New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build package for mulitple versions of Visual Studio / multiple toolsets? #1207

Closed
meastp opened this Issue Jun 1, 2017 · 10 comments

Comments

Projects
None yet
6 participants
@meastp

meastp commented Jun 1, 2017

Is it possible to build e.g. boost for multiple toolsets (140 and 141) with vcpkg?

(If 140 and 141 is a bad example because they are compatible, think of 141 and 150)

Perhaps the triplet could be expanded to include toolset as well (with empty toolset => latest being the default)?

@albertziegenhagel

This comment has been minimized.

Show comment
Hide comment
@albertziegenhagel

albertziegenhagel Jun 1, 2017

Contributor

The merge request #1098 adds support for pretty much exactly what you want as a side effect to supporting Fortran.

You can specify the toolset version via VCPKG_PLATFORM_TOOLSET in the triplet. If it is empty, vcpkg will do as it does now and just takes the latest VS version it can find.

Contributor

albertziegenhagel commented Jun 1, 2017

The merge request #1098 adds support for pretty much exactly what you want as a side effect to supporting Fortran.

You can specify the toolset version via VCPKG_PLATFORM_TOOLSET in the triplet. If it is empty, vcpkg will do as it does now and just takes the latest VS version it can find.

@meastp

This comment has been minimized.

Show comment
Hide comment
@meastp

meastp Jun 1, 2017

Wow, that's great!

Could you clarify with an example of compiling a package foo for both vs2015 and vs2017 (when the feature is merged)?

meastp commented Jun 1, 2017

Wow, that's great!

Could you clarify with an example of compiling a package foo for both vs2015 and vs2017 (when the feature is merged)?

@albertziegenhagel

This comment has been minimized.

Show comment
Hide comment
@albertziegenhagel

albertziegenhagel Jun 1, 2017

Contributor

I would suggest to create a triplet (e.g. x64-windows-v140) with the content of x64-windows and additionally the line

VCPKG_PLATFORM_TOOLSET=v140

and a second one (e.g. x64-windows-v141) with

VCPKG_PLATFORM_TOOLSET=v141

Then you can use

vcpkg install boost:x64-windows-v140 boost:x64-windows-v141

to build boost with both, VS2015 and VS2017.

Some additional remarks regarding the pull request: Since the PR is work in progress and tries to solve a more complicated problem (Fortran support) I am not sure when it will be ready to be merged. Maybe it makes sense to extract the changes that allow setting a toolset version explicitly into an other PR which can be merged without that much effect on other parts. @ras0219-msft what do you think?

Contributor

albertziegenhagel commented Jun 1, 2017

I would suggest to create a triplet (e.g. x64-windows-v140) with the content of x64-windows and additionally the line

VCPKG_PLATFORM_TOOLSET=v140

and a second one (e.g. x64-windows-v141) with

VCPKG_PLATFORM_TOOLSET=v141

Then you can use

vcpkg install boost:x64-windows-v140 boost:x64-windows-v141

to build boost with both, VS2015 and VS2017.

Some additional remarks regarding the pull request: Since the PR is work in progress and tries to solve a more complicated problem (Fortran support) I am not sure when it will be ready to be merged. Maybe it makes sense to extract the changes that allow setting a toolset version explicitly into an other PR which can be merged without that much effect on other parts. @ras0219-msft what do you think?

@ras0219-msft

This comment has been minimized.

Show comment
Hide comment
@ras0219-msft

ras0219-msft Jun 2, 2017

Contributor

I totally agree with splitting the fortran PR into two separate PRs! It has been a bit since I looked at the code changes, but I recall the toolset option support being pretty much good to go.

The triplet suggestion is also exactly as I would recommend handling the toolset difference (though the exact syntax would be set(VCPKG_PLATFORM_TOOLSET v140)).

Contributor

ras0219-msft commented Jun 2, 2017

I totally agree with splitting the fortran PR into two separate PRs! It has been a bit since I looked at the code changes, but I recall the toolset option support being pretty much good to go.

The triplet suggestion is also exactly as I would recommend handling the toolset difference (though the exact syntax would be set(VCPKG_PLATFORM_TOOLSET v140)).

@bagong

This comment has been minimized.

Show comment
Hide comment
@bagong

bagong Jun 2, 2017

Contributor

We'll get an explosion of triplets sooner or later ;). Each feature that's added to them doubles the number of potential "triplets". And toolset is binary only atm.

Contributor

bagong commented Jun 2, 2017

We'll get an explosion of triplets sooner or later ;). Each feature that's added to them doubles the number of potential "triplets". And toolset is binary only atm.

@ras0219-msft

