Skip to content

Commit

Permalink
Update septum to use alire build profiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
pyjarrett committed Mar 8, 2024
1 parent 10b2ee9 commit b1d14f4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 83 deletions.
19 changes: 19 additions & 0 deletions alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
94 changes: 11 additions & 83 deletions septum.gpr
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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
Expand All @@ -120,4 +44,8 @@ project Septum is
);
end Pretty_Printer;

package Install is
for Artifacts (".") use ("share");
end Install;

end Septum;

0 comments on commit b1d14f4

Please sign in to comment.