@@ -12,6 +12,14 @@ library project Langkit_Support is
12
12
Library_Kind_Param : Library_Kind_Type := external
13
13
("LIBRARY_TYPE", external ("LANGKIT_SUPPORT_LIBRARY_TYPE", "static"));
14
14
15
+ type OS_Kind is ("", "windows", "unix", "osx");
16
+ OS : OS_Kind := External ("LANGKIT_SUPPORT_OS", "");
17
+
18
+ SO_Version := External ("LANGKIT_SUPPORT_SOVERSION", "1");
19
+
20
+ Ada_Flags := External_As_List ("ADAFLAGS", " ");
21
+ Ld_Flags := External_As_List ("LDFLAGS", " ");
22
+
15
23
for Languages use ("Ada");
16
24
for Source_Dirs use (".");
17
25
for Object_Dir use "obj/" & Build_Mode;
@@ -70,20 +78,40 @@ library project Langkit_Support is
70
78
71
79
for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode;
72
80
81
+ case Library_Kind_Param is
82
+ when "relocatable" =>
83
+ case OS is
84
+ when "windows" =>
85
+ for Library_Version use "lib" & project'Library_Name
86
+ & ".dll." & SO_Version;
87
+ when "osx" =>
88
+ for Library_Version use "lib" & project'Library_Name
89
+ & ".dylib." & SO_Version;
90
+ when "unix" =>
91
+ for Library_Version use "lib" & project'Library_Name
92
+ & ".so." & SO_Version;
93
+ when "" =>
94
+ null;
95
+ end case;
96
+ for Leading_Library_Options use Ld_Flags;
97
+ when "static" | "static-pic" =>
98
+ null;
99
+ end case;
100
+
73
101
Common_Ada_Cargs := ("-gnatwa", "-gnatyg", "-fPIC");
74
102
75
103
package Compiler is
104
+ Mode_Args := ();
76
105
case Build_Mode is
77
106
when "dev" =>
78
- for Default_Switches ("Ada") use
79
- Common_Ada_Cargs & ("-g", "-O0", "-gnatwe", "-gnata");
80
-
107
+ Mode_Args := ("-g", "-O0", "-gnatwe", "-gnata");
81
108
when "prod" =>
82
109
-- Debug information is useful even with optimization for
83
110
-- profiling, for instance.
84
- for Default_Switches ("Ada") use
85
- Common_Ada_Cargs & ("-g", "-Ofast");
111
+ Mode_Args := ("-g", "-Ofast");
86
112
end case;
113
+ for Default_Switches ("Ada") use Common_Ada_Cargs & Mode_Args
114
+ & Ada_Flags;
87
115
end Compiler;
88
116
89
117
end Langkit_Support;
0 commit comments