diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fa7c21..2b2a39f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,8 @@ add_compile_options(-Wall -Wextra -g) # TODO: enabled by LTO option if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") add_compile_options(-flto=full) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + add_compile_options(-flto=full) else () #add_compile_options(-flto) # TODO: only for g++ endif () diff --git a/src/core_ffi/rust_ffi/Cargo.toml b/src/core_ffi/rust_ffi/Cargo.toml index bebf5d8..02e4736 100644 --- a/src/core_ffi/rust_ffi/Cargo.toml +++ b/src/core_ffi/rust_ffi/Cargo.toml @@ -8,6 +8,12 @@ repository = "https://github.com/dnomd343/klotski" license = "BSD-3-Clause" readme = "README.md" +[profile.release] +lto = "fat" +panic = "abort" + +# TODO: also for `profile.test` and `profile.bench` + [dependencies] cxx = "1.0" diff --git a/src/core_ffi/rust_ffi/build.rs b/src/core_ffi/rust_ffi/build.rs index ca70170..90d42ba 100644 --- a/src/core_ffi/rust_ffi/build.rs +++ b/src/core_ffi/rust_ffi/build.rs @@ -26,6 +26,7 @@ fn main() { .file("adapter/short_code.cc") .include("klotski/src/core") .flag("-std=c++23") + .flag_if_supported("-flto=full") // only for clang .flag("-fno-rtti") .flag("-fno-exceptions") .compile("klotski");