summaryrefslogtreecommitdiff
path: root/libxerces-c/xercesc/buildfile
blob: 71242931be1ec1c4afc08de71861b730af789d49 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# file      : xercesc/buildfile
# license   : Apache License 2.0; see accompanying LICENSE file

# Note that the installed util/NetAccessors/Curl/CurlURLInputStream.hpp
# includes the libcurl headers.
#
import int_libs = libcurl%lib{curl}

import imp_libs  = libicuuc%lib{icuuc}
import imp_libs += libicui18n%lib{icui18n}

lib{xerces-c}: {h          }{config                                        } \
               {hxx txx cxx}{*/** -util/FileManagers/** -util/XercesVersion} \
               {hxx        }{                            util/XercesVersion} \
               $int_libs $imp_libs

tclass = $cxx.target.class
tsys   = $cxx.target.system

windows      = ($tclass == 'windows')

lib{xerces-c}:    {h     c}{stricmp strnicmp}                        \
util/FileManagers/{hxx cxx}{PosixFileMgr    }: include = (!$windows)

lib{xerces-c}: util/FileManagers/{hxx cxx}{WindowsFileMgr}: include = $windows

# 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).
#
util/hxx{XercesVersion}: util/in{XercesVersion} $src_root/manifest
{
  dist  = true
  clean = ($src_root != $out_root)

  in.symbol = '@'

  XERCES_VERSION_MAJOR    = "$version.major"
  XERCES_VERSION_MINOR    = "$version.minor"
  XERCES_VERSION_REVISION = "$version.patch"

  XERCES_GRAMMAR_SERIALIZATION_LEVEL = "$grammar_serialization_level"
}

# Build options.
#
cc.poptions += -DXERCES_BUILDING_LIBRARY -DHAVE_CONFIG_H -D_THREAD_SAFE

if $windows
  cc.poptions += -DWIN32 -D_WINDOWS -D_MBCS

# Note that we need to add "-I$src_root" for the headers auto-generating
# machinery to work properly.
#
cc.poptions =+ "-I$out_root" "-I$src_root" "-I$src_base"

obja{*}: cxx.poptions += -DLIBXERCES_C_STATIC_BUILD
objs{*}: cxx.poptions += -DLIBXERCES_C_SHARED_BUILD

switch $c.class
{
  case 'gcc'
  {
    # Disable warnings that pop up with -Wall -Wextra. Upstream doesn't seem
    # to care about these and it is not easy to disable specific warnings in a
    # way that works across compilers/version (some -Wno-* options are only
    # recognized in newer versions). There are still some warnings left that
    # appear for certain platforms/compilers. We pass them through but disable
    # treating them as errors.
    #
    cc.coptions += -Wno-all -Wno-extra -Wno-error

    # Disable the Clang targeting MSVC warnings.
    #
    if ($c.id == 'clang' && $tsys == 'win32-msvc')
      cc.coptions += -Wno-deprecated-declarations
  }
  case 'msvc'
  {
    # Disable warnings that pop up with /W3.
    #
    cc.coptions += /wd4244 /wd4267 /wd4996 /wd4305
  }
}

switch $tclass, $tsys
{
  case 'windows', 'mingw32'
  {
    # Make sure all symbols are resolvable.
    #
    cxx.loptions += -Wl,--no-undefined

    cxx.libs += -lws2_32
  }
  case 'windows'
  {
    # Suppress the 'object file does not define any public symbols' warning.
    #
    cxx.aoptions += /IGNORE:4221

    cxx.libs += ws2_32.lib
  }
  case 'linux'
  {
    # Make sure all symbols are resolvable.
    #
    cxx.loptions += -Wl,--no-undefined

    cxx.libs += -lm -lpthread
  }
  default
  {
    cxx.libs += -lpthread
  }
}

# Export options.
#
lib{xerces-c}:
{
  cxx.export.poptions = "-I$out_root" "-I$src_root"
  cxx.export.libs     = $int_libs
}

liba{xerces-c}: cxx.export.poptions += -DLIBXERCES_C_STATIC
libs{xerces-c}: cxx.export.poptions += -DLIBXERCES_C_SHARED

# See bootstrap.build for details.
#
if $version.pre_release
  lib{xerces-c}: bin.lib.version = @"-$version.project_id"
else
  lib{xerces-c}: bin.lib.version = @"-$abi_version"

# Don't install the implementation details C headers (config.h and the
# compatibility function declarations).
#
h{*}: install = false

# Install the C++ headers into the xercesc/ subdirectory of, say, /usr/include/
# recreating subdirectories.
#
{hxx txx}{*}:
{
  install         = include/xercesc/
  install.subdirs = true
}