From 912fdf0b25f53e6af2fb4817576e73f002c654d8 Mon Sep 17 00:00:00 2001 From: Serein <2075337935@qq.com> Date: Tue, 24 Sep 2024 16:53:27 +0800 Subject: [PATCH] build: improve compile speed in debug mode --- src/CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 350dafa5..0e4198f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,14 +19,22 @@ if (LINUX) set(URING_LIBRARIES ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/liburing.a) endif() -slint_target_sources(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/ui/app.slint) - if (CMAKE_CONFIGURATION_TYPES MATCHES "Release") - message("Embedding resources in the executable") - set_property(TARGET ${PROJECT_NAME} PROPERTY SLINT_EMBED_RESOURCES embed-files) + set(SLINT_GENERATE_COMPILE_UNITS 1) + set(SLINT_RESOURCES_POLICY "embed-files") +else() + message("Embedding resources in the executable") + set(SLINT_GENERATE_COMPILE_UNITS 10) + set(SLINT_RESOURCES_POLICY "as-absolute-path") endif() -target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src) +slint_target_sources(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/ui/app.slint + COMPILATION_UNITS ${UI_UNITS} +) + +set_property(TARGET ${PROJECT_NAME} PROPERTY SLINT_EMBED_RESOURCES ${SLINT_RESOURCES_POLICY}) + +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) if(WIN32) set(PLATFORM PLATFORM_WINDOWS)