📄 msvc.jam
字号:
C++FLAGS on $(targets[1]) = ; get-rspline $(targets) : -TC ; compile-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ;}rule compile.c.pch ( targets + : sources * : properties * ){ C++FLAGS on $(targets[1]) = ; get-rspline $(targets[1]) : -TC ; get-rspline $(targets[2]) : -TC ; local pch-source = [ on $(<) return $(PCH_SOURCE) ] ; if $(pch-source) { DEPENDS $(<) : $(pch-source) ; compile-c-c++-pch-s $(targets) : $(sources) $(pch-source) ; } else { compile-c-c++-pch $(targets) : $(sources) ; }}# Action for running the C/C++ compiler without using precompiled headers.#actions compile-c-c++{ $(.CC) @"@($(<[1]:W).rsp:E="$(>[1]:W)" -Fo"$(<[1]:W)" -Yu"$(>[3]:D=)" -Fp"$(>[2]:W)" $(CC_RSPLINE))" $(.CC.FILTER)}rule compile-c-c++ ( targets + : sources * ){ DEPENDS $(<[1]) : [ on $(<[1]) return $(PCH_HEADER) ] ; DEPENDS $(<[1]) : [ on $(<[1]) return $(PCH_FILE) ] ;}# Action for running the C/C++ compiler using precompiled headers. In addition# to whatever else it needs to compile, this action also adds a temporary source# .cpp file used to compile the precompiled headers themselves.## The global .escaped-double-quote variable is used to avoid messing up Emacs# syntax highlighting in the messy N-quoted code below.#actions compile-c-c++-pch{ $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" -Yl"__bjam_pch_symbol_$(>[1]:D=)" -Fp"$(<[1]:W)" $(CC_RSPLINE))" "@($(<[1]:W).cpp:E=#include $(.escaped-double-quote)$(>[1]:D=)$(.escaped-double-quote))" $(.CC.FILTER)}# Action for running the C/C++ compiler using precompiled headers. An already# built source file for compiling the precompiled headers is expected to be# given as one of the source parameters.#actions compile-c-c++-pch-s{ $(.CC) @"@($(<[1]:W).rsp:E="$(>[2]:W)" -Fo"$(<[2]:W)" -Yc"$(>[1]:D=)" -Yl"__bjam_pch_symbol_$(>[1]:D=)" -Fp"$(<[1]:W)" $(CC_RSPLINE))" $(.CC.FILTER)}rule compile.c++ ( targets + : sources * : properties * ){ get-rspline $(targets) : -TP ; compile-c-c++ $(<) : $(>) [ on $(<) return $(PCH_FILE) ] [ on $(<) return $(PCH_HEADER) ] ;}rule compile.c++.pch ( targets + : sources * : properties * ){ get-rspline $(targets[1]) : -TP ; get-rspline $(targets[2]) : -TP ; local pch-source = [ on $(<) return $(PCH_SOURCE) ] ; if $(pch-source) { DEPENDS $(<) : $(pch-source) ; compile-c-c++-pch-s $(targets) : $(sources) $(pch-source) ; } else { compile-c-c++-pch $(targets) : $(sources) ; }}# See midl.jam for details.#actions compile.idl{ $(.IDL) /nologo @"@($(<[1]:W).rsp:E=$(.nl)"$(>:W)" $(.nl)-D$(DEFINES) $(.nl)"-I$(INCLUDES:W)" $(.nl)-U$(UNDEFS) $(.nl)$(MIDLFLAGS) $(.nl)/tlb "$(<[1]:W)" $(.nl)/h "$(<[2]:W)" $(.nl)/iid "$(<[3]:W)" $(.nl)/proxy "$(<[4]:W)" $(.nl)/dlldata "$(<[5]:W)")" $(.TOUCH_FILE) "$(<[4]:W)" $(.TOUCH_FILE) "$(<[5]:W)"}actions compile.mc{ $(.MC) $(MCFLAGS) -h "$(<[1]:DW)" -r "$(<[2]:DW)" "$(>:W)"}actions compile.rc{ $(.RC) -l 0x409 -U$(UNDEFS) -D$(DEFINES) -I"$(INCLUDES:W)" -fo "$(<:W)" "$(>:W)"}rule link.dll ( targets + : sources * : properties * ){ DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;}# Incremental linking a DLL causes no end of problems: if the actual exports do# not change, the import .lib file is never updated. Therefore, the .lib is# always out-of-date and gets rebuilt every time. I am not sure that incremental# linking is such a great idea in general, but in this case I am sure we do not# want it.# Windows manifest is a new way to specify dependencies on managed DotNet# assemblies and Windows native DLLs. The manifests are embedded as resources# and are useful in any PE target (both DLL and EXE).if [ os.name ] in NT{ actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% if exist "$(<[1]).manifest" ( $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);1" ) } actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% if exist "$(<[1]).manifest" ( $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);2" ) }}else{ actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" if test -e "$(<[1]).manifest"; then $(.MT) -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);1" fi } actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" if test -e "$(<[1]).manifest"; then $(.MT) -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);2" fi }}################################################################################## Classes.#################################################################################class msvc-pch-generator : pch-generator{ import property-set ; rule run-pch ( project name ? : property-set : sources * ) { # Searching for the header and source file in the sources. local pch-header ; local pch-source ; for local s in $(sources) { if [ type.is-derived [ $(s).type ] H ] { pch-header = $(s) ; } else if [ type.is-derived [ $(s).type ] CPP ] || [ type.is-derived [ $(s).type ] C ] { pch-source = $(s) ; } } if ! $(pch-header) { errors.user-error "can not build pch without pch-header" ; } # If we do not have the PCH source - that is fine. We will just create a # temporary .cpp file in the action. local generated = [ generator.run $(project) $(name) : [ property-set.create # Passing of <pch-source> is a dirty trick, needed because # non-composing generators with multiple inputs are subtly # broken. For more detailed information see: # https://zigzag.cs.msu.su:7813/boost.build/ticket/111 <pch-source>$(pch-source) [ $(property-set).raw ] ] : $(pch-header) ] ; local pch-file ; for local g in $(generated) { if [ type.is-derived [ $(g).type ] PCH ] { pch-file = $(g) ; } } return [ property-set.create <pch-header>$(pch-header) <pch-file>$(pch-file) ] $(generated) ; }}################################################################################## Local rules.################################################################################## Detects versions listed as '.known-versions' by checking registry information,# environment variables & default paths. Supports both native Windows and# Cygwin.#local rule auto-detect-toolset-versions ( ){ if [ os.name ] in NT CYGWIN { # Get installation paths from the registry. for local i in $(.known-versions) { if $(.version-$(i)-reg) { local vc-path ; for local x in "" "Wow6432Node\\" { vc-path += [ W32_GETREG "HKEY_LOCAL_MACHINE\\SOFTWARE\\"$(x)"\\Microsoft\\"$(.version-$(i)-reg) : "ProductDir" ] ; } if $(vc-path) { vc-path = [ path.join [ path.make-NT $(vc-path[1]) ] "bin" ] ; register-configuration $(i) : [ path.native $(vc-path[1]) ] ; } } } } # Check environment and default installation paths. for local i in $(.known-versions) { if ! $(i) in [ $(.versions).all ] { register-configuration $(i) : [ default-path $(i) ] ; } }}# Worker rule for toolset version configuration. Takes an explicit version id or# nothing in case it should configure the default toolset version (the first# registered one or a new 'default' one in case no toolset versions have been# registered yet).#local rule configure-really ( version ? : options * ){ local v = $(version) ; # Decide what the 'default' version is. if ! $(v) { # Take the first registered (i.e. auto-detected) version. version = [ $(.versions).all ] ; version = $(version[1]) ; v = $(version) ; # Note: 'version' can still be empty at this point if no versions have # been auto-detected. version ?= "default" ; } # Version alias -> real version number. if $(.version-alias-$(version)) { version = $(.version-alias-$(version)) ; } # Check whether the selected configuration is already in use. if $(version) in [ $(.versions).used ] { # Allow multiple 'toolset.using' calls for the same configuration if the # identical sets of options are used. if $(options) && ( $(options) != [ $(.versions).get $(version) : options ] ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -