From ad864ddb4a72f46f7c5f8da6fbeb278d0b30255d Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - ASCEE" Date: Wed, 19 Apr 2023 12:36:32 -0700 Subject: [PATCH] Added scripts and debugged cmake to make compile windows ready. Now it compiles, bug the problem is, we have DLL load failed --- cmake/OSSpecific.cmake | 22 ++------------------ scripts/configure_cmake_msys2.sh | 3 +++ scripts/install_msys2_builddeps.sh | 23 +++++++++++++++++++++ setup.py | 33 +++++++++++++++++------------- 4 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 scripts/configure_cmake_msys2.sh create mode 100644 scripts/install_msys2_builddeps.sh diff --git a/cmake/OSSpecific.cmake b/cmake/OSSpecific.cmake index 170c023..f44466c 100644 --- a/cmake/OSSpecific.cmake +++ b/cmake/OSSpecific.cmake @@ -3,27 +3,9 @@ if(WIN32) # set(miniconda_dir ${home}\\Miniconda3) message("Building for Windows") - include_directories( - ..\\rtaudio - C:\\mingw\\mingw64\\include\\OpenBLAS - link_directories(${home}\\miniconda3\\Library\\include) - ) - set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH} $miniconda_dir\\Lib\\cmake") - # include( - add_definitions(-DMS_WIN64) - link_directories(C:\\mingw\\mingw64\\lib) - link_directories(C:\\mingw\\mingw64\\bin) - link_directories(..\\rtaudio) - link_directories(${home}\\Miniconda3) add_definitions(-DHAS_RTAUDIO_WIN_WASAPI_API) else() # Linux compile - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors") - include_directories(/usr/local/include/rtaudio) - include_directories(/usr/include/rtaudio) - link_directories(/usr/local/lib) - # This should become optional later on, and be added to the windows list as - # well. + endif() -# The last argument here takes care of calling SIGABRT when an integer overflow -# occures. + diff --git a/scripts/configure_cmake_msys2.sh b/scripts/configure_cmake_msys2.sh new file mode 100644 index 0000000..d45789d --- /dev/null +++ b/scripts/configure_cmake_msys2.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# +cmake . -G"MinGW Makefiles" -DLASP_HAS_ULDAQ=OFF -DPython3_ROOT_DIR=C:\\winpython\\python-3.10.9.amd64 diff --git a/scripts/install_msys2_builddeps.sh b/scripts/install_msys2_builddeps.sh new file mode 100644 index 0000000..fb19aba --- /dev/null +++ b/scripts/install_msys2_builddeps.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# +# set default options for invoking pacman (in CI this variable is already set globally) +if [ -z $CI ]; then + PACMAN_OPTIONS="--needed --noconfirm" +fi +arch=mingw-w64-x86_64 + + +pacman -S ${PACMAN_OPTIONS} make + +deps="gcc make toolchain ccache cmake openblas pybind11 fftw" +for dep in $deps; do + pacman -S ${PACMAN_OPTIONS} ${arch}-${dep} +done + + +# install Python modules not provided as MSYS2/MinGW packages +#PACKAGES="" +#for arch in $(eval echo $ARCH); do + #/mingw64/bin/pip3 install --upgrade ${PACKAGES} +#done \ No newline at end of file diff --git a/setup.py b/setup.py index 66ceecd..50ebaec 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,31 @@ import glob, os import platform - from setuptools import setup -if 'Linux' in platform.platform(): +pf = platform.platform() + +if 'Linux' in pf: ext_name_glob = 'lasp_cpp.cpython*' - extensions = list(glob.glob('src/lasp/' + ext_name_glob)) - # Split of path from file. - ext_names = [os.path.split(a)[1] for a in extensions] - - print(extensions) - if len(extensions) == 0: - raise RuntimeError('Please first run CMake to build extension') - elif len(extensions) > 1: - raise RuntimeError('Too many extension files found') - - pkgdata = ext_names - + extensions = list(glob.glob('src/lasp/' + ext_name_glob)) +elif 'Windows' in pf: + ext_name_glob = 'lasp_cpp.cp*.pyd' + # Split of path from file. + extensions = list(glob.glob('src\\lasp/' + ext_name_glob)) else: raise RuntimeError('Not yet Windows-proof') + + +print(extensions) +ext_names = [os.path.split(a)[1] for a in extensions] + +if len(extensions) == 0: + raise RuntimeError('Please first run CMake to build extension') +elif len(extensions) > 1: + raise RuntimeError('Too many extension files found') + +pkgdata = ext_names classifiers = [ "Topic :: Scientific/Engineering", "Programming Language :: Python :: 3.8",