Build with VS2019 with 2017 compiler

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Build with VS2019 with 2017 compiler

Postby ndesktop » Mon Mar 22, 2021 6:05 am

Usually I have installed every VS version known to man - starting with 2010. (Ok, maybe not 2012-2013).
I am building CEF for integrating in another product, using VS 2017. After a BSOD requiring reinstall, I have now only VS 2019 Community Edition, but with 2017 tools installed.

My build script contains
Code: Select all
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
SET GYP_MSVS_VERSION=2017
SET GYP_MSVS_OVERRIDE_PATH=G:\bin\vs\2017\pro
set VS2017_INSTALL=G:\bin\vs\2017\pro

pointing to the specific path and version of VS 2017 - now gone as installed program (the disk content of the pre-Windows reset installation is intact, but not as installed - just the files).

So, the questions:
1. Can I use GYP_MSVS_VERSION=2017 and the GYP_MSVS_OVERRIDE_PATH + VS2017_INSTALL pointing to the VS 2019 Community Edition?
Will this know to build using the toolset v141 (cl 2017) tools using the installed VS from that location, or the VS version will be forced to whatever product is detected there (2019, in this case) and will build with toolset v142?
Something similar when creating a solution in VS2019 but instruct projects to build with Platform Toolset v141.
I saw in chromium/src/build/vs_toolchain.py there is the mapping between GYP_MSVS_VERSION and MSVC_TOOLSET_VERSION

or, as an alternative

2. Can the previous VS 2017 disk files be used by the build as-is (i.e. without actually having VS 2017 installed as a product) ?
There are setups for building various systems which simply copy a VS installation directory and then use it only based on its disk location, i.e. without relying on registry keys, default installation paths etc. - just knowing the build tools are in Q:\whatever\acme-2017-tools.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Build with VS2019 with 2017 compiler

Postby magreenblatt » Mon Mar 22, 2021 8:41 am

Why not just build with VS2019? You can use a local install at the default location, or you can extract VS + WinSDK to a directory as described here. Pay particular attention to the comments about using vcvarsall.bat, which is easier then setting INCLUDE/LIB/PATH manually.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Build with VS2019 with 2017 compiler

Postby ndesktop » Mon Mar 22, 2021 9:57 am

magreenblatt wrote:Why not just build with VS2019?

I am integrated in a product using 2017 (at this time) and I don't have a choice for the next 6 months.
But anyways I have installed 2017 community and building with it.

The question remains more as a curiosity, clearly it is not a supported (or desired) scenario.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Build with VS2019 with 2017 compiler

Postby magreenblatt » Mon Mar 22, 2021 11:46 am

I haven't tried mixing VS2017 and VS2019 dependencies. Seems like something that could cause issues.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Build with VS2019 with 2017 compiler

Postby ndesktop » Tue Mar 23, 2021 6:13 am

No, not mixing dependencies. Just using VS2019 but compiling with 2017 platform and use the 2017 runtime.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Build with VS2019 with 2017 compiler

Postby magreenblatt » Tue Mar 23, 2021 9:13 am

ndesktop wrote:No, not mixing dependencies. Just using VS2019 but compiling with 2017 platform and use the 2017 runtime.

In that case what will VS2019 be used for during the build?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Build with VS2019 with 2017 compiler

Postby ndesktop » Tue Mar 23, 2021 10:14 am

Yes, but but it will compile with platform toolset v141, which is 2017.
My question was if is it possible to use the installed 2019 (with 2017 tools and compilers installed as well), or saying VS2019 automatically implies the build will be done with its default toolset v142 (VS 2019).
I know is a edgy thing, but since one can have one VS 2019 installed (or, by accident, 2017 lost until reinstallation) and toolsets for 2015, 2017, 2019 available, to instruct rather the toolset to be used, having GYP_MSVS_PATH only as an indication of "this is the root directory of the Visual Studio" and GYP_MSVS_VERSION the real indicator of "I want to build with 2017" or 2019.
Basically what I was after is something like
set GYP_MSVS_PATH=G:\bin\vs2019
set GYP_MSVS_VERSION=2017
Anyways, I don't think is worth so much effort since installing VS2017 is still an option.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Build with VS2019 with 2017 compiler

Postby magreenblatt » Tue Mar 23, 2021 10:38 am

Got it. I believe a VS2019 install lets you target older toolchains, but I’m not sure if that’s configurable using existing Chromium flags. Note that it will likely use the toolchain from the required WinSDK instead of the VS install.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 27 guests