@@ -1,9 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
cmake_minimum_required(VERSION 3.31)
|
||||
|
||||
project(LunarWM C CXX)
|
||||
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
|
||||
|
||||
project(LunarWM LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_MODULE_STD 1)
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
|
||||
@@ -23,11 +23,17 @@
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell.override { stdenv = pkgs.llvmPackages_20.libcxxStdenv; } {
|
||||
hardeningDisable = [ "fortify" ];
|
||||
|
||||
packages = with pkgs; [
|
||||
(pkgs.callPackage ./nix/cmake-importstd-patched/package.nix {
|
||||
libcxx = pkgs.llvmPackages_20.libcxx;
|
||||
})
|
||||
|
||||
pkg-config
|
||||
cmake
|
||||
ninja
|
||||
clang-tools
|
||||
(pkgs.llvmPackages_20.clang-tools.override { enableLibcxx = true; })
|
||||
lldb
|
||||
|
||||
# For wlroots
|
||||
|
||||
37
nix/cmake-importstd-patched/package.nix
Normal file
37
nix/cmake-importstd-patched/package.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
# Dummy cmake package for replacing the ImportStd module.
|
||||
# Symlink existing derivation to avoid rebuilding package from source.
|
||||
# I.e. rather than using overlay or override(Attr) to add patch.
|
||||
#
|
||||
# Note this is actually a clang/llvm issue (`-print-file-name` flag not working),
|
||||
# but it is much simpler to just patch the cmake module itself. Maybe fixed in llvm 19.1.7
|
||||
#
|
||||
# See relevant issues:
|
||||
# 1. https://github.com/NixOS/nixpkgs/issues/370217
|
||||
# 2. https://gitlab.kitware.com/cmake/cmake/-/issues/25965#note_1523575
|
||||
{
|
||||
lib,
|
||||
cmake,
|
||||
libcxx,
|
||||
symlinkJoin,
|
||||
}:
|
||||
let
|
||||
cmake-ver = "${lib.versions.majorMinor cmake.version}";
|
||||
module-path = "share/cmake-${cmake-ver}/Modules/Compiler/Clang-CXX-CXXImportStd.cmake";
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "${cmake.name}-importstd-module-patched";
|
||||
paths = [ cmake ];
|
||||
postBuild = ''
|
||||
# copy binaries to avoid using original derivation
|
||||
for link in $(find $out/bin/ -type l); do
|
||||
cp --remove-destination $(readlink $link) $out/bin/
|
||||
done;
|
||||
|
||||
# replace symlink to existing module with copy for editing
|
||||
cp --remove-destination $(readlink $out/${module-path}) $out/${module-path}
|
||||
|
||||
# replace "libc++.modules.json" with full path
|
||||
# to libc++ module json in new copied module file
|
||||
sed -i 's#libc++.modules.json#${libcxx}/lib/libc++.modules.json#' $out/${module-path}
|
||||
'';
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
module;
|
||||
|
||||
#include <memory>
|
||||
#include <poll.h>
|
||||
#include <print>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
@@ -11,6 +9,8 @@ module;
|
||||
|
||||
export module LunarWM.LunarWM;
|
||||
|
||||
import std;
|
||||
|
||||
import LunarWM.wl.Subcompositor;
|
||||
import LunarWM.wl.Shm;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
module;
|
||||
|
||||
#include <cmath>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
import std;
|
||||
|
||||
export module LunarWM.Math;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <csignal>
|
||||
#include <memory>
|
||||
|
||||
import std;
|
||||
|
||||
import LunarWM.LunarWM;
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
module;
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
export module LunarWM.wl.Region;
|
||||
|
||||
import std;
|
||||
|
||||
import LunarWM.Math;
|
||||
|
||||
namespace LunarWM {
|
||||
|
||||
@@ -2,18 +2,17 @@ module;
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <wayland-server.h>
|
||||
|
||||
export module LunarWM.wl.Shm;
|
||||
|
||||
import std;
|
||||
|
||||
namespace LunarWM {
|
||||
|
||||
namespace wl {
|
||||
|
||||
@@ -2,12 +2,12 @@ module;
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
export module LunarWM.wl.Subsurface;
|
||||
|
||||
import std;
|
||||
|
||||
namespace LunarWM {
|
||||
|
||||
namespace wl {
|
||||
|
||||
Reference in New Issue
Block a user