⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msvc-tools.jam

📁 C++的一个好库。。。现在很流行
💻 JAM
字号:
# Microsoft Visual C++

# (C) Copyright David Abrahams 2001.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

# The following #// line will be used by the regression test table generation
# program as the column heading for HTML tables. Must not include version number.
#//<a href="http://msdn.microsoft.com/vstudio/default.asp">Micro-<br>soft<br>VC++</a>

# singleton variables...
set-as-singleton MSVCDir VISUALC MSVC_ROOT VC_TOOL_PATH VC_SETUP ;

# Get these variable set on the targets so that we can re-use the
# build actions for other toolsets using this one as a base.
flags msvc VC_TOOL_PATH ;
flags msvc VC_SETUP ;
flags msvc VC_COMPILER ;
flags msvc VC_LINKER ;
flags msvc VC_PDB_NAME ;

# compute MSVC tool path
# You can either put the msvc bin directory in your PATH, or you can set
# MSVCDir to point at the msvc installation directory

# Some installations set MSVCDIR instead of MSVCDir; who knows why?
MSVCDir ?= $(MSVCDIR) ;

# If MSVCDir is not set the user hasn't run VCVARS32.BAT
if ! $(MSVCDir)
{
    # In case someone set VISUALC in order to build Jam, we can just use that.
    MSVC_ROOT ?= $(VISUALC) ;
    # Otherwise, guess a standard installation directory

    ProgramFiles ?= $(PROGRAMFILES) ;
    MSVC_ROOT ?= $(ProgramFiles:J=" ")"\\Microsoft Visual Studio\\VC98" ;

    # Reconstitutes paths containing spaces
    MSVC_ROOT = $(MSVC_ROOT:J=" ") ;

    # The tools are provisionallly located in the msvc6 bin
    # directory. This may be overridden by toolsets which extend this
    # one.
    VC_TOOL_PATH = "$(MSVC_ROOT)"$(SLASH)bin$(SLASH) ;

    # Always call VCVARS32.BAT before invoking the tools
    VC_SETUP = "CALL \"$(VC_TOOL_PATH)VCVARS32.BAT\" >nul" ;
}
else
{
    # Reconstitutes paths containing spaces
    MSVCDir = $(MSVCDir:J=" ") ;

    # Don't clobber adjoining text or use explicit paths if MSVCDir is already set
    VC_TOOL_PATH = "" ;
}

VC_COMPILER = cl ;
VC_LINKER = link ;
VC_PDB_NAME = vc60 ;
VC_STDLIB_PATH = ;

flags msvc CFLAGS <debug-symbols>on/<debug-store>object : /Z7 ;
flags msvc CFLAGS <debug-symbols>on/<debug-store>database : /Zi ;
flags msvc PDB_CFLAG <debug-symbols>on/<debug-store>database : /Fd ;
flags msvc PDB_LINKFLAG <debug-symbols>on/<debug-store>database : /PDB: ;
flags msvc LINKFLAGS <debug-symbols>on : /DEBUG ;
# The linker disables the default optimizations when using /DEBUG. Whe have
# to enable them manually for release builds with debug symbols.
flags msvc LINKFLAGS <debug-symbols>on/<runtime-build>release : /OPT:REF,ICF ;

flags msvc CFLAGS <optimization>off : /Od ;
flags msvc CFLAGS <optimization>speed : /Ogity /O2 /Gs ;
flags msvc CFLAGS <optimization>space : /Ogisy /O1 /Gs ;
flags msvc CFLAGS <inlining>off : /Ob0 ;
flags msvc CFLAGS <inlining>on : /Ob1 ;
flags msvc CFLAGS <inlining>full : /Ob2 ;
flags msvc CFLAGS <exception-handling>on : /EHsc ;
flags msvc CFLAGS <rtti>on : /GR ;

# Note that these two options actually imply multithreading support on MSVC
# because there is no single-threaded dynamic runtime library. Specifying
# <threading>multi would be a bad idea, though, because no option would be
# matched when the build uses the default settings of <runtime-link>dynamic
# and <threading>single.
flags msvc CFLAGS <runtime-build>release/<runtime-link>dynamic : /MD ;
flags msvc CFLAGS <runtime-build>debug/<runtime-link>dynamic : /MDd ;

flags msvc CFLAGS <runtime-build>release/<runtime-link>static/<threading>single : /ML ;
flags msvc CFLAGS <runtime-build>debug/<runtime-link>static/<threading>single : /MLd ;
flags msvc CFLAGS <runtime-build>release/<runtime-link>static/<threading>multi : /MT ;
flags msvc CFLAGS <runtime-build>debug/<runtime-link>static/<threading>multi : /MTd ;

