diff --git a/cpp_src/CMakeLists.txt b/cpp_src/CMakeLists.txt index b661f49..221b58f 100644 --- a/cpp_src/CMakeLists.txt +++ b/cpp_src/CMakeLists.txt @@ -38,18 +38,26 @@ pybind11_add_module(lasp_cpp MODULE lasp_cpp.cpp target_link_libraries(lasp_cpp PRIVATE lasp_device_lib lasp_dsp_lib ${OpenMP_CXX_LIBRARIES} ${LASP_FFT_LIBS} ${TARGET_OS_LINKLIBS}) +target_compile_definitions(lasp_cpp PRIVATE + MODULE_NAME=$ + VERSION_INFO="${PY_FULL_VERSION}" +) + +# Hide all symbols by default (including external libraries on Linux) +if(CMAKE_BUILD_TYPE STREQUAL "Release") + set_target_properties(lasp_cpp PROPERTIES + CXX_VISIBILITY_PRESET "hidden" + VISIBILITY_INLINES_HIDDEN true) + if (CMAKE_SYSTEM_NAME MATCHES "Linux") + target_link_options(lasp_cpp PRIVATE "LINKER:--exclude-libs,ALL") + endif() +endif() + if(DEFINED PY_BUILD_CMAKE_MODULE_NAME) # Install the Python module install(TARGETS lasp_cpp EXCLUDE_FROM_ALL COMPONENT python_modules DESTINATION ${PY_BUILD_CMAKE_MODULE_NAME}) - # Install the debug file for the Python module (Windows only) - if (WIN32) - install(FILES $ - EXCLUDE_FROM_ALL - COMPONENT python_modules - DESTINATION ${PY_BUILD_CMAKE_MODULE_NAME} - OPTIONAL) - endif() + endif() \ No newline at end of file diff --git a/scripts/configure_cmake_msys2.sh b/scripts/copy_windows_dlls.sh similarity index 53% rename from scripts/configure_cmake_msys2.sh rename to scripts/copy_windows_dlls.sh index 353799b..abd79a6 100644 --- a/scripts/configure_cmake_msys2.sh +++ b/scripts/copy_windows_dlls.sh @@ -1,11 +1,9 @@ #!/bin/bash # -cmake . -G"Ninja" -DLASP_HAS_ULDAQ=OFF -DPython3_ROOT_DIR=C:\\winpython\\python-3.10.9.amd64 -arch=ucrt64 -#arch=mingw64 - +arch=mingw64 +# DLL's that are required by lasp_cpp files_to_cpy="libfftw3-3.dll libgcc_s_seh-1.dll libgfortran-5.dll libgomp-1.dll libopenblas.dll libquadmath-0.dll libstdc++-6.dll libwinpthread-1.dll" for fn in ${files_to_cpy}; do - cp /c/msys64/${arch}/bin/${fn} src/lasp + cp /c/msys64/${arch}/bin/${fn} python_src/lasp done diff --git a/scripts/install_msys2_builddeps.sh b/scripts/install_msys2_builddeps.sh index 70bab8b..7ebda8f 100644 --- a/scripts/install_msys2_builddeps.sh +++ b/scripts/install_msys2_builddeps.sh @@ -5,8 +5,8 @@ if [ -z $CI ]; then PACMAN_OPTIONS="--needed --noconfirm" fi -# arch=mingw-w64-x86_64 -arch=mingw-w64-ucrt-x86_64 +arch=mingw-w64-x86_64 +# arch=mingw-w64-ucrt-x86_64 pacman -S ${PACMAN_OPTIONS} make