1 ################################################################################
3 # Copyright (c) 2007-2008 Dario Senic, Jurko Gospodnetic.
5 # Use, modification and distribution is subject to the Boost Software
6 # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
7 # http://www.boost.org/LICENSE_1_0.txt)
9 ################################################################################
11 ################################################################################
13 # Boost Build wxFormBuilder generator tool module.
15 # wxFormBuilder is a GUI designer tool for the wxWidgets library. It can then
16 # generate C++ sources modeling the designed GUI using the wxWidgets library
19 # This module defines a wxFormBuilder project file type and rules needed to
20 # generate C++ source files from those projects. With it you can simply list
21 # wxFormBuilder projects as sources for some target and Boost Build will
22 # automatically convert them to C++ sources and process from there.
24 # The wxFormBuilder executable location may be provided as a parameter when
25 # configuring this toolset. Otherwise the default wxFormBuilder.exe executable
26 # name is used located in the folder pointed to by the WXFORMBUILDER environment
29 # Current limitations:
31 # * Works only on Windows.
32 # * Works only when run via Boost Jam using the native Windows cmd.exe command
33 # interpreter, i.e. the default native Windows Boost Jam build.
34 # * Used wxFormBuilder projects need to have their output file names defined
35 # consistently with target names assumed by this build script. This means
36 # that their target names must use the prefix 'wxFormBuilderGenerated_' and
37 # have no output folder defined where the base name is equal to the .fpb
38 # project file's name.
40 ################################################################################
42 ################################################################################
44 # Implementation note:
46 # Avoiding the limitation on the generated target file names can be done but
47 # would require depending on external tools to copy the wxFormBuilder project to
48 # a temp location and then modify it in-place to set its target file names. On
49 # the other hand wxFormBuilder is expected to add command-line options for
50 # choosing the target file names from the command line which will allow us to
51 # remove this limitation in a much cleaner way.
52 # (23.08.2008.) (Jurko)
54 ################################################################################
63 ################################################################################
65 # wxFormBuilder.generate()
66 # ------------------------
68 # Action for processing WX_FORM_BUILDER_PROJECT types.
70 ################################################################################
72 # Implementation notes:
74 # wxFormBuilder generated CPP and H files need to be moved to the location
75 # where the Boost Build target system expects them so that the generated CPP
76 # file can be included into the compile process and that the clean rule
77 # succesfully deletes both CPP and H files. We expect wxFormBuilder to generate
78 # files in the same location where the provided WX_FORM_BUILDER_PROJECT file is
80 # (15.05.2007.) (Dario)
82 ################################################################################
86 start "" /wait "$(EXECUTABLE)" /g "$(2)"
87 move "$(1[1]:BSR=$(2:P))" "$(1[1]:P)"
88 move "$(1[2]:BSR=$(2:P))" "$(1[2]:P)"
92 ################################################################################
94 # wxFormBuilder.init()
95 # --------------------
97 # Main toolset initialization rule called via the toolset.using rule.
99 ################################################################################
101 rule init ( executable ? )
105 if $(.debug-configuration)
107 ECHO notice: [wxFormBuilder-cfg] Repeated initialization request
108 (executable \"$(executable:E="")\") detected and ignored. ;
113 local environmentVariable = WXFORMBUILDER ;
115 if $(.debug-configuration)
117 ECHO notice: [wxFormBuilder-cfg] Configuring wxFormBuilder... ;
120 # Deduce the path to the used wxFormBuilder executable.
123 executable = "wxFormBuilder.exe" ;
124 local executable-path = [ os.environ $(environmentVariable) ] ;
125 if $(executable-path)-is-not-empty
127 executable = [ path.root $(executable) $(executable-path) ] ;
129 else if $(.debug-configuration)
131 ECHO notice: [wxFormBuilder-cfg] No wxFormBuilder path
132 configured either explicitly or using the
133 $(environmentVariable) environment variable. ;
134 ECHO notice: [wxFormBuilder-cfg] To avoid complications please
135 update your configuration to includes a correct path to the
136 wxFormBuilder executable. ;
137 ECHO notice: [wxFormBuilder-cfg] wxFormBuilder executable will
138 be searched for on the system path. ;
141 if $(.debug-configuration)
143 ECHO notice: [wxFormBuilder-cfg] Will use wxFormBuilder executable
147 # Now we are sure we have everything we need to initialize this toolset.
148 .initialized = true ;
150 # Store the path to the used wxFormBuilder executable.
151 .executable = $(executable) ;
154 type.register WX_FORM_BUILDER_PROJECT : fbp ;
156 # Parameters to be forwarded to the action rule.
157 toolset.flags wxFormBuilder.generate EXECUTABLE : $(.executable) ;
159 # Generator definition and registration.
160 generators.register-standard wxFormBuilder.generate :
161 WX_FORM_BUILDER_PROJECT : CPP(wxFormBuilderGenerated_%)
162 H(wxFormBuilderGenerated_%) ;
167 ################################################################################
169 # wxFormBuilder.is-initialized()
170 # ------------------------------
172 # Returns whether this toolset has been initialized.
174 ################################################################################
176 rule is-initialized ( )
178 return $(.initialized) ;
182 ################################################################################
184 # Startup code executed when loading this module.
186 ################################################################################
188 # Global variables for this module.
192 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
194 .debug-configuration = true ;