From 0d58137ae0ba7f225f6f22749d33db51c90ba2d4 Mon Sep 17 00:00:00 2001 From: "K. Noel Belcourt" Date: Wed, 26 Dec 2007 22:17:03 +0000 Subject: [PATCH] Add support for intel-darwin toolset and fix intel.jam to dispatch intel toolset on darwin to intel-darwin. [SVN r42309] --- v2/tools/intel-darwin.jam | 211 ++++++++++++++++++++++++++++++++++++++ v2/tools/intel.jam | 7 +- 2 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 v2/tools/intel-darwin.jam diff --git a/v2/tools/intel-darwin.jam b/v2/tools/intel-darwin.jam new file mode 100644 index 000000000..7a8feb4f5 --- /dev/null +++ b/v2/tools/intel-darwin.jam @@ -0,0 +1,211 @@ +# Copyright Vladimir Prus 2004. +# Copyright Noel Belcourt 2007. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt +# or copy at http://www.boost.org/LICENSE_1_0.txt) + +import intel ; +import feature : feature ; +import os ; +import toolset ; +import toolset : flags ; +import gcc ; +import common ; +import errors ; +import generators ; + +feature.extend-subfeature toolset intel : platform : darwin ; + +toolset.inherit-generators intel-darwin + intel darwin : gcc ; + +generators.override intel-darwin.prebuilt : builtin.lib-generator ; +generators.override intel-darwin.prebuilt : builtin.prebuilt ; +generators.override intel-darwin.searched-lib-generator : searched-lib-generator ; + +toolset.inherit-rules intel-darwin : gcc ; +toolset.inherit-flags intel-darwin : gcc + : off on full space + off all on + x86/32 + x86/64 + ; + +if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] +{ + .debug-configuration = true ; +} + +# vectorization diagnostics +feature vectorize : off on full ; + +# Initializes the intel-darwin toolset +# version in mandatory +# name (default icc) is used to invoke the specified intel complier +# compile and link options allow you to specify addition command line options for each version +rule init ( version ? : command * : options * ) +{ + local condition = [ common.check-init-parameters intel-darwin + : version $(version) ] ; + + command = [ common.get-invocation-command intel-darwin : icc + : $(command) : /opt/intel_cc_80/bin ] ; + + common.handle-options intel-darwin : $(condition) : $(command) : $(options) ; + + gcc.init-link-flags intel-darwin darwin $(condition) ; + + # handle + # local library-path = [ feature.get-values : $(options) ] ; + # flags intel-darwin.link USER_OPTIONS $(condition) : [ feature.get-values : $(options) ] ; + + local root = [ feature.get-values : $(options) ] ; + local bin ; + if $(command) || $(root) + { + bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; + root ?= $(bin:D) ; + + if $(root) + { + local lib_path = $(root)/lib ; + if $(.debug-configuration) + { + ECHO notice: using intel libraries :: $(condition) :: $(lib_path) ; + } + flags intel-darwin.link RUN_PATH $(condition) : $(lib_path) ; + } + } + + local m = [ MATCH (..).* : $(version) ] ; + local n = [ MATCH (.)\\. : $(m) ] ; + if $(n) { + m = $(n) ; + } + + local major = $(m) ; + + if $(major) = "8" { + flags intel-darwin.compile OPTIONS $(condition)/off : -Ob0 ; + flags intel-darwin.compile OPTIONS $(condition)/on : -Ob1 ; + flags intel-darwin.compile OPTIONS $(condition)/full : -Ob2 ; + flags intel-darwin.link OPTIONS $(condition)/static : -static -static-libcxa -lstdc++ -lpthread ; + flags intel-darwin.link OPTIONS $(condition)/shared : -shared-libcxa -lstdc++ -lpthread ; + } + else if $(major) = "9" { + flags intel-darwin.compile OPTIONS $(condition)/off : -Ob0 ; + flags intel-darwin.compile OPTIONS $(condition)/on : -Ob1 ; + flags intel-darwin.compile OPTIONS $(condition)/full : -Ob2 ; + flags intel-darwin.compile OPTIONS $(condition)/off : -vec-report0 ; + flags intel-darwin.compile OPTIONS $(condition)/on : -vec-report1 ; + flags intel-darwin.compile OPTIONS $(condition)/full : -vec-report5 ; + flags intel-darwin.link OPTIONS $(condition)/static : -static -static-libcxa -lstdc++ -lpthread ; + flags intel-darwin.link OPTIONS $(condition)/shared : -shared-libcxa -lstdc++ -lpthread ; + } + else { + flags intel-darwin.compile OPTIONS $(condition)/off : -inline-level=0 ; + flags intel-darwin.compile OPTIONS $(condition)/on : -inline-level=1 ; + flags intel-darwin.compile OPTIONS $(condition)/full : -inline-level=2 ; + flags intel-darwin.compile OPTIONS $(condition)/off : -vec-report0 ; + flags intel-darwin.compile OPTIONS $(condition)/on : -vec-report1 ; + flags intel-darwin.compile OPTIONS $(condition)/full : -vec-report5 ; + flags intel-darwin.link OPTIONS $(condition)/static : -static -static-intel -lstdc++ -lpthread ; + flags intel-darwin.link OPTIONS $(condition)/shared : -shared-intel -lstdc++ -lpthread ; + } +} + +SPACE = " " ; + +flags intel-darwin.compile OPTIONS ; +flags intel-darwin.compile OPTIONS ; +# flags intel-darwin.compile INCLUDES ; + +flags intel-darwin.compile OPTIONS space : -O1 ; # no specific space optimization flag in icc + +# +cpu-type-em64t = prescott nocona ; +# flags intel-darwin.compile OPTIONS $(cpu-type-em64t)/32 : -mcmodel=small ; +flags intel-darwin.compile OPTIONS $(cpu-type-em64t)/64 : -mcmodel=large ; + +flags intel-darwin.compile.c OPTIONS off : -w0 ; +flags intel-darwin.compile.c OPTIONS on : -w1 ; +flags intel-darwin.compile.c OPTIONS all : -w2 ; + +flags intel-darwin.compile.c++ OPTIONS off : -w0 ; +flags intel-darwin.compile.c++ OPTIONS on : -w1 ; +flags intel-darwin.compile.c++ OPTIONS all : -w2 ; + +actions compile.c +{ + "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + +actions compile.c++ +{ + "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" +} + +flags intel-darwin ARFLAGS ; + +# Default value. Mostly for the sake of intel-linux +# that inherits from gcc, but does not has the same +# logic to set the .AR variable. We can put the same +# logic in intel-linux, but that's hardly worth the trouble +# as on Linux, 'ar' is always available. +.AR = ar ; + +rule archive ( targets * : sources * : properties * ) +{ + # Always remove archive and start again. Here's rationale from + # Andre Hentz: + # + # I had a file, say a1.c, that was included into liba.a. + # I moved a1.c to a2.c, updated my Jamfiles and rebuilt. + # My program was crashing with absurd errors. + # After some debugging I traced it back to the fact that a1.o was *still* + # in liba.a + # + # Rene Rivera: + # + # Originally removing the archive was done by splicing an RM + # onto the archive action. That makes archives fail to build on NT + # when they have many files because it will no longer execute the + # action directly and blow the line length limit. Instead we + # remove the file in a different action, just before the building + # of the archive. + # + local clean.a = $(targets[1])(clean) ; + TEMPORARY $(clean.a) ; + NOCARE $(clean.a) ; + LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; + DEPENDS $(clean.a) : $(sources) ; + DEPENDS $(targets) : $(clean.a) ; + common.RmTemps $(clean.a) : $(targets) ; +} + +actions piecemeal archive +{ + "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" + "ranlib" -cs "$(<)" +} + +flags intel-darwin.link USER_OPTIONS ; + +# Declare actions for linking +rule link ( targets * : sources * : properties * ) +{ + SPACE on $(targets) = " " ; + # Serialize execution of the 'link' action, since + # running N links in parallel is just slower. + JAM_SEMAPHORE on $(targets) = intel-darwin-link-semaphore ; +} + +actions link bind LIBRARIES +{ + "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) +} + +actions link.dll bind LIBRARIES +{ + "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) +} diff --git a/v2/tools/intel.jam b/v2/tools/intel.jam index bb02305c2..81865281e 100644 --- a/v2/tools/intel.jam +++ b/v2/tools/intel.jam @@ -16,11 +16,16 @@ feature.subfeature toolset intel : platform : : propagated link-incompatible ; rule init ( * : * ) { - if [ os.name ] = LINUX || [ os.name ] = MACOSX + if [ os.name ] = LINUX { toolset.using intel-linux : $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; } + else if [ os.name ] = MACOSX + { + toolset.using intel-darwin : + $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; + } else { toolset.using intel-win :