From 30760ca0906790a3b63388b816b3e8469a17eeea Mon Sep 17 00:00:00 2001 From: Aidan Case Date: Thu, 14 Mar 2024 19:45:29 -0500 Subject: [PATCH] Do debug info, use thin static archives --- CMakeLists.txt | 9 +++++++++ flatpak/io.github.softfever.OrcaSlicer.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a2965a1b0..368fb327ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -276,6 +276,14 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP add_compile_options(-Wno-unknown-pragmas) # Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost. add_compile_options(-fext-numeric-literals) + # More of a "size" optimization, use thin archives for static building to not waste space + # Taken from https://bugs.webkit.org/show_bug.cgi?id=108330 + if(SLIC3R_STATIC AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(CMAKE_CXX_ARCHIVE_CREATE " crU --thin ") + set(CMAKE_C_ARCHIVE_CREATE " crU --thin ") + set(CMAKE_CXX_ARCHIVE_APPEND " rU --thin ") + set(CMAKE_C_ARCHIVE_APPEND " rU --thin ") + endif() endif() # Bit of a hack for flatpak building: compress the debug info with zstd to save space in CI @@ -283,6 +291,7 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP add_compile_options(-gz=zstd) endif() + endif() if (SLIC3R_ASAN) diff --git a/flatpak/io.github.softfever.OrcaSlicer.yml b/flatpak/io.github.softfever.OrcaSlicer.yml index 9e0cd53426..647eb0b02b 100755 --- a/flatpak/io.github.softfever.OrcaSlicer.yml +++ b/flatpak/io.github.softfever.OrcaSlicer.yml @@ -256,7 +256,7 @@ modules: -DSLIC3R_STATIC=ON \ -DSLIC3R_BUILD_TESTS=OFF \ -DSLIC3R_DESKTOP_INTEGRATION=OFF \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DFLATPAK=ON \ -DBBL_RELEASE_TO_PUBLIC=1 CXXFLAGS=-std=gnu++20 cmake --build . --target install -j$FLATPAK_BUILDER_N_JOBS