Permalink
Browse files

Do not define BOOST_TEST_DYN_LINK when statically linking (#1750)

  • Loading branch information...
jackgerrits authored and JohnLangford committed Feb 8, 2019
1 parent a3c0943 commit 4b84704b22cc2b80ff4b44e02d6f456670fca62d
@@ -7,6 +7,11 @@ add_executable(vw-unit-test.out
target_include_directories(vw-unit-test.out PRIVATE $<TARGET_PROPERTY:vw,INCLUDE_DIRECTORIES>)
target_link_libraries(vw-unit-test.out PRIVATE vw allreduce Boost::unit_test_framework Boost::system)

# Communicate that Boost Unit Test is being statically linked
if(STATIC_LINK_VW)
target_compile_definitions(vw-unit-test.out PRIVATE STATIC_LINK_VW)
endif()

add_test(
NAME vw_unit_test
COMMAND ./vw-unit-test.out
@@ -1,14 +1,16 @@

#ifndef STATIC_LINK_VW
#define BOOST_TEST_DYN_LINK
#endif

#include <boost/test/unit_test.hpp>

#include "vw.h"

BOOST_AUTO_TEST_CASE(cb_explore_adf_should_throw_empty_multi_example) {
auto vw = VW::initialize("--cb_explore_adf", nullptr, false, nullptr, nullptr);
multi_ex example_collection;

multi_ex example_collection;

// An empty example collection is invalid and so should throw.
BOOST_REQUIRE_THROW(vw->learn(example_collection), VW::vw_exception);
}
@@ -1,4 +1,6 @@
#ifndef STATIC_LINK_VW
#define BOOST_TEST_DYN_LINK
#endif

#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
@@ -1,3 +1,6 @@
#ifndef STATIC_LINK_VW
#define BOOST_TEST_DYN_LINK
#endif

#define BOOST_TEST_MODULE Main
#include <boost/test/unit_test.hpp>
@@ -1,4 +1,6 @@
#ifndef STATIC_LINK_VW
#define BOOST_TEST_DYN_LINK
#endif

#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
@@ -1,4 +1,6 @@
#ifndef STATIC_LINK_VW
#define BOOST_TEST_DYN_LINK
#endif

#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
@@ -1,4 +1,6 @@
#ifndef STATIC_LINK_VW
#define BOOST_TEST_DYN_LINK
#endif

#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>

0 comments on commit 4b84704

Please sign in to comment.