From 57bce358a557532eeb55c274a4051b0d23a0a0c2 Mon Sep 17 00:00:00 2001 From: Laurent Belcour Date: Fri, 17 Sep 2021 16:37:46 +0200 Subject: [PATCH 1/2] [CI] Modifying the CMAKE to better include python version] --- .appveyor.yml | 2 +- .travis.yml | 8 +++++--- CMakeLists.txt | 21 +++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index d278784..6c49658 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -62,7 +62,7 @@ build_script: # Build with CERES and Python - mkdir build & - cd build & - - cmake .. -DPython_Version="3.6" -DEIGEN3_INCLUDE_DIR="external/build/include/eigen3" -DCeres_DIR="external/build/CMake" -DNLOPT_INCLUDE_DIRS="../external/build/include" -DNLOPT_LIBRARIES="../external/build/lib/nlopt.lib" -Wdev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" & + - cmake .. -DPython_Version="3.6" -DEIGEN3_INCLUDE_DIR="../external/build/include/eigen3" -DCeres_DIR="../external/build/CMake" -DNLOPT_INCLUDE_DIRS="../external/build/include" -DNLOPT_LIBRARIES="../external/build/lib/nlopt.lib" -Wdev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" & - nmake /NOLOGO & - cd .. diff --git a/.travis.yml b/.travis.yml index bca08cf..ef14793 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,17 @@ env: os: - linux - osx - -dist: trusty +python: + - '3.8' +dist: + - focal sudo: required addons: apt: sources: - ubuntu-toolchain-r-test packages: - - g++-6 + - g++ - cmake - libboost-python-dev - libeigen3-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aed2ae..b8ac96d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,8 +32,9 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/configs/cmake/) # Find required packages find_package(Eigen3) find_package(OpenMP) -find_package(PythonInterp) -find_package(PythonLibs) +#find_package(PythonInterp) +#find_package(PythonLibs) +find_package(Python3 COMPONENTS Interpreter Development) find_package(Doxygen) find_package(Ceres) find_package(NLOPT) @@ -271,15 +272,15 @@ endif() #alta_add_plugin(nonlinear_fitter_ipopt nonlinear_fitter_ipopt/fitter.cpp) # Python bindings -if(PYTHONLIBS_FOUND AND PYBIND_FOUND) +if(Python3_FOUND AND PYBIND_FOUND) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python) # Note: Required on windows to build the python dll in the 'python' # directory. [Laurent] I have no idea why this is needed. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python) - include_directories(${PYTHON_INCLUDE_DIRS}) + include_directories(${Python3_INCLUDE_DIRS}) add_library(alta SHARED sources/python/alta.cpp) - target_link_libraries(alta core ${PYTHON_LIBRARIES}) + target_link_libraries(alta core ${Python3_LIBRARIES}) set_target_properties(alta PROPERTIES PREFIX "") if(APPLE) set_target_properties(alta PROPERTIES SUFFIX ".so") @@ -317,7 +318,7 @@ set(PLUGIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/plugins/) set(PYTHON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/python/) #INSTALL TARGETS = alta.lib and alta.pyd -if(PYTHONLIBS_FOUND AND PYBIND_FOUND ) +if(Python3_FOUND AND PYBIND_FOUND ) install( TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) endif() @@ -452,15 +453,15 @@ foreach(fitter IN ITEMS ${nonlinear_fitters}) "--func" "[nonlinear_function_diffuse, nonlinear_function_blinn]") endforeach() -if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND PYBIND_FOUND) +if(Python3_FOUND AND PYBIND_FOUND) alta_test_python(NAME "python_test_arguments" - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/sources/tests/python/test-arguments.py") + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/sources/tests/python/test-arguments.py") alta_test_python(NAME "python_test_vec" - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/sources/tests/python/test-vec.py") + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/sources/tests/python/test-vec.py") alta_test_python(NAME "python_test_function" - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/sources/tests/python/test-python-function.py") + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/sources/tests/python/test-python-function.py") endif() # add a target to generate API documentation with Doxygen From 63a699c692c22f0f4e880d539c0c08262249111a Mon Sep 17 00:00:00 2001 From: Laurent Belcour Date: Mon, 20 Sep 2021 10:03:29 +0200 Subject: [PATCH 2/2] [CI] Test AppVeyor configuration --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6c49658..398db51 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -62,7 +62,7 @@ build_script: # Build with CERES and Python - mkdir build & - cd build & - - cmake .. -DPython_Version="3.6" -DEIGEN3_INCLUDE_DIR="../external/build/include/eigen3" -DCeres_DIR="../external/build/CMake" -DNLOPT_INCLUDE_DIRS="../external/build/include" -DNLOPT_LIBRARIES="../external/build/lib/nlopt.lib" -Wdev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" & + - cmake .. -DPython_Version="3.6" -DEIGEN3_INCLUDE_DIR="external/build/include/eigen3" -DCeres_DIR="external/build/CMake" -DNLOPT_INCLUDE_DIRS="external/build/include" -DNLOPT_LIBRARIES="external/build/lib/nlopt.lib" -Wdev -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" & - nmake /NOLOGO & - cd ..