From 9f6ef37f61016372d2f7d464e4640f0a5dfda86b Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Mon, 11 Mar 2024 18:34:38 -0700 Subject: [PATCH] build: improve parallelism by removing core dependency on modules --- CMakeLists.txt | 9 +-------- Justfile | 2 +- src/CMakeLists.txt | 10 ++++++++++ src/core/CMakeLists.txt | 10 ++++++---- src/core/main.cpp | 4 +++- src/core/main.hpp | 3 +++ src/main.cpp | 5 +++++ 7 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 src/CMakeLists.txt create mode 100644 src/core/main.hpp create mode 100644 src/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 953d72a..c6fff4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,11 +87,4 @@ function (qs_pch target) target_link_libraries(${target} PRIVATE ${QT_DEPS}) # required for gcc to accept the pch on plugin targets endfunction() -add_subdirectory(src/core) -add_subdirectory(src/io) - -if (WAYLAND) - add_subdirectory(src/wayland) -endif () - -install(TARGETS quickshell RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +add_subdirectory(src) diff --git a/Justfile b/Justfile index 314bcdd..69fdff7 100644 --- a/Justfile +++ b/Justfile @@ -26,7 +26,7 @@ clean: rm -rf {{builddir}} run *ARGS='': build - {{builddir}}/src/core/quickshell {{ARGS}} + {{builddir}}/src/quickshell {{ARGS}} test *ARGS='': build ctest --test-dir {{builddir}} --output-on-failure {{ARGS}} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..247abf2 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,10 @@ +qt_add_executable(quickshell main.cpp) + +install(TARGETS quickshell RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +add_subdirectory(core) +add_subdirectory(io) + +if (WAYLAND) + add_subdirectory(wayland) +endif () diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a14a5a1..0ddd725 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,4 +1,4 @@ -qt_add_executable(quickshell +qt_add_library(quickshell-core STATIC main.cpp plugin.cpp shell.cpp @@ -19,10 +19,12 @@ qt_add_executable(quickshell ) set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS GIT_REVISION="${GIT_REVISION}") -qt_add_qml_module(quickshell URI Quickshell VERSION 0.1) +qt_add_qml_module(quickshell-core URI Quickshell VERSION 0.1) -target_link_libraries(quickshell PRIVATE ${QT_DEPS}) -qs_pch(quickshell) +target_link_libraries(quickshell-core PRIVATE ${QT_DEPS}) +qs_pch(quickshell-core) + +target_link_libraries(quickshell PRIVATE quickshell-coreplugin) if (BUILD_TESTING) add_subdirectory(test) diff --git a/src/core/main.cpp b/src/core/main.cpp index 21732ee..04761f4 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1,3 +1,5 @@ +#include "main.hpp" + #include #include @@ -17,7 +19,7 @@ #include "plugin.hpp" #include "rootwrapper.hpp" -int main(int argc, char** argv) { +int qs_main(int argc, char** argv) { const auto app = QGuiApplication(argc, argv); QGuiApplication::setApplicationName("quickshell"); QGuiApplication::setApplicationVersion("0.1.0 (" GIT_REVISION ")"); diff --git a/src/core/main.hpp b/src/core/main.hpp new file mode 100644 index 0000000..33921b4 --- /dev/null +++ b/src/core/main.hpp @@ -0,0 +1,3 @@ +#pragma once + +int qs_main(int argc, char** argv); // NOLINT diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..0ce548e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,5 @@ +#include "core/main.hpp" + +int main(int argc, char** argv) { + return qs_main(argc, argv); +}