• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /usr/bin/env python
2# -*- coding: utf-8 -*-
3# ===========================================================================
4#  Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5#  Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
6#  Copyright (c) 2009-2012 Mateusz Loskot (mateusz@loskot.net), London, UK
7#  Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland
8#
9#  Copyright (c) 2018, Oracle and/or its affiliates.
10#  Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
11#  Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
12#  Use, modification and distribution is subject to the Boost Software License,
13#  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
14#  http://www.boost.org/LICENSE_1_0.txt)
15# ============================================================================
16
17import os, sys, shutil
18
19script_dir = os.path.dirname(__file__)
20os.chdir(os.path.abspath(script_dir))
21print("Boost.Geometry is making .qbk files in %s" % os.getcwd())
22
23if 'DOXYGEN' in os.environ:
24    doxygen_cmd = os.environ['DOXYGEN']
25else:
26    doxygen_cmd = 'doxygen'
27
28if 'DOXYGEN_XML2QBK' in os.environ:
29    doxygen_xml2qbk_cmd = os.environ['DOXYGEN_XML2QBK']
30elif '--doxygen-xml2qbk' in sys.argv:
31    doxygen_xml2qbk_cmd = sys.argv[sys.argv.index('--doxygen-xml2qbk')+1]
32else:
33    doxygen_xml2qbk_cmd = 'doxygen_xml2qbk'
34os.environ['PATH'] = os.environ['PATH']+os.pathsep+os.path.dirname(doxygen_xml2qbk_cmd)
35doxygen_xml2qbk_cmd = os.path.basename(doxygen_xml2qbk_cmd)
36
37cmd = doxygen_xml2qbk_cmd
38cmd = cmd + " --xml doxy/doxygen_output/xml/%s.xml"
39cmd = cmd + " --start_include boost/geometry/"
40cmd = cmd + " --convenience_header_path ../../../boost/geometry/"
41cmd = cmd + " --convenience_headers geometry.hpp,geometries/geometries.hpp"
42cmd = cmd + " --skip_namespace boost::geometry::"
43cmd = cmd + " --copyright src/copyright_block.qbk"
44cmd = cmd + " --output_member_variables false"
45cmd = cmd + " > generated/%s.qbk"
46
47def run_command(command):
48    if os.system(command) != 0:
49        raise Exception("Error running %s" % command)
50
51def remove_all_files(dir_relpath):
52    if os.path.exists(dir_relpath):
53        dir_abspath = os.path.join(os.getcwd(), dir_relpath)
54        print("Boost.Geometry is cleaning Doxygen files in %s" % dir_abspath)
55        shutil.rmtree(dir_abspath, ignore_errors=True)
56
57def call_doxygen():
58    os.chdir("doxy")
59    remove_all_files("doxygen_output/xml/")
60    run_command(doxygen_cmd)
61    os.chdir("..")
62
63def group_to_quickbook(section):
64    run_command(cmd % ("group__" + section.replace("_", "__"), section))
65
66def model_to_quickbook(section):
67    run_command(cmd % ("classboost_1_1geometry_1_1model_1_1" + section.replace("_", "__"), section))
68
69def model_to_quickbook2(classname, section):
70    run_command(cmd % ("classboost_1_1geometry_1_1model_1_1" + classname, section))
71
72def struct_to_quickbook(section):
73    run_command(cmd % ("structboost_1_1geometry_1_1" + section.replace("_", "__"), section))
74
75def class_to_quickbook(section):
76    run_command(cmd % ("classboost_1_1geometry_1_1" + section.replace("_", "__"), section))
77
78def class_to_quickbook2(classname, section):
79    run_command(cmd % ("classboost_1_1geometry_1_1" + classname, section))
80
81def srs_class_to_quickbook(section):
82    run_command(cmd % ("classboost_1_1geometry_1_1srs_1_1" + section.replace("_", "__"), "srs_" + section))
83
84def strategy_to_quickbook(section):
85    p = section.find("::")
86    ns = section[:p]
87    strategy = section[p+2:]
88    run_command(cmd % ("classboost_1_1geometry_1_1strategy_1_1"
89        + ns.replace("_", "__") + "_1_1" + strategy.replace("_", "__"),
90        ns + "_" + strategy))
91
92def cs_to_quickbook(section):
93    run_command(cmd % ("structboost_1_1geometry_1_1cs_1_1" + section.replace("_", "__"), section))
94
95
96call_doxygen()
97
98algorithms = ["append", "assign", "make", "clear"
99    , "area", "buffer", "centroid", "convert", "correct", "covered_by"
100    , "convex_hull", "crosses", "densify", "difference"
101    , "discrete_frechet_distance", "discrete_hausdorff_distance", "disjoint"
102    , "distance", "envelope", "equals", "expand", "for_each", "is_empty"
103    , "is_simple", "is_valid", "intersection", "intersects", "length"
104    , "line_interpolate", "num_geometries", "num_interior_rings"
105    , "num_points", "num_segments", "overlaps", "perimeter", "relate"
106    , "relation", "reverse","simplify", "sym_difference", "touches"
107    , "transform", "union", "unique", "within"]
108
109arithmetic = ["cross_product"]
110
111access_functions = ["get", "set", "exterior_ring", "interior_rings"
112    , "num_points", "num_interior_rings", "num_geometries"]
113
114coordinate_systems = ["cartesian", "geographic", "polar", "spherical", "spherical_equatorial"]
115
116core = ["closure", "coordinate_system", "coordinate_type", "cs_tag"
117    , "dimension", "exception", "interior_type"
118    , "degree", "radian", "point_order"
119    , "point_type", "ring_type", "tag", "tag_cast" ]
120
121exceptions = ["exception", "centroid_exception"];
122
123iterators = ["circular_iterator", "closing_iterator"
124    , "ever_circling_iterator"]
125
126models = ["point", "linestring", "box"
127    , "polygon", "segment", "ring"
128    , "multi_linestring", "multi_point", "multi_polygon", "referring_segment"]
129
130srs = ["spheroid"]
131
132strategies = ["area::cartesian", "area::spherical", "area::geographic"
133    , "buffer::point_circle", "buffer::point_square"
134    , "buffer::join_round", "buffer::join_miter"
135    , "buffer::end_round", "buffer::end_flat"
136    , "buffer::distance_symmetric", "buffer::distance_asymmetric"
137    , "buffer::side_straight"
138    , "buffer::geographic_point_circle"
139    , "centroid::bashein_detmer", "centroid::average"
140    , "convex_hull::graham_andrew"
141    , "densify::cartesian", "densify::geographic", "densify::spherical"
142    , "distance::pythagoras", "distance::pythagoras_box_box"
143    , "distance::pythagoras_point_box", "distance::haversine"
144    , "distance::cross_track", "distance::cross_track_point_box"
145    , "distance::projected_point"
146    , "line_interpolate::cartesian"
147    , "line_interpolate::spherical"
148    , "line_interpolate::geographic"
149    , "simplify::douglas_peucker"
150    , "side::side_by_triangle", "side::side_by_cross_track"
151    , "side::spherical_side_formula", "side::geographic"
152    , "transform::inverse_transformer", "transform::map_transformer"
153    , "transform::rotate_transformer", "transform::scale_transformer"
154    , "transform::translate_transformer", "transform::matrix_transformer"
155    , "within::winding", "within::franklin", "within::crossings_multiply"
156    ]
157
158views = ["box_view", "segment_view"
159    , "closeable_view", "reversible_view", "identity_view"]
160
161
162
163for i in algorithms:
164    group_to_quickbook(i)
165
166for i in access_functions:
167    group_to_quickbook(i)
168
169for i in coordinate_systems:
170    cs_to_quickbook(i)
171
172for i in core:
173    struct_to_quickbook(i)
174
175for i in exceptions:
176    class_to_quickbook(i)
177
178for i in iterators:
179    struct_to_quickbook(i)
180
181for i in models:
182    model_to_quickbook(i)
183
184for i in srs:
185    srs_class_to_quickbook(i)
186
187for i in strategies:
188    strategy_to_quickbook(i)
189
190for i in views:
191    struct_to_quickbook(i)
192
193
194model_to_quickbook2("d2_1_1point__xy", "point_xy")
195model_to_quickbook2("d3_1_1point__xyz", "point_xyz")
196
197group_to_quickbook("arithmetic")
198group_to_quickbook("dsv")
199group_to_quickbook("enum")
200group_to_quickbook("register")
201group_to_quickbook("svg")
202class_to_quickbook("svg_mapper")
203group_to_quickbook("wkt")
204
205class_to_quickbook2("de9im_1_1matrix", "de9im_matrix")
206class_to_quickbook2("de9im_1_1mask", "de9im_mask")
207class_to_quickbook2("de9im_1_1static__mask", "de9im_static_mask")
208
209os.chdir("index")
210exec(compile(open("make_qbk.py", "rb").read(), "make_qbk.py", 'exec'))
211os.chdir("..")
212
213# Clean up generated intermediate files
214if "--release-build" in sys.argv:
215    remove_all_files("doxy/doxygen_output/xml/")
216    remove_all_files("doxy/doxygen_output/html_by_doxygen/")
217    remove_all_files("index/xml/")
218    remove_all_files("index/html_by_doxygen/")
219
220# Use either bjam or b2 or ../../../b2 (the last should be done on Release branch)
221if "--release-build" not in sys.argv:
222    run_command("b2")
223