Files
spawn/gnat/spawn_glib.gpr
2026-01-26 15:15:10 +04:00

154 lines
5.1 KiB
Plaintext

--
-- Copyright (C) 2018-2026, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0
--
with "gtkada";
with "../config/spawn_config.gpr";
library project Spawn_Glib is
type OS_API_Kind is ("unix", "osx", "Windows_NT");
OS_API : OS_API_Kind := external ("SPAWN_OS", external ("OS", "unix"));
type Library_Kind is ("static", "static-pic", "relocatable");
Library_Type : Library_Kind :=
external ("SPAWN_GLIB_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static"));
type Spawn_Glib_Build_Kind is ("dev", "prod", "coverage");
Build_Mode : Spawn_Glib_Build_Kind :=
external ("SPAWN_GLIB_BUILD_MODE", external ("BUILD_MODE", "prod"));
for Languages use ("Ada", "c");
for Library_Kind use Library_Type;
for Library_Name use "spawn_glib";
for Run_Path_Option use ();
for Object_Dir use "../.obj/spawn_glib/" & Library_Type;
for Library_Dir use "../.libs/spawn_glib/" & Library_Type;
for Source_Dirs use ("../source/spawn");
case Library_Type is
when "relocatable" =>
for Library_Options use ("-lglib-2.0");
when others =>
null;
end case;
Common_Excluded :=
("spawn-internal-monitor.ads",
"spawn-processes-monitor_loop.ads",
"spawn-processes-monitor_loop.adb");
case OS_API is
when "unix" | "osx" =>
for Excluded_Source_Files use Common_Excluded &
("spawn-windows_api.ads",
"spawn-windows_api.adb",
"spawn-internal-windows.ads",
"spawn-internal-windows.adb");
when "Windows_NT" =>
for Excluded_Source_Files use Common_Excluded &
("spawn-channels__glib_posix.ads",
"spawn-channels__glib_posix.adb",
"spawn-polls-posix_polls.ads",
"spawn-polls-posix_polls.adb",
"pipe2.c",
"posix_const.c");
end case;
Spawn_Ada_Compiler_Switches := ();
Coverage_Ada_Compiler_Switches := ();
Linker_Options := ();
case Build_Mode is
when "prod" =>
Spawn_Ada_Compiler_Switches := Spawn_Ada_Compiler_Switches & (
-- Compile with optimizations
"-O2",
-- Generate debug information: this is useful to get meaningful
-- tracebacks.
"-g"
);
when "dev" =>
Spawn_Ada_Compiler_Switches := Spawn_Ada_Compiler_Switches & (
-- Compile with no optimization and with debug information to ease
-- investigation in debuggers.
"-O0", "-g",
-- Enable all warnings and GNAT stylechecks (plus O: check for
-- overriding indicators).
"-gnatwa", "-gnatygO",
-- Enable assertions and all validity checking options
"-gnata", "-gnatVa",
-- Enable stack overflow checks
"-fstack-check"
);
when "coverage" =>
Spawn_Ada_Compiler_Switches := Spawn_Ada_Compiler_Switches & ();
Coverage_Ada_Compiler_Switches := (
-- Enable coverage code instrumentation.
"--coverage");
Linker_Options := Linker_Options & ("--coverage");
end case;
Ada_Compiler_Switches :=
Spawn_Config.Ada_Compiler_Switches
& Spawn_Ada_Compiler_Switches
& Coverage_Ada_Compiler_Switches;
package Compiler is
for Switches ("ada") use Spawn_Ada_Compiler_Switches;
end Compiler;
package Linker is
for Linker_Options use Linker_Options;
end Linker;
package Naming is
case OS_API is
when "unix" | "osx" =>
for Spec ("Spawn.Channels")
use "spawn-channels__glib_posix.ads";
for Body ("Spawn.Channels")
use "spawn-channels__glib_posix.adb";
for Spec ("Spawn.Internal")
use "spawn-internal__glib_posix.ads";
for Body ("Spawn.Internal")
use "spawn-internal__glib_posix.adb";
for Body ("Spawn.Environments.Initialize_Default")
use "spawn-environments-initialize_default__glib.adb";
for Spec ("Spawn.Environments.Internal")
use "spawn-environments-internal__glib.ads";
for Body ("Spawn.Environments.Internal")
use "spawn-environments-internal__glib.adb";
for Body ("Spawn.Environments.Search_In_Path")
use "spawn-environments-search_in_path__posix.adb";
when "Windows_NT" =>
for Spec ("Spawn.Internal")
use "spawn-internal__glib_windows.ads";
for Body ("Spawn.Internal")
use "spawn-internal__glib_windows.adb";
for Body ("Spawn.Environments.Initialize_Default")
use "spawn-environments-initialize_default__windows.adb";
for Spec ("Spawn.Environments.Internal")
use "spawn-environments-internal__windows.ads";
for Body ("Spawn.Environments.Internal")
use "spawn-environments-internal__windows.adb";
for Body ("Spawn.Environments.Search_In_Path")
use "spawn-environments-search_in_path__windows.adb";
end case;
end Naming;
end Spawn_Glib;