blob: 22251120310bf8ce9ddc554949db45601b5403b3 (
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
|
# file : libbuild2/c/buildfile
# license : MIT; see accompanying LICENSE file
# NOTE: shared imports should go into root.build.
#
include ../
impl_libs = ../lib{build2} # Implied interface dependency.
include ../cc/
intf_libs = ../cc/lib{build2-cc}
./: lib{build2-c}: libul{build2-c}: {hxx ixx txx cxx}{** -**.test...} \
$intf_libs $impl_libs
# Unit tests.
#
exe{*.test}:
{
test = true
install = false
}
for t: cxx{**.test...}
{
d = $directory($t)
n = $name($t)...
./: $d/exe{$n}: $t $d/{hxx ixx txx}{+$n} $d/testscript{+$n}
$d/exe{$n}: libul{build2-c}: bin.whole = false
}
# Build options.
#
obja{*}: cxx.poptions += -DLIBBUILD2_C_STATIC_BUILD
objs{*}: cxx.poptions += -DLIBBUILD2_C_SHARED_BUILD
# Note that we used to compare complete target triplets but that proved too
# strict (see libbuild2/buildfile for details).
#
cross = ($cxx.target.cpu != $build.host.cpu || \
$cxx.target.system != $build.host.system)
# Pass native C compiler path (not forgetting to escape backslashes on
# Windows). It is used as defaults for BUILD2_DEFAULT_C.
#
if! $cross
{obja objs}{init}: cxx.poptions += \
-DBUILD2_NATIVE_C=\"$regex.replace($recall($c.path), '\\', '\\\\')\"
# Export options.
#
lib{build2-c}:
{
cxx.export.poptions = "-I$out_root" "-I$src_root"
cxx.export.libs = $intf_libs
}
liba{build2-c}: cxx.export.poptions += -DLIBBUILD2_C_STATIC
libs{build2-c}: cxx.export.poptions += -DLIBBUILD2_C_SHARED
# For pre-releases use the complete version to make sure they cannot be used
# in place of another pre-release or the final version. See the version module
# for details on the version.* variable values.
#
# And because this is a build system module, we also embed the same value as
# the interface version (note that we cannot use build.version.interface for
# bundled modules because we could be built with a different version of the
# build system).
#
ver = ($version.pre_release \
? "$version.project_id" \
: "$version.major.$version.minor")
lib{build2-c}: bin.lib.version = @"-$ver"
libs{build2-c}: bin.lib.load_suffix = "-$ver"
# Install into the libbuild2/c/ subdirectory of, say, /usr/include/
# recreating subdirectories.
#
{hxx ixx txx}{*}:
{
install = include/libbuild2/c/
install.subdirs = true
}
|