nixos/homer: init (#368594)
[NixPkgs.git] / pkgs / development / libraries / ogre / default.nix
blob5ad09c0931fe54cd18e5bd57c18a348e02983ae1
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   # darwin
30   darwin,
31   # optional
32   withNvidiaCg ? false,
33   nvidia_cg_toolkit,
34   withSamples ? false,
37 let
38   common =
39     {
40       version,
41       hash,
42       imguiVersion,
43       imguiHash,
44     }:
45     let
46       imgui.src = fetchFromGitHub {
47         owner = "ocornut";
48         repo = "imgui";
49         rev = "v${imguiVersion}";
50         hash = imguiHash;
51       };
52     in
53     stdenv.mkDerivation {
54       pname = "ogre";
55       inherit version;
57       src = fetchFromGitHub {
58         owner = "OGRECave";
59         repo = "ogre";
60         rev = "v${version}";
61         inherit hash;
62       };
64       postPatch = ''
65         mkdir -p build
66         cp -R ${imgui.src} build/imgui-${imguiVersion}
67         chmod -R u+w build/imgui-${imguiVersion}
68       '';
70       nativeBuildInputs = [
71         cmake
72         pkg-config
73         unzip
74       ];
76       buildInputs =
77         [
78           SDL2
79           boost
80           freetype
81           libpng
82           ois
83           pugixml
84           zziplib
85         ]
86         ++ lib.optionals stdenv.hostPlatform.isLinux [
87           libglut
88           libGL
89           libGLU
90           libICE
91           libSM
92           libX11
93           libXaw
94           libXmu
95           libXrandr
96           libXrender
97           libXt
98           libXxf86vm
99           xorgproto
100         ]
101         ++ lib.optionals stdenv.hostPlatform.isDarwin [
102           darwin.apple_sdk.frameworks.Cocoa
103         ]
104         ++ lib.optionals withNvidiaCg [
105           nvidia_cg_toolkit
106         ];
108       cmakeFlags =
109         [
110           (lib.cmakeBool "OGRE_BUILD_DEPENDENCIES" false)
111           (lib.cmakeBool "OGRE_BUILD_SAMPLES" withSamples)
112         ]
113         ++ lib.optionals stdenv.hostPlatform.isDarwin [
114           (lib.cmakeBool "OGRE_BUILD_LIBS_AS_FRAMEWORKS" false)
115         ];
117       meta = {
118         description = "3D Object-Oriented Graphics Rendering Engine";
119         homepage = "https://www.ogre3d.org/";
120         maintainers = with lib.maintainers; [
121           raskin
122           wegank
123         ];
124         platforms = lib.platforms.unix;
125         license = lib.licenses.mit;
126       };
127     };
130   ogre_14 = common {
131     version = "14.3.3";
132     hash = "sha256-+ZWrYwgQFmL+9QA+pDQHqacJoONUDVTT+PQLmpLTChg=";
133     # https://github.com/OGRECave/ogre/blob/v14.3.3/Components/Overlay/CMakeLists.txt
134     imguiVersion = "1.91.2";
135     imguiHash = "sha256-B7XXQNuEPcT1ID5nMYbAV+aNCG9gIrC9J7BLnYB8yjI=";
136   };
138   ogre_13 = common {
139     version = "13.6.5";
140     hash = "sha256-8VQqePrvf/fleHijVIqWWfwOusGjVR40IIJ13o+HwaE=";
141     # https://github.com/OGRECave/ogre/blob/v13.6.5/Components/Overlay/CMakeLists.txt
142     imguiVersion = "1.87";
143     imguiHash = "sha256-H5rqXZFw+2PfVMsYvAK+K+pxxI8HnUC0GlPhooWgEYM=";
144   };