|
Boost-Build : |
From: Colin D Bennett (guppychiller_at_[hidden])
Date: 2007-07-19 17:16:26
> On Wednesday 11 July 2007 11:55, Jos Hickson wrote:
> > I still haven't managed to find a proper fix for this. My solution at
> > the moment is to add <cxxflags>-O2 to our Jamroot for release builds:
> > the -O2 appears after the -O3 and therefore is the setting use but
> > that does not seem a particularly neat approach.
>
> There's no nice solution. One possibility is to make a copy of gcc.jam,
> edit it to taste, and change BOOST_BUILD_PATH so that your copy of
> gcc.jam
> is found first.
I modified my gcc.jam file to make -O0 and -O3 defaults for the
optimization options, but if the user-config.jam pokes another value
into special variables in the gcc module, the flags used for
optimization=off and optimization=speed, etc., are overridden by the
user settings.
I don't know if attachments work on this list, so here is my sample
user-config.jam, and following it a diff of my system gcc.jam.
Regards,
Colin
((( begin my user-config.jam )))
# Customize gcc optimization flags
import modules ;
modules.poke gcc : optimization-off-flags : -O ;
modules.poke gcc : optimization-speed-flags : -O2 ;
using gcc : 4.1 : g++-4.1.2 ;
using gcc : 4.2 : g++-4.2.0 ;
using gcc : 3.4 : g++-3.4.6 ;
((( end my user-config.jam )))
--- gcc.jam.orig 2007-07-19 12:04:51.000000000 -0700
+++ gcc.jam 2007-07-19 13:53:18.000000000 -0700
@@ -267,21 +267,30 @@
flags gcc.compile PCH_FILE <pch>on : <pch-file> ;
# Declare flags and action for compilation
-flags gcc.compile OPTIONS <optimization>off : -O0 ;
-flags gcc.compile OPTIONS <optimization>speed : -O3 ;
-flags gcc.compile OPTIONS <optimization>space : -Os ;
+optimization-off-flags ?= -O0 ;
+optimization-speed-flags ?= -O3 ;
+optimization-space-flags ?= -Os ;
+flags gcc.compile OPTIONS <optimization>off : $(optimization-off-flags) ;
+flags gcc.compile OPTIONS <optimization>speed :
$(optimization-speed-flags) ;
+flags gcc.compile OPTIONS <optimization>space :
$(optimization-space-flags) ;
flags gcc.compile OPTIONS <inlining>off : -fno-inline ;
flags gcc.compile OPTIONS <inlining>on : -Wno-inline ;
flags gcc.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ;
-flags gcc.compile OPTIONS <warnings>off : -w ;
-flags gcc.compile OPTIONS <warnings>on : -Wall ;
-flags gcc.compile OPTIONS <warnings>all : -Wall -pedantic ;
-flags gcc.compile OPTIONS <warnings-as-errors>on : -Werror ;
-
-flags gcc.compile OPTIONS <debug-symbols>on : -g ;
-flags gcc.compile OPTIONS <profiling>on : -pg ;
+warnings-off-flags ?= -w ;
+warnings-on-flags ?= -Wall ;
+warnings-all-flags ?= -Wall -pedantic ;
+warnings-as-errors-on-flags ?= -Werror ;
+flags gcc.compile OPTIONS <warnings>off : $(warnings-off-flags) ;
+flags gcc.compile OPTIONS <warnings>on : $(warnings-on-flags) ;
+flags gcc.compile OPTIONS <warnings>all : $(warnings-all-flags) ;
+flags gcc.compile OPTIONS <warnings-as-errors>on :
$(warnings-as-errors-on-flags) ;
+
+debug-symbols-on-flags ?= -g ;
+profiling-on-flags ?= -pg ;
+flags gcc.compile OPTIONS <debug-symbols>on : $(debug-symbols-on-flags) ;
+flags gcc.compile OPTIONS <profiling>on : $(profiling-on-flags) ;
# On cygwin and mingw, gcc generates position independent code by default,
# and warns if -fPIC is specified. This might not be the right way
# of checking if we're using cygwin. For example, it's possible
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk