-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the test library a compiled library
Convert the header-only library to a compiled library which additionally depends (privately) on another compiled library (Boost.Atomic chosen as it has few other dependencies). This reproduces the runtime link failure of #155 when compiling shared libraries.
- Loading branch information
Showing
6 changed files
with
117 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Boost CI Test Build Jamfile | ||
|
||
# Copyright (c) 2022 Alexander Grund | ||
# | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE or www.boost.org/LICENSE_1_0.txt) | ||
|
||
import configure ; | ||
|
||
local requirements = | ||
<link>shared:<define>BOOST_BOOST_CI_DYN_LINK=1 | ||
<library>/boost/atomic//boost_atomic | ||
; | ||
|
||
project boost/ci | ||
: source-location ../src | ||
: requirements $(requirements) | ||
: usage-requirements $(requirements) | ||
; | ||
|
||
lib boost_ci | ||
: boost_ci.cpp | ||
; | ||
|
||
boost-install boost_ci ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// Copyright (c) 2022 Alexander Grund | ||
// | ||
// Use, modification and distribution is subject to the Boost Software License, | ||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#define BOOST_BOOST_CI_SOURCE | ||
|
||
#include <boost/boost-ci/boost_ci.hpp> | ||
// Just some dependency on another Boost library | ||
#include <boost/atomic/atomic.hpp> | ||
|
||
// Some simple struct big enough so that the atomic is forced to use a lock | ||
// forcing it to call into the library | ||
struct X | ||
{ | ||
double x, y, z; | ||
explicit X(int value = 0): x(value), y(value), z(value) {} | ||
}; | ||
|
||
namespace boost | ||
{ | ||
namespace boost_ci | ||
{ | ||
// Some function to test | ||
int get_answer(const bool isMsvc) | ||
{ | ||
boost::atomic<X> answer; | ||
// Specifically crafted condition to check for coverage from MSVC and non MSVC builds | ||
if(isMsvc) | ||
{ | ||
answer = X(21); | ||
} else | ||
{ | ||
answer = X(42); | ||
} | ||
#ifdef BOOST_NO_CXX11_SMART_PTR | ||
return answer.load().x; | ||
#else | ||
// Just use some stdlib feature combined with a Boost.Config feature as demonstration | ||
auto ptr = std::unique_ptr<int>(new int(answer.load().x)); | ||
return *ptr; | ||
#endif | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters