From b40d4147e09548fb050749faf8e1e5b7509d7646 Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sun, 25 Aug 2024 17:01:26 +0200 Subject: [PATCH] build: add opt-in installation of QML lib Override the package with `withQMLLib = true;` to enable lib installation, alternatively add `-DINSTALL_QML_LIB=ON` to your cmake build command. Co-authored-by: a-usr <81042605+a-usr@users.noreply.github.com> --- BUILD.md | 6 ++++++ CMakeLists.txt | 10 ++++++++++ default.nix | 4 +++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index 5fe6ebc6..4dcf9ac0 100644 --- a/BUILD.md +++ b/BUILD.md @@ -23,6 +23,12 @@ If your package manager supports enabling some features but not others, we recommend not exposing the subfeatures and just the main ones that introduce new dependencies: `wayland`, `x11`, `pipewire`, `hyprland` +### QML Library +If you wish to use a linter or similar tools, you will need the QML Modules for it to pick up on the types. + +To disable: `-DINSTALL_QML_LIB=OFF` + + ### Jemalloc We recommend leaving Jemalloc enabled as it will mask memory fragmentation caused by the QML engine, which results in much lower memory usage. Without this you diff --git a/CMakeLists.txt b/CMakeLists.txt index e3c01592..1a7126ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ option(BUILD_TESTING "Build tests" OFF) option(ASAN "Enable ASAN" OFF) # note: better output with gcc than clang option(FRAME_POINTERS "Always keep frame pointers" ${ASAN}) +option(INSTALL_QML_LIB "Installing the QML lib" ON) option(CRASH_REPORTER "Enable the crash reporter" ON) option(USE_JEMALLOC "Use jemalloc over the system malloc implementation" ON) option(SOCKETS "Enable unix socket support" ON) @@ -30,6 +31,7 @@ option(SERVICE_UPOWER "UPower service" ON) option(SERVICE_NOTIFICATIONS "Notification server" ON) message(STATUS "Quickshell configuration") +message(STATUS " QML lib installation: ${INSTALL_QML_LIB}") message(STATUS " Crash reporter: ${CRASH_REPORTER}") message(STATUS " Jemalloc: ${USE_JEMALLOC}") message(STATUS " Build tests: ${BUILD_TESTING}") @@ -119,6 +121,14 @@ find_package(Qt6 REQUIRED COMPONENTS ${QT_FPDEPS}) qt_standard_project_setup(REQUIRES 6.6) set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml_modules) +if (INSTALL_QML_LIB) + install( + DIRECTORY ${CMAKE_BINARY_DIR}/qml_modules/ + DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt-6/qml + FILES_MATCHING PATTERN "*" + ) +endif() + # pch breaks clang-tidy..... somehow if (NOT NO_PCH) file(GENERATE diff --git a/default.nix b/default.nix index 1ddb99b5..a00bf012 100644 --- a/default.nix +++ b/default.nix @@ -37,6 +37,7 @@ withPipewire ? true, withPam ? true, withHyprland ? true, + withQMLLib ? true, }: buildStdenv.mkDerivation { pname = "quickshell${lib.optionalString debug "-debug"}"; version = "0.1.0"; @@ -75,7 +76,8 @@ ++ lib.optional (!withWayland) "-DWAYLAND=OFF" ++ lib.optional (!withPipewire) "-DSERVICE_PIPEWIRE=OFF" ++ lib.optional (!withPam) "-DSERVICE_PAM=OFF" - ++ lib.optional (!withHyprland) "-DHYPRLAND=OFF"; + ++ lib.optional (!withHyprland) "-DHYPRLAND=OFF" + ++ lib.optional (!withQMLLib) "-DINSTALL_QML_LIB=OFF"; buildPhase = "ninjaBuildPhase"; enableParallelBuilding = true;