235 lines (191 with data), 7.7 kB
-- This is a GNAT, GCC or GNAT Programming Studio (GPS) project file
-- for the GLOBE_3D project.
--
-- Home page: https://globe3d.sourceforge.io/
-- Project page 1: https://github.com/zertovitch/globe-3d
-- Project page 2: https://sourceforge.net/projects/globe3d/
-- Alire crate: https://alire.ada.dev/crates/globe_3d
--
-- Build me with "gnatmake -P globe_3d_project_tree", "gprbuild -P globe_3d_project_tree",
-- or open me with GNAT Studio.
--
-- This variant is a hierarchical project, which refers to other projects.
-- It is used by the Alire crate for GLOBE_3D.
--
-- See "globe_3d.gpr" for the other variant (single, "flat", project file) for
-- the GLOBE_3D project, with all sources in subdirectories (standalone project).
with "GID";
with "ZipAda";
project GLOBE_3D_Project_Tree 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_Extra_Warnings_Type is
("level_0",
"level_1");
G3D_Extra_Warnings : G3D_Extra_Warnings_Type := external ("G3D_Extra_Warnings", "level_0");
type G3D_Styles_Checks_Type is
("off",
"level_1",
"level_2",
"level_3");
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");
Extra_Warnings_1 :=
("-gnatwh"); -- Warnings switches (h:turn on warnings for hiding declarations)
case G3D_Extra_Warnings is
when "level_0" => null;
when "level_1" => Common_Compiler_Options := Common_Compiler_Options & Extra_Warnings_1;
end case;
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
"-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)
Style_Checks_3 :=
("-gnatyM120"); -- Style: check line length <= 100 characters
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;
when "level_3" => Common_Compiler_Options := Common_Compiler_Options & Style_Checks_1 & Style_Checks_2 & Style_Checks_3;
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/gaming",
"src/gl",
"src/models");
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_Project_Tree;