-
Notifications
You must be signed in to change notification settings - Fork 4
/
globe_3d.gpr
215 lines (181 loc) · 6.94 KB
/
globe_3d.gpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
-- This is a GNAT, GCC or GNAT Programming Studio (GPS) project file
-- for the GLOBE_3D project.
--
-- GLOBE_3D Web site: http://globe3d.sf.net/
-- GLOBE_3D Mirror: https://github.com/zertovitch/globe-3d
--
-- Build me with "gnatmake -P globe_3d", "gprbuild -P globe_3d",
-- or open me with GNAT Studio.
--
-- This variant is a single project, which handles all sources, including
-- libraries (zip-ada, gid) which are also available as standalone projects
-- and made visible withthe Source_Dir_List variable below.
--
-- See "globe_3d_project_tree.gpr" for the other variant of
-- the GLOBE_3D project.
project GLOBE_3D is
type G3D_OS_Kind is
("win32", "win64", "linux", "macosx");
G3D_OS : G3D_OS_Kind := external ("G3D_OS", "win64");
type G3D_Build_Mode_Type is
("debug",
"fast",
"small");
G3D_Build_Mode : G3D_Build_Mode_Type := external ("G3D_Build_Mode", "debug");
type G3D_Styles_Checks_Type is
("off",
"level_1",
"level_2");
G3D_Styles_Checks : G3D_Styles_Checks_Type := external ("G3D_Styles_Checks", "off");
Binder_Options := ("-Es"); -- -Es: Store tracebacks in exception occurrences, and enable symbolic tracebacks
Common_Compiler_Options :=
("-gnatwa",
"-fno-strict-aliasing");
Style_Checks_1 :=
("-gnatyaknpr", -- Style: check all casings: a:attribute, k:keywords, n:package Standard identifiers, p:pragma, r:identifier references
"-gnatyO", -- Style: check overriding indicators
"-gnatyM120", -- Style: check line length <= 100 characters
"-gnatyx"); -- Style: check x:no extra parens
Style_Checks_2 :=
("-gnatybfhiu", -- Style: check b:no blanks at end of lines, f:no ff/vtabs, h: no htabs, i:if-then layout, u:no unnecessary blank lines
"-gnatye", -- Style: check e:end/exit labels present
"-gnatytc", -- Style: check t:token separation rules, c:comment format (two spaces)
"-gnatwh"); -- Warnings switches (h:turn on warnings for hiding declarations)
case G3D_Styles_Checks is
when "off" => null;
when "level_1" => Common_Compiler_Options := Common_Compiler_Options & Style_Checks_1;
when "level_2" => Common_Compiler_Options := Common_Compiler_Options & Style_Checks_1 & Style_Checks_2;
end case;
Debug_Options :=
Common_Compiler_Options &
"-gnato" &
"-fstack-check" &
"-g";
case G3D_OS is
when "win32" | "win64" =>
Debug_Options := Debug_Options & "-fno-inline"
& "-gnatVcdeimoprst";
-- & "-gnatVf" -- (2016) turned off floating point validity check, seems to give false positives on a scalar product for collision detection
when others =>
Debug_Options := Debug_Options & "-gnatVa";
end case;
Fast_Options :=
Common_Compiler_Options &
("-O2",
"-gnatn",
"-gnatp",
"-funroll-loops",
"-fpeel-loops",
"-ftracer",
"-funswitch-loops",
"-fweb",
"-frename-registers");
Small_Options :=
Common_Compiler_Options &
("-Os",
"-gnatp",
"-fno-inline",
"-ffunction-sections");
Compiler_Options := ();
case G3D_Build_Mode
is
when "debug" =>
Compiler_Options := Debug_Options;
when "fast" =>
case G3D_OS
is
when "linux" =>
Compiler_Options :=
Fast_Options &
"-fomit-frame-pointer";
when "win32" | "win64" =>
Compiler_Options :=
Fast_Options &
("-fipa-cp-clone",
"-fgcse-after-reload",
"-ftree-vectorize",
"-mfpmath=sse",
"-msse3");
when others =>
Compiler_Options := Fast_Options;
end case;
when "small" =>
case G3D_OS
is
when "linux" =>
Compiler_Options :=
Small_Options & "-fdata-sections";
when others =>
Compiler_Options := Small_Options;
end case;
end case;
case G3D_OS
is
when "macosx" =>
Compiler_Options :=
Compiler_Options &
("-gnatf",
"-gnatE",
"-gnatVcfimorst",
"-gnatyhiknp");
when "linux" =>
Binder_Options :=
Binder_Options & "-static";
when others =>
null;
end case;
G3D_GNAT_Obj_Suffix := external ("G3D_Build_Mode", "debug");
for Library_Name use "globe3d";
for Library_Dir use "lib/gnat_" & G3D_GNAT_Obj_Suffix;
for Library_Ali_Dir use "lib/gnat_" & G3D_GNAT_Obj_Suffix;
for Object_Dir use "obj/gnat_" & G3D_GNAT_Obj_Suffix;
Source_Dir_List :=
("bindings",
"src",
"src/culler",
"src/gaming",
"src/gl",
"src/models",
"src/objects",
-- Here are external projects's sources:
"src/gid",
"src/unzip");
case G3D_OS is
when "win64" => for Source_Dirs use Source_Dir_List & ("bindings/win32");
when others => for Source_Dirs use Source_Dir_List & ("bindings/" & external ("G3D_OS", "win32"));
end case;
package Ide is
case G3D_OS
is
when "linux" => for Default_Switches ("adacontrol") use ("-Ftgnat_short");
when "win32" | "win64" => for Default_Switches ("adacontrol") use ("-F", "gnat_short");
when "macosx" => for Default_Switches ("adacontrol") use ();
end case;
end Ide;
package Builder is
-- "If -j0 is used, then the maximum number of simultaneous compilation
-- jobs is the number of core processors on the platform."
for Default_Switches ("ada") use ("-C", "-j0");
case G3D_Build_Mode
is
when "debug" => for Global_Configuration_Pragmas use "obj/debug.pra";
when "fast" => null;
when "small" => null;
end case;
end Builder;
package Compiler is
for Default_Switches ("ada") use Compiler_Options;
end Compiler;
package Binder is
for Default_Switches ("ada") use Binder_Options;
end Binder;
package Linker is
case G3D_OS
is
when "linux" => for Linker_Options use ("-g", "-lGL", "-lGLU", "-lglut");
when "win32" => for Linker_Options use ("-g", "-Wl,--gc-sections", "obj/libwin32/glee.o", "-lopengl32", "-lglu32", "-lfreeglut", "-Lobj/libwin32", "-Xlinker", "--stack=0x40000000,0x400000");
when "win64" => for Linker_Options use ("-g", "-Wl,--gc-sections", "obj/libwin64/glee.o", "-lopengl32", "-lglu32", "-lfreeglut", "-Lobj/libwin64", "-Xlinker", "--stack=0x40000000,0x400000");
when "macosx" => for Linker_Options use ("-g", "-bind_at_load", "-framework", "/GLUT", "-framework", "/OpenGL", "-lm");
end case;
end Linker;
end GLOBE_3D;