-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to verify headers are self-contained
For each header, a translation unit is generated along with corresponding compile target. Currently, only boost/gil/*.hpp and boost/gil/io/* headres are included.
- Loading branch information
Showing
3 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,74 @@ | ||
# Boost.GIL (Generic Image Library) - tests | ||
# | ||
# Copyright (c) 2007-2015 Andrey Semashev | ||
# Copyright (c) 2008 Lubomir Bourdev, Hailin Jin | ||
# Copyright (c) 2018 Mateusz Loskot <mateusz@loskot.net> | ||
# | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or | ||
# copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
import path ; | ||
import regex ; | ||
import testing ; | ||
|
||
project | ||
: requirements | ||
: requirements | ||
<include>$(BOOST_ROOT) | ||
<include>. | ||
; | ||
; | ||
|
||
# This rule is based on script copied from similar rule in Boost.Log | ||
rule test_self_contained_headers | ||
{ | ||
local all_rules = ; | ||
local all_targets = ; | ||
local top_headers_path = [ path.make $(BOOST_ROOT)/libs/gil/include/boost/gil ] ; | ||
|
||
# NOTE: All '/' in test names are replaced with '-' because apparently | ||
# test scripts have a problem with test names containing slashes. | ||
|
||
# boost/gil core headers | ||
for local file in [ path.glob-tree $(top_headers_path) : *.hpp : extension io ] | ||
{ | ||
local rel_file = [ path.relative-to $(top_headers_path) $(file) ] ; | ||
local target = [ regex.replace self-contained/$(rel_file) "/" "-" ] ; | ||
all_rules += [ | ||
compile self_contained_header.cpp | ||
: <define>"BOOST_GIL_TEST_HEADER=$(rel_file)" <dependency>$(file) | ||
: $(target) | ||
] ; | ||
all_targets += $(target) ; | ||
} | ||
|
||
# boost/gil/io headers | ||
local headers_path = [ path.make $(BOOST_ROOT)/libs/gil/include/boost/gil/io ] ; | ||
for local file in [ path.glob-tree $(headers_path) : *.hpp : ] | ||
{ | ||
local rel_file = [ path.relative-to $(top_headers_path) $(file) ] ; | ||
local target = [ regex.replace self-contained/$(rel_file) "/" "-" ] ; | ||
all_rules += [ | ||
compile self_contained_header.cpp | ||
: <define>"BOOST_GIL_TEST_HEADER=$(rel_file)" <dependency>$(file) | ||
: $(target) | ||
] ; | ||
all_targets += $(target) ; | ||
} | ||
|
||
#explicit $(all_targets) ; | ||
return $(all_rules) ; | ||
} | ||
|
||
alias self_contained_headers : [ test_self_contained_headers ] ; | ||
#explicit self_contained_headers ; # TODO: Uncomment all `#explicit` to build on-demand | ||
|
||
run promote_integral.cpp ; | ||
run image.cpp sample_image.cpp error_if.cpp : : gil_reference_checksums.txt ; | ||
run channel.cpp error_if.cpp ; | ||
run pixel.cpp error_if.cpp ; | ||
run pixel_iterator.cpp error_if.cpp ; | ||
|
||
alias perf : | ||
[ run performance.cpp ] | ||
; | ||
explicit perf ; | ||
|
||
build-project channel ; | ||
build-project image_view ; | ||
|
||
alias perf : [ run performance.cpp ] ; | ||
explicit perf ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Copyright (c) 2007-2015 Andrey Semashev | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See | ||
// accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
// This file contains a test boilerplate for checking that every public header | ||
// is self-contained and does not have any missing #include-s. | ||
|
||
#define BOOST_GIL_TEST_INCLUDE_HEADER() <boost/gil/BOOST_GIL_TEST_HEADER> | ||
|
||
#include BOOST_GIL_TEST_INCLUDE_HEADER() | ||
|
||
int main() | ||
{ | ||
return 0; | ||
} |