1 # Copyright 2001 David Abrahams.
2 # Copyright 2004, 2005 Markus Schoepflin.
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
8 # See http://h30097.www3.hp.com/cplus/?jumpid=reg_R1002_USEN
11 # Notes on this toolset:
13 # - Because of very subtle issues with the default ansi mode, strict_ansi mode
14 # is used for compilation. One example of things that don't work correctly in
15 # the default ansi mode is overload resolution of function templates when
16 # mixed with non-template functions.
18 # - For template instantiation "-timplicit_local" is used. Previously,
19 # "-tlocal" has been tried to avoid the need for a template repository
20 # but this doesn't work with manually instantiated templates. "-tweak"
21 # has not been used to avoid the stream of warning messages issued by
22 # ar or ld when creating a library or linking an application.
24 # - Debug symbols are generated with "-g3", as this works both in debug and
25 # release mode. When compiling C++ code without optimization, we additionally
26 # use "-gall", which generates full symbol table information for all classes,
27 # structs, and unions. As this turns off optimization, it can't be used when
28 # optimization is needed.
31 import feature generators common ;
32 import toolset : flags ;
34 feature.extend toolset : hp_cxx ;
35 feature.extend c++abi : cxxarm ;
37 # Inherit from Unix toolset to get library ordering magic.
38 toolset.inherit hp_cxx : unix ;
40 generators.override hp_cxx.prebuilt : builtin.lib-generator ;
41 generators.override hp_cxx.prebuilt : builtin.prebuilt ;
42 generators.override hp_cxx.searched-lib-generator : searched-lib-generator ;
45 rule init ( version ? : command * : options * )
47 local condition = [ common.check-init-parameters hp_cxx : version $(version) ] ;
49 local command = [ common.get-invocation-command hp_cxx : cxx : $(command) ] ;
53 local root = [ common.get-absolute-tool-path $(command[-1]) ] ;
57 flags hp_cxx .root $(condition) : "\"$(root)\"/" ;
60 # If we can't find 'cxx' anyway, at least show 'cxx' in the commands
63 common.handle-options hp_cxx : $(condition) : $(command) : $(options) ;
66 generators.register-c-compiler hp_cxx.compile.c++ : CPP : OBJ : <toolset>hp_cxx ;
67 generators.register-c-compiler hp_cxx.compile.c : C : OBJ : <toolset>hp_cxx ;
71 # No static linking as far as I can tell.
72 # flags cxx LINKFLAGS <runtime-link>static : -bstatic ;
73 flags hp_cxx.compile OPTIONS <debug-symbols>on : -g3 ;
74 flags hp_cxx.compile OPTIONS <optimization>off/<debug-symbols>on : -gall ;
75 flags hp_cxx.link OPTIONS <debug-symbols>on : -g ;
76 flags hp_cxx.link OPTIONS <debug-symbols>off : -s ;
78 flags hp_cxx.compile OPTIONS <optimization>off : -O0 ;
79 flags hp_cxx.compile OPTIONS <optimization>speed/<inlining>on : -O2 ;
80 flags hp_cxx.compile OPTIONS <optimization>speed : -O2 ;
82 # This (undocumented) macro needs to be defined to get all C function
83 # overloads required by the C++ standard.
84 flags hp_cxx.compile.c++ OPTIONS : -D__CNAME_OVERLOADS ;
86 # Added for threading support
87 flags hp_cxx.compile OPTIONS <threading>multi : -pthread ;
88 flags hp_cxx.link OPTIONS <threading>multi : -pthread ;
90 flags hp_cxx.compile OPTIONS <optimization>space/<inlining>on : <inlining>size ;
91 flags hp_cxx.compile OPTIONS <optimization>space : -O1 ;
92 flags hp_cxx.compile OPTIONS <inlining>off : -inline none ;
94 # The compiler versions tried (up to V6.5-040) hang when compiling Boost code
95 # with full inlining enabled. So leave it at the default level for now.
97 # flags hp_cxx.compile OPTIONS <inlining>full : -inline all ;
99 flags hp_cxx.compile OPTIONS <profiling>on : -pg ;
100 flags hp_cxx.link OPTIONS <profiling>on : -pg ;
102 # Selection of the object model. This flag is needed on both the C++ compiler
103 # and linker command line.
105 # Unspecified ABI translates to '-model ansi' as most
106 # standard-conforming.
107 flags hp_cxx.compile.c++ OPTIONS <c++abi> : -model ansi : : hack-hack ;
108 flags hp_cxx.compile.c++ OPTIONS <c++abi>cxxarm : -model arm ;
109 flags hp_cxx.link OPTIONS <c++abi> : -model ansi : : hack-hack ;
110 flags hp_cxx.link OPTIONS <c++abi>cxxarm : -model arm ;
112 # Display a descriptive tag together with each compiler message. This tag can
113 # be used by the user to explicitely suppress the compiler message.
114 flags hp_cxx.compile OPTIONS : -msg_display_tag ;
116 flags hp_cxx.compile OPTIONS <cflags> ;
117 flags hp_cxx.compile.c++ OPTIONS <cxxflags> ;
118 flags hp_cxx.compile DEFINES <define> ;
119 flags hp_cxx.compile INCLUDES <include> ;
120 flags hp_cxx.link OPTIONS <linkflags> ;
122 flags hp_cxx.link LIBPATH <library-path> ;
123 flags hp_cxx.link LIBRARIES <library-file> ;
124 flags hp_cxx.link FINDLIBS-ST <find-static-library> ;
125 flags hp_cxx.link FINDLIBS-SA <find-shared-library> ;
127 flags hp_cxx.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
129 actions link bind LIBRARIES
131 $(CONFIG_COMMAND) -noimplicit_include $(OPTIONS) -o "$(<)" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) -lrt -lm
134 # When creating dynamic libraries, we don't want to be warned about unresolved
135 # symbols, therefore all unresolved symbols are marked as expected by
136 # '-expect_unresolved *'. This also mirrors the behaviour of the GNU tool
139 actions link.dll bind LIBRARIES
141 $(CONFIG_COMMAND) -shared -expect_unresolved \* -noimplicit_include $(OPTIONS) -o "$(<[1])" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) -lm
145 # Note: Relaxed ANSI mode (-std) is used for compilation because in strict ANSI
146 # C89 mode (-std1) the compiler doesn't accept C++ comments in C files. As -std
147 # is the default, no special flag is needed.
150 $(.root:E=)cc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
153 # Note: The compiler is forced to compile the files as C++ (-x cxx) because
154 # otherwise it will silently ignore files with no file extension.
156 # Note: We deliberately don't suppress any warnings on the compiler command
157 # line, the user can always do this in a customized toolset later on.
161 # We preprocess the TEMPLATE_DEPTH command line option here because we found
162 # no way to do it correctly in the actual action code. There we either get
163 # the -pending_instantiations parameter when no c++-template-depth property
164 # has been specified or we get additional quotes around
165 # "-pending_instantiations ".
166 local template-depth = [ on $(1) return $(TEMPLATE_DEPTH) ] ;
167 TEMPLATE_DEPTH on $(1) = "-pending_instantiations "$(template-depth) ;
172 $(CONFIG_COMMAND) -x cxx -c -std strict_ansi -nopure_cname -noimplicit_include -timplicit_local -ptr "$(<[1]:D)/cxx_repository" $(OPTIONS) $(TEMPLATE_DEPTH) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
175 # Always create archive from scratch. See the gcc toolet for rationale.
176 RM = [ common.rm-command ] ;
177 actions together piecemeal archive