2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-14 00:32:11 +00:00
Files
build/gcc.jam
Vladimir Prus cfe61e5caa Introduce the <dll-path> and <hardcode-dll-paths> features.
* gcc.jam: Handle the <dll-path> feature.

* builtin.jam
    New features <dll-path> and <hardcode-dll-paths>.
    (link-action.adjust-properties): Add library's
    full paths to <dll-path> when <hardcode-dll-paths>
    is specified.


[SVN r16588]
2002-12-11 17:40:48 +00:00

103 lines
3.8 KiB
Plaintext

import property ;
import generators ;
import os ;
feature.extend toolset : gcc ;
feature.subfeature toolset gcc : version : : optional ;
# Initializes the gcc toolset
# Each argument has the form:
# version binary-name [path]
# And specifies the name / path that should be used to invoke
# the specified gcc version. The default version will be always called
# with 'g++'.
rule init ( a1 * : a2 * : a3 * )
{
if $(a1)
{
local version = $(a1[1]) ;
local name = $(a1[2]) ;
local path = $(a1[3]) ;
feature.extend-subfeature toolset gcc : version : $(version) ;
# NOTE: this should be collapsed in one line once
# 'toolset.flags' supports specifying module name.
toolset.flags gcc.compile NAME <toolset>gcc/<toolset-version>$(version) : $(name) ;
toolset.flags gcc.link NAME <toolset>gcc/<toolset-version>$(version) : $(name) ;
toolset.flags gcc.link-dll NAME <toolset>gcc/<toolset-version>$(version) : $(name) ;
# TODO: set path accordingly.
}
}
# Declare generators
generators.register-linker gcc.link : LIB OBJ : EXE : <toolset>gcc ;
generators.register-composing gcc.archive : OBJ : STATIC_LIB : <toolset>gcc ;
generators.register-linker gcc.link-dll : OBJ : SHARED_LIB : <toolset>gcc ;
generators.register-c-compiler gcc.compile : CPP : OBJ : <toolset>gcc ;
generators.register-c-compiler gcc.compile : C : OBJ : <toolset>gcc ;
# Declare flags and action for compilation
toolset.flags gcc.compile OPTIONS <optimization>on : -O2 ;
toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ;
toolset.flags gcc.compile OPTIONS <cxxflags> ;
toolset.flags gcc.compile DEFINES <define> ;
toolset.flags gcc.compile INCLUDES <include> ;
actions compile
{
$(NAME:E=g++) -ftemplate-depth-100 $(OPTIONS) -D$(DEFINES) -I$(INCLUDES) -c -o $(<) $(>)
}
# Declare flags and action for linking
toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ;
toolset.flags gcc.link OPTIONS <linkflags> ;
toolset.flags gcc.link LINKPATH <library-path> ;
toolset.flags gcc.link FINDLIBS-ST <find-static-library> ;
toolset.flags gcc.link FINDLIBS-SA <find-shared-library> ;
toolset.flags gcc.link LIBRARIES <library> ;
toolset.flags gcc.link LINK-RUNTIME <link-runtime>static : static ;
toolset.flags gcc.link LINK-RUNTIME <link-runtime>shared : dynamic ;
toolset.flags gcc.link-dll RPATH <dll-path> ;
rule link ( targets * : sources * : properties * )
{
SPACE on $(targets) = " " ;
}
actions link bind LIBRARIES
{
$(NAME:E=g++) $(OPTIONS) -L$(LINKPATH) -Wl,-rpath$(SPACE)-Wl,$(RPATH) -o $(<) $(>) $(LIBRARIES) -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) $(LIBRARIES) -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
}
# Declare action for creating static libraries
actions archive
{
ar ur $(<) $(>)
}
# Declare flags and action for linking shared libraries
toolset.flags gcc.link-dll OPTIONS <debug-symbols>on : -g ;
toolset.flags gcc.link-dll OPTIONS <linkflags> ;
toolset.flags gcc.link-dll LINKPATH <library-path> ;
toolset.flags gcc.link-dll FINDLIBS-ST <find-static-library> ;
toolset.flags gcc.link-dll FINDLIBS-SA <find-shared-library> ;
toolset.flags gcc.link-dll LIBRARIES <library> ;
toolset.flags gcc.link-dll LINK-RUNTIME <link-runtime>static : static ;
toolset.flags gcc.link-dll LINK-RUNTIME <link-runtime>shared : dynamic ;
toolset.flags gcc.link RPATH <dll-path> ;
rule link-dll ( targets * : sources * : properties * )
{
SPACE on $(targets) = " " ;
}
actions link-dll bind LIBRARIES
{
$(NAME:E=g++) $(OPTIONS) -Wl,-rpath$(SPACE)-Wl,$(RPATH) -o $(<) -Wl,-soname,$(<[1]:D=) -shared $(>) $(LIBRARIES) -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) $(LIBRARIES) -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
}