Skip to content

Commit

Permalink
Remove use of VS2017 detection helpers in favor of ENV+path detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Apr 5, 2017
1 parent c230cb8 commit 838c622
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 340 deletions.
7 changes: 1 addition & 6 deletions src/engine/config_toolset.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@ECHO OFF

REM ~ Copyright 2002-2007 Rene Rivera.
REM ~ Copyright 2002-2017 Rene Rivera.
REM ~ Distributed under the Boost Software License, Version 1.0.
REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

Expand Down Expand Up @@ -165,12 +165,7 @@ if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
if NOT "_%VS150COMNTOOLS%_" == "__" (
set "BOOST_JAM_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\"
))
SET cl_path_cmd="%~dp0..\tools\vc141helper\cl_path.cmd"
if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
for /f "tokens=*" %%A in ('cmd /D /S /C "%cl_path_cmd% 14.10"') do if NOT "_%%A_" == "__" (
set "BOOST_JAM_TOOLSET_ROOT=%%A\VC\"))

REM vc141 vsvarsall requires the architecture as a parameter.
if "_%BOOST_JAM_ARCH%_" == "__" set BOOST_JAM_ARCH=x86
set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %BOOST_JAM_ARCH%

Expand Down
7 changes: 1 addition & 6 deletions src/engine/guess_toolset.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@ECHO OFF

REM ~ Copyright 2002-2007 Rene Rivera.
REM ~ Copyright 2002-2017 Rene Rivera.
REM ~ Distributed under the Boost Software License, Version 1.0.
REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

Expand Down Expand Up @@ -32,11 +32,6 @@ if NOT "_%VS150COMNTOOLS%_" == "__" (
set "BOOST_JAM_TOOLSET=vc141"
set "BOOST_JAM_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\"
goto :eof)
SET cl_path_cmd="%~dp0..\tools\vc141helper\cl_path.cmd"
for /f "tokens=*" %%A in ('cmd /D /S /C "%cl_path_cmd% 14.10"') do if NOT "_%%A_" == "__" (
set "BOOST_JAM_TOOLSET=vc141"
set "BOOST_JAM_TOOLSET_ROOT=%%A\VC\"
goto :eof)
if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
set "BOOST_JAM_TOOLSET=vc141"
set "BOOST_JAM_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\"
Expand Down
79 changes: 40 additions & 39 deletions src/tools/msvc.jam
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -708,19 +708,6 @@ local rule auto-detect-toolset-versions ( )
# Get installation paths from the registry.
for local i in $(.known-versions)
{
if $(i) = 14.1
{
local file = [ path.make [ modules.binding $(__name__) ] ] ;
local cl_path = [ path.native [ path.join [ path.parent $(file) ] vc141helper cl_path.cmd ] ] ;
local shell_ret = [ SHELL "$(cl_path) 14.10 -PathToCompiler" ] ;
local cl_path = $(shell_ret:D) ;
if $(cl_path)
{
path = [ path.native $(cl_path) ] ;
register-configuration $(i) : $(path) ;
}
}

if $(.version-$(i)-reg)
{
local vc-path ;
Expand Down Expand Up @@ -872,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) ;

Expand Down Expand Up @@ -1232,37 +1227,39 @@ 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)
for local env in $(.version-$(version)-env)
{
local vc-path = [ os.environ $(.version-$(version)-env) ] ;
if $(vc-path)
local env-path = [ os.environ $(env) ] ;
if $(env-path) && $(.version-$(version)-path)
{
vc-path = [ path.make $(vc-path) ] ;
vc-path = [ path.join $(vc-path) $(.version-$(version)-envpath) ] ;
vc-path = [ path.native $(vc-path) ] ;

path = $(vc-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 ;
}
}

# Check default path.
if ! $(path) && $(.version-$(version)-path)
{
path = [ path.native [ path.join $(.ProgramFiles) $(.version-$(version)-path) ] ] ;
}
}

return $(path) ;
return $(result) ;
}


Expand Down Expand Up @@ -1655,13 +1652,17 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
# 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. We can't do that as it would

This comment has been minimized.

Copy link
@refack

refack Apr 12, 2017

Contributor

That's not true. Discovery involves Powershell which is a built in Windows tool

# make for a recursive discovery and build dependency cycle. So 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 ;
Expand Down
43 changes: 0 additions & 43 deletions src/tools/vc141helper/GetCLPath.ps1

This file was deleted.

Loading

2 comments on commit 838c622

@KindDragon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very sad changes 😢 You removed everything after we fix almost all issues and compilation with VS2017 works fine
/cc @refack

@refack
Copy link
Contributor

@refack refack commented on 838c622 Apr 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grafikrobot what was the underlining issue?

Please sign in to comment.