1 # Copyright (c) 2001 David Abrahams.
2 # Copyright (c) 2002-2003 Rene Rivera.
3 # Copyright (c) 2002-2003 Vladimir Prus.
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)
21 feature.extend toolset : qcc ;
23 toolset.inherit-generators qcc : unix : unix.link unix.link.dll ;
24 generators.override builtin.lib-generator : qcc.prebuilt ;
25 toolset.inherit-flags qcc : unix ;
26 toolset.inherit-rules qcc : unix ;
28 # Initializes the qcc toolset for the given version. If necessary, command may
29 # be used to specify where the compiler is located. The parameter 'options' is a
30 # space-delimited list of options, each one being specified as
31 # <option-name>option-value. Valid option names are: cxxflags, linkflags and
32 # linker-type. Accepted values for linker-type are gnu and sun, gnu being the
36 # using qcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ;
38 rule init ( version ? : command * : options * )
40 local condition = [ common.check-init-parameters qcc : version $(version) ] ;
41 local command = [ common.get-invocation-command qcc : QCC : $(command) ] ;
42 common.handle-options qcc : $(condition) : $(command) : $(options) ;
46 generators.register-c-compiler qcc.compile.c++ : CPP : OBJ : <toolset>qcc ;
47 generators.register-c-compiler qcc.compile.c : C : OBJ : <toolset>qcc ;
48 generators.register-c-compiler qcc.compile.asm : ASM : OBJ : <toolset>qcc ;
51 # Declare flags for compilation.
52 toolset.flags qcc.compile OPTIONS <debug-symbols>on : -gstabs+ ;
54 # Declare flags and action for compilation.
55 toolset.flags qcc.compile OPTIONS <optimization>off : -O0 ;
56 toolset.flags qcc.compile OPTIONS <optimization>speed : -O3 ;
57 toolset.flags qcc.compile OPTIONS <optimization>space : -Os ;
59 toolset.flags qcc.compile OPTIONS <inlining>off : -Wc,-fno-inline ;
60 toolset.flags qcc.compile OPTIONS <inlining>on : -Wc,-Wno-inline ;
61 toolset.flags qcc.compile OPTIONS <inlining>full : -Wc,-finline-functions -Wc,-Wno-inline ;
63 toolset.flags qcc.compile OPTIONS <warnings>off : -w ;
64 toolset.flags qcc.compile OPTIONS <warnings>all : -Wc,-Wall ;
65 toolset.flags qcc.compile OPTIONS <warnings-as-errors>on : -Wc,-Werror ;
67 toolset.flags qcc.compile OPTIONS <profiling>on : -p ;
69 toolset.flags qcc.compile OPTIONS <cflags> ;
70 toolset.flags qcc.compile.c++ OPTIONS <cxxflags> ;
71 toolset.flags qcc.compile DEFINES <define> ;
72 toolset.flags qcc.compile INCLUDES <include> ;
74 toolset.flags qcc.compile OPTIONS <link>shared : -shared ;
76 toolset.flags qcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
81 # Here we want to raise the template-depth parameter value to something
82 # higher than the default value of 17. Note that we could do this using the
83 # feature.set-default rule but we do not want to set the default value for
84 # all toolsets as well.
86 # TODO: This 'modified default' has been inherited from some 'older Boost
87 # Build implementation' and has most likely been added to make some Boost
88 # library parts compile correctly. We should see what exactly prompted this
89 # and whether we can get around the problem more locally.
90 local template-depth = [ on $(1) return $(TEMPLATE_DEPTH) ] ;
91 if ! $(template-depth)
93 TEMPLATE_DEPTH on $(1) = 128 ;
99 "$(CONFIG_COMMAND)" -Wc,-ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
104 "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
109 "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
113 # The class checking that we do not try to use the <runtime-link>static property
114 # while creating or using a shared library, since it is not supported by qcc/
117 class qcc-linking-generator : unix-linking-generator
119 rule generated-targets ( sources + : property-set : project name ? )
121 if <runtime-link>static in [ $(property-set).raw ]
124 if [ id ] = "qcc.link.dll"
126 m = "on qcc, DLL can't be build with <runtime-link>static" ;
130 for local s in $(sources)
132 local type = [ $(s).type ] ;
133 if $(type) && [ type.is-derived $(type) SHARED_LIB ]
135 m = "on qcc, using DLLS together with the <runtime-link>static options is not possible " ;
141 errors.user-error $(m) : "It is suggested to use"
142 "<runtime-link>static together with <link>static." ;
146 return [ unix-linking-generator.generated-targets
147 $(sources) : $(property-set) : $(project) $(name) ] ;
151 generators.register [ new qcc-linking-generator qcc.link : LIB OBJ : EXE
154 generators.register [ new qcc-linking-generator qcc.link.dll : LIB OBJ
155 : SHARED_LIB : <toolset>qcc ] ;
157 generators.override qcc.prebuilt : builtin.prebuilt ;
158 generators.override qcc.searched-lib-generator : searched-lib-generator ;
161 # Declare flags for linking.
162 # First, the common flags.
163 toolset.flags qcc.link OPTIONS <debug-symbols>on : -gstabs+ ;
164 toolset.flags qcc.link OPTIONS <profiling>on : -p ;
165 toolset.flags qcc.link OPTIONS <linkflags> ;
166 toolset.flags qcc.link LINKPATH <library-path> ;
167 toolset.flags qcc.link FINDLIBS-ST <find-static-library> ;
168 toolset.flags qcc.link FINDLIBS-SA <find-shared-library> ;
169 toolset.flags qcc.link LIBRARIES <library-file> ;
171 toolset.flags qcc.link FINDLIBS-SA : m ;
173 # For <runtime-link>static we made sure there are no dynamic libraries in the
175 toolset.flags qcc.link OPTIONS <runtime-link>static : -static ;
177 # Assuming this is just like with gcc.
178 toolset.flags qcc.link RPATH : <dll-path> : unchecked ;
179 toolset.flags qcc.link RPATH_LINK : <xdll-path> : unchecked ;
182 # Declare actions for linking.
184 rule link ( targets * : sources * : properties * )
186 SPACE on $(targets) = " " ;
187 # Serialize execution of the 'link' action, since running N links in
188 # parallel is just slower. For now, serialize only qcc links while it might
189 # be a good idea to serialize all links.
190 JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
193 actions link bind LIBRARIES
195 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)
199 # Always remove archive and start again. Here is the rationale from Andre Hentz:
200 # I had a file, say a1.c, that was included into liba.a. I moved a1.c to a2.c,
201 # updated my Jamfiles and rebuilt. My program was crashing with absurd errors.
202 # After some debugging I traced it back to the fact that a1.o was *still* in
204 RM = [ common.rm-command ] ;
207 RM = "if exist \"$(<[1])\" DEL \"$(<[1])\"" ;
211 # Declare action for creating static libraries. The 'r' letter means to add
212 # files to the archive with replacement. Since we remove the archive, we do not
213 # care about replacement, but there is no option to "add without replacement".
214 # The 'c' letter suppresses warnings in case the archive does not exists yet.
215 # That warning is produced only on some platforms, for whatever reasons.
217 # Use qcc driver to create archive, see
218 # http://www.qnx.com/developers/docs/6.3.2/neutrino/utilities/q/qcc.html
219 actions piecemeal archive
222 "$(CONFIG_COMMAND)" -A "$(<)" "$(>)"
226 rule link.dll ( targets * : sources * : properties * )
228 SPACE on $(targets) = " " ;
229 JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
233 # Differ from 'link' above only by -shared.
235 actions link.dll bind LIBRARIES
237 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" $(HAVE_SONAME)-Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)