Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMake/SofaPython3Tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ function(SP3_add_python_module)
if ("${pybind11_VERSION}" VERSION_GREATER_EQUAL "2.6.0")
target_link_libraries(${A_TARGET} PRIVATE pybind11::headers)
target_link_libraries(${A_TARGET} PRIVATE pybind11::embed)
target_link_libraries(${A_TARGET} PRIVATE pybind11::lto)
if(SP3_ENABLE_LINK_TIME_OPTIMIZATION AND TARGET pybind11::lto)
target_link_libraries(${A_TARGET} PRIVATE pybind11::lto)
endif()
if(MSVC)
target_link_libraries(${A_TARGET} PRIVATE pybind11::windows_extras)
endif()
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ CMAKE_DEPENDENT_OPTION(SP3_WITH_SOFAEXPORTER "Bind the SOFA exporter component."
sofa_find_package(Sofa.GUI.Common QUIET)
CMAKE_DEPENDENT_OPTION(SP3_WITH_SOFAGUI "Bind the SOFA gui component." ON "Sofa.GUI.Common_FOUND" OFF)

option(SP3_ENABLE_LINK_TIME_OPTIMIZATION "Enable link-time optimization of the python modules (ignored in Debug and RelWithDebInfo builds)." OFF)
string(TOUPPER "${CMAKE_BUILD_TYPE}" SP3_BUILD_TYPE_UPPER)
if(SP3_ENABLE_LINK_TIME_OPTIMIZATION AND SP3_BUILD_TYPE_UPPER MATCHES "^(DEBUG|RELWITHDEBINFO)$")
message(WARNING "SP3_ENABLE_LINK_TIME_OPTIMIZATION is ON but has no effect: pybind11 does not enable link-time optimization in ${CMAKE_BUILD_TYPE} builds.")
endif()

# BUILD OPTIONS
if (NOT SP3_COMPILED_AS_SUBPROJECT)
Expand Down
Loading