-
Notifications
You must be signed in to change notification settings - Fork 0
/
adatyper.gpr
264 lines (216 loc) · 9.49 KB
/
adatyper.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
-------------------------------------------------------------------------------
-- --
-- A D A T Y P E R . G P R --
-- --
-- A D A T Y P E R --
-- --
-- G P R --
-- --
-------------------------------------------------------------------------------
-- Copyright (c) 2020-2022 José Antonio Verde Jiménez All Rights Reserved --
-------------------------------------------------------------------------------
-- This file is part of adatyper. --
-- --
-- This program is free software: you can redistribute it and/or modify it --
-- under the terms of the GNU General License as published by the Free --
-- Software Foundation, either version 3 of the License, or (at your --
-- opinion) any later version. --
-- --
-- This program is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License along --
-- with this program. If not, see <https://www.gnu.org/licenses/>. --
-- --
-------------------------------------------------------------------------------
with "../Malef/Malef/malef.gpr";
-- This file is inspired by the alire gpr file template.
project AdaTyper is
--------------
-- EXTERNAL --
--------------
-- These are variables set by the user.
type OS_Kind is ("linux", "windows");
Operating_System : Os_Kind := External ("ADATYPER_OPERATING_SYSTEM",
"linux");
type Enabled_Kind is ("enabled", "disabled");
Compile_Checks : Enabled_Kind := External ("ADATYPER_COMPILE_CHECKS",
"enabled");
Runtime_Checks : Enabled_Kind := External ("ADATYPER_RUNTIME_CHECKS",
"disabled");
Style_Checks : Enabled_Kind := External ("ADATYPER_STYLE_CHECKS",
"enabled");
Contracts_Checks : Enabled_Kind := External ("ADATYPER_CONTRACTS",
"enabled");
type Build_Kind is ("debug", "optimize");
Build_Mode : Build_Kind := External ("ADATYPER_BUILD_MODE", "debug");
type On_Off_Kind is ("on", "off");
Alire_Built : On_Off_Kind := External ("ADATYPER_ALIRE_BUILT",
"off");
-------------
-- PROJECT --
-------------
-- The game is fully written in Ada as oposed in previous version where it
-- had some parts in C for Windows compatibility. As it now uses Malef there
-- is no need for that.
for Languages use ("Ada");
-- The source dir is unique for all the operating systems.
for Source_Dirs use ("src");
-- For alire compatibility
Prefix := "";
case Alire_Built is
when "on" => Prefix := "";
when others => Prefix := "alire/build/";
end case;
-- The object directory where all the objects, ali and temporary files will
-- be stored.
for Object_Dir use Prefix & "obj-" & Operating_System;
-- The directory where the executable will be found.
for Exec_Dir use Prefix & "bin";
-- The files that will be converted into executables.
for Main use ("main.adb");
-- This tells gprbuild to build missing directories.
for Create_Missing_Dirs use "True";
--------------
-- SWITCHES --
--------------
-- Depending on the options we select some switches.
Compile_Checks_Switches := ();
case Compile_Checks is
when "enabled" =>
Compile_Checks_Switches :=
("-gnatwa", -- All warnings
"-gnatwM", -- Remove the warning for assigned but not used
-- because many functions return things that aren't
-- needed at all.
"-gnatVa", -- All validity checks
"-gnatwe"); -- All warnings as errors
when others =>
null;
end case;
Runtime_Checks_Switches := ();
case Runtime_Checks is
when "enabled" =>
null;
when others =>
Runtime_Checks_Switches :=
("-gnatp"); -- Suppress checks
end case;
Style_Checks_Switches := ();
case Style_Checks is
when "enabled" =>
-- TODO: Fill this.
Style_Checks_Switches :=
("-gnaty3" & -- Check indentation
"a" & -- Check attribute casing
"");
-- ("-gnatyg", -- GNAT Style Checks
-- "-gnaty-d", -- Disable no DOS line terminators
-- "-gnatyM79", -- Maximum line length
-- "-gnatyO"); -- Overriding subprograms explicitly marked as such
when others =>
null;
end case;
Contracts_Switches := ();
case Contracts_Checks is
when "enabled" =>
Contracts_Switches :=
("-gnata"); -- Enable assertions and contracts
when others =>
null;
end case;
Build_Switches := ();
case Build_Mode is
when "optimize" =>
Build_Switches :=
("-O3", -- Optimization
"-gnatn"); -- Enable inlining
when "debug" =>
Build_Switches :=
("-g", -- Debug info
"-Og", -- No optimizations
"-gnatv", -- Verbose mode. Full error output with source lines
-- to stdout.
"-gnatf", -- Full errors. Verbose details, all undefined
-- references.
"-gnatd7"); -- Suppress timestamps.
end case;
--------------
-- PACKAGES --
--------------
-- Finally we wrap everything up and apply the changes.
package Builder is
-- We change the name of the main executable.
for Executable ("main.adb") use "adatyper";
end Builder;
package Compiler is
for Switches ("Ada") use
Compile_Checks_Switches &
Build_Switches &
Runtime_Checks_Switches &
Style_Checks_Switches &
Contracts_Switches &
("-gnatQ"); -- Don't quit. Generate ALI and tree files even if there
-- are illegalities.
end Compiler;
package Linker is
for Switches ("Ada") use
("-Wl,--gc-sections"); -- Remove unused sections
end Linker;
package Binder is
for Switches ("Ada") use ("-Es"); -- Symbolic traceback.
end Binder;
package Documentation is
-- To build the documentation:
-- `gnatdoc -bplwPadatyper --enable-build'
for Documentation_Dir use Prefix & "docs";
end Documentation;
package Naming is
-- The file names are in lower case.
for Casing use "lowercase";
-- This tells to replace the dashes `-' in names with dots when using dot
-- notation, e.g:
-- parent-child.adb -> Parent.Child
for Dot_Replacement use "-";
-- The specification files' extension is `.ads'.
for Spec_Suffix ("Ada") use ".ads";
-- The implementation files' extension is `.adb'.
for Body_Suffix ("Ada") use ".adb";
-- The suffix for separate units (subunits).
for Separate_Suffix use ".separate.adb";
end Naming;
package Installer is
-- The artifacts are a set of files that are required to be installed but
-- doesn't belong to the source files, like data files.
-- for Artifatcs use ("");
-- These are the same as the Artifacts, but when one of them is missing,
-- instead of displaying a warning and error is reported.
-- for Required_Artifacts use ("");
-- The place of the executable.
for Exec_Subdir use "bin";
-- The mode of installation.
case Build_Mode is
when "debug" =>
for Mode use "dev";
when others =>
for Mode use "usage";
end case;
-- The installation name.
for Install_Name use "adatyper";
-- This is the default installation directory.
for Prefix use ("alire/opt");
-- Another option that isn't in this package and must be passed by the
-- user to `gprinstall' is:
--
-- * Prefix (--prefix): The aboslute/relative path where the files
-- will be installed.
--
-- Check `gprinstall --help' for more information. This is not required,
-- though.
end Installer;
end AdaTyper;
---=======================-------------------------=========================---
--=======================-- E N D O F F I L E --=========================--
---=======================-------------------------=========================---