diff --git a/support/langkit_support.gpr b/support/langkit_support.gpr index dc958168e..0495aebd5 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", "windows"); + + Soversion := External ("LANGKIT_SUPPORT_SOVERSION", "1"); + + Adaflags := External_As_List ("ADAFLAGS", " "); + Ldflags := External_As_List ("LDFLAGS", " "); + for Languages use ("Ada"); for Source_Dirs use ("."); for Object_Dir use "obj/" & Build_Mode; @@ -70,20 +78,35 @@ library project Langkit_Support is for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode; + So_Ext := ""; + case OS is + when "windows" => So_Ext := "dll"; + when "osx" => So_Ext := "dylib"; + when "unix" => So_Ext := "so"; + end case; + + case Library_Kind_Param is + when "relocatable" => + for Library_version use "lib" & project'Library_Name & "." & So_Ext + & "." & Soversion; + for Leading_Library_Options use Ldflags; + 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 & Adaflags; end Compiler; end Langkit_Support;