msvc

Microsoft Visual C++/Intel C++ compiler support

Usage:

$ waf configure --msvc_version="msvc 10.0,msvc 9.0" --msvc_target="x64"

or:

def configure(conf):
        conf.env['MSVC_VERSIONS'] = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', 'wsdk 7.0', 'intel 11', 'PocketPC 9.0', 'Smartphone 8.0']
        conf.env['MSVC_TARGETS'] = ['x64']
        conf.load('msvc')

or:

def configure(conf):
        conf.load('msvc', funs='no_autodetect')
        conf.check_lib_msvc('gdi32')
        conf.check_libs_msvc('kernel32 user32')
def build(bld):
        tg = bld.program(source='main.c', target='app', use='KERNEL32 USER32 GDI32')

Platforms and targets will be tested in the order they appear; the first good configuration will be used. Supported platforms: ia64, x64, x86, x86_amd64, x86_ia64

Compilers supported:

  • msvc => Visual Studio, versions 6.0 (VC 98, VC .NET 2002) to 10.0 (Visual Studio 2010)
  • wsdk => Windows SDK, versions 6.0, 6.1, 7.0
  • icl => Intel compiler, versions 9,10,11
  • Smartphone => Compiler/SDK for Smartphone devices (armv4/v4i)
  • PocketPC => Compiler/SDK for PocketPC devices (armv4/v4i)

