From b1d14f484cf40d20137e66eb9ade6388cf61f661 Mon Sep 17 00:00:00 2001 From: Paul Jarrett Date: Fri, 8 Mar 2024 00:05:06 -0500 Subject: [PATCH] Update septum to use alire build profiles. --- alire.toml | 19 +++++++++++ septum.gpr | 94 +++++++----------------------------------------------- 2 files changed, 30 insertions(+), 83 deletions(-) diff --git a/alire.toml b/alire.toml index 76c1613..5c1a973 100644 --- a/alire.toml +++ b/alire.toml @@ -16,6 +16,25 @@ windows = { Septum_Platform = "windows" } linux = { Septum_Platform = "linux" } macos = { Septum_Platform = "macos" } +[build-switches] +Development.Debug_Info = "Yes" +Development.Contracts = "Yes" +Development.Runtime_Checks = [ + "-gnato", # Enable numeric overflow checking; + "-fstack-check", # Stack overflow checking + "-gnatVa" # All validity checks +] + +Release.Runtime_Checks = "None" + +"*".Compile_Checks = "Errors" +"*".Ada_Version = "Ada2022" +"*".Style_Checks = [ + "-gnaty-d", # Disable no DOS line terminators + "-gnatyM200", # Maximum line length + "-gnatyO" # Overriding subprograms explicitly marked as such] +] + [[depends-on]] # Added by alr dir_iterators = "~0.0.4" # Added by alr [[depends-on]] # Added by alr diff --git a/septum.gpr b/septum.gpr index bb91de0..352632a 100644 --- a/septum.gpr +++ b/septum.gpr @@ -1,23 +1,15 @@ -- begin auto-gpr-with -- -- This section was automatically added by Alire with "atomic.gpr"; +with "config/septum_config.gpr"; with "dir_iterators.gpr"; with "progress_indicators.gpr"; with "trendy_terminal.gpr"; -- end auto-gpr-with -- -with "config/septum_config.gpr"; project Septum is - Septum_Sources := ("src/common"); - - type Enabled_Kind is ("enabled", "disabled"); - Checks_Enabled : Enabled_Kind := "disabled"; - - Compile_Checks : Enabled_Kind := External ("SEPTUM_COMPILE_CHECKS", Checks_Enabled); - Runtime_Checks : Enabled_Kind := External ("SEPTUM_RUNTIME_CHECKS", Checks_Enabled); - Style_Checks : Enabled_Kind := External ("SEPTUM_STYLE_CHECKS", Checks_Enabled); - Contracts_Checks : Enabled_Kind := External ("SEPTUM_CONTRACTS", Checks_Enabled); + Septum_Sources := ("src/common", "config/"); type Platform_Type is ("windows", "linux", "macos"); Platform : Platform_Type := external ("Septum_Platform"); @@ -27,88 +19,20 @@ project Septum is when "macos" => Septum_Sources := Septum_Sources & "src/mac"; end case; - type Build_Kind is ("debug", "optimize"); - Build_Mode : Build_Kind := External ("SEPTUM_BUILD_MODE", "optimize"); - for Source_Dirs use Septum_Sources; - for Object_Dir use "obj"; + for Object_Dir use "obj/" & Septum_Config.Build_Profile; for Create_Missing_Dirs use "True"; for Exec_Dir use "bin"; for Main use ("septum.adb"); - Compile_Checks_Switches := (); - case Compile_Checks is - when "enabled" => - Compile_Checks_Switches := ( - "-gnatwa", -- All warnings - "-gnatVa", -- All validity checks - "-gnatwe" -- Warnings as errors - ); - when others => null; - end case; - - Runtime_Checks_Switches := (); - case Runtime_Checks is - when "enabled" => - Runtime_Checks_Switches := ( - "-gnato", -- Enable numeric overflow checking; - "-fstack-check", -- Stack overflow checking - "-gnatVa" -- All validity checks - ); - when others => - Runtime_Checks_Switches := - ("-gnatp"); -- Suppress checks - end case; - - Style_Checks_Switches := (); - case Style_Checks is - when "enabled" => - Style_Checks_Switches := ( - "-gnaty-d", -- Disable no DOS line terminators - "-gnatyM200", -- Maximum line length - "-gnatyO" -- Overriding subprograms explicitly marked as such - ); - when others => null; - end case; - - Contracts_Switches := (); - case Contracts_Checks is - when "enabled" => - Contracts_Switches := - ("-gnata"); -- Enable assertions and contracts - when others => null; - end case; - - Build_Switches := (); - case Build_Mode is - when "optimize" => - Build_Switches := ("-O3", -- Optimization - "-gnatn"); -- Enable inlining - when "debug" => - Build_Switches := ("-g", -- Debug info - "-Og"); -- No optimization - end case; - - package Compiler is - for Default_Switches ("Ada") use - Compile_Checks_Switches & - Build_Switches & - Runtime_Checks_Switches & - Style_Checks_Switches & - Contracts_Switches & - ("-gnatw.X", -- Disable warnings for No_Exception_Propagation - "-gnatf", -- Full errors. Multiple errors per line, all undefined references, - -- Do not attempt to suppress cascaded errors. - "-gnat2022", -- Use Ada 2012 - "-gnatw.oa", -- Warning settings - "-gnatQ" -- Don't quit. Generate ALI and tree files even if illegalities - ); - end Compiler; - package Binder is for Switches ("Ada") use ("-Es"); -- Symbolic traceback end Binder; + package Compiler is + for Default_Switches ("Ada") use Septum_Config.Ada_Compiler_Switches; + end Compiler; + package Pretty_Printer is for Default_Switches ("ada") use ( "-i4", -- Indentation level @@ -120,4 +44,8 @@ project Septum is ); end Pretty_Printer; + package Install is + for Artifacts (".") use ("share"); + end Install; + end Septum;