Skip to content

Commit

Permalink
⚡ Enable target stripping, IPO, PCH, and unity builds for pyfiction
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelwa committed Oct 9, 2023
1 parent 4687bcc commit 03ca9fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bindings/pyfiction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@ pybind11_add_module(pyfiction pyfiction.cpp)
target_link_libraries(pyfiction PRIVATE libfiction)
target_include_directories(pyfiction PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
set_property(TARGET pyfiction PROPERTY POSITION_INDEPENDENT_CODE ON)

# Strip the executable if we are in Release mode
if (CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_STRIP)
add_custom_command(
TARGET pyfiction
POST_BUILD
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:fiction>
)
else ()
message(WARNING "Strip command is not available. The executables will not be stripped.")
endif ()
endif ()
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def build_extension(self, ext):
'-DFICTION_CLI=OFF',
'-DFICTION_TEST=OFF',
'-DFICTION_EXPERIMENTS=OFF',
'-DFICTION_BENCHMARK=OFF',
'-DFICTION_ENABLE_IPO=ON',
'-DFICTION_ENABLE_PCH=ON',
'-DFICTION_ENABLE_UNITY_BUILD=ON',
'-DFICTION_PYTHON_BINDINGS=ON',
f'-DFICTION_Z3={z3}',
]
Expand Down

0 comments on commit 03ca9fd

Please sign in to comment.