Files
Archimedes/ExampleModules.nix
2025-05-08 23:50:01 -05:00

380 lines
9.3 KiB
Nix

{ inputs, pkgs, ... }: {
TestMenu = pkgs.stdenvNoCC.mkDerivation {
name = "TestMenu";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildPhase = ''
clang++ \
modules/examples/TestMenu/src/*.cpp \
-fpic -shared \
-I src \
-Wall \
-DTESTMENU_DYNAMIC \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
TestNotCurses = pkgs.stdenvNoCC.mkDerivation {
name = "TestNotCurses";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
notcurses
];
buildPhase = ''
clang++ \
modules/examples/TestNotCurses/src/*.cpp \
-fpic -shared \
-I src -I include \
-Wall \
-lnotcurses \
-DTESTNOTCURSES_DYNAMIC \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
Print = pkgs.stdenvNoCC.mkDerivation {
name = "Print";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildPhase = ''
clang++ \
modules/examples/Print/src/*.cpp \
-fpic -shared \
-I src -I include \
-Wall \
-DPRINT_DYNAMIC \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
DependsOnPrint = pkgs.stdenvNoCC.mkDerivation {
name = "DependsOnPrint";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildPhase = ''
clang++ \
modules/examples/DependsOnPrint/src/*.cpp \
-fpic -shared \
-I src -I include \
-Wall \
-DDEPENDSONPRINT_DYNAMIC \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
DependsOnPrintStatic = pkgs.stdenvNoCC.mkDerivation {
name = "DependsOnPrintStatic";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildPhase = ''
clang++ \
modules/examples/DependsOnPrintStatic/src/*.cpp \
modules/examples/Print/src/*.cpp \
-fpic -shared \
-I src -I include -I . \
-DDEPENDSONPRINTSTATIC_DYNAMIC \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
TestImgui = pkgs.stdenvNoCC.mkDerivation {
name = "TestImgui";
src = ./.;
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
glfw
glew
];
buildPhase = ''
clang++ \
modules/examples/TestImgui/src/*.cpp \
modules/WindowModule/src/*.cpp \
modules/ImguiModule/src/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER_OPENGL \
-DWINDOW_GLFW \
-DTESTIMGUI_DYNAMIC \
-fpic -shared \
-I src -I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
TestClay = pkgs.stdenvNoCC.mkDerivation {
name = "TestClay";
src = ./.;
clay = inputs.clay;
nativeBuildInputs = with pkgs; [
clang
];
buildPhase = ''
clang++ \
modules/examples/TestClay/src/*.cpp \
-fpic -shared \
-I src -I include \
-DRENDERER_OPENGL \
-DWINDOW_GLFW \
-DTESTCLAY_DYNAMIC \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
ChatServer = pkgs.stdenvNoCC.mkDerivation {
name = "ChatServer";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
gamenetworkingsockets
];
buildPhase = ''
clang++ \
modules/examples/ChatServer/src/*.cpp \
modules/ServerModule/src/*.cpp \
-fpic -shared \
-I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \
-I src -I include -I . \
-lGameNetworkingSockets \
-DCHATSERVER_DYNAMIC \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
ChatServerVoice = pkgs.stdenvNoCC.mkDerivation {
name = "ChatServerVoice";
src = ./.;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
gamenetworkingsockets
];
buildPhase = ''
clang++ \
modules/examples/ChatServerVoice/src/*.cpp \
modules/ServerModule/src/*.cpp \
-fpic -shared \
-I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \
-I src -I include -I . \
-lGameNetworkingSockets \
-DCHATSERVERVOICE_DYNAMIC \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
ChatClient = pkgs.stdenvNoCC.mkDerivation {
name = "ChatClient";
src = ./.;
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
gamenetworkingsockets
glfw
glew
];
buildPhase = ''
clang++ \
modules/examples/ChatClient/src/*.cpp \
modules/ClientModule/src/*.cpp \
-I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \
-lGameNetworkingSockets \
-DCHATCLIENT_DYNAMIC \
modules/WindowModule/src/*.cpp \
modules/ImguiModule/src/*.cpp \
$imgui/backends/imgui_impl_glfw.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER_OPENGL \
-DWINDOW_GLFW \
-fpic -shared \
-I src -I include -I $imgui -I . \
-lGL -lglfw -lGLEW \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
ChatClientVoice = pkgs.stdenvNoCC.mkDerivation {
name = "ChatClientVoice";
src = ./.;
imgui = inputs.imgui;
nativeBuildInputs = with pkgs; [
clang
];
buildInputs = with pkgs; [
gamenetworkingsockets
sdl3
glew
];
buildPhase = ''
clang++ \
modules/examples/ChatClientVoice/src/*.cpp \
modules/ClientModule/src/*.cpp \
-I ${pkgs.gamenetworkingsockets}/include/GameNetworkingSockets \
-lGameNetworkingSockets \
-DCHATCLIENTVOICE_DYNAMIC \
modules/WindowModule/src/*.cpp \
modules/ImguiModule/src/*.cpp \
$imgui/backends/imgui_impl_sdl3.cpp \
$imgui/backends/imgui_impl_opengl3.cpp \
$imgui/misc/cpp/*.cpp \
$imgui/*.cpp \
-DRENDERER=1 \
-DWINDOW=2 \
-fpic -shared \
-I src -I include -I $imgui -I . \
-lGL -lSDL3 -lGLEW \
-Wall \
-o $name
'';
installPhase = ''
mkdir -p $out/bin
cp $name $out/bin
'';
};
}