summarylogtreecommitdiffstats
path: root/vulkada.gpr
blob: a5d046398c5117d6f032a9bc653e88a9913f07f8 (plain)
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
project VulkAda
is
   ----------------------
   -- Scenario variables.
   --

   type Os_Type         is ("Windows_NT", "Linux",  "MacOSX");
   type Restrictions    is ("xgc",        "ravenscar");
   type Build_Mode_Type is ("debug",      "fast",    "small");

   OS           : Os_Type         := external ("OS",           "Linux");
   Restrictions : Restrictions    := external ("restrictions", "xgc");
   Build_Mode   : Build_Mode_Type := external ("Build_Mode",   "debug");



   --------------
   -- Directories
   --
   
   for Library_Name use "VulkAda";
   for Library_Dir  use "lib";
   for Object_Dir   use "build";

   for Source_Dirs  use ("vulkada");



   ---------------------------
   -- Declare various options.
   --

   Binder_Options := ();

   Style_Options  := ("-gnatyk",      --  Check casings: a:attribute, k:keywords, n:package Standard identifiers, p:pragma, r:identifier references.
                      "-gnatybfhi",   --  Check b:no blanks at end of lines, f:no ff/vtabs, h: no htabs, i:if-then layout, u:no unnecessary blank lines.
                      "-gnatyO",      --  Check that overriding subprograms are explicitly marked as such.
                      "-gnatye",      --  Check that labels on end statements (ending subprograms), and on exit statements (exiting named loops), are present.
                      "-gnatyx");     --  Check x:no extra parens.

   Compiler_Options :=   ("-gnat2022",
                          "-gnatwa",
                          "-gnatwU",  -- Suppress 'Unreferenced' warnings (temp way to stop flood of these warnings).
                          "-fno-strict-aliasing")
                        & Style_Options;

   Fast_Options := ("-g",
                    "-O3", 
                    "-gnatn2",
                    "-gnatp",
                    "-funroll-loops",
                    "-fpeel-loops",
                    "-ftracer",
                    "-funswitch-loops",
                    "-fweb",
                    "-frename-registers"); 

   Small_Options := ("-Os",
                     "-gnatp",
                     "-fno-inline",
                     "-march=i386",
                     "-ffunction-sections",
                     "-falign-jumps=0",
                     "-falign-loops=0",
                     "-falign-functions=0",
                     "-mpreferred-stack-boundary=2");


   ----------------------------------------------
   -- Modify options to cater for the build mode.
   --
   
   case Build_Mode 
   is
      when "debug" =>
         Binder_Options   := Binder_Options   & "-Es";
         Compiler_Options := Compiler_Options & "-O0"
                                              & "-gnata"
                                              & "-gnato"
                                              & "-gnateE"                -- Extra debug info in 'constraint_Error' messages.
                                              & "-fstack-check"
                                              & "-g";
         case OS
         is
            when "Linux"  =>
               Compiler_Options := Compiler_Options & "-gnatVa";

            when "Windows_NT"  =>
               Compiler_Options := Compiler_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 "MacOSX" =>
               null;
         end case;

      when "fast" =>
         case OS
         is
            when "Linux"  =>
               Compiler_Options := Compiler_Options & Fast_Options 
                                                    & "-fomit-frame-pointer";
            when "Windows_NT"  =>
               Compiler_Options := Compiler_Options & Fast_Options
                                                    & "-fipa-cp-clone"
                                                    & "-fgcse-after-reload" 
                                                    & "-ftree-vectorize"
                                                    & "-mfpmath=sse"
                                                    & "-msse3";
            when "MacOSX" =>
               null;
         end case;

      when "small" =>
         case OS
         is
            when "Linux"  =>
               Compiler_Options := Compiler_Options & Small_Options 
                                                    & "-fdata-sections";
            when "Windows_NT"  =>
               Compiler_Options := Compiler_Options & Small_Options;

            when "MacOSX" =>
               null;
         end case;
   end case;


   ----------------------------------------------------
   -- Modify options to cater for the operating system.
   --
   
   case OS
   is
      when "MacOSX" =>
         Compiler_Options := Compiler_Options & "-gnatf" 
                                              & "-gnatE" 
                                              & "-gnatVcfimorst"
                                              & "-gnatyhiknp";
      when "Linux" =>
         Binder_Options   := Binder_Options   & "-static";

      when "Windows_NT" =>
         null;
   end case;


   -----------------------
   -- Define the packages.
   --

   package Ide is
      case OS
      is
         when "Linux"      => for Default_Switches ("adacontrol") use ("-Ftgnat_short");
         when "Windows_NT" => for Default_Switches ("adacontrol") use ("-F", "gnat_short");
         when "MacOSX"     => for Default_Switches ("adacontrol") use ();
      end case;
   end Ide;


   package Builder is
      for Default_Switches ("ada") use ("-C", "-j0");

      case Build_Mode 
      is
         when "debug" => for Global_Configuration_Pragmas use "debug.pra";
                         for Default_Switches ("ada") use ("-C", "-j0");
         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;

end VulkAda;