From f3896eb77420c34021940941f72d476e2b6be154 Mon Sep 17 00:00:00 2001 From: Steve Gates Date: Tue, 27 May 2014 16:59:59 -0700 Subject: [PATCH] Adding a new feature to help support building for the Windows Runtime (Windows store/phone). 1. Adds a new feature for specifying the WINAPI_FAMILY API set to target. Defaults to desktop, which is how builds before my changes. 2. A few small changes for adding ARM support. 3. Changes to call to correct vcvars setup script for Windows Phone 8. --- src/tools/msvc.jam | 118 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 107 insertions(+), 11 deletions(-) diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index bab9a9fb6..e09e19063 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -5,6 +5,7 @@ # Copyright (c) 2006 Ilya Sokolov # Copyright (c) 2007 Rene Rivera # Copyright (c) 2008 Jurko Gospodnetic +# Copyright (c) 2014 Microsoft Corporation # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at @@ -268,9 +269,27 @@ rule configure-version-specific ( toolset : version : conditions ) # dependencies to put there. toolset.flags $(toolset).link LINKFLAGS $(conditions) : /MANIFEST ; } + + # Starting with Visual Studio 2013 the CRT is split into a desktop and app dll. + #If targeting WinRT and 12.0 set lib path to link against app CRT. + if [ MATCH "(12)" : $(version) ] + { + local VCPath = [ path.parent [ path.make [ default-path $(version) ] ] ] ; + local storeLibPath = [ path.join [ path.join $(VCPath) "lib" ] "store" ] ; + toolset.flags $(toolset).link LINKPATH $(conditions)/store/$(.cpu-arch-i386) : [ path.native $(storeLibPath) ] ; + toolset.flags $(toolset).link LINKPATH $(conditions)/store/$(.cpu-arch-amd64) : [ path.native [ path.join $(storeLibPath) "amd64" ] ] ; + toolset.flags $(toolset).link LINKPATH $(conditions)/store/$(.cpu-arch-arm) : [ path.native [ path.join $(storeLibPath) "arm" ] ] ; + } + toolset.pop-checking-for-flags-module ; } +# Feature for handling targeting different Windows API sets. +feature.feature windows-api : desktop store phone : propagated composite link-incompatible ; +feature.compose store : WINAPI_FAMILY=WINAPI_FAMILY_APP _WIN32_WINNT=0x0602 /APPCONTAINER off ; +feature.compose phone : WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP _WIN32_WINNT=0x0602 /APPCONTAINER off ; +feature.set-default windows-api : desktop ; + # Registers this toolset including all of its flags, features & generators. Does # nothing on repeated calls. @@ -677,6 +696,52 @@ local rule auto-detect-toolset-versions ( ) } +# Local helper rule to create the vcvars setup command for given architecture +# and options. +# +local rule generate-setup-cmd ( command : parent : options * : cpu : global-setup : default-global-setup-options : default-setup ) +{ + local setup-prefix = "call " ; + local setup-suffix = " >nul"$(.nl) ; + if ! [ os.name ] in NT + { + setup-prefix = "cmd.exe /S /C call " ; + setup-suffix = " \">nul\" \"&&\" " ; + } + + local setup-options ; + local setup = [ feature.get-values : $(options) ] ; + + if $(setup) = "" + { + if $(global-setup) != "" + { + setup = $(global-setup) ; + + # If needed we can easily add using configuration flags + # here for overriding which options get passed to the + # global setup command for which target platform: + # setup-options = [ feature.get-values : $(options) ] ; + setup-options ?= $(default-global-setup-options) ; + } + else + { + setup = [ locate-default-setup $(command) : $(parent) : $(default-setup) ] ; + } + } + + # Cygwin to Windows path translation. + setup = "\""$(setup:W)"\"" ; + + # Append setup options to the setup name and add the final setup + # prefix & suffix. + setup-options ?= "" ; + + setup = $(setup-prefix)$(setup:J=" ")" "$(setup-options:J=" ")$(setup-suffix) ; + return $(setup) ; +} + + # 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 @@ -791,13 +856,21 @@ local rule configure-really ( version ? : options * ) # Generate and register setup command. local below-8.0 = [ MATCH ^([67]\\.) : $(version) ] ; - + if $(version) < 11 + { + local below-11.0 = true ; + } + local cpu = i386 amd64 ia64 arm ; if $(below-8.0) { cpu = i386 ; } - + if $(below-11.0) + { + cpu = i386 amd64 ia64 ; + } + local setup-amd64 ; local setup-i386 ; local setup-ia64 ; @@ -856,6 +929,7 @@ local rule configure-really ( version ? : options * ) local default-setup-i386 = vcvars32.bat ; local default-setup-ia64 = vcvarsx86_ia64.bat ; local default-setup-arm = vcvarsx86_arm.bat ; + local default-setup-phone = vcvarsphoneall.bat ; # http://msdn2.microsoft.com/en-us/library/x4d2c09s(VS.80).aspx and # http://msdn2.microsoft.com/en-us/library/x4d2c09s(vs.90).aspx @@ -929,6 +1003,18 @@ local rule configure-really ( version ? : options * ) setup-options ?= "" ; setup-$(c) = $(setup-prefix)$(setup-$(c):J=" ")" "$(setup-options:J=" ")$(setup-suffix) ; } + + # Windows phone uses a setup script in a different directory hierarchy. + # Support for future version of Windows phone will need to deal with phone versions here. + local phone-command = [ path.native [ path.join $(parent) WPSDK WP80 ] ] ; + local phone-parent = [ path.make $(phone-command) ] ; + phone-parent = [ path.native [ path.parent $(phone-parent) ] ] ; + local global-setup-phone = [ feature.get-values : $(options) ] ; + global-setup-phone ?= [ path.native [ path.join $(phone-command) $(default-setup-phone) ] ] ; + setup-phone-i386 = [ generate-setup-cmd $(phone-command) : $(phone-parent) : $(options) : i386 + : $(global-setup-phone) : $(default-global-setup-options-i386) : $(default-setup-phone) ] ; + setup-phone-arm = [ generate-setup-cmd $(phone-command) : $(phone-parent) : $(options) : arm + : $(global-setup-phone) : $(default-global-setup-options-arm) : $(default-setup-phone) ] ; } # Get tool names (if any) and finish setup. @@ -981,15 +1067,23 @@ local rule configure-really ( version ? : options * ) local cpu-assembler = $(assembler) ; cpu-assembler ?= $(default-assembler-$(c)) ; - toolset.flags msvc.compile .CC $(cpu-conditions) : $(setup-$(c))$(compiler) /Zm800 -nologo ; - toolset.flags msvc.compile .RC $(cpu-conditions) : $(setup-$(c))$(resource-compiler) ; - toolset.flags msvc.compile .ASM $(cpu-conditions) : $(setup-$(c))$(cpu-assembler) -nologo ; - toolset.flags msvc.link .LD $(cpu-conditions) : $(setup-$(c))$(linker) /NOLOGO /INCREMENTAL:NO ; - toolset.flags msvc.archive .LD $(cpu-conditions) : $(setup-$(c))$(linker) /lib /NOLOGO ; - toolset.flags msvc.compile .IDL $(cpu-conditions) : $(setup-$(c))$(idl-compiler) ; - toolset.flags msvc.compile .MC $(cpu-conditions) : $(setup-$(c))$(mc-compiler) ; + toolset.flags msvc.compile .RC $(api)/$(cpu-conditions) : $(setup-$(c))$(resource-compiler) ; + toolset.flags msvc.compile .IDL $(api)/$(cpu-conditions) : $(setup-$(c))$(idl-compiler) ; + toolset.flags msvc.compile .MC $(api)/$(cpu-conditions) : $(setup-$(c))$(mc-compiler) ; + toolset.flags msvc.link .MT $(api)/$(cpu-conditions) : $(setup-$(c))$(manifest-tool) -nologo ; - toolset.flags msvc.link .MT $(cpu-conditions) : $(setup-$(c))$(manifest-tool) -nologo ; + for api in desktop store phone + { + local setup-script = $(setup-$(c)) ; + if $(api) = phone + { + setup-script = $(setup-phone-$(c)) ; + } + toolset.flags msvc.compile .CC $(api)/$(cpu-conditions) : $(setup-script)$(compiler) /Zm800 -nologo ; + toolset.flags msvc.compile .ASM $(api)/$(cpu-conditions) : $(setup-script)$(cpu-assembler) -nologo ; + toolset.flags msvc.link .LD $(api)/$(cpu-conditions) : $(setup-script)$(linker) /NOLOGO /INCREMENTAL:NO ; + toolset.flags msvc.archive .LD $(api)/$(cpu-conditions) : $(setup-script)$(linker) /lib /NOLOGO ; + } if $(cc-filter) { @@ -1367,6 +1461,7 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] ia64/64 ; .cpu-arch-arm = + arm/ arm/32 ; @@ -1388,7 +1483,8 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] athlon-mp $(.cpu-type-em64t) $(.cpu-type-amd64) ; .cpu-type-itanium = itanium itanium1 merced ; .cpu-type-itanium2 = itanium2 mckinley ; - +.cpu-type-arm = armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5te armv6 armv6j iwmmxt ep9312 + armv7 armv7s ; # Known toolset versions, in order of preference. .known-versions = 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1