Boost & BJam plus Web Chats coming up


I'm a big C++ fan, despite the fact that the VC++ optimizer is written in C.  I've been using Boost for a couple years now, and just picked up the initial tarball for 1.32.0.  Someone's written a .jam file for VC8 on x64, but it just does the bare minimum - lots of warnings & whatnot.  I have written these for all 3 platforms and I've been tempted to try my hand at a PocketPC ARM & x86 version, too (since I fool around on those platforms, occasionally).  I haven't ever bothered testing the IA64 stuff, but I haven't had any problems with my x64 & x86 version.  I'll have to figure out if I can upload files here.  Anyway, for now I'll just toss in the x64 one I've got inline:


# Microsoft Visual C++


# (C) Copyright David Abrahams 2001. Permission to copy, use,
# modify, sell and distribute this software is granted provided this
# copyright notice appears in all copies. This software is provided
# "as is" without express or implied warranty, and with no claim as
# to its suitability for any purpose.


# 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">Microsoft VC++</a>


# singleton variables...
set-as-singleton VC8_ROOT 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 vc80x64 VC_SETUP ;
flags vc80x64 VC_COMPILER ;
flags vc80x64 VC_LINKER ;
flags vc80x64 VC_PDB_NAME ;
 
# compute vc80x64 tool path


VC8_ROOT = $(VS80COMNTOOLS:J=" ")"..\\..\\VC" ;
VC8_ROOT = $(VC8_ROOT:J=" ") ;


VC_SETUP = "CALL \"$(VC8_ROOT)$(SLASH)vcvarsall.bat\" x86_amd64  >nul" ;


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


flags vc80x64 CFLAGS <debug-symbols>on/<debug-store>object : /Z7 ;
flags vc80x64 CFLAGS <debug-symbols>on/<debug-store>database : /Zi ;
flags vc80x64 PDB_CFLAG <debug-symbols>on/<debug-store>database : /Fd ;
flags vc80x64 PDB_LINKFLAG <debug-symbols>on/<debug-store>database : /PDB: ;
flags vc80x64 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 vc80x64 LINKFLAGS <debug-symbols>on/<runtime-build>release : /OPT:REF,ICF ;


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


# Note that these two options actually imply multithreading support on vc80x64
# 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 vc80x64 CFLAGS <runtime-build>release/<runtime-link>dynamic : /MD /GL ;
flags vc80x64 LINKFLAGS <runtime-build>release/<runtime-link>dynamic : /LTCG ;
flags vc80x64 CFLAGS <runtime-build>debug/<runtime-link>dynamic : /MDd ;


# VC8 doesn't support a single threaded runtime, just some single-threaded optimizations
flags vc80x64 CFLAGS <runtime-build>release/<runtime-link>static/<threading>single : /MT /D_ST_MODEL ;
flags vc80x64 CFLAGS <runtime-build>debug/<runtime-link>static/<threading>single : /MTd /D_ST_MODEL ;


flags vc80x64 CFLAGS <runtime-build>release/<runtime-link>static/<threading>multi : /MT ;
flags vc80x64 CFLAGS <runtime-build>debug/<runtime-link>static/<threading>multi : /MTd ;


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


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


flags vc80x64 LINKFLAGS <user-interface>console : /subsystem:console ;
flags vc80x64 LINKFLAGS <user-interface>gui : /subsystem:windows ;
flags vc80x64 LINKFLAGS <user-interface>wince : /subsystem:windowsce ;
flags vc80x64 LINKFLAGS <user-interface>native : /subsystem:native ;
flags vc80x64 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) ;


    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) ;
}


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


#### Cc #####


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


actions vc-Cc
{
    $(VC_SETUP)
    $(VC_COMPILER) /Zm800 -nologo -wd4996 -wd4103 -c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" $(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_COMPILER) /Zm800 -nologo -wd4996 -wd4103 -EHsc -c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" $(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_LINKER) /lib $(ARFLAGS) $(PDB_LINKFLAG)"$(VC_PDB_FILE)" /out:"$(<)" @"$(>)"
}


That seems to work pretty well.  I haven't tried this with Beta 1 - I did the work @ home, but didn't test it until I got to work, so I only ran against a more recent build.


Microsoft will be hosting an online chat November 9, 2004 at 9:00am Pacific Time to answer your Managed Code on 64-bit Windows Platforms questions.


http://msdn.microsoft.com/chats/


http://msdn.microsoft.com/chats/outlook_reminders/04_MC_64BitWP_Nov9.ics


And I'll be one of the hosts in this one on Wednesday, November 10th at 9AM PST:


http://msdn.microsoft.com/chats/outlook_reminders/04_MC_64Bit_Nov10.ics


I also answered questions in a couple of excellent 'WebCasts' hosted by Kang Su Gatlin, one of our project managers on the compiler, last week that people might be interested in.   If I ever find the stinking links to them, I'll put them up here, too.

Skip to main content