From 2721aabec6a3330fc6a2bfe5476c3aab47dd5b44 Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Wed, 9 Oct 2024 10:53:23 +0200 Subject: [PATCH] fix cmake windows --- .github/workflows/sub_buildWindows.yml | 5 +++++ .gitignore | 1 + CMakeSettings.json | 27 +++++++++++++++++++++++++ cmake/SetupBoost.cmake | 2 +- cmake/SetupSWIG.cmake | 27 +++++++++++++++++++++++++ src/VolumetricMeshRepair/CMakeLists.txt | 12 ----------- src/ctr/CMakeLists.txt | 12 ----------- src/isimpa/CMakeLists.txt | 4 ++-- src/preprocess/CMakeLists.txt | 12 ----------- src/spps/CMakeLists.txt | 21 ------------------- 10 files changed, 63 insertions(+), 60 deletions(-) create mode 100644 CMakeSettings.json create mode 100644 cmake/SetupSWIG.cmake diff --git a/.github/workflows/sub_buildWindows.yml b/.github/workflows/sub_buildWindows.yml index c521f6b2..b03bec05 100644 --- a/.github/workflows/sub_buildWindows.yml +++ b/.github/workflows/sub_buildWindows.yml @@ -108,12 +108,17 @@ jobs: . $env:ccachebindir\ccache -s . $env:ccachebindir\ccache -z . $env:ccachebindir\ccache -p + - name: Install NuGet Packages + shell: powershell + run: | + nuget install swigwintools -OutputDirectory "${{ env.builddir }}/Tools" -Version 4.2.0 - name: Configuring CMake run: > cmake -B"${{ env.builddir }}" . -DCPM_SOURCE_CACHE=${{ env.CPM_SOURCE_CACHE }} -DCMAKE_VS_NO_COMPILE_BATCHING=ON -DCMAKE_BUILD_TYPE=Release + -DSWIG_EXECUTABLE=${{ env.builddir }}/swigwintools.4.2.0/tools/swigwin-4.2.0/swig.exe - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - name: Compiling sources diff --git a/.gitignore b/.gitignore index 9dd6c3eb..484f301f 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ files.txt .vscode .vs .DS_Store +out/ diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 00000000..0c5fbf94 --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,27 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] + } + ] +} \ No newline at end of file diff --git a/cmake/SetupBoost.cmake b/cmake/SetupBoost.cmake index 7abb9459..36548768 100644 --- a/cmake/SetupBoost.cmake +++ b/cmake/SetupBoost.cmake @@ -14,7 +14,7 @@ macro(SetupBoost) VERSION 1.86.0 URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.xz URL_HASH SHA256=2c5ec5edcdff47ff55e27ed9560b0a0b94b07bd07ed9928b476150e16b0efc57 - OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES system\\\;algorithm\\\;random\\\;filesystem\\\;regex\\\;thread\\\;chrono\\\;test\\\;date_time\\\;python\\\;numeric" # Note the escapes! + OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES system\\\;algorithm\\\;random\\\;filesystem\\\;regex\\\;thread\\\;chrono\\\;test\\\;date_time\\\;python\\\;numeric/conversion" # Note the escapes! ) endif() endmacro(SetupBoost) diff --git a/cmake/SetupSWIG.cmake b/cmake/SetupSWIG.cmake new file mode 100644 index 00000000..174d7848 --- /dev/null +++ b/cmake/SetupSWIG.cmake @@ -0,0 +1,27 @@ + +CPMAddPackage( + NAME SWIG + VERSION 4.2.1 + URL https://github.com/swig/swig/archive/refs/tags/v4.2.1.tar.gz + URL_HASH SHA256=8895878b9215612e73611203dc8f5232c626e4d07ffc4532922f375518f067ca + OPTIONS "WITH_PCRE OFF" + "SWIG_BUILD_EXAMPLES OFF" + "SWIG_CSHARP OFF" + "SWIG_JAVA OFF" + "SWIG_JAVASCRIPT OFF" + "SWIG_LUA OFF" + "SWIG_OCTAVE OFF" + "SWIG_PERL OFF" + "SWIG_PHP OFF" + "SWIG_PYTHON ON" + "SWIG_R OFF" + "SWIG_RUBY OFF" + "SWIG_TCL OFF" +) + +if(SWIG_ADDED) + message(STATUS "SWIG added successfully: ${SWIG_SOURCE_DIR}") + set(SWIG_EXECUTABLE ${SWIG_SOURCE_DIR}/swig) +else() + message(FATAL_ERROR "Failed to add SWIG") +endif() \ No newline at end of file diff --git a/src/VolumetricMeshRepair/CMakeLists.txt b/src/VolumetricMeshRepair/CMakeLists.txt index 17c6878a..2fbd413e 100644 --- a/src/VolumetricMeshRepair/CMakeLists.txt +++ b/src/VolumetricMeshRepair/CMakeLists.txt @@ -45,18 +45,6 @@ target_link_libraries (vmr lib_interface) # Adds logic to INSTALL.vcproj to copy vmr to destination directory install (TARGETS vmr RUNTIME DESTINATION meshing/vmr) - -if(WIN32) - # Resolve symbolic link - LIB_TO_DLL(${Boost_FILESYSTEM_LIBRARY_RELEASE} Boost_FILESYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_SYSTEM_LIBRARY_RELEASE} Boost_SYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_REGEX_LIBRARY_RELEASE} Boost_REGEX_LIBRARY_RELEASE_REAL) - install (FILES - ${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_SYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_REGEX_LIBRARY_RELEASE_REAL} - DESTINATION meshing/vmr) -endif() if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ) install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION meshing/vmr COMPONENT System ) diff --git a/src/ctr/CMakeLists.txt b/src/ctr/CMakeLists.txt index f64e351a..35e905eb 100644 --- a/src/ctr/CMakeLists.txt +++ b/src/ctr/CMakeLists.txt @@ -55,18 +55,6 @@ target_link_libraries(classicalTheory ${Boost_LIBRARIES}) install (TARGETS classicalTheory RUNTIME DESTINATION core/classical_theory) -if (WIN32) - # Resolve symbolic link - LIB_TO_DLL(${Boost_FILESYSTEM_LIBRARY_RELEASE} Boost_FILESYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_SYSTEM_LIBRARY_RELEASE} Boost_SYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_REGEX_LIBRARY_RELEASE} Boost_REGEX_LIBRARY_RELEASE_REAL) - install (FILES - ${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_SYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_REGEX_LIBRARY_RELEASE_REAL} - DESTINATION core/classical_theory) -endif () - if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ) install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION core/classical_theory COMPONENT System ) endif( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ) \ No newline at end of file diff --git a/src/isimpa/CMakeLists.txt b/src/isimpa/CMakeLists.txt index 034b666c..91c591c9 100644 --- a/src/isimpa/CMakeLists.txt +++ b/src/isimpa/CMakeLists.txt @@ -460,7 +460,7 @@ IF(CMAKE_BUILD_TYPE STREQUAL "Debug") ELSE() SET(wxWidgets_USE_DEBUG OFF) SET(wxWidgets_USE_STATIC OFF) - MESSAGE(STATUS "Using dynamic wxWidgets library lib:${wxWidgets_LIB_DIR} include:${wxWidgets_ROOT_DIR}") + #MESSAGE(STATUS "Using dynamic wxWidgets library lib:${wxWidgets_LIB_DIR} include:${wxWidgets_ROOT_DIR}") ENDIF() SET(CMAKE_EXE_LINKER_FLAGS @@ -552,7 +552,7 @@ if(WIN32) # Check if we are on Windows set(PYTHON_LIB_FOLDER ${PYTHON_ROOT_FOLDER}/Lib) #Fetch required Dll's for GUI - string(REPLACE "\\" "/" wxWidgets_LIB_DIR_SLASH ${wxWidgets_LIB_DIR}) + #string(REPLACE "\\" "/" wxWidgets_LIB_DIR_SLASH ${wxWidgets_LIB_DIR}) set(DIRS ${Boost_LIBRARY_DIR_DEBUG} ${Boost_LIBRARY_DIR_RELEASE} ${wxWidgets_LIB_DIR_SLASH} diff --git a/src/preprocess/CMakeLists.txt b/src/preprocess/CMakeLists.txt index d03f91a4..6e457865 100644 --- a/src/preprocess/CMakeLists.txt +++ b/src/preprocess/CMakeLists.txt @@ -36,18 +36,6 @@ target_link_libraries (preprocess lib_interface) # Adds logic to INSTALL.vcproj to copy preprocess to destination directory install (TARGETS preprocess RUNTIME DESTINATION meshing/tetgen) -if(WIN32) - # Resolve symbolic link - LIB_TO_DLL(${Boost_FILESYSTEM_LIBRARY_RELEASE} Boost_FILESYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_SYSTEM_LIBRARY_RELEASE} Boost_SYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_REGEX_LIBRARY_RELEASE} Boost_REGEX_LIBRARY_RELEASE_REAL) - - install (FILES - ${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_SYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_REGEX_LIBRARY_RELEASE_REAL} - DESTINATION meshing/tetgen) -endif() if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ) install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION meshing/tetgen COMPONENT System ) diff --git a/src/spps/CMakeLists.txt b/src/spps/CMakeLists.txt index a0fe9e35..17017dff 100644 --- a/src/spps/CMakeLists.txt +++ b/src/spps/CMakeLists.txt @@ -102,27 +102,6 @@ endif() install (TARGETS spps RUNTIME DESTINATION core/spps) - -if(WIN32) - # Resolve symbolic link - LIB_TO_DLL(${Boost_FILESYSTEM_LIBRARY_RELEASE} Boost_FILESYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_SYSTEM_LIBRARY_RELEASE} Boost_SYSTEM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_RANDOM_LIBRARY_RELEASE} Boost_RANDOM_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_REGEX_LIBRARY_RELEASE} Boost_REGEX_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_THREAD_LIBRARY_RELEASE} Boost_THREAD_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_CHRONO_LIBRARY_RELEASE} Boost_CHRONO_LIBRARY_RELEASE_REAL) - LIB_TO_DLL(${Boost_DATE_TIME_LIBRARY_RELEASE} Boost_DATE_TIME_LIBRARY_RELEASE_REAL) - install (FILES - ${Boost_FILESYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_SYSTEM_LIBRARY_RELEASE_REAL} - ${Boost_REGEX_LIBRARY_RELEASE_REAL} - ${Boost_RANDOM_LIBRARY_RELEASE_REAL} - ${Boost_THREAD_LIBRARY_RELEASE_REAL} - ${Boost_CHRONO_LIBRARY_RELEASE_REAL} - ${Boost_DATE_TIME_LIBRARY_RELEASE_REAL} - DESTINATION core/spps) -endif() - if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ) install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION core/spps COMPONENT System ) endif( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )