aboutsummaryrefslogtreecommitdiff
path: root/proj/common.gpr
blob: c4bea2fdf4756e4a0ce70c361928596a7e2f66a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103


abstract project Common is


    type Build_Kind is ("release", "debug");

    Ver : Build_Kind := external ("build", "release");


    package Builder is
        for Default_Switches ("Ada") use ("-j4", "-m");
        for Global_Compilation_Switches ("Ada") use ("-shared");

        case Ver is

        when "release" =>
            null;

        when "debug" =>
            for Default_Switches ("Ada") use Builder'Default_Switches ("Ada") & "-g";

        end case;
    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

    CPP_Common :=
       ("-Wall",
        "-Werror",
        "-Wextra",
        "-Wpedantic",
        "-std=c++11");

    package Compiler is
        case Ver is

        when "release" =>
            for Default_Switches ("Ada") use Ada_Common & "-O3" & "-Os" & "-gnatn";
            for Default_Switches ("C++") use CPP_Common & "-O3" & "-Os";

        when "debug" =>
            for Default_Switches ("Ada") use Ada_Common & "-O0" & "-gnata" & "-gnato" & "-g";
            for Default_Switches ("C++") use CPP_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") & "-E";

        end case;
    end Binder;


    package Linker is
        case Ver is

        when "release" =>
            null;

        when "debug" =>
            for Default_Switches ("Ada") use ("-g");

        end case;
    end Linker;


end Common;