📄 build-system.jam
字号:
local test-config = [ MATCH ^--test-config=(.*)$ : $(.argv) ] ; local uq = [ MATCH \"(.*)\" : $(test-config) ] ; if $(uq) { test-config = $(uq) ; } if $(test-config) { local where = [ load-config test-config : $(test-config:BS) : $(test-config:D) ] ; if $(where) { if $(.debug-config) && ! $(.legacy-ignore-config) { ECHO "notice: Regular site and user configuration files will" ; ECHO "notice: be ignored due to the test configuration being" "loaded." ; } } else { test-config = ; } } local user-path = [ os.home-directories ] [ os.environ BOOST_BUILD_PATH ] ; local site-path = /etc $(user-path) ; if [ os.name ] in NT CYGWIN { site-path = [ modules.peek : SystemRoot ] $(user-path) ; } if $(ignore-site-config) && !$(.legacy-ignore-config) { ECHO "notice: Site configuration files will be ignored due to the" ; ECHO "notice: --ignore-site-config command-line option." ; } initialize-config-module site-config ; if ! $(test-config) && ! $(ignore-site-config) && ! $(.legacy-ignore-config) { load-config site-config : site-config.jam : $(site-path) ; } initialize-config-module user-config ; if ! $(test-config) && ! $(.legacy-ignore-config) { local user-config = [ MATCH ^--user-config=(.*)$ : $(.argv) ] ; user-config = $(user-config[-1]) ; user-config ?= [ os.environ BOOST_BUILD_USER_CONFIG ] ; # Special handling for the case when the OS does not strip the quotes # around the file name, as is the case when using Cygwin bash. user-config = [ utility.unquote $(user-config) ] ; local explicitly-requested = $(user-config) ; user-config ?= user-config.jam ; if $(user-config) { if $(explicitly-requested) { # Treat explicitly entered user paths as native OS path # references and, if non-absolute, root them at the current # working directory. user-config = [ path.make $(user-config) ] ; user-config = [ path.root $(user-config) [ path.pwd ] ] ; user-config = [ path.native $(user-config) ] ; if $(.debug-config) { ECHO "notice: Loading explicitly specified user" "configuration file:" ; ECHO " $(user-config)" ; } load-config user-config : $(user-config:BS) : $(user-config:D) : must-exist ; } else { load-config user-config : $(user-config) : $(user-path) ; } } else if $(.debug-config) { ECHO "notice: User configuration file loading explicitly disabled." ; } }}# Autoconfigure toolsets based on any instances of --toolset=xx,yy,...zz or# toolset=xx,yy,...zz in the command line. May return additional properties to# be processed as if they had been specified by the user.#local rule process-explicit-toolset-requests{ local extra-properties ; local option-toolsets = [ regex.split-list [ MATCH ^--toolset=(.*)$ : $(.argv) ] : "," ] ; local feature-toolsets = [ regex.split-list [ MATCH ^toolset=(.*)$ : $(.argv) ] : "," ] ; for local t in $(option-toolsets) $(feature-toolsets) { # Parse toolset-version/properties. local (t-v,t,v) = [ MATCH (([^-/]+)-?([^/]+)?)/?.* : $(t) ] ; local toolset-version = $((t-v,t,v)[1]) ; local toolset = $((t-v,t,v)[2]) ; local version = $((t-v,t,v)[3]) ; if $(.debug-config) { ECHO notice: [cmdline-cfg] Detected command-line request for $(toolset-version): "toolset=" $(toolset) "version=" $(version) ; } # If the toolset is not known, configure it now. local known ; if $(toolset) in [ feature.values <toolset> ] { known = true ; } if $(known) && $(version) && ! [ feature.is-subvalue toolset : $(toolset) : version : $(version) ] { known = ; } # TODO: we should do 'using $(toolset)' in case no version has been # specified and there are no versions defined for the given toolset to # allow the toolset to configure its default version. For this we need # to know how to detect whether a given toolset has any versions # defined. An alternative would be to do this whenever version is not # specified but that would require that toolsets correctly handle the # case when their default version is configured multiple times which # should be checked for all existing toolsets first. if ! $(known) { if $(.debug-config) { ECHO notice: [cmdline-cfg] toolset $(toolset-version) not previously configured; attempting to auto-configure now ; } toolset.using $(toolset) : $(version) ; } else { if $(.debug-config) { ECHO notice: [cmdline-cfg] toolset $(toolset-version) already configured ; } } # Make sure we get an appropriate property into the build request in # case toolset has been specified using the "--toolset=..." command-line # option form. if ! $(t) in $(.argv) && ! $(t) in $(feature-toolsets) { if $(.debug-config) { ECHO notice: [cmdline-cfg] adding toolset=$(t) to the build request. ; } extra-properties += toolset=$(t) ; } } return $(extra-properties) ;}# Returns 'true' if the given 'project' is equal to or is a (possibly indirect)# child to any of the projects requested to be cleaned in this build system run.# Returns 'false' otherwise. Expects the .project-targets list to have already# been constructed.#local rule should-clean-project ( project ){ if ! $(.should-clean-project.$(project)) { local r = false ; if $(project) in $(.project-targets) { r = true ; } else { local parent = [ project.attribute $(project) parent-module ] ; if $(parent) && $(parent) != user-config { r = [ should-clean-project $(parent) ] ; } } .should-clean-project.$(project) = $(r) ; } return $(.should-clean-project.$(project)) ;}################################################################################## main()# ------#################################################################################{ if --version in $(.argv) { version.print ; EXIT ; } load-configuration-files ; local extra-properties ; # Note that this causes --toolset options to be ignored if --ignore-config # is specified. if ! $(.legacy-ignore-config) { extra-properties = [ process-explicit-toolset-requests ] ; } # We always load project in "." so that 'use-project' directives have any # chance of being seen. Otherwise, we would not be able to refer to # subprojects using target ids. local current-project ; if [ project.find "." : "." ] { current-project = [ project.target [ project.load "." ] ] ; } # In case there are no toolsets currently defined makes the build run using # the default toolset. if ! $(.legacy-ignore-config) && ! [ feature.values <toolset> ] { local default-toolset = $(.default-toolset) ; local default-toolset-version = ; if $(default-toolset) { default-toolset-version = $(.default-toolset-version) ; } else { default-toolset = gcc ; if [ os.name ] = NT { default-toolset = msvc ; } } ECHO "warning: No toolsets are configured." ; ECHO "warning: Configuring default toolset" \"$(default-toolset)\". ; ECHO "warning: If the default is wrong, your build may not work correctly." ; ECHO "warning: Use the \"toolset=xxxxx\" option to override our guess." ; ECHO "warning: For more configuration options, please consult" ; ECHO "warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html" ; toolset.using $(default-toolset) : $(default-toolset-version) ; } # Parse command line for targets and properties. Note that this requires # that all project files already be loaded. local build-request = [ build-request.from-command-line $(.argv) $(extra-properties) ] ; local target-ids = [ $(build-request).get-at 1 ] ; local properties = [ $(build-request).get-at 2 ] ; # Expand properties specified on the command line into multiple property # sets consisting of all legal property combinations. Each expanded property # set will be used for a single build run. E.g. if multiple toolsets are # specified then requested targets will be built with each of them. if $(properties) { expanded = [ build-request.expand-no-defaults $(properties) ] ; local xexpanded ; for local e in $(expanded) { xexpanded += [ property-set.create [ feature.split $(e) ] ] ; } expanded = $(xexpanded) ; } else { expanded = [ property-set.empty ] ; } # Check that we actually found something to build. if ! $(current-project) && ! $(target-ids) { errors.user-error "error: no Jamfile in current directory found, and no" "target references specified." ; EXIT ; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -