Skip to content

Commit

Permalink
enable boost python for cmake cpm
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Oct 3, 2024
1 parent bc12ae8 commit 9f07dd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmake/SetupBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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\\\;python\\\;numeric/conversion\\\;test" # Note the escapes!
OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_ENABLE_PYTHON ON" "BOOST_INCLUDE_LIBRARIES system\\\;algorithm\\\;random\\\;filesystem\\\;regex\\\;python\\\;numeric/conversion\\\;test" # Note the escapes!
)
else()
find_package (Threads)
Expand Down
10 changes: 3 additions & 7 deletions src/python_bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ SET(CMAKE_SWIG_FLAGS "")

SET_SOURCE_FILES_PROPERTIES(libsimpa.i PROPERTIES CPLUSPLUS ON)

set(Boost_USE_STATIC_LIBS OFF)

link_directories( ${Boost_LIBRARY_DIRS})

IF (${CMAKE_VERSION} VERSION_LESS "3.8.0")
SWIG_ADD_MODULE(libsimpa python libsimpa.i)
ELSE()
Expand All @@ -39,9 +35,9 @@ ENDIF ()
message(STATUS ${Python_LIBRARY_RELEASE})
SWIG_LINK_LIBRARIES(libsimpa lib_interface ${PYTHON_LIBRARIES})

if(WIN32 AND MSVC)
target_link_libraries(${SWIG_MODULE_libsimpa_REAL_NAME} ${PYTHON_LIBRARY_RELEASE})
endif()
SetupBoost()

target_link_libraries(${SWIG_MODULE_libsimpa_REAL_NAME} ${PYTHON_LIBRARY_RELEASE} Boost::python Boost::thread)

# Creates a folder "libraries" and adds target project (lib_interface.vcproj) under it
set_property(TARGET ${SWIG_MODULE_libsimpa_REAL_NAME} PROPERTY FOLDER "libraries")
Expand Down

0 comments on commit 9f07dd6

Please sign in to comment.