mirror of
https://github.com/hyprwm/hyprland-qt-support.git
synced 2025-05-13 05:30:35 +01:00
build: fix installation, disable tester by default
This commit is contained in:
parent
ed177913b0
commit
4aae02fde1
4 changed files with 38 additions and 11 deletions
|
@ -1,16 +1,19 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(cmake/install-qml-module.cmake)
|
include(cmake/install-qml-module.cmake)
|
||||||
|
|
||||||
|
option(BUILD_TESTER "Build style tester" OFF)
|
||||||
|
|
||||||
# Get version
|
# Get version
|
||||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
||||||
string(STRIP ${VER_RAW} VER)
|
string(STRIP ${VER_RAW} VER)
|
||||||
|
|
||||||
project(hyprland-qt-support VERSION ${VER} LANGUAGES CXX)
|
project(hyprland-qt-support VERSION ${VER} LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
find_package(Qt6 6.6 REQUIRED COMPONENTS Qml Quick QuickControls2)
|
find_package(Qt6 6.6 REQUIRED COMPONENTS Qml Quick QuickControls2)
|
||||||
|
|
||||||
qt_standard_project_setup(REQUIRES 6.6)
|
qt_standard_project_setup(REQUIRES 6.6)
|
||||||
|
|
|
@ -1,9 +1,27 @@
|
||||||
set(INSTALL_QMLDIR "${CMAKE_INSTALL_LIBDIR}/qt-6/qml")
|
set(INSTALL_QMLDIR "" CACHE STRING "QML install dir")
|
||||||
|
set(INSTALL_QML_PREFIX "" CACHE STRING "QML install prefix")
|
||||||
|
|
||||||
|
# There doesn't seem to be a standard cross-distro qml install path.
|
||||||
|
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(QML_FULL_INSTALLDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_QML_PREFIX}")
|
||||||
|
else()
|
||||||
|
set(QML_FULL_INSTALLDIR "${INSTALL_QMLDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "QML install dir: ${QML_FULL_INSTALLDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Install a given target as a QML module. This is mostly pulled from ECM, as there does not seem
|
# Install a given target as a QML module. This is mostly pulled from ECM, as there does not seem
|
||||||
# to be an official way to do it.
|
# to be an official way to do it.
|
||||||
# see https://github.com/KDE/extra-cmake-modules/blob/fe0f606bf7f222e36f7560fd7a2c33ef993e23bb/modules/ECMQmlModule6.cmake#L160
|
# see https://github.com/KDE/extra-cmake-modules/blob/fe0f606bf7f222e36f7560fd7a2c33ef993e23bb/modules/ECMQmlModule6.cmake#L160
|
||||||
function(install_qml_module arg_TARGET)
|
function(install_qml_module arg_TARGET)
|
||||||
|
if (NOT DEFINED QML_FULL_INSTALLDIR)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
qt_query_qml_module(${arg_TARGET}
|
qt_query_qml_module(${arg_TARGET}
|
||||||
URI module_uri
|
URI module_uri
|
||||||
VERSION module_version
|
VERSION module_version
|
||||||
|
@ -15,17 +33,17 @@ function(install_qml_module arg_TARGET)
|
||||||
RESOURCES module_resources
|
RESOURCES module_resources
|
||||||
)
|
)
|
||||||
|
|
||||||
set(module_dir "${INSTALL_QMLDIR}/${module_target_path}")
|
set(module_dir "${QML_FULL_INSTALLDIR}/${module_target_path}")
|
||||||
|
|
||||||
if (NOT TARGET "${module_plugin_target}")
|
if (NOT TARGET "${module_plugin_target}")
|
||||||
message(FATAL_ERROR "install_qml_modules called for a target without a plugin")
|
message(FATAL_ERROR "install_qml_modules called for a target without a plugin")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(
|
# Install the target to /lib instead of the qml module dir.
|
||||||
TARGETS "${arg_TARGET}"
|
# If installed to the module dir, inter-module dependencies will not work
|
||||||
LIBRARY DESTINATION "${module_dir}"
|
# due to broken rpaths. The standard fix for this seems to be to just
|
||||||
RUNTIME DESTINATION "${module_dir}"
|
# put the library in /lib.
|
||||||
)
|
install(TARGETS "${arg_TARGET}")
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS "${module_plugin_target}"
|
TARGETS "${module_plugin_target}"
|
||||||
|
|
|
@ -28,6 +28,10 @@ in stdenv.mkDerivation {
|
||||||
qt6.qtwayland
|
qt6.qtwayland
|
||||||
];
|
];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
(lib.cmakeFeature "INSTALL_QML_PREFIX" qt6.qtbase.qtQmlPrefix)
|
||||||
|
];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "hyprland-qt-support";
|
description = "hyprland-qt-support";
|
||||||
homepage = "https://github.com/hyprwm/hyprland-qt-support";
|
homepage = "https://github.com/hyprwm/hyprland-qt-support";
|
||||||
|
|
|
@ -21,4 +21,6 @@ target_link_libraries(hyprland-quick-style PRIVATE hyprland-quick-style-impl)
|
||||||
|
|
||||||
install_qml_module(hyprland-quick-style)
|
install_qml_module(hyprland-quick-style)
|
||||||
|
|
||||||
add_subdirectory(test)
|
if (BUILD_TESTER)
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue