1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 unzip,
8 SDL2,
9 boost,
10 freetype,
11 libpng,
12 ois,
13 pugixml,
14 zziplib,
15 # linux
16 libglut,
17 libGL,
18 libGLU,
19 libICE,
20 libSM,
21 libX11,
22 libXaw,
23 libXmu,
24 libXrandr,
25 libXrender,
26 libXt,
27 libXxf86vm,
28 xorgproto,
29 # optional
30 withNvidiaCg ? false,
31 nvidia_cg_toolkit,
32 withSamples ? false,
33}:
34
35let
36 common =
37 {
38 version,
39 hash,
40 imguiVersion,
41 imguiHash,
42 }:
43 let
44 imgui.src = fetchFromGitHub {
45 owner = "ocornut";
46 repo = "imgui";
47 rev = "v${imguiVersion}";
48 hash = imguiHash;
49 };
50 in
51 stdenv.mkDerivation {
52 pname = "ogre";
53 inherit version;
54
55 src = fetchFromGitHub {
56 owner = "OGRECave";
57 repo = "ogre";
58 rev = "v${version}";
59 inherit hash;
60 };
61
62 postPatch = ''
63 mkdir -p build
64 cp -R ${imgui.src} build/imgui-${imguiVersion}
65 chmod -R u+w build/imgui-${imguiVersion}
66 '';
67
68 nativeBuildInputs = [
69 cmake
70 pkg-config
71 unzip
72 ];
73
74 buildInputs = [
75 SDL2
76 boost
77 freetype
78 libpng
79 ois
80 pugixml
81 zziplib
82 ]
83 ++ lib.optionals stdenv.hostPlatform.isLinux [
84 libglut
85 libGL
86 libGLU
87 libICE
88 libSM
89 libX11
90 libXaw
91 libXmu
92 libXrandr
93 libXrender
94 libXt
95 libXxf86vm
96 xorgproto
97 ]
98 ++ lib.optionals withNvidiaCg [
99 nvidia_cg_toolkit
100 ];
101
102 cmakeFlags = [
103 (lib.cmakeBool "OGRE_BUILD_DEPENDENCIES" false)
104 (lib.cmakeBool "OGRE_BUILD_SAMPLES" withSamples)
105 ]
106 ++ lib.optionals stdenv.hostPlatform.isDarwin [
107 (lib.cmakeBool "OGRE_BUILD_LIBS_AS_FRAMEWORKS" false)
108 ];
109
110 meta = {
111 description = "3D Object-Oriented Graphics Rendering Engine";
112 homepage = "https://www.ogre3d.org/";
113 maintainers = with lib.maintainers; [
114 raskin
115 wegank
116 ];
117 platforms = lib.platforms.unix;
118 license = lib.licenses.mit;
119 };
120 };
121in
122{
123 ogre_14 = common {
124 version = "14.4.0";
125 hash = "sha256-hRHjgJgnSc8saOoLoyBCQKrLpbUVpUxuS/zsZEoulKA=";
126 # https://github.com/OGRECave/ogre/blob/v14.4.0/Components/Overlay/CMakeLists.txt
127 imguiVersion = "1.91.9b";
128 imguiHash = "sha256-dkukDP0HD8CHC2ds0kmqy7KiGIh4148hMCyA1QF3IMo=";
129 };
130
131 ogre_13 = common {
132 version = "13.6.5";
133 hash = "sha256-8VQqePrvf/fleHijVIqWWfwOusGjVR40IIJ13o+HwaE=";
134 # https://github.com/OGRECave/ogre/blob/v13.6.5/Components/Overlay/CMakeLists.txt
135 imguiVersion = "1.87";
136 imguiHash = "sha256-H5rqXZFw+2PfVMsYvAK+K+pxxI8HnUC0GlPhooWgEYM=";
137 };
138}