Files
spawn/gnat/spawn.gpr

167 lines
5.7 KiB
Plaintext
Raw Permalink Normal View History

2022-06-21 11:30:33 +03:00
--
2026-01-26 15:15:10 +04:00
-- Copyright (C) 2018-2026, AdaCore
2022-06-21 11:30:33 +03:00
--
-- SPDX-License-Identifier: Apache-2.0
--
2023-05-12 18:10:58 +03:00
with "../config/spawn_config.gpr";
library project Spawn is
2019-01-09 19:00:53 +02:00
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_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static"));
2021-08-26 06:51:04 +00:00
type Spawn_Build_Kind is ("dev", "prod", "coverage", "AddressSanitizer");
Build_Mode : Spawn_Build_Kind :=
external ("SPAWN_BUILD_MODE", external ("BUILD_MODE", "prod"));
2021-04-08 15:29:53 +03:00
Superproject := external ("SUPERPROJECT", "");
2019-01-09 19:00:53 +02:00
for Languages use ("Ada", "c");
2026-01-26 15:15:10 +04:00
for Library_Kind use Library_Type;
for Library_Name use "spawn";
for Run_Path_Option use ();
for Object_Dir use "../.obj/" & Superproject & "/spawn/" & Library_Type;
for Library_Dir use "../.libs/" & Superproject & "/spawn/" & Library_Type;
for Source_Dirs use ("../source/spawn");
Common_Excluded :=
("spawn-channels__glib_posix.ads", "spawn-channels__glib_posix.adb");
2018-11-26 18:13:26 +02:00
case OS_API is
2019-01-09 19:00:53 +02:00
when "unix" =>
2018-11-26 18:13:26 +02:00
for Excluded_Source_Files use Common_Excluded &
2019-01-09 19:00:53 +02:00
("pipe2.c",
"spawn-windows_api.ads",
"spawn-windows_api.adb",
"spawn-internal-windows.ads",
"spawn-internal-windows.adb");
2018-11-26 18:13:26 +02:00
when "Windows_NT" =>
for Excluded_Source_Files use Common_Excluded &
("pipe2.c",
"posix_const.c",
"spawn-polls-posix_polls.ads",
"spawn-polls-posix_polls.adb");
when "osx" =>
for Excluded_Source_Files use Common_Excluded &
("spawn-windows_api.ads",
2023-04-28 19:10:43 +03:00
"spawn-windows_api.adb",
"spawn-internal-windows.ads",
"spawn-internal-windows.adb");
2018-11-26 18:13:26 +02:00
end case;
2023-05-12 18:10:58 +03:00
Spawn_Ada_Compiler_Switches := ();
Coverage_Ada_Compiler_Switches := ();
Linker_Options := ();
case Build_Mode is
when "prod" =>
2023-05-12 18:10:58 +03:00
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" =>
2023-05-12 18:10:58 +03:00
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" =>
2023-05-12 18:10:58 +03:00
Spawn_Ada_Compiler_Switches := Spawn_Ada_Compiler_Switches & ();
Coverage_Ada_Compiler_Switches := (
-- Enable coverage code instrumentation.
"--coverage");
Linker_Options := Linker_Options & ("--coverage");
2021-08-26 06:51:04 +00:00
when "AddressSanitizer" =>
2023-05-12 18:10:58 +03:00
Spawn_Ada_Compiler_Switches := Spawn_Ada_Compiler_Switches & (
2021-08-26 06:51:04 +00:00
-- Standard development flags
"-O0", "-g",
-- Enable the AddressSanitizer
"-fsanitize=address");
Linker_Options := Linker_Options & ("-fsanitize=address");
end case;
2023-05-12 18:10:58 +03:00
Ada_Compiler_Switches :=
Spawn_Config.Ada_Compiler_Switches
& Spawn_Ada_Compiler_Switches
& Coverage_Ada_Compiler_Switches;
package Compiler is
2023-05-12 18:10:58 +03:00
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
2019-01-09 19:00:53 +02:00
when "unix" | "osx" =>
for Spec ("Spawn.Channels")
use "spawn-channels__posix.ads";
for Body ("Spawn.Channels")
use "spawn-channels__posix.adb";
for Spec ("Spawn.Internal")
use "spawn-internal__posix.ads";
for Body ("Spawn.Internal")
use "spawn-internal__posix.adb";
for Body ("Spawn.Environments.Initialize_Default")
use "spawn-environments-initialize_default__posix.adb";
for Spec ("Spawn.Environments.Internal")
use "spawn-environments-internal__posix.ads";
for Body ("Spawn.Environments.Internal")
use "spawn-environments-internal__posix.adb";
for Body ("Spawn.Environments.Search_In_Path")
use "spawn-environments-search_in_path__posix.adb";
for Body ("Spawn.Internal.Monitor")
use "spawn-internal-monitor__posix.adb";
for Body ("Spawn.Internal.Monitor.Initialize")
use "spawn-internal-monitor-" & OS_API & "_initialize.adb";
when "Windows_NT" =>
for Spec ("Spawn.Internal")
use "spawn-internal__windows.ads";
for Body ("Spawn.Internal")
use "spawn-internal__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";
for Body ("Spawn.Internal.Monitor")
use "spawn-internal-monitor__windows.adb";
end case;
end Naming;
2021-04-08 15:29:53 +03:00
end Spawn;