@@ -12,6 +12,14 @@ library project Langkit_Support is
1212 Library_Kind_Param : Library_Kind_Type := external
1313 ("LIBRARY_TYPE", external ("LANGKIT_SUPPORT_LIBRARY_TYPE", "static"));
1414
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+
1523 for Languages use ("Ada");
1624 for Source_Dirs use (".");
1725 for Object_Dir use "obj/" & Build_Mode;
@@ -70,20 +78,40 @@ library project Langkit_Support is
7078
7179 for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode;
7280
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+
73101 Common_Ada_Cargs := ("-gnatwa", "-gnatyg", "-fPIC");
74102
75103 package Compiler is
104+ Mode_Args := ();
76105 case Build_Mode is
77106 when "dev" =>
78- for Default_Switches ("Ada") use
79- Common_Ada_Cargs & ("-g", "-O0", "-gnatwe", "-gnata");
80-
107+ Mode_Args := ("-g", "-O0", "-gnatwe", "-gnata");
81108 when "prod" =>
82109 -- Debug information is useful even with optimization for
83110 -- profiling, for instance.
84- for Default_Switches ("Ada") use
85- Common_Ada_Cargs & ("-g", "-Ofast");
111+ Mode_Args := ("-g", "-Ofast");
86112 end case;
113+ for Default_Switches ("Ada") use Common_Ada_Cargs & Mode_Args
114+ & Ada_Flags;
87115 end Compiler;
88116
89117end Langkit_Support;
0 commit comments