mirror of
https://github.com/AdaCore/spawn.git
synced 2026-02-12 13:09:41 -08:00
178 lines
7.0 KiB
Plaintext
178 lines
7.0 KiB
Plaintext
------------------------------------------------------------------------------
|
|
-- Language Server Protocol --
|
|
-- --
|
|
-- Copyright (C) 2018-2021, AdaCore --
|
|
-- --
|
|
-- This is free software; you can redistribute it and/or modify it under --
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
-- sion. This software is distributed in the hope that it will be useful, --
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
|
|
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
|
|
-- License for more details. You should have received a copy of the GNU --
|
|
-- General Public License distributed with this software; see file --
|
|
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
|
|
-- of the license. --
|
|
-- --
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
|
------------------------------------------------------------------------------
|
|
|
|
library project Spawn is
|
|
|
|
type OS_API_Kind is ("unix", "osx", "Windows_NT");
|
|
OS_API : OS_API_Kind := external ("OS", "unix");
|
|
|
|
type Library_Kind is ("static", "static-pic", "relocatable");
|
|
Library_Type : Library_Kind := external ("LIBRARY_TYPE", "static");
|
|
|
|
type Spawn_Build_Kind is ("dev", "prod", "coverage", "AddressSanitizer");
|
|
Build_Mode : Spawn_Build_Kind :=
|
|
external ("SPAWN_BUILD_MODE", external ("BUILD_MODE", "prod"));
|
|
|
|
Superproject := external ("SUPERPROJECT", "");
|
|
|
|
-- By default, treat warnings as errors in dev mode, but not in prod
|
|
-- mode. Let users override this default using the SPAWN_WARN_ERRORS
|
|
-- environment variable.
|
|
|
|
type Any_Boolean is ("false", "true");
|
|
Warnings_As_Errors : Any_Boolean := external ("SPAWN_WARN_ERRORS", "true");
|
|
|
|
for Library_Kind use Library_Type;
|
|
for Object_Dir use "../.obj/" & Superproject & "/spawn/" & Library_Type;
|
|
for Library_Dir use "../.libs/" & Superproject & "/spawn/" & Library_Type;
|
|
for Library_Name use "spawn";
|
|
for Source_Dirs use ("../source/spawn");
|
|
for Languages use ("Ada", "c");
|
|
|
|
Common_Excluded := ();
|
|
|
|
case OS_API is
|
|
when "unix" =>
|
|
for Excluded_Source_Files use Common_Excluded &
|
|
("pipe2.c",
|
|
"spawn-windows_api.ads",
|
|
"spawn-processes-windows.ads",
|
|
"spawn-processes-windows.adb");
|
|
|
|
when "Windows_NT" =>
|
|
for Excluded_Source_Files use Common_Excluded &
|
|
("pipe2.c",
|
|
"posix_const.c");
|
|
|
|
when "osx" =>
|
|
for Excluded_Source_Files use Common_Excluded &
|
|
("spawn-windows_api.ads",
|
|
"spawn-processes-windows.ads",
|
|
"spawn-processes-windows.adb");
|
|
end case;
|
|
|
|
Ada_Switches := ();
|
|
Linker_Options := ();
|
|
case Warnings_As_Errors is
|
|
when "true" => Ada_Switches := Ada_Switches & ("-gnatwe");
|
|
when "false" => null;
|
|
end case;
|
|
|
|
case Build_Mode is
|
|
when "prod" =>
|
|
Ada_Switches := Ada_Switches & (
|
|
-- Compile with optimizations
|
|
"-O2",
|
|
|
|
-- Generate debug information: this is useful to get meaningful
|
|
-- tracebacks.
|
|
"-g"
|
|
);
|
|
|
|
when "dev" =>
|
|
Ada_Switches := Ada_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" =>
|
|
Ada_Switches := Ada_Switches & (
|
|
-- Compile with no optimization and with debug information to ease
|
|
-- investigation in debuggers.
|
|
"-O0", "-g",
|
|
|
|
-- Enable coverage code instrumentation.
|
|
"--coverage");
|
|
|
|
Linker_Options := Linker_Options & ("--coverage");
|
|
|
|
when "AddressSanitizer" =>
|
|
Ada_Switches := Ada_Switches & (
|
|
-- Standard development flags
|
|
"-O0", "-g",
|
|
-- Enable the AddressSanitizer
|
|
"-fsanitize=address");
|
|
|
|
Linker_Options := Linker_Options & ("-fsanitize=address");
|
|
end case;
|
|
|
|
package Compiler is
|
|
for Switches ("ada") use Ada_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.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.Processes")
|
|
use "spawn-processes__posix.adb";
|
|
for Body ("Spawn.Environments.Search_In_Path")
|
|
use "spawn-environments-search_in_path__posix.adb";
|
|
for Body ("Spawn.Processes.Monitor")
|
|
use "spawn-processes-monitor__posix.adb";
|
|
for Body ("Spawn.Processes.Monitor.Initialize")
|
|
use "spawn-processes-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.Processes")
|
|
use "spawn-processes__windows.adb";
|
|
for Body ("Spawn.Environments.Search_In_Path")
|
|
use "spawn-environments-search_in_path__windows.adb";
|
|
for Body ("Spawn.Processes.Monitor")
|
|
use "spawn-processes-monitor__windows.adb";
|
|
end case;
|
|
end Naming;
|
|
|
|
end Spawn;
|