cmake: Migrate to Python3 and use Development.Module
note: Development.Module is use to look for python header only since library is not available on manylinux. see: https://gitlab.kitware.com/cmake/cmake/-/issues/20425 note2: Development.Module has been introduced in CMake 3.18 ref: https://cmake.org/cmake/help/latest/module/FindPython3.html
This commit is contained in:
@@ -8,11 +8,9 @@ swig_add_library(pywraprcpsp
|
||||
OUTPUT_DIR ${PROJECT_BINARY_DIR}/python/${PROJECT_NAME}/data
|
||||
SOURCES rcpsp.i)
|
||||
|
||||
target_include_directories(pywraprcpsp PRIVATE ${Python_INCLUDE_DIRS})
|
||||
target_include_directories(pywraprcpsp PRIVATE ${Python3_INCLUDE_DIRS})
|
||||
set_property(TARGET pywraprcpsp PROPERTY SWIG_USE_TARGET_INCLUDE_DIRECTORIES ON)
|
||||
if(Python_VERSION VERSION_GREATER_EQUAL 3)
|
||||
target_compile_definitions(pywraprcpsp PUBLIC "PY3")
|
||||
endif()
|
||||
target_compile_definitions(pywraprcpsp PUBLIC "PY3")
|
||||
|
||||
# note: macOS is APPLE and also UNIX !
|
||||
if(APPLE)
|
||||
@@ -32,5 +30,5 @@ target_link_libraries(pywraprcpsp PRIVATE ortools::ortools)
|
||||
# i.e. we can't use: $<$<PLATFORM_ID:Windows>:${PYTHON_LIBRARIES}>
|
||||
# see: https://cmake.org/cmake/help/git-stage/command/target_link_libraries.html#command:target_link_libraries
|
||||
if(MSVC)
|
||||
target_link_libraries(pywraprcpsp PRIVATE ${Python_LIBRARIES})
|
||||
target_link_libraries(pywraprcpsp PRIVATE ${Python3_LIBRARIES})
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user