Skip to content

Commit 3d51941

Browse files
committed
Use compiler switches from Alire's configuration
Signed-off-by: onox <denkpadje@gmail.com>
1 parent 193a864 commit 3d51941

File tree

5 files changed

+15
-116
lines changed

5 files changed

+15
-116
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
build/
22
alire/
3+
config/

alire.lock

Lines changed: 0 additions & 32 deletions
This file was deleted.

alire.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ description = "Ada 2012 bindings for libcanberra"
33
version = "2.0.1"
44
website = "https://github.com/onox/canberra-ada"
55
licenses = "Apache-2.0"
6-
tags = ["canberra", "audio", "sound"]
6+
tags = ["canberra", "audio", "sound", "linux"]
77

88
authors = ["onox"]
99
maintainers = ["onox <denkpadje@gmail.com>"]
1010
maintainers-logins = ["onox"]
1111

12-
configuration.disabled = true
13-
1412
[available.'case(os)']
1513
linux = true
1614
'...' = false
1715

1816
[[depends-on]]
1917
libcanberra = "~0.30.0"
18+
19+
[build-switches]
20+
validation.compile_checks = "warnings"
21+
"*".style_checks = ["-gnatygAO-Is"]

canberra_ada.gpr

Lines changed: 7 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,28 @@
1+
with "config/canberra_ada_config";
2+
13
project Canberra_Ada is
24

35
for Library_Name use "canberra-ada";
4-
for Library_Version use "2.0.0";
6+
for Library_Version use Project'Library_Name & ".so." & Canberra_Ada_Config.Crate_Version;
57

6-
for Source_Dirs use ("src");
7-
for Object_Dir use "build/obj";
88
for Create_Missing_Dirs use "True";
9+
10+
for Source_Dirs use ("src");
11+
for Object_Dir use "build/obj/" & Canberra_Ada_Config.Build_Profile;
912
for Library_Dir use "build/lib";
1013

1114
type Library_Type_Type is ("relocatable", "static", "static-pic");
1215
Library_Type : Library_Type_Type :=
1316
external ("CANBERRA_ADA_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static"));
1417
for Library_Kind use Library_Type;
1518

16-
type Enabled_Kind is ("enabled", "disabled");
17-
Compile_Checks : Enabled_Kind := External ("CANBERRA_ADA_COMPILE_CHECKS", "enabled");
18-
Runtime_Checks : Enabled_Kind := External ("CANBERRA_ADA_RUNTIME_CHECKS", "enabled");
19-
Style_Checks : Enabled_Kind := External ("CANBERRA_ADA_STYLE_CHECKS", "enabled");
20-
Contracts_Checks : Enabled_Kind := External ("CANBERRA_ADA_CONTRACTS", "enabled");
21-
22-
type Build_Kind is ("debug", "release", "coverage", "profiling");
23-
Build_Mode : Build_Kind := External ("CANBERRA_ADA_BUILD_MODE", "release");
24-
25-
Compile_Checks_Switches := ();
26-
case Compile_Checks is
27-
when "enabled" =>
28-
Compile_Checks_Switches :=
29-
("-gnatwa", -- All warnings
30-
"-gnatVa", -- All validity checks
31-
"-gnatf", -- Full errors
32-
"-gnatwFl.l.s",
33-
"-gnatwe"); -- Warnings as errors
34-
when others => null;
35-
end case;
36-
37-
Runtime_Checks_Switches := ();
38-
case Runtime_Checks is
39-
when "enabled" => null;
40-
when others =>
41-
Runtime_Checks_Switches :=
42-
("-gnatp"); -- Supress checks
43-
end case;
44-
45-
Style_Checks_Switches := ();
46-
case Style_Checks is
47-
when "enabled" =>
48-
Style_Checks_Switches :=
49-
("-gnatyg", -- GNAT Style checks
50-
"-gnaty-Is", -- Disable check mode in and separate subprogram spec
51-
"-gnatyM99", -- Maximum line length
52-
"-gnatyA", -- Array attribute indexes
53-
"-gnatyO"); -- Overriding subprograms explicitly marked as such
54-
when others => null;
55-
end case;
56-
57-
Contracts_Switches := ();
58-
case Contracts_Checks is
59-
when "enabled" =>
60-
Contracts_Switches :=
61-
("-gnata"); -- Enable assertions and contracts
62-
when others => null;
63-
end case;
64-
65-
Build_Switches := ();
66-
case Build_Mode is
67-
when "release" =>
68-
Build_Switches := ("-O2", -- Optimization
69-
"-march=native",
70-
"-fomit-frame-pointer",
71-
"-ffunction-sections",
72-
"-gnatn"); -- Enable inlining
73-
when "debug" =>
74-
Build_Switches := ("-g", -- Debug info
75-
"-Og"); -- No optimization
76-
when "coverage" =>
77-
Build_Switches := ("-fprofile-arcs", "-ftest-coverage");
78-
when "profiling" =>
79-
Build_Switches := ("-g", "-pg");
80-
end case;
81-
8219
package Compiler is
83-
for Default_Switches ("Ada") use
84-
Compile_Checks_Switches &
85-
Build_Switches &
86-
Runtime_Checks_Switches &
87-
Style_Checks_Switches &
88-
Contracts_Switches &
89-
("-gnatw.X", -- Disable warnings for No_Exception_Propagation
90-
"-gnatQ"); -- Don't quit. Generate ALI and tree files even if illegalities
20+
for Default_Switches ("Ada") use Canberra_Ada_Config.Ada_Compiler_Switches & ("-gnatyM99");
9121
for Local_Configuration_Pragmas use "gnat.adc";
9222
end Compiler;
9323

9424
package Binder is
9525
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
9626
end Binder;
9727

98-
package Linker is
99-
for Linker_Options use ("-lcanberra");
100-
end Linker;
101-
10228
end Canberra_Ada;

src/canberra.adb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ package body Canberra is
2323
procedure Free is new Ada.Unchecked_Deallocation (Sound_Status, Sound_Status_Access);
2424

2525
package API is
26+
pragma Linker_Options ("-lcanberra");
27+
2628
type Error_Code is
2729
(Error_Disconnected,
2830
Error_Forked,

0 commit comments

Comments
 (0)