@@ -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", "windows");
17
+
18
+ Soversion := External ("LANGKIT_SUPPORT_SOVERSION", "1");
19
+
20
+ Adaflags := External_As_List ("ADAFLAGS", " ");
21
+ Ldflags := 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,35 @@ library project Langkit_Support is
70
78
71
79
for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode;
72
80
81
+ So_Ext := "";
82
+ case OS is
83
+ when "windows" => So_Ext := "dll";
84
+ when "osx" => So_Ext := "dylib";
85
+ when "unix" => So_Ext := "so";
86
+ end case;
87
+
88
+ case Library_Kind_Param is
89
+ when "relocatable" =>
90
+ for Library_version use "lib" & project'Library_Name & "." & So_Ext
91
+ & "." & Soversion;
92
+ for Leading_Library_Options use Ldflags;
93
+ when "static" | "static-pic" =>
94
+ null;
95
+ end case;
96
+
73
97
Common_Ada_Cargs := ("-gnatwa", "-gnatyg", "-fPIC");
74
98
75
99
package Compiler is
100
+ Mode_Args := ();
76
101
case Build_Mode is
77
102
when "dev" =>
78
- for Default_Switches ("Ada") use
79
- Common_Ada_Cargs & ("-g", "-O0", "-gnatwe", "-gnata");
80
-
103
+ Mode_Args := ("-g", "-O0", "-gnatwe", "-gnata");
81
104
when "prod" =>
82
105
-- Debug information is useful even with optimization for
83
106
-- profiling, for instance.
84
- for Default_Switches ("Ada") use
85
- Common_Ada_Cargs & ("-g", "-Ofast");
107
+ Mode_Args := ("-g", "-Ofast");
86
108
end case;
109
+ for Default_Switches ("Ada") use Common_Ada_Cargs & Mode_Args & Adaflags;
87
110
end Compiler;
88
111
89
112
end Langkit_Support;
0 commit comments