diff --git a/support/langkit_support.gpr b/support/langkit_support.gpr index dc958168e..3e04553a9 100644 --- a/support/langkit_support.gpr +++ b/support/langkit_support.gpr @@ -12,6 +12,14 @@ library project Langkit_Support is Library_Kind_Param : Library_Kind_Type := external ("LIBRARY_TYPE", external ("LANGKIT_SUPPORT_LIBRARY_TYPE", "static")); + type OS_Kind is ("", "windows", "unix", "osx"); + OS : OS_Kind := External ("LANGKIT_SUPPORT_OS", ""); + + SO_Version := External ("LANGKIT_SUPPORT_SOVERSION", "1"); + + 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; @@ -70,20 +78,40 @@ library project Langkit_Support is for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode; + case Library_Kind_Param is + when "relocatable" => + case OS is + when "windows" => + for Library_Version use "lib" & project'Library_Name + & ".dll." & SO_Version; + when "osx" => + for Library_Version use "lib" & project'Library_Name + & ".dylib." & SO_Version; + when "unix" => + for Library_Version use "lib" & project'Library_Name + & ".so." & SO_Version; + when "" => + null; + 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;