Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/v1/msvc-tools.jam @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 6.9 KB
Line 
1# Microsoft Visual C++
2
3# (C) Copyright David Abrahams 2001.
4# Distributed under the Boost Software License, Version 1.0.
5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7# The following #// line will be used by the regression test table generation
8# program as the column heading for HTML tables. Must not include version number.
9#//<a href="http://msdn.microsoft.com/vstudio/default.asp">Micro-<br>soft<br>VC++</a>
10
11# singleton variables...
12set-as-singleton MSVCDir VISUALC MSVC_ROOT VC_TOOL_PATH VC_SETUP ;
13
14# Get these variable set on the targets so that we can re-use the
15# build actions for other toolsets using this one as a base.
16flags msvc VC_TOOL_PATH ;
17flags msvc VC_SETUP ;
18flags msvc VC_COMPILER ;
19flags msvc VC_LINKER ;
20flags msvc VC_PDB_NAME ;
21
22# compute MSVC tool path
23# You can either put the msvc bin directory in your PATH, or you can set
24# MSVCDir to point at the msvc installation directory
25
26# Some installations set MSVCDIR instead of MSVCDir; who knows why?
27MSVCDir ?= $(MSVCDIR) ;
28
29# If MSVCDir is not set the user hasn't run VCVARS32.BAT
30if ! $(MSVCDir)
31{
32    # In case someone set VISUALC in order to build Jam, we can just use that.
33    MSVC_ROOT ?= $(VISUALC) ;
34    # Otherwise, guess a standard installation directory
35
36    ProgramFiles ?= $(PROGRAMFILES) ;
37    MSVC_ROOT ?= $(ProgramFiles:J=" ")"\\Microsoft Visual Studio\\VC98" ;
38
39    # Reconstitutes paths containing spaces
40    MSVC_ROOT = $(MSVC_ROOT:J=" ") ;
41
42    # The tools are provisionallly located in the msvc6 bin
43    # directory. This may be overridden by toolsets which extend this
44    # one.
45    VC_TOOL_PATH = "$(MSVC_ROOT)"$(SLASH)bin$(SLASH) ;
46
47    # Always call VCVARS32.BAT before invoking the tools
48    VC_SETUP = "CALL \"$(VC_TOOL_PATH)VCVARS32.BAT\" >nul" ;
49}
50else
51{
52    # Reconstitutes paths containing spaces
53    MSVCDir = $(MSVCDir:J=" ") ;
54
55    # Don't clobber adjoining text or use explicit paths if MSVCDir is already set
56    VC_TOOL_PATH = "" ;
57}
58
59VC_COMPILER = cl ;
60VC_LINKER = link ;
61VC_PDB_NAME = vc60 ;
62VC_STDLIB_PATH = ;
63
64flags msvc CFLAGS <debug-symbols>on/<debug-store>object : /Z7 ;
65flags msvc CFLAGS <debug-symbols>on/<debug-store>database : /Zi ;
66flags msvc PDB_CFLAG <debug-symbols>on/<debug-store>database : /Fd ;
67flags msvc PDB_LINKFLAG <debug-symbols>on/<debug-store>database : /PDB: ;
68flags msvc LINKFLAGS <debug-symbols>on : /DEBUG ;
69# The linker disables the default optimizations when using /DEBUG. Whe have
70# to enable them manually for release builds with debug symbols.
71flags msvc LINKFLAGS <debug-symbols>on/<runtime-build>release : /OPT:REF,ICF ;
72
73flags msvc CFLAGS <optimization>off : /Od ;
74flags msvc CFLAGS <optimization>speed : /Ogity /O2 /Gs ;
75flags msvc CFLAGS <optimization>space : /Ogisy /O1 /Gs ;
76flags msvc CFLAGS <inlining>off : /Ob0 ;
77flags msvc CFLAGS <inlining>on : /Ob1 ;
78flags msvc CFLAGS <inlining>full : /Ob2 ;
79flags msvc CFLAGS <exception-handling>on : /EHsc ;
80flags msvc CFLAGS <rtti>on : /GR ;
81
82# Note that these two options actually imply multithreading support on MSVC
83# because there is no single-threaded dynamic runtime library. Specifying
84# <threading>multi would be a bad idea, though, because no option would be
85# matched when the build uses the default settings of <runtime-link>dynamic
86# and <threading>single.
87flags msvc CFLAGS <runtime-build>release/<runtime-link>dynamic : /MD ;
88flags msvc CFLAGS <runtime-build>debug/<runtime-link>dynamic : /MDd ;
89
90flags msvc CFLAGS <runtime-build>release/<runtime-link>static/<threading>single : /ML ;
91flags msvc CFLAGS <runtime-build>debug/<runtime-link>static/<threading>single : /MLd ;
92flags msvc CFLAGS <runtime-build>release/<runtime-link>static/<threading>multi : /MT ;
93flags msvc CFLAGS <runtime-build>debug/<runtime-link>static/<threading>multi : /MTd ;
94
95flags msvc CFLAGS <cflags> ;
96flags msvc C++FLAGS <cxxflags> ;
97flags msvc DEFINES <define> ;
98flags msvc UNDEFS <undef> ;
99flags msvc HDRS <include> ;
100flags msvc SYSHDRS <sysinclude> ;
101flags msvc LINKFLAGS <linkflags> ;
102flags msvc ARFLAGS <arflags> ;
103
104flags msvc STDHDRS : $(MSVCDir)$(SLASH)include ;
105flags msvc STDLIBPATH : $(MSVCDir)$(SLASH)lib ;
106flags msvc LIBPATH <library-path> ;
107flags msvc NEEDLIBS <library-file> ;
108flags msvc FINDLIBS <find-library> ;
109flags msvc LINKFLAGS <target-type>$(SHARED_TYPES) : /DLL ;
110
111flags msvc LINKFLAGS <user-interface>console : /subsystem:console ;
112flags msvc LINKFLAGS <user-interface>gui : /subsystem:windows ;
113flags msvc LINKFLAGS <user-interface>wince : /subsystem:windowsce ;
114flags msvc LINKFLAGS <user-interface>native : /subsystem:native ;
115flags msvc LINKFLAGS <user-interface>auto : /subsystem:posix ;
116
117
118rule vc-set-pdb-file ( targets + : name )
119{
120    local pdb = $(targets[1]:B=$(name):S=.pdb) ;
121    VC_PDB_FILE on $(targets) = $(pdb:G=:R=$(LOCATE_TARGET)) ;
122    LOCATE on $(pdb) = $(LOCATE_TARGET) ;
123    Clean clean : $(pdb) ;
124}
125
126#### Link ####
127
128rule Link-action ( target implib ? : sources + : target-type ? )
129{
130    with-command-file vc-Link $(<) : $(sources) $(NEEDLIBS) ;
131
132    if $(target-type) in $(SHARED_TYPES)
133    {
134        MANIFEST on $(target) = $(VC_MANIFEST) ;
135        OUTPUTRESOURCE on $(target) = $(VC_OUTPUTRESOURCE) ;
136    }
137
138    gRUN_PATH($(<)) += $(VC_STDLIB_PATH) ;
139    if $(implib)
140    {
141        # incremental linking a DLL causes no end of problems: if the
142        # actual exports don't change, the import .lib file is never
143        # updated. Therefore, the .lib is always out-of-date and gets
144        # rebuilt every time. I'm not sure that incremental linking is
145        # such a great idea in general, but in this case I'm sure we
146        # don't want it.
147        NOINCREMENTAL on $(<) = /INCREMENTAL:NO ;
148    }
149    vc-set-pdb-file $(<) : $(target:B) ;
150}
151
152VC_MANIFEST = ;
153VC_OUTPUTRESOURCE = ;
154
155actions together vc-Link
156{
157    $(VC_SETUP)
158    "$(VC_TOOL_PATH)$(VC_LINKER)" /nologo $(NOINCREMENTAL) $(LINKFLAGS) $(PDB_LINKFLAG)"$(VC_PDB_FILE)" /out:"$(<[1])" /IMPLIB:"$(<[2])" /LIBPATH:"$(LIBPATH)" /LIBPATH:"$(STDLIBPATH)" "$(FINDLIBS:S=.lib)" @"$(>)"
159    $(MANIFEST)$(<[1]).manifest $(OUTPUTRESOURCE)$(<[1]);#2
160}
161
162#### Cc #####
163
164rule Cc-action
165{
166    vc-set-pdb-file $(<) : $(VC_PDB_NAME) ;
167    vc-Cc $(<) : $(>) ;
168}
169
170actions vc-Cc
171{
172    $(VC_SETUP)
173    "$(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"$(<)" "$(>)"
174}
175
176#### C++ ####
177rule C++-action
178{
179    vc-set-pdb-file $(<) : $(VC_PDB_NAME) ;
180    vc-C++ $(<) : $(>) ;
181}
182
183actions vc-C++
184{
185    $(VC_SETUP)
186    "$(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"$(>)"
187}
188
189#### Archive ####
190rule Archive-action
191{
192    vc-set-pdb-file $(<) : $(<:B) ;
193    with-command-file vc-Archive $(<) : $(>) ;
194}
195
196actions vc-Archive
197{
198    $(VC_SETUP)
199    if exist "$(<)" DEL "$(<)"
200    "$(VC_TOOL_PATH)$(VC_LINKER)" /lib $(ARFLAGS) $(PDB_LINKFLAG)"$(VC_PDB_FILE)" /out:"$(<)" @"$(>)"
201}
202
203
Note: See TracBrowser for help on using the repository browser.