From 0ae4e78a12d7fdea687ca52647465b9cf9ef95ee Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 22 Sep 2023 04:18:47 +0400 Subject: [PATCH] Minimize amount of code to rebuild when switching options --- external/qt/qt_static_plugins/CMakeLists.txt | 7 +++ .../qt_static_plugins/qt_static_plugins.cpp | 4 +- options.cmake | 49 ------------------- win_directx_helper/CMakeLists.txt | 7 +++ win_directx_helper/win_directx_helper.cpp | 4 +- 5 files changed, 18 insertions(+), 53 deletions(-) diff --git a/external/qt/qt_static_plugins/CMakeLists.txt b/external/qt/qt_static_plugins/CMakeLists.txt index ca56bbf..f6d7308 100644 --- a/external/qt/qt_static_plugins/CMakeLists.txt +++ b/external/qt/qt_static_plugins/CMakeLists.txt @@ -19,6 +19,13 @@ PUBLIC desktop-app::external_kimageformats ) +if (DESKTOP_APP_USE_PACKAGED) + target_compile_definitions(external_qt_static_plugins + PRIVATE + QT_STATIC_PLUGINS_USE_PACKAGED + ) +endif() + if (LINUX) target_link_libraries(external_qt_static_plugins PUBLIC diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index af68849..8e6a311 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -7,10 +7,10 @@ https://github.com/desktop-app/legal/blob/master/LEGAL */ #include -#if !defined DESKTOP_APP_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN +#if !defined QT_STATIC_PLUGINS_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN Q_IMPORT_PLUGIN(QGenericEnginePlugin) Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QJpegPlugin) Q_IMPORT_PLUGIN(QGifPlugin) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) -#endif // !DESKTOP_APP_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN +#endif // !QT_STATIC_PLUGINS_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN diff --git a/options.cmake b/options.cmake index 91f5eff..7ad2804 100644 --- a/options.cmake +++ b/options.cmake @@ -16,13 +16,6 @@ INTERFACE QT_DEPRECATED_WARNINGS_SINCE=0x051500 ) -if (DESKTOP_APP_DISABLE_CRASH_REPORTS) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_DISABLE_CRASH_REPORTS - ) -endif() - if (DESKTOP_APP_DISABLE_X11_INTEGRATION) target_compile_definitions(common_options INTERFACE @@ -30,48 +23,6 @@ if (DESKTOP_APP_DISABLE_X11_INTEGRATION) ) endif() -if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED_LAZY) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED_LAZY - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED_FONTS) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED_FONTS - ) -endif() - -if (DESKTOP_APP_USE_PACKAGED_RLOTTIE) - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_USE_PACKAGED_RLOTTIE - ) -endif() - -if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") - target_compile_definitions(common_options - INTERFACE - DESKTOP_APP_SPECIAL_TARGET=${DESKTOP_APP_SPECIAL_TARGET} - ) -endif() - if (WIN32) include(cmake/options_win.cmake) elseif (APPLE) diff --git a/win_directx_helper/CMakeLists.txt b/win_directx_helper/CMakeLists.txt index 889f8a9..a5e766f 100644 --- a/win_directx_helper/CMakeLists.txt +++ b/win_directx_helper/CMakeLists.txt @@ -19,3 +19,10 @@ target_link_libraries(win_directx_helper PUBLIC desktop-app::external_openssl ) + +if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "") + target_compile_definitions(win_directx_helper + PRIVATE + WIN_DIRECTX_HELPER_SPECIAL_TARGET=${DESKTOP_APP_SPECIAL_TARGET} + ) +endif() diff --git a/win_directx_helper/win_directx_helper.cpp b/win_directx_helper/win_directx_helper.cpp index 13a90f0..7550177 100644 --- a/win_directx_helper/win_directx_helper.cpp +++ b/win_directx_helper/win_directx_helper.cpp @@ -173,9 +173,9 @@ bool ResolveD3DCompiler() { if (FileSha256(path) == hash && ResolveD3DCompiler(path)) { return true; } -#elif defined DESKTOP_APP_SPECIAL_TARGET // DESKTOP_APP_D3DCOMPILER_HASH +#elif defined WIN_DIRECTX_HELPER_SPECIAL_TARGET // DESKTOP_APP_D3DCOMPILER_HASH #error "Special target build should have d3dcompiler hash." -#endif // !DESKTOP_APP_D3DCOMPILER_HASH && DESKTOP_APP_SPECIAL_TARGET +#endif // !DESKTOP_APP_D3DCOMPILER_HASH && WIN_DIRECTX_HELPER_SPECIAL_TARGET return ResolveD3DCompiler(L"d3dcompiler_47.dll"); }();