diff --git a/BUILD.md b/BUILD.md index 4650d1ff..5a0652fe 100644 --- a/BUILD.md +++ b/BUILD.md @@ -25,6 +25,16 @@ If we cannot retrieve debug information, please set this to `NO` and In both cases you should build with `-DCMAKE_BUILD_TYPE=RelWithDebInfo` (then split or keep the debuginfo). +### QML Module dir +Currently all QML modules are statically linked to quickshell, but this is where +tooling information will go. + +`-DINSTALL_QML_PREFIX="path/to/qml"` + +`-DINSTALL_QMLDIR="/full/path/to/qml"` + +`INSTALL_QML_PREFIX` works the same as `INSTALL_QMLDIR`, except it prepends `CMAKE_INSTALL_PREFIX`. You usually want this. + ## Dependencies Quickshell has a set of base dependencies you will always need, names vary by distro: diff --git a/CMakeLists.txt b/CMakeLists.txt index 367b39e0..e142ae57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,9 @@ boption(SERVICE_GREETD "Greetd" ON) boption(SERVICE_UPOWER "UPower" ON) boption(SERVICE_NOTIFICATIONS "Notifications" ON) +set(INSTALL_QMLDIR "" CACHE STRING "QML install dir") +set(INSTALL_QML_PREFIX "" CACHE STRING "QML install prefix") + add_compile_options(-Wall -Wextra) if (FRAME_POINTERS) @@ -154,11 +157,22 @@ if (USE_JEMALLOC) target_link_libraries(quickshell PRIVATE ${JEMALLOC_LIBRARIES}) endif() -install( - DIRECTORY ${CMAKE_BINARY_DIR}/qml_modules/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt-6/qml - FILES_MATCHING PATTERN "*" -) +if ("${INSTALL_QMLDIR}" STREQUAL "" AND "${INSTALL_QML_PREFIX}" STREQUAL "") + message(WARNING "Neither INSTALL_QMLDIR nor INSTALL_QML_PREFIX is set. QML modules will not be installed.") +else() + if ("${INSTALL_QMLDIR}" STREQUAL "") + set(INSTALLDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_QML_PREFIX}") + else() + set(INSTALLDIR "${INSTALL_QMLDIR}") + endif() + + message(STATUS "QML install dir: ${INSTALLDIR}") + install( + DIRECTORY ${CMAKE_BINARY_DIR}/qml_modules/ + DESTINATION ${INSTALLDIR} + FILES_MATCHING PATTERN "*" + ) +endif() install(CODE " execute_process( diff --git a/default.nix b/default.nix index f7352267..298e561e 100644 --- a/default.nix +++ b/default.nix @@ -69,6 +69,7 @@ cmakeFlags = [ (lib.cmakeFeature "DISTRIBUTOR" "Official-Nix-Flake") + (lib.cmakeFeature "INSTALL_QML_PREFIX" qt6.qtbase.qtQmlPrefix) (lib.cmakeBool "DISTRIBUTOR_DEBUGINFO_AVAILABLE" true) (lib.cmakeFeature "GIT_REVISION" gitRev) (lib.cmakeBool "CRASH_REPORTER" withCrashReporter)