flags msvc CFLAGS <cflags> ;
flags msvc C++FLAGS <cxxflags> ;
flags msvc DEFINES <define> ;
flags msvc UNDEFS <undef> ;
flags msvc HDRS <include> ;
flags msvc SYSHDRS <sysinclude> ;
flags msvc LINKFLAGS <linkflags> ;
flags msvc ARFLAGS <arflags> ;

flags msvc STDHDRS : $(MSVCDir)$(SLASH)include ;
flags msvc STDLIBPATH : $(MSVCDir)$(SLASH)lib ;
flags msvc LIBPATH <library-path> ;
flags msvc NEEDLIBS <library-file> ;
flags msvc FINDLIBS <find-library> ;
flags msvc LINKFLAGS <target-type>$(SHARED_TYPES) : /DLL ;

flags msvc LINKFLAGS <user-interface>console : /subsystem:console ;
flags msvc LINKFLAGS <user-interface>gui : /subsystem:windows ;
flags msvc LINKFLAGS <user-interface>wince : /subsystem:windowsce ;
flags msvc LINKFLAGS <user-interface>native : /subsystem:native ;
flags msvc LINKFLAGS <user-interface>auto : /subsystem:posix ;


rule vc-set-pdb-file ( targets + : name )
{
    local pdb = $(targets[1]:B=$(name):S=.pdb) ;
    VC_PDB_FILE on $(targets) = $(pdb:G=:R=$(LOCATE_TARGET)) ;
    LOCATE on $(pdb) = $(LOCATE_TARGET) ;
    Clean clean : $(pdb) ;
}

#### Link ####

rule Link-action ( target implib ? : sources + : target-type ? )
{
    with-command-file vc-Link $(<) : $(sources) $(NEEDLIBS) ;

    if $(target-type) in $(SHARED_TYPES)
    {
        MANIFEST on $(target) = $(VC_MANIFEST) ;
        OUTPUTRESOURCE on $(target) = $(VC_OUTPUTRESOURCE) ;
    }

    gRUN_PATH($(<)) += $(VC_STDLIB_PATH) ;
    if $(implib)
    {
        # incremental linking a DLL causes no end of problems: if the
        # actual exports don't change, the import .lib file is never
        # updated. Therefore, the .lib is always out-of-date and gets
        # rebuilt every time. I'm not sure that incremental linking is
        # such a great idea in general, but in this case I'm sure we
        # don't want it.
        NOINCREMENTAL on $(<) = /INCREMENTAL:NO ;
    }
    vc-set-pdb-file $(<) : $(target:B) ;
}

VC_MANIFEST = ;
VC_OUTPUTRESOURCE = ;

actions together vc-Link
{
    $(VC_SETUP)
    "$(VC_TOOL_PATH)$(VC_LINKER)" /nologo $(NOINCREMENTAL) $(LINKFLAGS) $(PDB_LINKFLAG)"$(VC_PDB_FILE)" /out:"$(<[1])" /IMPLIB:"$(<[2])" /LIBPATH:"$(LIBPATH)" /LIBPATH:"$(STDLIBPATH)" "$(FINDLIBS:S=.lib)" @"$(>)"
    $(MANIFEST)$(<[1]).manifest $(OUTPUTRESOURCE)$(<[1]);#2
}

#### Cc #####

rule Cc-action
{
    vc-set-pdb-file $(<) : $(VC_PDB_NAME) ;
    vc-Cc $(<) : $(>) ;
}

actions vc-Cc
{
    $(VC_SETUP)
    "$(VC_TOOL_PATH)$(VC_COMPILER)" /Zm800 -nologo -c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" $(PDB_CFLAG)"$(VC_PDB_FILE)" -Fo"$(<)" "$(>)"
}

#### C++ ####
rule C++-action
{
    vc-set-pdb-file $(<) : $(VC_PDB_NAME) ;
    vc-C++ $(<) : $(>) ;
}

actions vc-C++
{
    $(VC_SETUP)
    "$(VC_TOOL_PATH)$(VC_COMPILER)" /Zm800 -nologo /EHsc -c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" $(PDB_CFLAG)"$(VC_PDB_FILE)" -Fo"$(<)" -Tp"$(>)"
}

#### Archive ####
rule Archive-action
{
    vc-set-pdb-file $(<) : $(<:B) ;
    with-command-file vc-Archive $(<) : $(>) ;
}

actions vc-Archive
{
    $(VC_SETUP)
    if exist "$(<)" DEL "$(<)"
    "$(VC_TOOL_PATH)$(VC_LINKER)" /lib $(ARFLAGS) $(PDB_LINKFLAG)"$(VC_PDB_FILE)" /out:"$(<)" @"$(>)"
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -