mirror of
https://github.com/boostorg/config.git
synced 2025-07-30 04:17:16 +02:00
Update link_test to check that separate file template instantiation and export works as expected.
[SVN r62332]
This commit is contained in:
@ -14,3 +14,6 @@ lib link_test : link_test.cpp
|
||||
debug release
|
||||
;
|
||||
|
||||
run main.cpp link_test : : : <define>BOOST_DYN_LINK=1 <define>BOOST_CONFIG_NO_LIB <link>shared <runtime-link>shared <threading>single : link_test_test ;
|
||||
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#define BOOST_CONFIG_SOURCE
|
||||
|
||||
#include "link_test.hpp"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
bool BOOST_CONFIG_DECL check_options(
|
||||
bool m_dyn_link,
|
||||
@ -17,10 +19,36 @@ bool BOOST_CONFIG_DECL check_options(
|
||||
bool m_debug,
|
||||
bool m_stlp_debug)
|
||||
{
|
||||
return (m_dyn_link == dyn_link)
|
||||
&& (m_dyn_rtl == dyn_rtl)
|
||||
&& (m_has_threads == has_threads)
|
||||
&& (m_debug == debug)
|
||||
&& (m_stlp_debug == stl_debug);
|
||||
if(m_dyn_link != dyn_link)
|
||||
{
|
||||
std::cout << "Dynamic link options do not match" << std::endl;
|
||||
std::cout << "Application setting = " << m_dyn_link << " Library setting = " << dyn_link << std::endl;
|
||||
return false;
|
||||
}
|
||||
if(m_dyn_rtl != dyn_rtl)
|
||||
{
|
||||
std::cout << "Runtime library options do not match" << std::endl;
|
||||
std::cout << "Application setting = " << m_dyn_rtl << " Library setting = " << dyn_rtl << std::endl;
|
||||
return false;
|
||||
}
|
||||
if(m_has_threads != has_threads)
|
||||
{
|
||||
std::cout << "Threading options do not match" << std::endl;
|
||||
std::cout << "Application setting = " << m_has_threads << " Library setting = " << has_threads << std::endl;
|
||||
return false;
|
||||
}
|
||||
if(m_debug != debug)
|
||||
{
|
||||
std::cout << "Debug options do not match" << std::endl;
|
||||
std::cout << "Application setting = " << m_debug << " Library setting = " << debug << std::endl;
|
||||
return false;
|
||||
}
|
||||
if(m_stlp_debug != stl_debug)
|
||||
{
|
||||
std::cout << "STLPort debug options do not match" << std::endl;
|
||||
std::cout << "Application setting = " << m_stlp_debug << " Library setting = " << stl_debug << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -44,11 +44,11 @@ static const bool stl_debug = false;
|
||||
//
|
||||
// set up import and export options:
|
||||
//
|
||||
#if defined(BOOST_HAS_DECLSPEC) && defined(BOOST_DYN_LINK)
|
||||
#if defined(BOOST_DYN_LINK)
|
||||
# ifdef BOOST_CONFIG_SOURCE
|
||||
# define BOOST_CONFIG_DECL __declspec(dllexport)
|
||||
# define BOOST_CONFIG_DECL BOOST_SYMBOL_EXPORT
|
||||
# else
|
||||
# define BOOST_CONFIG_DECL __declspec(dllimport)
|
||||
# define BOOST_CONFIG_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
#endif
|
||||
#ifndef BOOST_CONFIG_DECL
|
||||
@ -73,5 +73,36 @@ bool BOOST_CONFIG_DECL check_options(
|
||||
# include <boost/config/auto_link.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_EXTERN_TEMPLATE
|
||||
|
||||
template <class T>
|
||||
T test_free_proc(T v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct tester
|
||||
{
|
||||
static int test();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
int tester<T>::test()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BOOST_CONFIG_SOURCE
|
||||
template BOOST_SYMBOL_EXPORT int test_free_proc<int>(int);
|
||||
template BOOST_SYMBOL_EXPORT int tester<int>::test();
|
||||
#else
|
||||
extern template BOOST_SYMBOL_IMPORT int test_free_proc<int>(int);
|
||||
extern template BOOST_SYMBOL_IMPORT int tester<int>::test();
|
||||
#endif
|
||||
|
||||
#endif // BOOST_NO_EXTERN_TEMPLATE
|
||||
|
||||
#endif // BOOST_LINK_TEST_HPP
|
||||
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef BOOST_NO_EXTERN_TEMPLATE
|
||||
test_free_proc<int>(0);
|
||||
tester<int>::test();
|
||||
#endif
|
||||
return check_options(dyn_link, dyn_rtl, has_threads, debug, stl_debug) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
@ -69,13 +69,14 @@ autolink-lib link_test : ../link_test.cpp
|
||||
:
|
||||
;
|
||||
|
||||
|
||||
explicit link_test ;
|
||||
|
||||
run ../main.cpp link_test
|
||||
: : : <toolset>msvc-8.0:<build>no <link>static <runtime-link>static <threading>single debug : link_test_ssd ;
|
||||
: : : <toolset>msvc-8.0:<build>no <toolset>msvc-9.0:<build>no <toolset>msvc-10.0:<build>no <link>static <runtime-link>static <threading>single debug : link_test_ssd ;
|
||||
|
||||
run ../main.cpp link_test
|
||||
: : : <toolset>msvc-8.0:<build>no <link>static <runtime-link>static <threading>single release : link_test_ssr ;
|
||||
: : : <toolset>msvc-8.0:<build>no <toolset>msvc-9.0:<build>no <toolset>msvc-10.0:<build>no <link>static <runtime-link>static <threading>single release : link_test_ssr ;
|
||||
|
||||
run ../main.cpp link_test
|
||||
: : : <link>static <runtime-link>static <threading>multi debug : link_test_smd ;
|
||||
@ -113,3 +114,4 @@ run ../main.cpp link_test
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user