Skip to content

Commit

Permalink
Enable parallel flto for pymrpt
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jul 18, 2023
1 parent 3c8dc38 commit 4088747
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion doc/source/doxygen-docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# Version 2.10.1: UNRELEASED
- Build system:
- Disable LTO in pymrpt module by default. This will make compilation much faster, and avoids build errors on some architectures (mipsel).
- Add cmake flag to disable LTO in pymrpt module.
- Add -flto=auto to pymrpt so linking is much faster.
- BUG FIXES:
- Fix "FTBFS when binutils-dev is installed but not libiberty-dev" (Debian bug [#1041165](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041165))
-
Expand Down
5 changes: 4 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ pybind11_add_module(pymrpt
)

# Remove LTO from pybind flags:
option(MRPT_PYBIND11_WITH_LTO "If enabled, MRPT will not remove the LTO build flags added by pybind for pymrpt. Default is OFF, so disabling LTO" "OFF")
option(MRPT_PYBIND11_WITH_LTO "If disabled, MRPT will remove the LTO build flags added by pybind for pymrpt. Default is ON, so enabling LTO" "ON")
if (NOT MRPT_PYBIND11_WITH_LTO)
get_target_property(_opts pymrpt LINK_LIBRARIES)
string(REPLACE "pybind11::lto" "" _opts "${_opts}")
string(REPLACE "pybind11::thin_lto" "" _opts "${_opts}")
set_target_properties(pymrpt PROPERTIES LINK_LIBRARIES ${_opts})
else()
# Add parallel lto:
target_link_options(pymrpt PRIVATE -flto=auto)
endif()

target_link_libraries(pymrpt PUBLIC
Expand Down

0 comments on commit 4088747

Please sign in to comment.