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>
This commit is contained in:
Nydragon 2024-08-25 17:01:26 +02:00
parent f95e7dbaf6
commit b40d4147e0
No known key found for this signature in database
3 changed files with 19 additions and 1 deletions

View file

@ -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 we recommend not exposing the subfeatures and just the main ones that introduce
new dependencies: `wayland`, `x11`, `pipewire`, `hyprland` 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 ### Jemalloc
We recommend leaving Jemalloc enabled as it will mask memory fragmentation caused 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 by the QML engine, which results in much lower memory usage. Without this you

View file

@ -9,6 +9,7 @@ option(BUILD_TESTING "Build tests" OFF)
option(ASAN "Enable ASAN" OFF) # note: better output with gcc than clang option(ASAN "Enable ASAN" OFF) # note: better output with gcc than clang
option(FRAME_POINTERS "Always keep frame pointers" ${ASAN}) 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(CRASH_REPORTER "Enable the crash reporter" ON)
option(USE_JEMALLOC "Use jemalloc over the system malloc implementation" ON) option(USE_JEMALLOC "Use jemalloc over the system malloc implementation" ON)
option(SOCKETS "Enable unix socket support" ON) option(SOCKETS "Enable unix socket support" ON)
@ -30,6 +31,7 @@ option(SERVICE_UPOWER "UPower service" ON)
option(SERVICE_NOTIFICATIONS "Notification server" ON) option(SERVICE_NOTIFICATIONS "Notification server" ON)
message(STATUS "Quickshell configuration") message(STATUS "Quickshell configuration")
message(STATUS " QML lib installation: ${INSTALL_QML_LIB}")
message(STATUS " Crash reporter: ${CRASH_REPORTER}") message(STATUS " Crash reporter: ${CRASH_REPORTER}")
message(STATUS " Jemalloc: ${USE_JEMALLOC}") message(STATUS " Jemalloc: ${USE_JEMALLOC}")
message(STATUS " Build tests: ${BUILD_TESTING}") message(STATUS " Build tests: ${BUILD_TESTING}")
@ -119,6 +121,14 @@ find_package(Qt6 REQUIRED COMPONENTS ${QT_FPDEPS})
qt_standard_project_setup(REQUIRES 6.6) qt_standard_project_setup(REQUIRES 6.6)
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml_modules) 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 # pch breaks clang-tidy..... somehow
if (NOT NO_PCH) if (NOT NO_PCH)
file(GENERATE file(GENERATE

View file

@ -37,6 +37,7 @@
withPipewire ? true, withPipewire ? true,
withPam ? true, withPam ? true,
withHyprland ? true, withHyprland ? true,
withQMLLib ? true,
}: buildStdenv.mkDerivation { }: buildStdenv.mkDerivation {
pname = "quickshell${lib.optionalString debug "-debug"}"; pname = "quickshell${lib.optionalString debug "-debug"}";
version = "0.1.0"; version = "0.1.0";
@ -75,7 +76,8 @@
++ lib.optional (!withWayland) "-DWAYLAND=OFF" ++ lib.optional (!withWayland) "-DWAYLAND=OFF"
++ lib.optional (!withPipewire) "-DSERVICE_PIPEWIRE=OFF" ++ lib.optional (!withPipewire) "-DSERVICE_PIPEWIRE=OFF"
++ lib.optional (!withPam) "-DSERVICE_PAM=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"; buildPhase = "ninjaBuildPhase";
enableParallelBuilding = true; enableParallelBuilding = true;