To use WAF in a VS2008 Make file project (see http://code.google.com/p/waf/issues/detail?id=894) You may consider to set the environment variable “VS_UNICODE_OUTPUT” to nothing before calling waf. So in your project settings use something like ‘cmd.exe /C “set VS_UNICODE_OUTPUT=& set PYTHONUNBUFFERED=true & waf build”’. cmd.exe /C “chcp 1252 & set PYTHONUNBUFFERED=true && set && waf configure” Setting PYTHONUNBUFFERED gives the unbuffered output.

waflib.Tools.msvc.g_msvc_systemlibs

importlibs provided by MSVC/Platform SDK. Do NOT search them

waflib.Tools.msvc.all_msvc_platforms

List of msvc platforms

waflib.Tools.msvc.all_wince_platforms

List of wince platforms

waflib.Tools.msvc.all_icl_platforms

List of icl platforms

waflib.Tools.msvc.get_msvc_version(conf, compiler, version, target, vcvars)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Create a bat file to obtain the location of the libraries

Parameters:
  • compiler

    ?

  • version

    ?

Target :

?

Vcvars :

?

Returns:

the location of msvc, the location of include dirs, and the library paths

Return type:

tuple of strings

waflib.Tools.msvc.gather_wsdk_versions(conf, versions)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Use winreg to add the msvc versions to the input list

Parameters:
  • versions (list) – list to modify
waflib.Tools.msvc.gather_wince_supported_platforms()[source]

Checks SmartPhones SDKs

Parameters:
  • versions (list) – list to modify
waflib.Tools.msvc.gather_msvc_targets(conf, versions, version, vc_path)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.gather_wince_targets(conf, versions, version, vc_path, vsvars, supported_platforms)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.gather_msvc_versions(conf, versions)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.gather_icl_versions(conf, versions)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Checks ICL compilers

Parameters:
  • versions (list) – list to modify
waflib.Tools.msvc.get_msvc_versions(conf)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Returns:list of compilers installed
Return type:list of string
waflib.Tools.msvc.print_all_msvc_detected(conf)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Print the contents of conf.env.MSVC_INSTALLED_VERSIONS

waflib.Tools.msvc.detect_msvc(conf)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.find_lt_names_msvc(self, libname, is_static=False)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Win32/MSVC specific code to glean out information from libtool la files. this function is not attached to the task_gen class

waflib.Tools.msvc.libname_msvc(self, libname, is_static=False)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.check_lib_msvc(self, libname, is_static=False, uselib_store=None)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Ideally we should be able to place the lib in the right env var, either STLIB or LIB, but we don’t distinguish static libs from shared libs. This is ok since msvc doesn’t have any special linker flag to select static libs (no env[‘STLIB_MARKER’])

waflib.Tools.msvc.check_libs_msvc(self, libnames, is_static=False)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.configure(conf)[source]

Configuration methods to call for detecting msvc

waflib.Tools.msvc.no_autodetect(conf)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.autodetect(conf)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

waflib.Tools.msvc.find_msvc(conf)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext Due to path format limitations, limit operation only to native Win32. Yeah it sucks.

waflib.Tools.msvc.visual_studio_add_flags(self)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext visual studio flags found in the system environment

waflib.Tools.msvc.msvc_common_flags(conf)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Setup the flags required for executing the msvc compiler

The default is to allow a static and a shared library having the same name in the same directory, the static one being prefixed by ‘lib’. If you feel that this is incorrect, just change the extension (issue #824):

bld.env.STLIB_ST = bld.env.SHLIB_ST = '%s.lib'
bld.stlib(..., name='libfoo')
bld.shlib(..., name='foo')
waflib.Tools.msvc.apply_flags_msvc(self)[source]

Task generator method

Add additional flags implied by msvc, such as subsystems and pdb files:

def build(bld):
        bld.stlib(source='main.c', target='bar', subsystem='gruik')
Feature :c, cxx
waflib.Tools.msvc.apply_manifest(self)[source]

Task generator method

Special linker for MSVC with support for embedding manifests into DLL’s and executables compiled by Visual Studio 2005 or probably later. Without the manifest file, the binaries are unusable. See: http://msdn2.microsoft.com/en-us/library/ms235542(VS.80).aspx

Feature :cprogram, cshlib, cxxprogram, cxxshlib
waflib.Tools.msvc.exec_mf(self)[source]

Create the manifest file

waflib.Tools.msvc.conf(f)

Decorator: attach new configuration functions to waflib.Build.BuildContext and waflib.Configure.ConfigurationContext. The methods bound will accept a parameter named ‘mandatory’ to disable the configuration errors:

def configure(conf):
        conf.find_program('abc', mandatory=False)
Parameters:
  • f (function) – method to bind
waflib.Tools.msvc.feature(*k)

Decorator: register a task generator method that will be executed when the object attribute ‘feature’ contains the corresponding key(s):

from waflib.Task import feature
@feature('myfeature')
def myfunction(self):
        print('that is my feature!')
def build(bld):
        bld(features='myfeature')
Parameters:
  • k (list of string) – feature names
waflib.Tools.msvc.before_method(*k)

Decorator: register a task generator method which will be executed before the functions of given name(s):

from waflib.TaskGen import feature, before
@feature('myfeature')
@before_method('fun2')
def fun1(self):
        print('feature 1!')
@feature('myfeature')
def fun2(self):
        print('feature 2!')
def build(bld):
        bld(features='myfeature')
Parameters:
  • k (list of string) – method names
waflib.Tools.msvc.after_method(*k)

Decorator: register a task generator method which will be executed after the functions of given name(s):

from waflib.TaskGen import feature, after
@feature('myfeature')
@after_method('fun2')
def fun1(self):
        print('feature 1!')
@feature('myfeature')
def fun2(self):
        print('feature 2!')
def build(bld):
        bld(features='myfeature')
Parameters:
  • k (list of string) – method names
waflib.Tools.msvc.info(*k, **kw)

Wrap logging.info

waflib.Tools.msvc.warn(*k, **kw)

Wrap logging.warn

waflib.Tools.msvc.error(*k, **kw)

Wrap logging.errors, display the origin of the message when ‘-vv’ is set

waflib.Tools.msvc.debug(*k, **kw)

Wrap logging.debug, the output is filtered for performance reasons

waflib.Tools.msvc.exec_command_msvc(self, *k, **kw)[source]

Change the command-line execution for msvc programs. Instead of quoting all the paths and keep using the shell, we can just join the options msvc is interested in

waflib.Tools.msvc.cls

alias of cxxstlib

Features defined in this module:

Previous topic

xlcxx

Next topic

winres

This Page