diff --git a/.gitignore b/.gitignore index 53fcfbf..34bb894 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ -obj/ -lib/ -alire/ alire.lock -config/ +/obj/ +/lib/ +/alire/ diff --git a/alire.toml b/alire.toml index 5643661..c66cbbd 100644 --- a/alire.toml +++ b/alire.toml @@ -1,6 +1,6 @@ name = "toml_slicer" description = "Edit TOML files directly without parsing" -version = "0.1.0" +version = "0.1.1" licenses = "MIT" tags = ["toml"] @@ -10,4 +10,4 @@ maintainers-logins = ["mosteo"] website = "https://github.com/mosteo/toml_slicer" [[depends-on]] -aaa = "~0.2.4" +aaa = "~0.2.4|~0.3" diff --git a/config/toml_slicer_config.ads b/config/toml_slicer_config.ads new file mode 100644 index 0000000..8c474b7 --- /dev/null +++ b/config/toml_slicer_config.ads @@ -0,0 +1,19 @@ +-- Configuration for toml_slicer generated by Alire +pragma Restrictions (No_Elaboration_Code); + +package Toml_Slicer_Config is + pragma Pure; + + Crate_Version : constant String := "0.1.1"; + Crate_Name : constant String := "toml_slicer"; + + Alire_Host_OS : constant String := "linux"; + + Alire_Host_Arch : constant String := "x86_64"; + + Alire_Host_Distro : constant String := "ubuntu"; + + type Build_Profile_Kind is (release, validation, development); + Build_Profile : constant Build_Profile_Kind := release; + +end Toml_Slicer_Config; diff --git a/config/toml_slicer_config.gpr b/config/toml_slicer_config.gpr new file mode 100644 index 0000000..16bd2f0 --- /dev/null +++ b/config/toml_slicer_config.gpr @@ -0,0 +1,23 @@ +-- Configuration for toml_slicer generated by Alire +with "aaa.gpr"; +abstract project Toml_Slicer_Config is + Crate_Version := "0.1.1"; + Crate_Name := "toml_slicer"; + + Alire_Host_OS := "linux"; + + Alire_Host_Arch := "x86_64"; + + Alire_Host_Distro := "ubuntu"; + Ada_Compiler_Switches := External_As_List ("ADAFLAGS", " ") & + ( + "-O3" -- Optimize for performance + ,"-gnatn" -- Enable inlining + ,"-ffunction-sections" -- Separate ELF section for each function + ,"-fdata-sections" -- Separate ELF section for each variable + ); + + type Build_Profile_Kind is ("release", "validation", "development"); + Build_Profile : Build_Profile_Kind := "release"; + +end Toml_Slicer_Config; diff --git a/config/toml_slicer_config.h b/config/toml_slicer_config.h new file mode 100644 index 0000000..ef5d7e7 --- /dev/null +++ b/config/toml_slicer_config.h @@ -0,0 +1,20 @@ +/* Configuration for toml_slicer generated by Alire */ +#ifndef TOML_SLICER_CONFIG_H +#define TOML_SLICER_CONFIG_H + +#define CRATE_VERSION "0.1.1" +#define CRATE_NAME "toml_slicer" + +#define ALIRE_HOST_OS "linux" + +#define ALIRE_HOST_ARCH "x86_64" + +#define ALIRE_HOST_DISTRO "ubuntu" + +#define BUILD_PROFILE_RELEASE 1 +#define BUILD_PROFILE_VALIDATION 2 +#define BUILD_PROFILE_DEVELOPMENT 3 + +#define BUILD_PROFILE 1 + +#endif diff --git a/toml_slicer.gpr b/toml_slicer.gpr index 26fe2ae..c0e1819 100644 --- a/toml_slicer.gpr +++ b/toml_slicer.gpr @@ -1,12 +1,11 @@ -with "aaa"; - +with "config/toml_slicer_config.gpr"; project Toml_Slicer is for Library_Name use "Toml_Slicer"; - for Library_Version use "0.0.0"; + for Library_Version use Project'Library_Name & ".so." & Toml_Slicer_Config.Crate_Version; - for Source_Dirs use ("src"); - for Object_Dir use "obj"; + for Source_Dirs use ("src/", "config/"); + for Object_Dir use "obj/" & Toml_Slicer_Config.Build_Profile; for Create_Missing_Dirs use "True"; for Library_Dir use "lib"; @@ -15,76 +14,16 @@ project Toml_Slicer is external ("TOML_SLICER_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static")); for Library_Kind use Library_Type; - type Enabled_Kind is ("enabled", "disabled"); - Compile_Checks : Enabled_Kind := External ("TOML_SLICER_COMPILE_CHECKS", "enabled"); - Runtime_Checks : Enabled_Kind := External ("TOML_SLICER_RUNTIME_CHECKS", "enabled"); - Style_Checks : Enabled_Kind := External ("TOML_SLICER_STYLE_CHECKS", "enabled"); - Contracts_Checks : Enabled_Kind := External ("TOML_SLICER_CONTRACTS", "enabled"); - - type Build_Kind is ("debug", "optimize"); - Build_Mode : Build_Kind := External ("TOML_SLICER_BUILD_MODE", "debug"); - - 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" => null; - when others => - Runtime_Checks_Switches := - ("-gnatp"); -- Supress checks - end case; - - Style_Checks_Switches := (); - case Style_Checks is - when "enabled" => - Style_Checks_Switches := - ("-gnatyg", -- GNAT Style checks - "-gnaty-d", -- Disable no DOS line terminators - "-gnatyM80", -- Maximum line length - "-gnaty-s", -- Relax Fwd Declarations - "-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 - "-gnatQ"); -- Don't quit. Generate ALI and tree files even if illegalities + for Default_Switches ("Ada") use Toml_Slicer_Config.Ada_Compiler_Switches; end Compiler; package Binder is for Switches ("Ada") use ("-Es"); -- Symbolic traceback end Binder; + package Install is + for Artifacts (".") use ("share"); + end Install; + end Toml_Slicer;