]>
Commit | Line | Data |
---|---|---|
92f5a8d4 | 1 | # Copyright (C) 2012-2019 Antony Polukhin |
7c673cae FG |
2 | # |
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) | |
5 | # | |
6 | ||
7 | import testing ; | |
8 | import feature ; | |
9 | import os ; | |
10 | ||
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 ; | |
13 | ||
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. | |
92f5a8d4 | 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-" ; |
7c673cae | 17 | |
92f5a8d4 | 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" ; |
7c673cae FG |
19 | |
20 | ||
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) ; | |
26 | ||
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 ; | |
31 | ||
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) ; | |
37 | ||
38 | exe testing_crossmodule_anonymous_no_rtti : testing_crossmodule_anonymous.cpp test_lib_anonymous_nortti : <rtti>off $(norttidefines) ; | |
39 | ||
40 | test-suite type_index | |
41 | : | |
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 ] | |
11fdf7f2 | 49 | [ run testing_crossmodule_anonymous.cpp test_lib_anonymous_rtti : : : <test-info>always_show_run_output ] |
7c673cae | 50 | [ run compare_ctti_stl.cpp ] |
92f5a8d4 | 51 | [ run track_13621.cpp ] |
7c673cae FG |
52 | |
53 | [ compile-fail type_index_test_ctti_copy_fail.cpp ] | |
54 | [ compile-fail type_index_test_ctti_construct_fail.cpp ] | |
55 | [ compile type_index_test_ctti_alignment.cpp ] | |
56 | ||
57 | # Mixing RTTI on and off | |
11fdf7f2 TL |
58 | |
59 | # MSVC sometimes overrides the /GR-, without `detect_missmatch` this test may link. | |
60 | # TODO: Disabled on MSVC. Enable again when there'll be an understanding of how to write this test correctly wor MSVC. | |
61 | [ link-fail testing_crossmodule.cpp test_lib_rtti : $(nortti) <toolset>msvc:<build>no : link_fail_nortti_rtti ] | |
62 | [ link-fail testing_crossmodule.cpp test_lib_nortti : <toolset>msvc:<build>no : link_fail_rtti_nortti ] | |
63 | ||
7c673cae FG |
64 | [ run testing_crossmodule.cpp test_lib_rtti_compat : : : $(nortti) $(compat) : testing_crossmodule_nortti_rtti_compat ] |
65 | [ run testing_crossmodule.cpp test_lib_nortti_compat : : : $(compat) : testing_crossmodule_rtti_nortti_compat ] | |
66 | ; | |
67 | ||
68 | # Assuring that examples compile and run. Adding sources from `examples` directory to the `type_index` test suite. | |
69 | for local p in [ glob ../examples/*.cpp ] | |
70 | { | |
71 | # RTTI on | |
72 | type_index += [ run $(p) ] ; | |
73 | ||
74 | # RTTI off | |
75 | local target_name = $(p[1]:B)_no_rtti ; | |
76 | if $(target_name) != "table_of_names_no_rtti" | |
77 | { | |
78 | type_index += [ run $(p) : : : <rtti>off $(norttidefines) : $(target_name) ] ; | |
79 | } | |
80 | } | |
81 |