aboutsummaryrefslogtreecommitdiff
path: root/libbutl/buildfile
blob: 2be258a33635bc4fafd9af6f6724092ab180680e (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
# file      : libbutl/buildfile
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

int_libs =

if ($force_std_modules == true)
{
  #@@ MOD is it really an interface dependency? I guess if we re-export
  #       then it is? Or maybe it is special?
  #
  import int_libs += libstd-modules%liba{std-modules}
  cxx.poptions += -D__cpp_lib_modules
}

lib{butl}: {mxx hxx ixx txx cxx}{** -uuid-* +uuid-io -win32-utility -version} \
           {hxx}{version} $int_libs

windows = ($cxx.target.class == 'windows')

# Exclude these from compilation on non-Windows targets.
#
lib{butl}: {hxx cxx}{win32-utility}: include = $windows

# Our C-files are included into sha256.cxx (sha256c.c) and timestamp.cxx
# (strptime.c timelocal.h timelocal.c), so treat them as files exclude from
# the compilation.
#
lib{butl}: file{*.c *.h}

# Platform-specific UUID implementations.
#
lib{butl}: cxx{uuid-linux}:   include = ($cxx.target.class  == 'linux')
lib{butl}: cxx{uuid-macos}:   include = ($cxx.target.class  == 'macos')
lib{butl}: cxx{uuid-windows}: include = $windows
lib{butl}: cxx{uuid-freebsd}: include = ($cxx.target.system == 'freebsd')

if ($cxx.target.class == 'linux')
  cxx.libs += -ldl
elif ($cxx.target.class == 'macos')
  cxx.libs += -framework CoreFoundation
elif ($windows)
  cxx.libs += ($cxx.target.system == 'mingw32' ? -lrpcrt4 : rpcrt4.lib)

# Additional system libraries.
#
if $windows
  cxx.libs += ($cxx.target.system == 'mingw32' ? -limagehlp : imagehlp.lib)
else
  cxx.libs += -lpthread

#@@ MOD VC bogus warning if module and dll-exported function called within DLL.
#
if ($cxx.features.modules && $cxx.class == 'msvc')
  cxx.loptions += /ignore:4217

# Include the generated version header into the distribution (so that we don't
# pick up an installed one) and don't remove it when cleaning in src (so that
# clean results in a state identical to distributed).
#
hxx{version}: in{version} $src_root/manifest
hxx{version}: dist  = true
hxx{version}: clean = ($src_root != $out_root)

# For pre-releases use the complete version to make sure they cannot be used
# in place of another pre-release or the final version.
#
if $version.pre_release
  lib{butl}: bin.lib.version = @"-$version.project_id"
else
  lib{butl}: bin.lib.version = @"-$version.major.$version.minor"

lib{butl}: cxx.export.libs = $int_libs

cxx.poptions =+ "-I$out_root" "-I$src_root"
obja{*} bmia{*}: cxx.poptions += -DLIBBUTL_STATIC_BUILD
objs{*} bmis{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD

lib{butl}: cxx.export.poptions = "-I$out_root" "-I$src_root"
liba{butl}: cxx.export.poptions += -DLIBBUTL_STATIC
libs{butl}: cxx.export.poptions += -DLIBBUTL_SHARED

# Install into the libbutl/ subdirectory of, say, /usr/include/ recreating
# subdirectories.
#
{mxx hxx ixx txx}{*}: install         = include/$project/
{mxx hxx ixx txx}{*}: install.subdirs = true