Jamfile.v2 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Copyright (C) 2012-2019 Antony Polukhin
  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. import testing ;
  7. import feature ;
  8. import os ;
  9. # Variable that contains all the stuff required for linking together <rtti>on and <rtti>off
  10. compat = <define>BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY ;
  11. # Making own `nortti` that is link compatible.
  12. # We explicitly define BOOST_NO_RTTI because it sometimes can not be detected by build system.
  13. 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-" ;
  14. 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" ;
  15. # Making libraries that CANNOT work between rtti-on/rtti-off modules
  16. obj test_lib_nortti-obj : test_lib.cpp : <link>shared <rtti>off $(norttidefines) ;
  17. obj test_lib_anonymous_nortti-obj : test_lib_anonymous.cpp : <link>shared <rtti>off $(norttidefines) ;
  18. lib test_lib_nortti : test_lib_nortti-obj : <link>shared <rtti>off $(norttidefines) ;
  19. lib test_lib_anonymous_nortti : test_lib_anonymous_nortti-obj : <link>shared <rtti>off $(norttidefines) ;
  20. obj test_lib_rtti-obj : test_lib.cpp : <link>shared ;
  21. obj test_lib_anonymous_rtti-obj : test_lib_anonymous.cpp : <link>shared ;
  22. lib test_lib_rtti : test_lib_rtti-obj : <link>shared ;
  23. lib test_lib_anonymous_rtti : test_lib_anonymous_rtti-obj : <link>shared ;
  24. # Making libraries that can work between rtti-on/rtti-off modules
  25. obj test_lib_nortti_compat-obj : test_lib.cpp : <link>shared $(nortti) $(compat) ;
  26. obj test_lib_rtti_compat-obj : test_lib.cpp : <link>shared $(nortti) $(compat) ;
  27. lib test_lib_nortti_compat : test_lib_nortti_compat-obj : <link>shared $(nortti) $(compat) ;
  28. lib test_lib_rtti_compat : test_lib_rtti_compat-obj : <link>shared $(nortti) $(compat) ;
  29. exe testing_crossmodule_anonymous_no_rtti : testing_crossmodule_anonymous.cpp test_lib_anonymous_nortti : <rtti>off $(norttidefines) ;
  30. test-suite type_index
  31. :
  32. [ run type_index_test.cpp ]
  33. [ run type_index_runtime_cast_test.cpp ]
  34. [ run type_index_constexpr_test.cpp ]
  35. [ run type_index_test.cpp : : : <rtti>off $(norttidefines) : type_index_test_no_rtti ]
  36. [ run ctti_print_name.cpp : : : <test-info>always_show_run_output ]
  37. [ run testing_crossmodule.cpp test_lib_rtti ]
  38. [ run testing_crossmodule.cpp test_lib_nortti : : : <rtti>off $(norttidefines) : testing_crossmodule_no_rtti ]
  39. [ run testing_crossmodule_anonymous.cpp test_lib_anonymous_rtti : : : <test-info>always_show_run_output ]
  40. [ run compare_ctti_stl.cpp ]
  41. [ run track_13621.cpp ]
  42. [ compile-fail type_index_test_ctti_copy_fail.cpp ]
  43. [ compile-fail type_index_test_ctti_construct_fail.cpp ]
  44. [ compile type_index_test_ctti_alignment.cpp ]
  45. # Mixing RTTI on and off
  46. # MSVC sometimes overrides the /GR-, without `detect_missmatch` this test may link.
  47. # TODO: Disabled on MSVC. Enable again when there'll be an understanding of how to write this test correctly wor MSVC.
  48. [ link-fail testing_crossmodule.cpp test_lib_rtti : $(nortti) <toolset>msvc:<build>no : link_fail_nortti_rtti ]
  49. [ link-fail testing_crossmodule.cpp test_lib_nortti : <toolset>msvc:<build>no : link_fail_rtti_nortti ]
  50. [ run testing_crossmodule.cpp test_lib_rtti_compat : : : $(nortti) $(compat) : testing_crossmodule_nortti_rtti_compat ]
  51. [ run testing_crossmodule.cpp test_lib_nortti_compat : : : $(compat) : testing_crossmodule_rtti_nortti_compat ]
  52. ;
  53. # Assuring that examples compile and run. Adding sources from `examples` directory to the `type_index` test suite.
  54. for local p in [ glob ../examples/*.cpp ]
  55. {
  56. # RTTI on
  57. type_index += [ run $(p) ] ;
  58. # RTTI off
  59. local target_name = $(p[1]:B)_no_rtti ;
  60. if $(target_name) != "table_of_names_no_rtti"
  61. {
  62. type_index += [ run $(p) : : : <rtti>off $(norttidefines) : $(target_name) ] ;
  63. }
  64. }