• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Units documentation Jamfile
2#
3# Copyright (c) 2007-2008
4# Steven Watanabe
5#
6# Distributed under the Boost Software License, Version 1.0. (See
7# accompanying file LICENSE_1_0.txt or copy at
8# http://www.boost.org/LICENSE_1_0.txt
9
10import path ;
11import quickbook ;
12using boostbook ;
13using doxygen ;
14import print ;
15import regex ;
16import sequence ;
17
18path-constant here : . ;
19
20rule run_doxygen ( target : files * : name )
21{
22    doxygen $(target)
23      :
24        $(files)
25      :
26        <doxygen:param>EXTRACT_ALL=YES
27        <doxygen:param>EXPAND_ONLY_PREDEF=YES
28
29        # Horribly ugly, but then macros usually are :(
30        <doxygen:param>"PREDEFINED= \\
31            \"BOOST_MPL_ASSERT(expr)=\" \\
32            \"BOOST_UNITS_STATIC_CONSTANT(a,b)=static const b a\" \\
33            \"BOOST_UNITS_AUTO_STATIC_CONSTANT(a,b)=static const auto a = b\" \\
34            \"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
35            \"BOOST_PREVENT_MACRO_SUBSTITUTION=\" \\
36            \"BOOST_UNITS_HAS_TYPEOF=1\" \\
37            \"BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS(namespace_, name_, name_string, symbol_, factor, other_unit, id)= \\
38                namespace boost { namespace units { namespace namespace_ { \\
39                    struct name_ ## _base_unit : boost::units::base_unit<name_ ## _base_unit, other_unit::dimension_type, id> { \\
40                        static const char* name(); \\
41                        static const char* symbol(); \\
42                    }; \\
43                } } }\" \\
44            \"BOOST_UNITS_DOXYGEN=1\""
45        <doxygen:param>HIDE_UNDOC_MEMBERS=NO
46        <doxygen:param>EXTRACT_PRIVATE=NO
47        <doxygen:param>ENABLE_PREPROCESSING=YES
48        <doxygen:param>MACRO_EXPANSION=YES
49        $(expand)
50        <doxygen:param>SEARCH_INCLUDES=NO
51        <reftitle>$(name)
52    ;
53
54}
55
56run_doxygen units_reference
57  :
58    [ glob $(here)/../../../boost/units/*.hpp :
59           $(here)/../../../boost/units/physical_dimensions.hpp ]
60  :
61    "Units Reference"
62  ;
63
64run_doxygen si_reference
65  :
66    $(here)/../../../boost/units/systems/si.hpp
67    [ path.glob-tree $(here)/../../../boost/units/systems/si : *.hpp : detail ]
68  :
69    "SI System Reference"
70  ;
71
72run_doxygen cgs_reference
73  :
74    $(here)/../../../boost/units/systems/cgs.hpp
75    [ path.glob-tree $(here)/../../../boost/units/systems/cgs : *.hpp : detail ]
76  :
77    "CGS System Reference"
78  ;
79
80rule make_base_units_doc ( directory : name )
81{
82    run_doxygen $(directory)_base_units_reference
83      :
84        [ path.glob-tree $(here)/../../../boost/units/base_units/$(directory) : *.hpp : detail conversions.hpp ]
85      :
86        "$(name) Base Units Reference"
87      ;
88}
89
90make_base_units_doc angle : Angle ;
91make_base_units_doc astronomical : Astronomical ;
92make_base_units_doc cgs : CGS ;
93make_base_units_doc imperial : Imperial ;
94make_base_units_doc information : Information ;
95make_base_units_doc metric : Metric ;
96make_base_units_doc si : SI ;
97make_base_units_doc temperature : Temperature ;
98make_base_units_doc us : US ;
99
100all_base_units_doc = angle astronomical cgs imperial information metric si temperature us ;
101all_base_units_doc = $(all_base_units_doc)_base_units_reference ;
102
103run_doxygen dimensions_reference
104  :
105    $(here)/../../../boost/units/physical_dimensions.hpp
106    [ path.glob-tree $(here)/../../../boost/units/physical_dimensions : *.hpp : detail ]
107  :
108    "Dimensions Reference"
109  ;
110
111run_doxygen trig_reference
112  :
113    #../../../boost/units/systems/trig.hpp
114    [ path.glob-tree $(here)/../../../boost/units/systems/angle : *.hpp : detail ]
115  :
116    "Trigonometry and Angle System Reference"
117  ;
118
119run_doxygen temperature_reference
120  :
121    [ path.glob-tree $(here)/../../../boost/units/systems/temperature : *.hpp : detail ]
122  :
123    "Temperature System Reference"
124  ;
125
126run_doxygen information_reference
127  :
128    $(here)/../../../boost/units/systems/information.hpp
129    [ path.glob-tree $(here)/../../../boost/units/systems/information : *.hpp : detail prefixes.hpp ]
130  :
131    "Information System Reference"
132  ;
133
134run_doxygen abstract_reference
135  :
136    $(here)/../../../boost/units/systems/abstract.hpp
137  :
138    "Abstract System Reference"
139  ;
140
141rule less ( a b )
142{
143    if [ path.basename $(a) ]  < [ path.basename $(b) ]
144    {
145        return true ;
146    }
147}
148
149rule generate-qbk ( target : sources * : properties * )
150{
151    print.output $(target) ;
152    local as-path = [ sequence.transform path.make : $(sources:G=) ] ;
153    local known = ;
154    local duplicated = ;
155    for local file in $(as-path)
156    {
157        local base = [ path.basename $(file) ] ;
158        if $(base) in $(known)
159        {
160            if ! $(base) in $(duplicated)
161            {
162                duplicated += $(base) ;
163            }
164        } else
165        {
166            known += $(base) ;
167        }
168    }
169    for local file in [ sequence.insertion-sort $(as-path) : less ]
170    {
171        local output_filename = [ path.relative-to [ path.make $(here)/../../.. ] $(file) ] ;
172        local base_filename = [ path.basename $(file) ] ;
173        local base_unit = [ regex.replace $(base_filename) "\\.hpp" "" ] ;
174        if $(base_filename) in $(duplicated)
175        {
176            # tack the directory name onto the end
177            local dir-name = [ path.basename [ path.parent $(file) ] ] ;
178            base_unit = "$(base_unit) ($(dir-name))" ;
179        }
180        print.text "[headerref $(output_filename) $(base_unit)][br]" : overwrite ;
181    }
182}
183
184make base_units.qbk : [ path.glob-tree $(here)/../../../boost/units/base_units : *.hpp : detail conversions.hpp ] : @generate-qbk ;
185explicit base_units ;
186
187install base_units_install : base_units.qbk : <location>. ;
188
189xml units
190  :
191    units.qbk
192  :
193    <dependency>base_units_install
194    <dependency>units_reference
195    <dependency>si_reference
196    <dependency>cgs_reference
197    <dependency>$(all_base_units_doc)
198    <dependency>dimensions_reference
199    <dependency>trig_reference
200    <dependency>temperature_reference
201    <dependency>information_reference
202    <dependency>abstract_reference
203;
204
205boostbook standalone
206  :
207    units
208  :
209    <xsl:param>toc.max.depth=1
210    <xsl:param>toc.section.depth=8
211    <xsl:param>chunk.section.depth=8
212    <xsl:param>boost.root="../../../.."
213    <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
214;
215
216###############################################################################
217alias boostdoc
218    : units
219    :
220    :
221    : ;
222explicit boostdoc ;
223alias boostrelease ;
224explicit boostrelease ;
225