From 674e7df0006c77904105fac181f110e9ca915adb Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sun, 22 Sep 2024 12:35:29 +0300 Subject: [PATCH] Revert "nix: adapt cmake options" This reverts commit c35ed8363f321bb9925bc5e6f5ff03a903593802. --- nix/cmake-version.patch | 10 ++++++++++ nix/default.nix | 30 ++++++++++++++++++------------ nix/stdcxx.patch | 12 ++++++++++++ 3 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 nix/cmake-version.patch create mode 100644 nix/stdcxx.patch diff --git a/nix/cmake-version.patch b/nix/cmake-version.patch new file mode 100644 index 00000000..ccc9c738 --- /dev/null +++ b/nix/cmake-version.patch @@ -0,0 +1,10 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6fdf98db..d8424d91 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.30) ++cmake_minimum_required(VERSION 3.27) + + # Get version + file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW) diff --git a/nix/default.nix b/nix/default.nix index 40675d9a..3edc5bf7 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -53,7 +53,7 @@ inherit (lib.attrsets) mapAttrsToList; inherit (lib.lists) flatten concatLists optional optionals; inherit (lib.sources) cleanSourceWith cleanSource; - inherit (lib.strings) hasSuffix makeBinPath optionalString mesonBool mesonEnable; + inherit (lib.strings) cmakeBool hasSuffix makeBinPath optionalString; adapters = flatten [ stdenvAdapters.useMoldLinker @@ -76,6 +76,14 @@ in src = cleanSource ../.; }; + patches = [ + # forces GCC to use -std=c++26 + ./stdcxx.patch + + # Nix does not have CMake 3.30 yet, so override the minimum version + ./cmake-version.patch + ]; + postPatch = '' # Fix hardcoded paths to /usr installation sed -i "s#/usr#$out#" src/render/OpenGL.cpp @@ -144,22 +152,20 @@ in (optional withSystemd systemd) ]; - mesonBuildType = + cmakeBuildType = if debug - then "debug" - else "release"; + then "Debug" + else "RelWithDebInfo"; # we want as much debug info as possible dontStrip = debug; - mesonFlags = flatten [ - (mapAttrsToList mesonEnable { - "xwayland" = enableXWayland; - "legacy_renderer" = legacyRenderer; - "systemd" = withSystemd; - }) - (mesonBool "b_pch" false) - ]; + cmakeFlags = mapAttrsToList cmakeBool { + "NO_XWAYLAND" = !enableXWayland; + "LEGACY_RENDERER" = legacyRenderer; + "NO_SYSTEMD" = !withSystemd; + "CMAKE_DISABLE_PRECOMPILE_HEADERS" = true; + }; postInstall = '' ${optionalString wrapRuntimeDeps '' diff --git a/nix/stdcxx.patch b/nix/stdcxx.patch new file mode 100644 index 00000000..032e494d --- /dev/null +++ b/nix/stdcxx.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cfbd431f..73e8e0c2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,6 +64,7 @@ endif() + include_directories(. "src/" "subprojects/udis86/" "protocols/") + set(CMAKE_CXX_STANDARD 26) + add_compile_options( ++ -std=c++26 + -Wall + -Wextra + -Wno-unused-parameter