forked from alire-project/alire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alire_common.gpr
138 lines (115 loc) · 4.78 KB
/
alire_common.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
abstract project Alire_Common is
for Create_Missing_Dirs use "True";
type Host_OSes is ("linux",
"freebsd",
"macos",
"windows");
Host_OS : Host_OSes := external ("ALIRE_OS");
-- Set by user or in alire.toml
type Any_Build_Mode is ("debug", "release");
Build_Mode : Any_Build_Mode := external ("ALIRE_BUILD_MODE", "debug");
-- Profile for the build, depending on the use case. Debug favors
-- debuggability (for developper convenience) while release favors
-- optimizations.
type Any_Style_Check_Mode is ("enabled", "disabled");
Style_Check_Mode : Any_Style_Check_Mode :=
external ("ALIRE_STYLE_CHECK_MODE", "enabled");
Style_Check_Switches := ();
case Style_Check_Mode is
when "enabled" => Style_Check_Switches :=
( "-gnatwe" -- Warnings as errors
,"-gnaty3" -- Specify indentation level of 3
,"-gnatya" -- Check attribute casing
,"-gnatyA" -- Use of array index numbers in array attributes
,"-gnatyB" -- Check Boolean operators
,"-gnatyb" -- Blanks not allowed at statement end
,"-gnatyc" -- Check comments
,"-gnatye" -- Check end/exit labels
,"-gnatyf" -- No form feeds or vertical tabs
,"-gnatyh" -- No horizontal tabs
,"-gnatyi" -- Check if-then layout
,"-gnatyI" -- check mode IN keywords
,"-gnatyk" -- Check keyword casing
,"-gnatyl" -- Check layout
,"-gnatym" -- Check maximum line length
,"-gnatyn" -- Check casing of entities in Standard
,"-gnatyO" -- Check all overriding subprograms explicitly marked
,"-gnatyp" -- Check pragma casing
,"-gnatyr" -- Check identifier references casing
,"-gnatyS" -- Check no statements after THEN/ELSE
,"-gnatyt" -- Check token spacing
,"-gnatyu" -- Check unnecessary blank lines
,"-gnatyx" -- Check extra parentheses
);
when "disabled" => Style_Check_Switches := ();
end case;
type Any_Experimental_Ada_Features is ("enabled", "disabled");
Experimental_Ada_Features : Any_Experimental_Ada_Features :=
external ("ALIRE_EXPERIMENTAL_ADA_FEATURES", "disabled");
-- These should only be enabled temporarily to help with debugging.
-- Production builds are always checked with these disabled.
Experimental_Ada_Switches := ();
case Experimental_Ada_Features is
when "enabled" => Experimental_Ada_Switches :=
("-gnat2022",
"-gnatx",
"-gnatwJ" -- Disable warnings about obsolescent "()"
);
when "disabled" => Experimental_Ada_Switches := ();
end case;
Ada_Common_Switches :=
( "-gnatW8" -- use UTF-8 Encoding for Source Files
, "-s" -- Recompile if compiler Switches Have Changed
);
package Compiler is
case Build_Mode is
when "debug" =>
for Default_Switches ("Ada") use Ada_Common_Switches &
(
-- Build with no optimization in debug mode
"-g", "-O0",
-- Enable lots of extra runtime checks
"-gnatVa", "-gnato", "-fstack-check", "-gnata",
-- Enable full errors, verbose details
"-gnatf",
-- Report Elaboration Circularity Details
"-gnatd_F",
-- Enable all warnings
"-gnatwa")
& Style_Check_Switches
& Experimental_Ada_Switches;
for Default_Switches ("C") use ("-g", "-O0", "-Wall");
-- Likewise for C units
when "release" =>
for Default_Switches ("Ada") use Ada_Common_Switches &
(
-- Build with lots of optimizations. Generate debug info
-- (useful for tracebacks).
"-O2", "-g",
-- Generate position-independent code
"-fPIC",
-- Enable lots of extra runtime checks
"-gnatVa", "-gnatwa", "-gnato", "-fstack-check", "-gnata",
"-gnatf", "-fPIC")
& Style_Check_Switches;
for Default_Switches ("C") use ("-g", "-O2", "-Wall", "-fPIC");
-- Likewise for C units
end case;
end Compiler;
package Builder is
for Switches ("Ada") use
("-s", -- Recompile if switches changed
"-j0" -- Full parallelism
);
end Builder;
package Binder is
for Switches ("Ada") use
("-Es", -- Symbolic tracebacks
"-g", -- Keep binder generated files (for debugging?)
"-static" -- Static linking
);
end Binder;
package Ide is
for Vcs_Kind use "Git";
end Ide;
end Alire_Common;