Skip to content

Commit

Permalink
support: allow override of ADAFLAGS, LDFLAGS, library soversion
Browse files Browse the repository at this point in the history
  • Loading branch information
asarhaddon committed Apr 3, 2022
1 parent 4b25d1f commit 07749ab
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions support/langkit_support.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ library project Langkit_Support is
Library_Kind_Param : Library_Kind_Type := external
("LIBRARY_TYPE", external ("LANGKIT_SUPPORT_LIBRARY_TYPE", "static"));

SO_Name := External ("LANGKIT_SONAME", "");

Ada_Flags := External_As_List ("ADAFLAGS", " ");
Ld_Flags := External_As_List ("LDFLAGS", " ");

for Languages use ("Ada");
for Source_Dirs use (".");
for Object_Dir use "obj/" & Build_Mode;
Expand Down Expand Up @@ -65,20 +70,33 @@ library project Langkit_Support is

for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode;

case Library_Kind_Param is
when "relocatable" =>
case SO_Name is
when "" =>
null;
when others =>
for Library_Version use SO_Name;
end case;
for Leading_Library_Options use Ld_Flags;
when "static" | "static-pic" =>
null;
end case;

Common_Ada_Cargs := ("-gnatwa", "-gnatyg", "-fPIC");

package Compiler is
Mode_Args := ();
case Build_Mode is
when "dev" =>
for Default_Switches ("Ada") use
Common_Ada_Cargs & ("-g", "-O0", "-gnatwe", "-gnata");

Mode_Args := ("-g", "-O0", "-gnatwe", "-gnata");
when "prod" =>
-- Debug information is useful even with optimization for
-- profiling, for instance.
for Default_Switches ("Ada") use
Common_Ada_Cargs & ("-g", "-Ofast");
Mode_Args := ("-g", "-Ofast");
end case;
for Default_Switches ("Ada") use Common_Ada_Cargs & Mode_Args
& Ada_Flags;
end Compiler;

end Langkit_Support;

0 comments on commit 07749ab

Please sign in to comment.