Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 55475e9

Browse files
committed
[tests] Issue #90. Added test HeaderLibraryTest2, to exercise a header library having a dependency on a static library, and an application then uses the header library. The static library dependency must be forwarded to the application link step.
1 parent 91f899b commit 55475e9

File tree

9 files changed

+369
-0
lines changed

9 files changed

+369
-0
lines changed

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
25-Aug-2016 Issue #90. Added test HeaderLibraryTest2, to exercise a header library having a dependency on a static library, and an application then uses the header library. The static library dependency must be forwarded to the application link step.
2+
13
23-Aug-2016 Fixes #285. VisualStudio solution files now embed a format version number dependent on the VisualC package used.
24

35
23-Aug-2016 Fixes #286. C.ICommonCompilerSettings.SystemIncludePaths are now honoured in VSSolution build mode. These are merged into any C.ICommonCompilerSettings.IncludePaths, with non-system paths appearing first (consistent with Native build mode behaviour).
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<PackageDefinition xsi:schemaLocation="http://www.buildamation.com ./Schema/BamPackageDefinitionV1.xsd" name="HeaderLibraryTest2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.buildamation.com">
3+
<Description>Exercise forwarding dependencies when using header libraries</Description>
4+
<Dependents>
5+
<Package name="C" />
6+
<Package name="Clang" version="Xcode4" />
7+
<Package name="Clang" version="Xcode5" />
8+
<Package name="Clang" version="Xcode6" default="true" />
9+
<Package name="Clang" version="Xcode7" />
10+
<Package name="Gcc" version="4.8" />
11+
<Package name="MakeFileBuilder" />
12+
<Package name="Mingw" version="4.8.1" />
13+
<Package name="NativeBuilder" />
14+
<Package name="VisualC" version="10.0" />
15+
<Package name="VisualC" version="11.0" />
16+
<Package name="VisualC" version="12.0" default="true" />
17+
<Package name="VisualC" version="14.0" />
18+
<Package name="VSSolutionBuilder" />
19+
<Package name="XcodeBuilder" />
20+
</Dependents>
21+
<BamAssemblies>
22+
<BamAssembly name="Bam.Core" major="1" minor="0" patch="4" />
23+
</BamAssemblies>
24+
<DotNetAssemblies>
25+
<DotNetAssembly name="System" requiredTargetFramework="4.0.30319" />
26+
<DotNetAssembly name="System.Xml" requiredTargetFramework="4.0.30319" />
27+
<DotNetAssembly name="System.Core" requiredTargetFramework="4.0.30319" />
28+
</DotNetAssemblies>
29+
<SupportedPlatforms>
30+
<Platform name="Windows" />
31+
<Platform name="Linux" />
32+
<Platform name="OSX" />
33+
</SupportedPlatforms>
34+
</PackageDefinition>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#region License
2+
// Copyright (c) 2010-2016, Mark Final
3+
// All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are met:
7+
//
8+
// * Redistributions of source code must retain the above copyright notice, this
9+
// list of conditions and the following disclaimer.
10+
//
11+
// * Redistributions in binary form must reproduce the above copyright notice,
12+
// this list of conditions and the following disclaimer in the documentation
13+
// and/or other materials provided with the distribution.
14+
//
15+
// * Neither the name of BuildAMation nor the names of its
16+
// contributors may be used to endorse or promote products derived from
17+
// this software without specific prior written permission.
18+
//
19+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
#endregion // License
30+
using Bam.Core;
31+
namespace HeaderLibraryTest2
32+
{
33+
class BaseLibrary :
34+
C.StaticLibrary
35+
{
36+
protected override void Init(Module parent)
37+
{
38+
base.Init(parent);
39+
40+
this.CreateHeaderContainer("$(packagedir)/include/baselib/*.h");
41+
var source = this.CreateCSourceContainer("$(packagedir)/source/baselib/*.c");
42+
43+
this.PublicPatch((settings, appliedTo) =>
44+
{
45+
var compiler = settings as C.ICommonCompilerSettings;
46+
if (null != compiler)
47+
{
48+
compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/include/baselib"));
49+
}
50+
});
51+
}
52+
}
53+
54+
class HeaderLibrary :
55+
C.HeaderLibrary
56+
{
57+
protected override void Init(Module parent)
58+
{
59+
base.Init(parent);
60+
61+
this.CreateHeaderContainer("$(packagedir)/include/headerlib/*.h");
62+
63+
this.CompileAgainst<BaseLibrary>();
64+
65+
this.PublicPatch((settings, appliedTo) =>
66+
{
67+
var compiler = settings as C.ICommonCompilerSettings;
68+
if (null != compiler)
69+
{
70+
compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/include/headerlib"));
71+
}
72+
});
73+
}
74+
}
75+
76+
class MiddleLibrary :
77+
C.StaticLibrary
78+
{
79+
protected override void Init(Module parent)
80+
{
81+
base.Init(parent);
82+
83+
this.CreateHeaderContainer("$(packagedir)/include/middlelib/*.h");
84+
var source = this.CreateCSourceContainer("$(packagedir)/source/middlelib/*.c");
85+
86+
this.CompileAgainst<HeaderLibrary>(source);
87+
88+
this.PublicPatch((settings, appliedTo) =>
89+
{
90+
var compiler = settings as C.ICommonCompilerSettings;
91+
if (null != compiler)
92+
{
93+
compiler.IncludePaths.AddUnique(this.CreateTokenizedString("$(packagedir)/include/middlelib"));
94+
}
95+
});
96+
}
97+
}
98+
99+
sealed class App :
100+
C.ConsoleApplication
101+
{
102+
protected override void Init(Module parent)
103+
{
104+
base.Init(parent);
105+
106+
var source = this.CreateCSourceContainer("$(packagedir)/source/app/*.c");
107+
108+
this.CompileAndLinkAgainst<MiddleLibrary>(source);
109+
110+
if (this.Linker is VisualCCommon.LinkerBase)
111+
{
112+
this.LinkAgainst<WindowsSDK.WindowsSDK>();
113+
}
114+
}
115+
}
116+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright (c) 2010-2016, Mark Final
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of BuildAMation nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
#ifndef BASELIB_H
31+
#define BASELIB_H
32+
33+
extern char *baseLib_GetMessage();
34+
35+
#endif /* BASELIB_H */
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
Copyright (c) 2010-2016, Mark Final
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of BuildAMation nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
#ifndef HEADERLIB_H
31+
#define HEADERLIB_H
32+
33+
#include "baselib.h"
34+
35+
#define headerLib_GetMessage baseLib_GetMessage
36+
37+
#endif /* HEADERLIB_H */
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright (c) 2010-2016, Mark Final
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of BuildAMation nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
#ifndef MIDDLELIB_H
31+
#define MIDDLELIB_H
32+
33+
extern char *middleLib_GetMessage();
34+
35+
#endif /* MIDDLELIB_H */
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
Copyright (c) 2010-2016, Mark Final
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of BuildAMation nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
#include "middlelib.h"
31+
#include <stdio.h>
32+
33+
int main()
34+
{
35+
char *message = middleLib_GetMessage();
36+
printf("Message was: %s\n", message);
37+
return 0;
38+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright (c) 2010-2016, Mark Final
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of BuildAMation nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
#include "baselib.h"
31+
32+
char *baseLib_GetMessage()
33+
{
34+
return "FromBaseLib";
35+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
Copyright (c) 2010-2016, Mark Final
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of BuildAMation nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
#include "middlelib.h"
31+
#include "headerlib.h"
32+
33+
char *
34+
middleLib_GetMessage()
35+
{
36+
return headerLib_GetMessage();
37+
}

0 commit comments

Comments
 (0)