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)
18 local here = [ modules.binding $(__name__) ] ;
20 project.push-current [ project.current ] ;
21 project.load [ path.join [ path.make $(here:D) ] config/has-bcrypt ] ;
27 # Disable warnings about using 'insecure' standard C functions
28 <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
29 <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
30 <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
31 <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
32 <toolset>intel-win:<define>_SCL_SECURE_NO_WARNINGS
33 <toolset>intel-win:<define>_SCL_SECURE_NO_DEPRECATE
34 <toolset>intel-win:<define>_CRT_SECURE_NO_WARNINGS
35 <toolset>intel-win:<define>_CRT_SECURE_NO_DEPRECATE
38 # 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.
43 # This rule makes sure the tests are run only on Windows
44 rule filter-target-os ( properties * )
47 if ! ( <target-os>windows in $(properties) || <target-os>cygwin in $(properties) )
55 # The rule tests if the Windows SDK supports BCrypt API and library
56 rule check-has-bcrypt ( properties * )
60 local has_bcrypt = [ configure.builds /boost/winapi/test/has-bcrypt//has_bcrypt : $(properties) : windows-sdk-supports-bcrypt ] ;
69 # This rule enumerates through all the sources and invokes
70 # the run rule for each source, the result is a list of all
71 # the run rules, which we can pass on to the test_suite rule:
76 local headers_path = [ path.make $(BOOST_ROOT)/libs/winapi/include/boost/winapi ] ;
77 for file in [ path.glob-tree $(headers_path) : *.hpp : detail ]
79 local rel_file = [ path.relative-to [ path.parent $(headers_path) ] $(file) ] ;
80 # Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
81 # All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
82 local test_name = [ regex.replace $(rel_file) "/" "-" ] ;
83 local decl_test_name = ~hdr-decl-$(test_name) ;
84 local use_winh_test_name = ~hdr-use-winh-$(test_name) ;
85 local pre_winh_test_name = ~hdr-pre-winh-$(test_name) ;
86 local post_winh_test_name = ~hdr-post-winh-$(test_name) ;
88 all_rules += [ compile compile/decl_header.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(decl_test_name) ] ;
89 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) ] ;
90 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) ] ;
91 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) ] ;
94 headers_path = [ path.make $(BOOST_ROOT)/libs/winapi/include/boost/detail ] ;
95 for file in [ path.glob $(headers_path) : *.hpp : detail ]
97 local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
98 local test_name = [ regex.replace $(rel_file) "/" "-" ] ;
99 local decl_test_name = ~hdr-decl-$(test_name) ;
100 local use_winh_test_name = ~hdr-use-winh-$(test_name) ;
101 local pre_winh_test_name = ~hdr-pre-winh-$(test_name) ;
102 local post_winh_test_name = ~hdr-post-winh-$(test_name) ;
104 all_rules += [ compile compile/decl_header.cpp : <conditional>@filter-target-os <define>"BOOST_WINAPI_TEST_HEADER=detail/$(rel_file)" <dependency>$(file) : $(decl_test_name) ] ;
105 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) ] ;
106 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) ] ;
107 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) ] ;
110 for file in [ glob run/*.cpp ]
112 local reqs = <conditional>@filter-target-os <define>"BOOST_WINAPI_DEFINE_VERSION_MACROS=1" ;
113 local test_name = [ path.basename $(file) ] ;
114 if $(test_name) = "winapi_info.cpp"
116 reqs += <test-info>always_show_run_output ;
118 else if $(test_name) = "bcrypt_abi.cpp"
120 reqs += <conditional>@check-has-bcrypt ;
121 reqs += <library>bcrypt ;
123 else if $(test_name) = "crypt_abi.cpp" || $(test_name) = "pipes_abi.cpp" || $(test_name) = "security_abi.cpp"
125 reqs += <library>advapi32 ;
127 else if $(test_name) = "show_window_abi.cpp"
129 reqs += <library>user32 ;
132 all_rules += [ run $(file) : : : $(reqs) ] ;
135 #ECHO All rules: $(all_rules) ;
136 return $(all_rules) ;
139 test-suite winapi : [ test_all ] ;