1# Boost.Geometry (aka GGL, Generic Geometry Library) 2# 3# Copyright (c) 2018 Mateusz Loskot <mateusz@loskot.net> 4# 5# Use, modification and distribution is subject to the Boost Software License, 6# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7# http://www.boost.org/LICENSE_1_0.txt) 8 9import os ; 10import path ; 11import regex ; 12 13rule generate_self_contained_headers ( headers_subpath ) 14{ 15 # This rule is based on script copied from similar rule in Boost.GIL 16 # On CI services, test the self-contained headers on-demand only to avoid build timeouts 17 # CI environment is common for Travis CI, AppVeyor, CircleCI, etc. 18 # For example: 19 # if ! [ os.environ CI ] || [ os.environ TEST_HEADERS ] { 20 # alias self_contained_headers : [ generate_self_contained_headers ] ; 21 # } 22 23 local targets ; 24 25 # NOTE: All '/' in test names are replaced with '-' because apparently 26 # test scripts have a problem with test names containing slashes. 27 28 local top_headers_path = [ path.make $(BOOST_ROOT)/libs/geometry/include/boost/geometry ] ; 29 30 for local file in [ path.glob-tree $(top_headers_path)/$(headers_subpath) : *.hpp ] 31 { 32 local rel_file = [ path.relative-to $(top_headers_path) $(file) ] ; 33 local target_name = [ regex.replace h/$(rel_file) "/" "-" ] ; 34 local target_name = [ regex.replace $(target_name) "\.hpp" "" ] ; 35 targets += [ 36 compile $(BOOST_ROOT)/libs/geometry/test/headers/main.cpp 37 : <define>"BOOST_GEOMETRY_TEST_HEADER=$(rel_file)" <dependency>$(file) 38 : $(target_name) 39 ] ; 40 } 41 42 return $(targets) ; 43} 44 45# TODO: Review sorting to get as close as possible from general to specific 46 47# Core 48alias core : [ generate_self_contained_headers core ] ; 49alias util : [ generate_self_contained_headers util ] ; 50alias policies : [ generate_self_contained_headers policies ] ; 51alias geometries : [ generate_self_contained_headers geometries ] ; 52alias concepts : [ generate_self_contained_headers concepts ] ; 53alias arithmetic : [ generate_self_contained_headers arithmetic ] ; 54alias formulas : [ generate_self_contained_headers formulas ] ; 55alias iterators : [ generate_self_contained_headers iterators ] ; 56alias strategies : [ generate_self_contained_headers strategies ] ; 57alias srs : [ generate_self_contained_headers srs ] ; 58alias algorithms : [ generate_self_contained_headers algorithms ] ; 59alias views : [ generate_self_contained_headers views ] ; 60# Even though index is a separate submodule test headers here 61alias index : [ generate_self_contained_headers index ] ; 62