Jamfile.v2 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #
  2. # Copyright Andrey Semashev 2015 - 2018.
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE_1_0.txt or copy at
  5. # http://www.boost.org/LICENSE_1_0.txt)
  6. import testing ;
  7. import modules ;
  8. import path ;
  9. import regex ;
  10. import project ;
  11. import configure ;
  12. lib advapi32 ;
  13. lib bcrypt ;
  14. lib user32 ;
  15. local here = [ modules.binding $(__name__) ] ;
  16. project.push-current [ project.current ] ;
  17. project.load [ path.join [ path.make $(here:D) ] config/has-bcrypt ] ;
  18. project.pop-current ;
  19. project
  20. : requirements
  21. # Disable warnings about using 'insecure' standard C functions
  22. <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
  23. <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
  24. <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
  25. <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
  26. <toolset>intel-win:<define>_SCL_SECURE_NO_WARNINGS
  27. <toolset>intel-win:<define>_SCL_SECURE_NO_DEPRECATE
  28. <toolset>intel-win:<define>_CRT_SECURE_NO_WARNINGS
  29. <toolset>intel-win:<define>_CRT_SECURE_NO_DEPRECATE
  30. : default-build
  31. # Testers typically don't specify threading environment and the library can be built and tested for single and multi. I'm more interested in multi though.
  32. <threading>multi
  33. # <link>static
  34. ;
  35. # This rule makes sure the tests are run only on Windows
  36. rule filter-target-os ( properties * )
  37. {
  38. local result ;
  39. if ! ( <target-os>windows in $(properties) || <target-os>cygwin in $(properties) )
  40. {
  41. result = <build>no ;
  42. }
  43. return $(result) ;
  44. }
  45. # The rule tests if the Windows SDK supports BCrypt API and library
  46. rule check-has-bcrypt ( properties * )
  47. {
  48. local result ;
  49. local has_bcrypt = [ configure.builds /boost/winapi/test/has-bcrypt//has_bcrypt : $(properties) : windows-sdk-supports-bcrypt ] ;
  50. if ! $(has_bcrypt)
  51. {
  52. result = <build>no ;
  53. }
  54. return $(result) ;
  55. }
  56. # This rule enumerates through all the sources and invokes
  57. # the run rule for each source, the result is a list of all
  58. # the run rules, which we can pass on to the test_suite rule:
  59. rule test_all
  60. {
  61. local all_rules ;
  62. local file ;
  63. local headers_path = [ path.make $(BOOST_ROOT)/libs/winapi/include/boost/winapi ] ;
  64. for file in [ path.glob-tree $(headers_path) : *.hpp : detail ]
  65. {
  66. local rel_file = [ path.relative-to [ path.parent $(headers_path) ] $(file) ] ;
  67. # Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
  68. # All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
  69. local test_name = [ regex.replace $(rel_file) "/" "-" ] ;
  70. local decl_test_name = ~hdr-decl-$(test_name) ;
  71. local use_winh_test_name = ~hdr-use-winh-$(test_name) ;
  72. local pre_winh_test_name = ~hdr-pre-winh-$(test_name) ;
  73. local post_winh_test_name = ~hdr-post-winh-$(test_name) ;
  74. #ECHO $(rel_file) ;
  75. all_rules += [ compile compile/decl_header.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(decl_test_name) ] ;
  76. all_rules += [ compile compile/decl_header.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=$(rel_file)" <define>"BOOST_USE_WINDOWS_H" <dependency>$(file) : $(use_winh_test_name) ] ;
  77. all_rules += [ compile compile/windows_h_pre.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(pre_winh_test_name) ] ;
  78. all_rules += [ compile compile/windows_h_post.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(post_winh_test_name) ] ;
  79. }
  80. headers_path = [ path.make $(BOOST_ROOT)/libs/winapi/include/boost/detail ] ;
  81. for file in [ path.glob $(headers_path) : *.hpp : detail ]
  82. {
  83. local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
  84. local test_name = [ regex.replace $(rel_file) "/" "-" ] ;
  85. local decl_test_name = ~hdr-decl-$(test_name) ;
  86. local use_winh_test_name = ~hdr-use-winh-$(test_name) ;
  87. local pre_winh_test_name = ~hdr-pre-winh-$(test_name) ;
  88. local post_winh_test_name = ~hdr-post-winh-$(test_name) ;
  89. #ECHO $(rel_file) ;
  90. all_rules += [ compile compile/decl_header.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=detail/$(rel_file)" <dependency>$(file) : $(decl_test_name) ] ;
  91. all_rules += [ compile compile/decl_header.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=detail/$(rel_file)" <define>"BOOST_USE_WINDOWS_H" <dependency>$(file) : $(use_winh_test_name) ] ;
  92. all_rules += [ compile compile/windows_h_pre.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=detail/$(rel_file)" <dependency>$(file) : $(pre_winh_test_name) ] ;
  93. all_rules += [ compile compile/windows_h_post.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=detail/$(rel_file)" <dependency>$(file) : $(post_winh_test_name) ] ;
  94. }
  95. for file in [ glob run/*.cpp ]
  96. {
  97. local reqs = <conditional>@filter-target-os <define>"BOOST_WINAPI_DEFINE_VERSION_MACROS=1" ;
  98. local test_name = [ path.basename $(file) ] ;
  99. if $(test_name) = "winapi_info.cpp"
  100. {
  101. reqs += <test-info>always_show_run_output ;
  102. }
  103. else if $(test_name) = "bcrypt_abi.cpp"
  104. {
  105. reqs += <conditional>@check-has-bcrypt ;
  106. reqs += <library>bcrypt ;
  107. }
  108. else if $(test_name) = "crypt_abi.cpp" || $(test_name) = "pipes_abi.cpp" || $(test_name) = "security_abi.cpp"
  109. {
  110. reqs += <library>advapi32 ;
  111. }
  112. else if $(test_name) = "show_window_abi.cpp"
  113. {
  114. reqs += <library>user32 ;
  115. }
  116. all_rules += [ run $(file) : : : $(reqs) ] ;
  117. }
  118. #ECHO All rules: $(all_rules) ;
  119. return $(all_rules) ;
  120. }
  121. test-suite winapi : [ test_all ] ;