From f422ec5ac8102abb99a92d4742b4baa88130b75f Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 15 Apr 2025 00:41:02 +1200 Subject: Executable now knows where it is, installs and finds logo image correctly, better build config --- adapad.gpr | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 97 insertions(+), 9 deletions(-) (limited to 'adapad.gpr') diff --git a/adapad.gpr b/adapad.gpr index 2d88316..dacc020 100644 --- a/adapad.gpr +++ b/adapad.gpr @@ -1,39 +1,127 @@ --- goal is for executable to be no more than 90-100kB --- when dynamically linked, to match leafpad +with - -with "fltkada"; + "fltkada"; project AdaPad is - for Languages use ("Ada"); + for Languages use ("Ada", "C"); - for Source_Dirs use ("src/**"); + for Source_Dirs use ("hereiam", "src"); for Object_Dir use "obj"; for Exec_Dir use "bin"; for Main use ("main.adb"); + type Build_Kind is ("release", "debug"); + + Ver : Build_Kind := external ("build", "release"); + + package Builder is - for Executable("main.adb") use "adapad"; + for Default_Switches ("Ada") use ("-j4", "-m"); + + case Ver is + + when "release" => + null; + + when "debug" => + for Default_Switches ("Ada") use Builder'Default_Switches ("Ada") & "-g"; + + end case; + + for Executable ("main.adb") use "adapad"; end Builder; + Ada_Common := + ("-gnaty" + & "4" -- indentation + & "a" -- attribute casing + & "A" -- array attribute indices + & "b" -- blanks at end of lines + & "c" -- two space comments + & "e" -- end/exit labels + & "f" -- no form feeds or vertical tabs + & "h" -- no horizontal tabs + & "i" -- if/then layout + & "k" -- keyword casing + & "l" -- reference manual layout + & "M100" -- max line length + & "n" -- package Standard casing + & "p" -- pragma casing + & "r" -- identifier casing + & "t", -- token separation + "-gnatw" + & "a" -- various warning modes + & "F" -- don't check for unreferenced formal parameters + & "J" -- don't check for obsolescent feature use + & "U"); -- don't check for unused entities + + C_Common := + ("-Wall", + "-Werror", + "-Wextra", + "-Wpedantic"); + package Compiler is - for Default_Switches("Ada") use ("-gnaty4aAbcefhiklM100nprt"); + case Ver is + + when "release" => + for Default_Switches ("Ada") use Ada_Common & "-O3" & "-gnatn"; + for Default_Switches ("C") use C_Common & "-O3"; + + when "debug" => + for Default_Switches ("Ada") use Ada_Common & "-O0" & "-gnata" & "-gnato" & "-g"; + for Default_Switches ("C") use C_Common & "-O0"; + + end case; end Compiler; + package Binder is + for Default_Switches ("Ada") use ("-shared"); + + case Ver is + + when "release" => + null; + + when "debug" => + for Default_Switches ("Ada") use Binder'Default_Switches ("Ada") & "-Es"; + + end case; + end Binder; + + package Linker is - for Default_Switches("Ada") use ("-lfltk", "-lfltk_images"); + case Ver is + + when "release" => + null; + + when "debug" => + for Default_Switches ("Ada") use ("-g"); + + end case; + + for Default_Switches ("Ada") use + Linker'Default_Switches ("Ada") & ("-lfltk", "-lfltk_images"); end Linker; + package Install is + for Artifacts ("share") use ("share/*"); + for Required_Artifacts ("share") use ("share/adapad/logo.png"); + for Mode use "usage"; + end Install; + + end AdaPad; -- cgit