This comment has been minimized.

Show comment
Hide comment
@ras0219-msft

ras0219-msft Jun 2, 2017

Contributor

Yep, there's an explosion of possible triplets. This is just the wonderful/terrible nature of the beast that is C++!

However, that doesn't mean we must add all of them by default! It's important to be capable of handling these scenarios, but it's also important to clearly indicate where the path ends and the forest begins!
🌲 🌲 🌲

For this specific case, we'll continue with what we do today: pick the latest of VS2015 or VS2017. In some future where there's another abi break, we'll need to add a new set of triplets for that.

Contributor

ras0219-msft commented Jun 2, 2017

Yep, there's an explosion of possible triplets. This is just the wonderful/terrible nature of the beast that is C++!

However, that doesn't mean we must add all of them by default! It's important to be capable of handling these scenarios, but it's also important to clearly indicate where the path ends and the forest begins!
🌲 🌲 🌲

For this specific case, we'll continue with what we do today: pick the latest of VS2015 or VS2017. In some future where there's another abi break, we'll need to add a new set of triplets for that.

@Voskrese

This comment has been minimized.

Show comment
Hide comment
@Voskrese

Voskrese Jun 3, 2017

Contributor

простите, а вынести в командную строку можно данный параметр?
или это возможно только вносить через скрипт cmake

Sorry, but the command line can be put in this option?
or is it only possible to make cmake via script

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets>dir

LLVM-vs2014
LLVM-vs2014_xp
v140
v140_clang_3_7
v140_clang_c2
v140_xp
WindowsApplicationForDrivers10.0
WindowsKernelModeDriver10.0
WindowsUserModeDriver10.0

Contributor

Voskrese commented Jun 3, 2017

простите, а вынести в командную строку можно данный параметр?
или это возможно только вносить через скрипт cmake

Sorry, but the command line can be put in this option?
or is it only possible to make cmake via script

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets>dir

LLVM-vs2014
LLVM-vs2014_xp
v140
v140_clang_3_7
v140_clang_c2
v140_xp
WindowsApplicationForDrivers10.0
WindowsKernelModeDriver10.0
WindowsUserModeDriver10.0

@ras0219-msft ras0219-msft closed this in #1213 Jun 6, 2017

@ras0219-msft

This comment has been minimized.

Show comment
Hide comment
@ras0219-msft

ras0219-msft Jun 6, 2017

Contributor

простите, а вынести в командную строку можно данный параметр?
или это возможно только вносить через скрипт cmake

@Voskrese I'm not totally sure what you mean by that, but many of those toolsets are slightly different MSBuild wrappers around a small set of true compiler versions (which may have different default compiler macros/flags).

We've recently added support for specifying compiler flags in the triplet file via 0c70ca2, which may help here.

As for using clang, we don't currently support it though we'd be open to PR's that make it work! The trouble would be figuring out how to pipe it through into all the various library buildsystems. Most might react to a CXX environment variable.

Contributor

ras0219-msft commented Jun 6, 2017

простите, а вынести в командную строку можно данный параметр?
или это возможно только вносить через скрипт cmake

@Voskrese I'm not totally sure what you mean by that, but many of those toolsets are slightly different MSBuild wrappers around a small set of true compiler versions (which may have different default compiler macros/flags).

We've recently added support for specifying compiler flags in the triplet file via 0c70ca2, which may help here.

As for using clang, we don't currently support it though we'd be open to PR's that make it work! The trouble would be figuring out how to pipe it through into all the various library buildsystems. Most might react to a CXX environment variable.

@Voskrese

This comment has been minimized.

Show comment
Hide comment
@Voskrese

Voskrese Jun 6, 2017

Contributor

ras0219-msft, спасибо за ответ, я уже понял) только для версии 14 и 15 полностью совместимы
не судите строго, из-за незнания много вещей)

ras0219-msft, thanks for the reply, I have already realized) only version 14 and 15 are fully compatible
do not judge strictly, due to ignorance of many things)

Contributor

Voskrese commented Jun 6, 2017

ras0219-msft, спасибо за ответ, я уже понял) только для версии 14 и 15 полностью совместимы
не судите строго, из-за незнания много вещей)

ras0219-msft, thanks for the reply, I have already realized) only version 14 and 15 are fully compatible
do not judge strictly, due to ignorance of many things)

@txponto

This comment has been minimized.

Show comment
Hide comment
@txponto

txponto Jan 28, 2018

I have tried the triplets to install x86 toolset 141 boost libs and I'm not having much success.

txponto commented Jan 28, 2018

I have tried the triplets to install x86 toolset 141 boost libs and I'm not having much success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment