fix windows build (requires glew built for windows)

This commit is contained in:
2026-03-06 22:03:40 +01:00
parent e482adbb76
commit 1b6f597cd5

View File

@ -185,11 +185,17 @@ rec {
# Header-only library # Header-only library
dontBuild = true; dontBuild = true;
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out mkdir -p $out
mv ./include $out/include cp -rv ./include $out/include
runHook postInstall
''; '';
}; };
# We can use the pkgs.stdenv for Linux+Windows because it's a header only library.
# The build is required to create the pkg-config/cmake configuration files.
libmorton = stdenv.mkDerivation { libmorton = stdenv.mkDerivation {
pname = "libmorton"; pname = "libmorton";
version = "0.2.12-unstable-2023-05-24"; version = "0.2.12-unstable-2023-05-24";
@ -201,13 +207,6 @@ rec {
hash = "sha256-5LHiWu2GIuDmfM2gXGbRsFasE7AmVCSRphNdFElbbjk="; hash = "sha256-5LHiWu2GIuDmfM2gXGbRsFasE7AmVCSRphNdFElbbjk=";
}; };
# Header-only library
# dontBuild = true;
# installPhase = ''
# mkdir -p $out
# mv ./include $out/include
# '';
nativeBuildInputs = with pkgs; [cmake]; nativeBuildInputs = with pkgs; [cmake];
cmakeFlags = [ cmakeFlags = [
@ -217,6 +216,41 @@ rec {
]; ];
}; };
glew-windows = windowsPkgs.stdenv.mkDerivation rec {
pname = "glew-windows";
version = "2.2.0";
src = pkgs.fetchurl {
url = "https://github.com/nigels-com/glew/releases/download/glew-${version}/glew-${version}.tgz";
hash = "sha256-1PyCiTz7ABCVeNChojN/uMozWzzsz5e5flzH8I5DU+E=";
};
nativeBuildInputs = with pkgs; [
cmake
ninja
pkg-config
];
preConfigure = ''
cd build/cmake
'';
cmakeFlags = [
"-DBUILD_UTILS=OFF"
"-DGLEW_OSMESA=OFF"
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
];
installPhase = ''
runHook preInstall
cmake --install . --prefix "$out"
runHook postInstall
'';
};
# =========================================================================================== # ===========================================================================================
# Specify dependencies # Specify dependencies
# https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview # https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview
@ -250,8 +284,8 @@ rec {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
# C/C++: # C/C++:
raylib raylib
glew
raygui raygui
glew
thread-pool thread-pool
libmorton libmorton
boost boost
@ -297,11 +331,13 @@ rec {
''; '';
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/lib mkdir -p $out/lib
cp ./${pname} $out/lib/ cp ./${pname} $out/lib/
cp $src/default.puzzle $out/lib/ cp -rv $src/default.puzzle $out/lib/
cp -r $src/fonts $out/lib/fonts cp -rv $src/fonts $out/lib/fonts
cp -r $src/shader $out/lib/shader cp -rv $src/shader $out/lib/shader
# The wrapper enters the correct working dir, so fonts/shaders/presets are available # The wrapper enters the correct working dir, so fonts/shaders/presets are available
mkdir -p $out/bin mkdir -p $out/bin
@ -316,6 +352,8 @@ rec {
Exec=$out/bin/${pname} %f Exec=$out/bin/${pname} %f
Type=Application Type=Application
INI INI
runHook postInstall
''; '';
}; };
@ -333,6 +371,7 @@ rec {
buildInputs = with windowsPkgs; [ buildInputs = with windowsPkgs; [
raylib raylib
raygui raygui
glew-windows
thread-pool thread-pool
libmorton libmorton
@ -356,11 +395,15 @@ rec {
]; ];
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
cp ./${pname}.exe $out/bin/ cp -rv ./${pname}.exe $out/bin/
cp $src/default.puzzle $out/bin/ cp -rv $src/default.puzzle $out/bin/
cp -r $src/fonts $out/bin/fonts cp -rv $src/fonts $out/bin/fonts
cp -r $src/shader $out/bin/shader cp -rv $src/shader $out/bin/shader
runHook postInstall
''; '';
}; };
in rec { in rec {
@ -404,6 +447,7 @@ rec {
# C/C++: # C/C++:
raylib raylib
raygui raygui
glew
thread-pool thread-pool
libmorton libmorton
boost boost