From 97b759c92a919c30137088e864e11b826fec70a2 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Tue, 23 Jan 2024 05:12:40 -0800 Subject: [PATCH] Minor changes to reduce kde build deps --- CMakeLists.txt | 14 ++++++++------ README.md | 2 ++ default.nix | 23 +++++++++++++++++++++++ shell.nix | 33 +++++++++++++++++++++++++++++++++ src/declarative/CMakeLists.txt | 4 +++- 5 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 default.nix create mode 100644 shell.nix diff --git a/CMakeLists.txt b/CMakeLists.txt index 57fd740..462ef9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ set(PROJECT_VERSION_MAJOR 6) set(CMAKE_C_STANDARD 99) set(QT_MIN_VERSION "6.6.0") -set(KF6_MIN_VERSION "5.240.0") -set(KDE_COMPILERSETTINGS_LEVEL "5.82") +#set(KF6_MIN_VERSION "5.240.0") +#set(KDE_COMPILERSETTINGS_LEVEL "5.82") set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -26,9 +26,9 @@ include(ECMSetupVersion) include(ECMDeprecationSettings) include(ECMGenerateHeaders) include(CMakePackageConfigHelpers) -include(FeatureSummary) +#include(FeatureSummary) include(GenerateExportHeader) -include(KDEClangFormat) +#include(KDEClangFormat) include(ECMQtDeclareLoggingCategory) include(ECMQmlModule) @@ -45,20 +45,22 @@ set_package_properties(Wayland PROPERTIES TYPE REQUIRED) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") +set(CMAKE_AUTOMOC ON) + ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LAYERSHELLQT VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/layershellqt_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfigVersion.cmake" SOVERSION ${PROJECT_VERSION_MAJOR}) file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) -kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) +#kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) ecm_set_disabled_deprecation_versions(QT 6.5 KF 5.240 ) add_subdirectory(src) -add_subdirectory(tests) +#add_subdirectory(tests) set(CMAKECONFIG_INSTALL_DIR ${KDE_INSTALL_CMAKEPACKAGEDIR}/LayerShellQt) install(EXPORT LayerShellQtTargets diff --git a/README.md b/README.md index 4e5367e..50dc5a2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Forked to reduce kde deps / build for qt6 as its not stable in nixpkgs, really only minor cmake patches + # LayerShellQt This component is meant for applications to be able to easily use clients based on wlr-layer-shell. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..b6093a9 --- /dev/null +++ b/default.nix @@ -0,0 +1,23 @@ +{ stdenv, cmake, qt6, wayland, wayland-scanner, wayland-protocols, pkg-config, libsForQt5 }: stdenv.mkDerivation { + pname = "layer-shell-qt-nokde"; + version = "6.0.80"; + + src = ./.; + + nativeBuildInputs = [ + cmake + pkg-config + wayland-scanner + libsForQt5.extra-cmake-modules + ]; + + dontWrapQtApps = true; + + buildInputs = [ + qt6.qtbase + qt6.qtdeclarative + qt6.qtwayland + wayland + wayland-protocols + ]; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..f4c3863 --- /dev/null +++ b/shell.nix @@ -0,0 +1,33 @@ +{ pkgs ? import {} }: pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + cmake + wayland-scanner + libsForQt5.extra-cmake-modules + + clang-tools_17 + ]; + + buildInputs = with pkgs; [ + qt6.qtbase + qt6.qtdeclarative + qt6.qtwayland + wayland + wayland-protocols + ]; + + shellHook = '' + export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) + + # Add Qt-related environment variables. + # https://discourse.nixos.org/t/qt-development-environment-on-a-flake-system/23707/5 + setQtEnvironment=$(mktemp) + random=$(openssl rand -base64 20 | sed "s/[^a-zA-Z0-9]//g") + makeWrapper "$(type -p sh)" "$setQtEnvironment" "''${qtWrapperArgs[@]}" --argv0 "$random" + sed "/$random/d" -i "$setQtEnvironment" + source "$setQtEnvironment" + + # qmlls does not account for the import path and bases its search off qtbase's path. + # The actual imports come from qtdeclarative. This directs qmlls to the correct imports. + export QMLLS_BUILD_DIRS=$(pwd)/build:$QML2_IMPORT_PATH + ''; +} diff --git a/src/declarative/CMakeLists.txt b/src/declarative/CMakeLists.txt index 07bcda9..c97d6fd 100644 --- a/src/declarative/CMakeLists.txt +++ b/src/declarative/CMakeLists.txt @@ -1,10 +1,12 @@ # SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez # SPDX-License-Identifier: BSD-3-Clause +set(BUILD_SHARED_LIBS ON) + ecm_add_qml_module(LayerShellQtQml URI "org.kde.layershell" VERSION 1.0 SOURCES layershellqtplugin.cpp) target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface) -ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR}) \ No newline at end of file +ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR})