This was just (basically) discussed recently in thread
'Checking for OS in gnatstudio project file(.gpr)'
I replied with scnenario/environment variables does the trick
db_libs := ();
case db is
when Oracle => db_libs := db_lib1;
when Postgresql => db_libs := db_lib2;
when sqlserver => db_libs := db_lib3;
end case
then you can use db_libs and fill it up and use it like
ORACLE_HOME := external ("ORACLE_HOME", "ORACLE_HOME_not_set");
ORACLE_CLIENT := external ("ORACLE_CLIENT", "ORACLE_CLIENT_not_set");
ORA_INST := external ("ORACLE_INST", "ORACLE_INST_not_set");
LIB_SATTMATE := external ("SATTMATE_A", "SATTMATE_A_not_set");
....
there is also
Target_Machine : Environment.OS_Version_Type := Environment.Os_Version;
Compiler_Version : Environment.Compiler_Version_Type :=
Environment.Compiler_Version;
Data_Base : Environment.Database_Type := Environment.Database;
then it comes down to casing the correct combinations
case Target_Machine is
when "AIX_7.1" =>
case Database is
when "oracle_11" => db_libs :=
(SMT & "/global/sqlifc_oracle.o",
ORACLE_CLIENT & "/lib/libclntsh.a");
when "oci" => Data_Base_Libs :=
(ORACLE_CLIENT & "/lib/libclntsh.a",
SATTMATE_OCILIB & "/lib/libocilib.a");
when others => null;
end case;
Platform_Dependent_Compiler_Switches := ("-mminimal-toc") ;
Platform_Dependent_Linker_Switches := ("-L" & SMT & "/global",
LIB_SATTMATE,
"-Xlinker",
"-bhalt:5") & db_libs;
when "windows_6.2" =>
case Database is
when "oracle_11" => db_libs :=
(SMT & "/global/sqlifc_oracle.o",
ORA_INST & "/precomp/lib/oraSQL11.LIB");
when "oci" => db_libs :=
("-L" & ORACLE_CLIENT & "/bin",
"-loci",
"-L" & SATTMATE_OCILIB,
"-lociliba");
when "sqlserver" => db_libs := ("-lodbc32");
when others => null;
end case;
Platform_Dependent_Compiler_Switches := ("-gnatP");
Platform_Dependent_Linker_Switches :=
("-L" & SMT & "/global",
"-lsattmate") & db_libs;
when "linux-x64" => ....
when "linux-arm32" => ...
end case;
then use it like (the not previously shown varibles get values in other
case statemets)
package Compiler is
for Default_Switches ("Ada") use
Platform_Independent_Compiler_Switches &
Compiler_Dependent_Compiler_Switches &
Platform_Dependent_Compiler_Switches;
end Compiler;
package Linker is
for Default_Switches ("Ada") use Platform_Dependent_Linker_Switches;
end Linker;
Scenario variables are useful too to include a certain directory among
sources or not, like having common specs but os/db depedent bodies.
make directories win_x86, winx64,Linux_x64/mac/aix/whaterever and
include the correct one in Sources_dir
for Source_Dirs use common_dirs & (../win_x86);
--
Björn