]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/tools/build/src/tools/msvc.jam
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / src / tools / msvc.jam
index 3f8f49e68b6d14742fb4f98aa1f856edad250e28..f5e56e0c4fdd2987b179ef20aa2226db5bc8bd03 100644 (file)
@@ -3,7 +3,7 @@
 # Copyright (c) 2005 Alexey Pakhunov
 # Copyright (c) 2006 Bojan Resnik
 # Copyright (c) 2006 Ilya Sokolov
-# Copyright (c) 2007 Rene Rivera
+# Copyright (c) 2007-2017 Rene Rivera
 # Copyright (c) 2008 Jurko Gospodnetic
 # Copyright (c) 2014 Microsoft Corporation
 #
@@ -820,7 +820,16 @@ local rule generate-setup-cmd ( version : command : parent : options * : cpu : g
         }
         else
         {
+            if [ MATCH "(14.1)" : $(version) ]
+            {
+                if $(.debug-configuration)
+                {
+                    ECHO 'notice: [generate-setup-cmd] $(version) is 14.1' ;
+                }
+                parent = [ path.native [ path.join  $(parent) "..\\..\\..\\..\\..\\Auxiliary\\Build" ] ] ;
+            }
             setup = [ locate-default-setup $(command) : $(parent) : $(default-setup) ] ;
+            setup ?= [ path.join  $(parent) "vcvarsall.bat" ] ;
         }
     }
     
