|
| 1 | +with "config/canberra_ada_config"; |
| 2 | + |
1 | 3 | project Canberra_Ada is |
2 | 4 |
|
3 | 5 | for Library_Name use "canberra-ada"; |
4 | | - for Library_Version use "2.0.0"; |
| 6 | + for Library_Version use Project'Library_Name & ".so." & Canberra_Ada_Config.Crate_Version; |
5 | 7 |
|
6 | | - for Source_Dirs use ("src"); |
7 | | - for Object_Dir use "build/obj"; |
8 | 8 | for Create_Missing_Dirs use "True"; |
| 9 | + |
| 10 | + for Source_Dirs use ("src"); |
| 11 | + for Object_Dir use "build/obj/" & Canberra_Ada_Config.Build_Profile; |
9 | 12 | for Library_Dir use "build/lib"; |
10 | 13 |
|
11 | 14 | type Library_Type_Type is ("relocatable", "static", "static-pic"); |
12 | 15 | Library_Type : Library_Type_Type := |
13 | 16 | external ("CANBERRA_ADA_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static")); |
14 | 17 | for Library_Kind use Library_Type; |
15 | 18 |
|
16 | | - type Enabled_Kind is ("enabled", "disabled"); |
17 | | - Compile_Checks : Enabled_Kind := External ("CANBERRA_ADA_COMPILE_CHECKS", "enabled"); |
18 | | - Runtime_Checks : Enabled_Kind := External ("CANBERRA_ADA_RUNTIME_CHECKS", "enabled"); |
19 | | - Style_Checks : Enabled_Kind := External ("CANBERRA_ADA_STYLE_CHECKS", "enabled"); |
20 | | - Contracts_Checks : Enabled_Kind := External ("CANBERRA_ADA_CONTRACTS", "enabled"); |
21 | | - |
22 | | - type Build_Kind is ("debug", "release", "coverage", "profiling"); |
23 | | - Build_Mode : Build_Kind := External ("CANBERRA_ADA_BUILD_MODE", "release"); |
24 | | - |
25 | | - Compile_Checks_Switches := (); |
26 | | - case Compile_Checks is |
27 | | - when "enabled" => |
28 | | - Compile_Checks_Switches := |
29 | | - ("-gnatwa", -- All warnings |
30 | | - "-gnatVa", -- All validity checks |
31 | | - "-gnatf", -- Full errors |
32 | | - "-gnatwFl.l.s", |
33 | | - "-gnatwe"); -- Warnings as errors |
34 | | - when others => null; |
35 | | - end case; |
36 | | - |
37 | | - Runtime_Checks_Switches := (); |
38 | | - case Runtime_Checks is |
39 | | - when "enabled" => null; |
40 | | - when others => |
41 | | - Runtime_Checks_Switches := |
42 | | - ("-gnatp"); -- Supress checks |
43 | | - end case; |
44 | | - |
45 | | - Style_Checks_Switches := (); |
46 | | - case Style_Checks is |
47 | | - when "enabled" => |
48 | | - Style_Checks_Switches := |
49 | | - ("-gnatyg", -- GNAT Style checks |
50 | | - "-gnaty-Is", -- Disable check mode in and separate subprogram spec |
51 | | - "-gnatyM99", -- Maximum line length |
52 | | - "-gnatyA", -- Array attribute indexes |
53 | | - "-gnatyO"); -- Overriding subprograms explicitly marked as such |
54 | | - when others => null; |
55 | | - end case; |
56 | | - |
57 | | - Contracts_Switches := (); |
58 | | - case Contracts_Checks is |
59 | | - when "enabled" => |
60 | | - Contracts_Switches := |
61 | | - ("-gnata"); -- Enable assertions and contracts |
62 | | - when others => null; |
63 | | - end case; |
64 | | - |
65 | | - Build_Switches := (); |
66 | | - case Build_Mode is |
67 | | - when "release" => |
68 | | - Build_Switches := ("-O2", -- Optimization |
69 | | - "-march=native", |
70 | | - "-fomit-frame-pointer", |
71 | | - "-ffunction-sections", |
72 | | - "-gnatn"); -- Enable inlining |
73 | | - when "debug" => |
74 | | - Build_Switches := ("-g", -- Debug info |
75 | | - "-Og"); -- No optimization |
76 | | - when "coverage" => |
77 | | - Build_Switches := ("-fprofile-arcs", "-ftest-coverage"); |
78 | | - when "profiling" => |
79 | | - Build_Switches := ("-g", "-pg"); |
80 | | - end case; |
81 | | - |
82 | 19 | package Compiler is |
83 | | - for Default_Switches ("Ada") use |
84 | | - Compile_Checks_Switches & |
85 | | - Build_Switches & |
86 | | - Runtime_Checks_Switches & |
87 | | - Style_Checks_Switches & |
88 | | - Contracts_Switches & |
89 | | - ("-gnatw.X", -- Disable warnings for No_Exception_Propagation |
90 | | - "-gnatQ"); -- Don't quit. Generate ALI and tree files even if illegalities |
| 20 | + for Default_Switches ("Ada") use Canberra_Ada_Config.Ada_Compiler_Switches & ("-gnatyM99"); |
91 | 21 | for Local_Configuration_Pragmas use "gnat.adc"; |
92 | 22 | end Compiler; |
93 | 23 |
|
94 | 24 | package Binder is |
95 | 25 | for Switches ("Ada") use ("-Es"); -- Symbolic traceback |
96 | 26 | end Binder; |
97 | 27 |
|
98 | | - package Linker is |
99 | | - for Linker_Options use ("-lcanberra"); |
100 | | - end Linker; |
101 | | - |
102 | 28 | end Canberra_Ada; |
0 commit comments