From 03ca9fde5dab7027662b299ca5faf9cfd89c8017 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Mon, 9 Oct 2023 16:28:53 +0200 Subject: [PATCH] :zap: Enable target stripping, IPO, PCH, and unity builds for pyfiction --- bindings/pyfiction/CMakeLists.txt | 13 +++++++++++++ setup.py | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/bindings/pyfiction/CMakeLists.txt b/bindings/pyfiction/CMakeLists.txt index 067c95c0b..aa7fc0cb8 100644 --- a/bindings/pyfiction/CMakeLists.txt +++ b/bindings/pyfiction/CMakeLists.txt @@ -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} $ + ) + else () + message(WARNING "Strip command is not available. The executables will not be stripped.") + endif () +endif () diff --git a/setup.py b/setup.py index 02e6e7ec2..28e04e7df 100644 --- a/setup.py +++ b/setup.py @@ -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}', ]