@@ -850,8 +859,16 @@ local rule configure-really ( version ? : options * )
     # Decide what the 'default' version is.
     if ! $(v)
     {
-        # Take the first registered (i.e. auto-detected) version.
+        # Take the best registered (i.e. auto-detected) version.
         version = [ $(.versions).all ] ;
+        for local known in $(.known-versions)
+        {
+            if $(known) in $(version)
+            {
+                version = $(known) ;
+                break ;
+            }
+        }
         version = $(version[1]) ;
         v = $(version) ;
 
@@ -894,11 +911,29 @@ local rule configure-really ( version ? : options * )
 
         local command = [ feature.get-values <command> : $(options) ] ;
 
+        # For 14.1 we need the exact version as MS is planning rolling updates
+        # that will cause our `setup-cmd` to become invalid
+        exact-version = [ MATCH "(14\.10\.[0-9\.]+)" : $(command) ] ;
+
         # If version is specified, we try to search first in default paths, and
         # only then in PATH.
         command = [ common.get-invocation-command msvc : cl.exe : $(command) :
             [ default-paths $(version) ] : $(version) ] ;
 
+        if ( ! $(version) || $(version) = "default" ) && ! $(command:D)
+        {
+            ECHO ;
+            ECHO warning:
+                "Did not find command for MSVC toolset."
+                "If you have Visual Studio 2017 installed you will need to"
+                "specify the full path to the command,"
+                "set VS150COMNTOOLS for your installation,"
+                "or"
+                "build from the 'Visual Studio Command Prompt for VS 2017'."
+                ;
+            ECHO ;
+        }
+
         common.handle-options msvc : $(conditions) : $(command) : $(options) ;
 
         if ! $(version)
@@ -907,9 +942,9 @@ local rule configure-really ( version ? : options * )
             # version from the path.
             # FIXME: We currently detect both Microsoft Visual Studio 9.0 and
             # 9.0express as 9.0 here.
-            if [ MATCH "(Microsoft Visual Studio 15)" : $(command) ]
+            if [ MATCH "(MSVC\\14.1)" : $(command) ]
             {
-                version = 15.0 ;
+                version = 14.1 ;
             }
             else if [ MATCH "(Microsoft Visual Studio 14)" : $(command) ]
             {
@@ -1073,7 +1108,8 @@ local rule configure-really ( version ? : options * )
 
             for local c in $(cpu)
             {
-                setup-$(c) = [ generate-setup-cmd $(version) : $(command) : $(parent) : $(options) : $(c) : $(global-setup) : $(default-global-setup-options-$(c)) : $(default-setup-$(c)) ] ;
+                exact-version ?= $(version) ;
+                setup-$(c) = [ generate-setup-cmd $(exact-version) : $(command) : $(parent) : $(options) : $(c) : $(global-setup) : $(default-global-setup-options-$(c)) : $(default-setup-$(c)) ] ;
             }
             
             # Windows phone has different setup scripts, located in a different directory hierarchy.
@@ -1205,37 +1241,68 @@ local rule configure-really ( version ? : options * )
 local rule default-path ( version )
 {
     # Use auto-detected path if possible.
-    local path = [ feature.get-values <command> : [ $(.versions).get $(version)
+    local result = [ feature.get-values <command> : [ $(.versions).get $(version)
         : options ] ] ;
 
-    if $(path)
+    if $(result)
     {
-        path = $(path:D) ;
+        result = $(result:D) ;
     }
     else
     {
-        # Check environment.
-        if $(.version-$(version)-env)
+        # try to use vswhere
+        local pseudo_env_VS150 ;
+        if $(version) = 14.1 || $(version) = "default"
         {
-            local vc-path = [ os.environ $(.version-$(version)-env) ] ;
-            if $(vc-path)
+            local req = "-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64" ;
+            local prop = "-property installationPath" ;
+            local limit = "-version \"[15.0,16.0)\"" ;
+            local root = [ os.environ "ProgramFiles(x86)" ] ;
+            if ( ! $(root) )
             {
-                vc-path = [ path.make $(vc-path) ] ;
-                vc-path = [ path.join $(vc-path) $(.version-$(version)-envpath) ] ;
-                vc-path = [ path.native $(vc-path) ] ;
-
-                path = $(vc-path) ;
+                root = [ os.environ "ProgramFiles" ] ;
+            }
+            local vswhere = "$(root)\\Microsoft Visual Studio\\Installer\\vswhere.exe" ;
+            if ( [ path.exists $(vswhere) ] )
+            {
+                local vmwhere_cmd = "\"$(vswhere)\" -latest -products * $(req) $(prop) $(limit)" ;
+                local shell_ret = [ SPLIT_BY_CHARACTERS [ SHELL $(vmwhere_cmd) ] : "\n" ] ;
+                pseudo_env_VS150 = [ path.native [ path.join $(shell_ret) "\\Common7\\Tools" ] ] ;
             }
         }
 
-        # Check default path.
-        if ! $(path) && $(.version-$(version)-path)
+        # Check environment or previous path_VS150
+        for local env in $(.version-$(version)-env)
         {
-            path = [ path.native [ path.join $(.ProgramFiles) $(.version-$(version)-path) ] ] ;
+            local env-path ;
+            if ( $(pseudo_env_VS150) && [ path.exists $(pseudo_env_VS150) ] )
+            {
+                env-path = $(pseudo_env_VS150) ;
+            }
+            else
+            {
+                env-path = [ os.environ $(env) ] ;
+            }
+            if $(env-path) && $(.version-$(version)-path)
+            {
+                for local bin-path in $(.version-$(version)-path)
+                {
+                    result = [ path.glob [ path.make $(env-path) ] : $(bin-path) ] ;
+                    if $(result)
+                    {
+                        result = [ path.native $(result[1]) ] ;
+                        break ;
+                    }
+                }
+            }
+            if $(result)
+            {
+                break ;
+            }
         }
     }
 
-    return $(path) ;
+    return $(result) ;
 }
 
 
@@ -1424,6 +1491,10 @@ local rule register-toolset-really ( )
     toolset.flags msvc.compile C++FLAGS  <exception-handling>on/<asynch-exceptions>on/<extern-c-nothrow>off : /EHa ;
     toolset.flags msvc.compile C++FLAGS  <exception-handling>on/<asynch-exceptions>on/<extern-c-nothrow>on : /EHac ;
 
+    toolset.flags msvc.compile C++FLAGS  <cxxstd>14 : /std:c++14 ;
+    toolset.flags msvc.compile C++FLAGS  <cxxstd>17 : /std:c++17 ;
+    toolset.flags msvc.compile C++FLAGS  <cxxstd>latest : /std:c++latest ;
+
     # By default 8.0 enables rtti support while prior versions disabled it. We
     # simply enable or disable it explicitly so we do not have to depend on this
     # default behaviour.
@@ -1583,10 +1654,11 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 .cpu-type-em64t    = prescott nocona core2 corei7 corei7-avx core-avx-i
                      conroe conroe-xe conroe-l allendale merom
                      merom-xe kentsfield kentsfield-xe penryn wolfdale
-                     yorksfield nehalem sandy-bridge ivy-bridge haswell ;
+                     yorksfield nehalem sandy-bridge ivy-bridge haswell
+                     broadwell skylake skylake-avx512 cannonlake ;
 .cpu-type-amd64    = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3
                      athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3
-                     btver1 btver2 ;
+                     bdver4 btver1 btver2 znver1 ;
 .cpu-type-g7       = pentium4 pentium4m athlon athlon-tbird athlon-4 athlon-xp
                      athlon-mp $(.cpu-type-em64t) $(.cpu-type-amd64) ;
 .cpu-type-itanium  = itanium itanium1 merced ;
@@ -1595,7 +1667,7 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
                      armv7 armv7s ;
 
 # Known toolset versions, in order of preference.
-.known-versions = 15.0 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1
+.known-versions = 14.1 14.0 12.0 11.0 10.0 10.0express 9.0 9.0express 8.0 8.0express 7.1
     7.1toolkit 7.0 6.0 ;
 
 # Version aliases.
@@ -1608,7 +1680,7 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 .version-alias-11 = 11.0 ;
 .version-alias-12 = 12.0 ;
 .version-alias-14 = 14.0 ;
-.version-alias-15 = 15.0 ;
+.version-alias-14.1 = 14.1 ;
 
 # Names of registry keys containing the Visual C++ installation path (relative
 # to "HKEY_LOCAL_MACHINE\SOFTWARE\\Microsoft").
@@ -1624,18 +1696,20 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 .version-11.0-reg = "VisualStudio\\11.0\\Setup\\VC" ;
 .version-12.0-reg = "VisualStudio\\12.0\\Setup\\VC" ;
 .version-14.0-reg = "VisualStudio\\14.0\\Setup\\VC" ;
-.version-15.0-reg = "VisualStudio\\15.0\\Setup\\VC" ;
 
 # Visual C++ Toolkit 2003 does not store its installation path in the registry.
 # The environment variable 'VCToolkitInstallDir' and the default installation
 # path will be checked instead.
-.version-7.1toolkit-path    = "Microsoft Visual C++ Toolkit 2003" "bin" ;
+.version-7.1toolkit-path    = "Microsoft Visual C++ Toolkit 2003/bin" ;
 .version-7.1toolkit-env     = VCToolkitInstallDir ;
-
-# Path to the folder containing "cl.exe" relative to the value of the
-# corresponding environment variable.
-.version-7.1toolkit-envpath = "bin" ;
-
+# Visual Studio 2017 doesn't use a registry at all. And the suggested methods
+# of discovery involve having a compiled program. So as a fallback we search
+# paths for VS2017 (aka msvc >= 14.1).
+.version-14.1-path =
+    "../../VC/Tools/MSVC/*/bin/Host*/*"
+    "Microsoft Visual Studio/2017/*/VC/Tools/MSVC/*/bin/Host*/*"
+    ;
+.version-14.1-env = VS150COMNTOOLS ProgramFiles ProgramFiles(x86) ;
 
 # Auto-detect all the available msvc installations on the system.
 auto-detect-toolset-versions ;