blob: 54326de31f788b039d137e947be7f0a8b104540c (
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
|
# Latest jamplus is needed to use this
# Targets:
# pugixml - build pugixml library
# tests - build pugixml test suite
# run_tests - run pugixml test suite
# coverage - get test suite coverage
# Options:
# toolset=name - select toolset
# supported toolsets: mingw*, msvc*
# default toolset/configuration
if ( ! $(toolset) )
{
if ( $(OS) = SOLARIS )
{
toolset = suncc ;
}
else if ( $(UNIX) )
{
local GCCVERSION = [ Subst [ Shell "gcc -dumpversion" ] : $(NEWLINE) ] ;
toolset = "gcc"$(GCCVERSION) ;
}
else
{
toolset = msvc ;
}
}
if ( ! $(configuration) )
{
configuration = "debug" ;
}
if ( ! $(defines) )
{
defines = "PUGIXML_STANDARD" ;
}
# coverage options
if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
{
CCFLAGS = -fprofile-arcs -ftest-coverage ;
LDFLAGS = -fprofile-arcs ;
GCOVFLAGS = -n ;
}
# build folder
BUILD = build ;
# enable dependency cache
DEPCACHE.standard = $(BUILD)/.depcache ;
# rules
include "Jamrules.jam" ;
# split define sets into list
local DEFINESETS = [ Split $(defines) : ':' ] ;
# split configurations into list
local CONFIGURATIONS = [ Split $(configuration) : ',' ] ;
for CONFIG in $(CONFIGURATIONS)
{
for DEFINESET in $(DEFINESETS)
{
local DEFINES = [ Split $(DEFINESET) : ',' ] ;
# build folder
local CFGBUILD = $(BUILD)/$(toolset)/$(DEFINES:J=_)/$(CONFIG) ;
# compilation options
local CFGFLAGS = $(CCFLAGS) [ GetCFlags $(CONFIG) : $(DEFINES) ] ;
# build library
local PUGIXML = $(CFGBUILD)/pugixml.lib ;
Library $(PUGIXML) : src/pugixml.cpp src/pugixpath.cpp : $(CFGFLAGS) ;
Alias pugixml : $(PUGIXML) ;
# build tests
local TESTS = $(CFGBUILD)/tests.exe ;
Application $(TESTS) : [ Glob tests : *.cpp ] : $(CFGFLAGS) : $(PUGIXML) ;
Alias tests : $(TESTS) ;
# run tests
Test $(TESTS)_run : $(TESTS) ;
Alias run_tests : $(TESTS)_run ;
# gather coverage
Coverage $(TESTS)_coverage : $(PUGIXML) ;
Alias coverage : $(TESTS)_coverage ;
GCOVFLAGS on $(TESTS)_coverage = $(GCOVFLAGS) -o $(CFGBUILD)/src ; # because stupid gcov can't find files via relative paths
# add special autotest markers to build log
if $(autotest)
{
COVPREFIX on $(TESTS)_coverage = "... autotest $(CONFIG) [$(DEFINESET)]" ;
}
# gather coverage after tests run
Depends $(TESTS)_coverage : $(TESTS)_run ;
}
}
# documentation
Documentation docs/manual.html : docs/manual.qbk ;
Alias docs : docs/manual.html ;
|