diff --git a/pkgs/by-name/op/opencomposite/package.nix b/pkgs/by-name/op/opencomposite/package.nix index 5607d55a0be6..d9e6508b0c55 100644 --- a/pkgs/by-name/op/opencomposite/package.nix +++ b/pkgs/by-name/op/opencomposite/package.nix @@ -43,6 +43,7 @@ stdenv.mkDerivation { cmakeFlags = [ (lib.cmakeBool "USE_SYSTEM_OPENXR" true) (lib.cmakeBool "USE_SYSTEM_GLM" true) + (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-DGLM_ENABLE_EXPERIMENTAL") # debug logging macros cause format-security warnings (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-Wno-error=format-security") ]; diff --git a/pkgs/by-name/op/opensplat/package.nix b/pkgs/by-name/op/opensplat/package.nix index cd6052f5369b..d808a403e7bd 100644 --- a/pkgs/by-name/op/opensplat/package.nix +++ b/pkgs/by-name/op/opensplat/package.nix @@ -4,13 +4,13 @@ cmake, ninja, fetchFromGitHub, - fetchpatch, python3, opencv, nlohmann_json, nanoflann, glm, cxxopts, + nix-update-script, config, # Upstream has rocm/hip support, too. anyone? cudaSupport ? config.cudaSupport, @@ -18,7 +18,7 @@ autoAddDriverRunpath, }: let - version = "1.1.2"; + version = "1.1.3"; torch = python3.pkgs.torch.override { inherit cudaSupport; }; # Using a normal stdenv with cuda torch gives # ld: /nix/store/k1l7y96gv0nc685cg7i3g43i4icmddzk-python3.11-torch-2.2.1-lib/lib/libc10.so: undefined reference to `std::ios_base_library_init()@GLIBCXX_3.4.32' @@ -32,27 +32,9 @@ stdenv'.mkDerivation { owner = "pierotofy"; repo = "OpenSplat"; rev = "refs/tags/v${version}"; - hash = "sha256-3tk62b5fSf6wzuc5TwkdfAKgUMrw3ZxetCJa2RVMS/s="; + hash = "sha256-2NcKb2SWU/vNsnd2KhdU85J60fJPuc44ZxIle/1UT6g="; }; - patches = [ - (fetchpatch { - name = "install-executables.patch"; - url = "https://github.com/pierotofy/OpenSplat/commit/b4c4176819b508978583b7ebf66306171807a8e6.patch"; - hash = "sha256-BUgPMcO3lt3ZEzv24u36k3aTEIoloOhxrCGi1KQ5Epk="; - }) - ]; - - postPatch = '' - # the two vendored gsplats are so heavily modified they may be considered a fork - find vendor ! -name 'gsplat*' -maxdepth 1 -mindepth 1 -exec rm -rf {} + - mkdir vendor/{nanoflann,glm} - ln -s ${glm}/include/glm vendor/glm/glm - ln -s ${nanoflann}/include/nanoflann.hpp vendor/nanoflann/nanoflann.hpp - ln -s ${nlohmann_json}/include/nlohmann vendor/json - ln -s ${cxxopts}/include/cxxopts.hpp vendor/cxxopts.hpp - ''; - nativeBuildInputs = [ cmake ninja @@ -63,6 +45,9 @@ stdenv'.mkDerivation { buildInputs = [ nlohmann_json + nanoflann + glm + cxxopts torch.cxxdev torch opencv @@ -74,15 +59,23 @@ stdenv'.mkDerivation { cmakeFlags = [ (lib.cmakeBool "CMAKE_SKIP_RPATH" true) + (lib.cmakeFeature "FETCHCONTENT_TRY_FIND_PACKAGE_MODE" "ALWAYS") ] ++ lib.optionals cudaSupport [ (lib.cmakeFeature "GPU_RUNTIME" "CUDA") (lib.cmakeFeature "CUDA_TOOLKIT_ROOT_DIR" "${cudaPackages.cudatoolkit}/") ]; + passthru.updateScript = nix-update-script { }; + meta = { description = "Production-grade 3D gaussian splatting"; homepage = "https://github.com/pierotofy/OpenSplat/"; - license = lib.licenses.mit; + license = [ + # main + lib.licenses.agpl3Only + # vendored+modified gsplat + lib.licenses.asl20 + ]; maintainers = [ lib.maintainers.jcaesar ]; platforms = lib.platforms.linux ++ lib.optionals (!cudaSupport) lib.platforms.darwin; }; diff --git a/pkgs/development/libraries/glm/default.nix b/pkgs/development/libraries/glm/default.nix index 417d70d621b6..3894db5ab9c8 100644 --- a/pkgs/development/libraries/glm/default.nix +++ b/pkgs/development/libraries/glm/default.nix @@ -1,61 +1,40 @@ { lib , stdenv , fetchFromGitHub -, fetchpatch , cmake }: stdenv.mkDerivation rec { - version = "0.9.9.8"; + version = "1.0.1"; pname = "glm"; src = fetchFromGitHub { owner = "g-truc"; repo = pname; rev = version; - sha256 = "sha256-F//+3L5Ozrw6s7t4LrcUmO7sN30ZSESdrPAYX57zgr8="; + sha256 = "sha256-GnGyzNRpzuguc3yYbEFtYLvG+KiCtRAktiN+NvbOICE="; }; - # (https://github.com/g-truc/glm/pull/986 wasn't enough, and -Werror is used) - # (https://github.com/g-truc/glm/pull/1055 neither) - patches = [ - (fetchpatch { - name = "glm-0.9.9.8-clang.patch"; - url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/glm/files/glm-0.9.9.8-clang.patch?id=79476d4b145a4a6b0cbc0e73a6cefb5d584bf8fa"; - hash = "sha256-D8O+qofnGUEaH5nQGdNddwHyr5FhPQa/lOup4z4SFgY="; - }) - ]; - outputs = [ "out" "doc" ]; nativeBuildInputs = [ cmake ]; - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102823 - env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") "-fno-ipa-modref"; + env.NIX_CFLAGS_COMPILE = + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102823 + if (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") then "-fno-ipa-modref" + # Fix compilation errors on darwin + else if (stdenv.cc.isClang) then "-Wno-error" + else ""; cmakeFlags = [ - "-DBUILD_SHARED_LIBS=OFF" - "-DBUILD_STATIC_LIBS=OFF" - "-DGLM_TEST_ENABLE=${if doCheck then "ON" else "OFF"}" + (lib.cmakeBool "BUILD_SHARED_LIBS" false) + (lib.cmakeBool "BUILD_STATIC_LIBS" false) + (lib.cmakeBool "GLM_TEST_ENABLE" doCheck) ]; doCheck = true; - installPhase = '' - runHook preInstall - - # Install header-only library - mkdir -p $out/include - cp -rv ../glm $out/include - rm $out/include/glm/CMakeLists.txt - rm $out/include/glm/detail/*.cpp - - # Install CMake files - mkdir -p $out/lib - cp -rv ../cmake $out/lib - substituteInPlace $out/lib/cmake/glm/glmConfig.cmake \ - --replace 'GLM_INCLUDE_DIRS ''${_IMPORT_PREFIX}' "GLM_INCLUDE_DIRS $out/include" - + postInstall = '' # Install pkg-config file mkdir -p $out/lib/pkgconfig substituteAll ${./glm.pc.in} $out/lib/pkgconfig/glm.pc @@ -64,8 +43,6 @@ stdenv.mkDerivation rec { mkdir -p $doc/share/doc/glm cp -rv ../doc/api $doc/share/doc/glm/html cp -v ../doc/manual.pdf $doc/share/doc/glm - - runHook postInstall ''; meta = with lib; { diff --git a/pkgs/games/empty-epsilon/default.nix b/pkgs/games/empty-epsilon/default.nix index 657607031295..542e920b78fc 100644 --- a/pkgs/games/empty-epsilon/default.nix +++ b/pkgs/games/empty-epsilon/default.nix @@ -33,7 +33,8 @@ let buildInputs = [ sfml libX11 glm SDL2 ]; cmakeFlags = [ - "-DFETCHCONTENT_SOURCE_DIR_BASIS=${basis-universal}" + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_BASIS" "${basis-universal}") + (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-DGLM_ENABLE_EXPERIMENTAL") ]; meta = with lib; { @@ -63,15 +64,16 @@ stdenv.mkDerivation { buildInputs = [ serious-proton sfml glew libX11 python3 glm SDL2 ninja ]; cmakeFlags = [ - "-DSERIOUS_PROTON_DIR=${serious-proton.src}" - "-DCPACK_PACKAGE_VERSION=${version.emptyepsilon}" - "-DCPACK_PACKAGE_VERSION_MAJOR=${major}" - "-DCPACK_PACKAGE_VERSION_MINOR=${minor}" - "-DCPACK_PACKAGE_VERSION_PATCH=${patch.emptyepsilon}" - "-DFETCHCONTENT_SOURCE_DIR_BASIS=${basis-universal}" - "-DFETCHCONTENT_SOURCE_DIR_MESHOPTIMIZER=${meshoptimizer.src}" - "-DCMAKE_AR=${stdenv.cc.cc}/bin/gcc-ar" - "-DCMAKE_RANLIB=${stdenv.cc.cc}/bin/gcc-ranlib" + (lib.cmakeFeature "SERIOUS_PROTON_DIR" "${serious-proton.src}") + (lib.cmakeFeature "CPACK_PACKAGE_VERSION" "${version.emptyepsilon}") + (lib.cmakeFeature "CPACK_PACKAGE_VERSION_MAJOR" "${major}") + (lib.cmakeFeature "CPACK_PACKAGE_VERSION_MINOR" "${minor}") + (lib.cmakeFeature "CPACK_PACKAGE_VERSION_PATCH" "${patch.emptyepsilon}") + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_BASIS" "${basis-universal}") + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MESHOPTIMIZER" "${meshoptimizer.src}") + (lib.cmakeFeature "CMAKE_AR" "${stdenv.cc.cc}/bin/gcc-ar") + (lib.cmakeFeature "CMAKE_RANLIB" "${stdenv.cc.cc}/bin/gcc-ranlib") + (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-DGLM_ENABLE_EXPERIMENTAL") "-G Ninja" ]; diff --git a/pkgs/games/frogatto/engine.nix b/pkgs/games/frogatto/engine.nix index 1efdb2ceee04..d5e380588176 100644 --- a/pkgs/games/frogatto/engine.nix +++ b/pkgs/games/frogatto/engine.nix @@ -33,6 +33,8 @@ stdenv.mkDerivation { glm ]; + env.CXXFLAGS = "-DGLM_ENABLE_EXPERIMENTAL -Wno-error=deprecated-declarations"; + enableParallelBuilding = true; installPhase = '' diff --git a/pkgs/games/solarus/default.nix b/pkgs/games/solarus/default.nix index fd80b03066ce..b59c20c2b322 100644 --- a/pkgs/games/solarus/default.nix +++ b/pkgs/games/solarus/default.nix @@ -22,6 +22,10 @@ mkDerivation rec { openal libmodplug libvorbis qtbase glm ]; + cmakeFlags = [ + (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-DGLM_ENABLE_EXPERIMENTAL") + ]; + preFixup = '' mkdir $lib/ mv $out/lib $lib