1 # Copyright (C) 2012-2014 Antony Polukhin
3 # Distributed under the Boost Software License, Version 1.0. (See accompanying
4 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 # Variable that contains all the stuff required for linking together <rtti>on and <rtti>off
12 compat = <define>BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY ;
14 # Making own `nortti` that is link compatible.
15 # We explicitly define BOOST_NO_RTTI because it sometimes can not be detected by build system.
16 nortti = <toolset>gcc:"<cxxflags>-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>clang:"<cxxflags>-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>intel:"<cxxflags>-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>darwin:"<cxxflags>-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>msvc:<cxxflags>/GR- ;
18 norttidefines = <toolset>gcc:"<cxxflags>-DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>clang:"<cxxflags>-DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>intel:"<cxxflags>-DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>darwin:"<cxxflags>-DBOOST_NO_RTTI -DBOOST_NO_TYPEID" <toolset>msvc:<cxxflags>-DBOOST_NO_RTTI ;
21 # Making libraries that CANNOT work between rtti-on/rtti-off modules
22 obj test_lib_nortti-obj : test_lib.cpp : <link>shared <rtti>off $(norttidefines) ;
23 obj test_lib_anonymous_nortti-obj : test_lib_anonymous.cpp : <link>shared <rtti>off $(norttidefines) ;
24 lib test_lib_nortti : test_lib_nortti-obj : <link>shared <rtti>off $(norttidefines) ;
25 lib test_lib_anonymous_nortti : test_lib_anonymous_nortti-obj : <link>shared <rtti>off $(norttidefines) ;
27 obj test_lib_rtti-obj : test_lib.cpp : <link>shared ;
28 obj test_lib_anonymous_rtti-obj : test_lib_anonymous.cpp : <link>shared ;
29 lib test_lib_rtti : test_lib_rtti-obj : <link>shared ;
30 lib test_lib_anonymous_rtti : test_lib_anonymous_rtti-obj : <link>shared ;
32 # Making libraries that can work between rtti-on/rtti-off modules
33 obj test_lib_nortti_compat-obj : test_lib.cpp : <link>shared $(nortti) $(compat) ;
34 obj test_lib_rtti_compat-obj : test_lib.cpp : <link>shared $(nortti) $(compat) ;
35 lib test_lib_nortti_compat : test_lib_nortti_compat-obj : <link>shared $(nortti) $(compat) ;
36 lib test_lib_rtti_compat : test_lib_rtti_compat-obj : <link>shared $(nortti) $(compat) ;
38 exe testing_crossmodule_anonymous_no_rtti : testing_crossmodule_anonymous.cpp test_lib_anonymous_nortti : <rtti>off $(norttidefines) ;
42 [ run type_index_test.cpp ]
43 [ run type_index_runtime_cast_test.cpp ]
44 [ run type_index_constexpr_test.cpp ]
45 [ run type_index_test.cpp : : : <rtti>off $(norttidefines) : type_index_test_no_rtti ]
46 [ run ctti_print_name.cpp : : : <test-info>always_show_run_output ]
47 [ run testing_crossmodule.cpp test_lib_rtti ]
48 [ run testing_crossmodule.cpp test_lib_nortti : : : <rtti>off $(norttidefines) : testing_crossmodule_no_rtti ]
49 [ run testing_crossmodule_anonymous.cpp test_lib_anonymous_rtti : : : <test-info>always_show_run_output ]
50 [ run compare_ctti_stl.cpp ]
52 [ compile-fail type_index_test_ctti_copy_fail.cpp ]
53 [ compile-fail type_index_test_ctti_construct_fail.cpp ]
54 [ compile type_index_test_ctti_alignment.cpp ]
56 # Mixing RTTI on and off
58 # MSVC sometimes overrides the /GR-, without `detect_missmatch` this test may link.
59 # TODO: Disabled on MSVC. Enable again when there'll be an understanding of how to write this test correctly wor MSVC.
60 [ link-fail testing_crossmodule.cpp test_lib_rtti : $(nortti) <toolset>msvc:<build>no : link_fail_nortti_rtti ]
61 [ link-fail testing_crossmodule.cpp test_lib_nortti : <toolset>msvc:<build>no : link_fail_rtti_nortti ]
63 [ run testing_crossmodule.cpp test_lib_rtti_compat : : : $(nortti) $(compat) : testing_crossmodule_nortti_rtti_compat ]
64 [ run testing_crossmodule.cpp test_lib_nortti_compat : : : $(compat) : testing_crossmodule_rtti_nortti_compat ]
67 # Assuring that examples compile and run. Adding sources from `examples` directory to the `type_index` test suite.
68 for local p in [ glob ../examples/*.cpp ]
71 type_index += [ run $(p) ] ;
74 local target_name = $(p[1]:B)_no_rtti ;
75 if $(target_name) != "table_of_names_no_rtti"
77 type_index += [ run $(p) : : : <rtti>off $(norttidefines) : $(target_name) ] ;