Skip to content
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

Feature/msbuild toolchain #7674

Merged
merged 12 commits into from Sep 25, 2020

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Sep 8, 2020

Changelog: Feature: New experimental MSBuildToolchain to generate conan_toolchain.props files (it is multi-config, will generate one specific toolchain file per configuration) for more transparent integration and better developer experience with Visual Studio.
Docs: conan-io/docs#1865

@memsharded memsharded added this to the 1.30 milestone Sep 8, 2020
@memsharded memsharded requested a review from solvingj Sep 8, 2020
Copy link
Contributor

@solvingj solvingj left a comment

This looks good.
I agree with the comment that the "arch" mapping needs to include at least ARM in the near future, but it's not critical for right now.
At this moment, I can't think of any other variables we would want to add here for MSVC, but it seems like there should be others.

@memsharded memsharded marked this pull request as ready for review Sep 9, 2020
@memsharded memsharded requested review from jgsogo and SSE4 Sep 9, 2020

props = [("Configuration", settings.build_type),
# FIXME: This probably requires mapping ARM architectures
("Platform", {'x86': 'Win32',
Copy link
Contributor

@SSE4 SSE4 Sep 9, 2020

Choose a reason for hiding this comment

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

yes, armv7 -> ARM, armv8 - ARM64 (maybe few others for Windows CE and Itanium).
https://github.com/dotnet/msbuild/blob/df645299a158c787f9884fca2bcd8c295318193f/src/Shared/NativeMethodsShared.cs#L437
https://github.com/dotnet/msbuild/blob/cb5277fbfa4fba3e87874b472ade356c0ecf47b2/src/Utilities/ProcessorArchitecture.cs#L60
might be good idea to extract to the common tool as well, as we have mapping in several places already

def format_macro(k, value):
return '%s="%s"' % (k, value) if value is not None else k

runtime = self._conanfile.settings.get_safe("compiler.runtime")
Copy link
Contributor

@SSE4 SSE4 Sep 9, 2020

Choose a reason for hiding this comment

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

I think we should respect compiler.base (for Intel and other base toolchains).
maybe also introduce runtime_from_settings? (like cppstd_from_settings)

conans/client/toolchain/msbuild.py Outdated Show resolved Hide resolved
conans/client/toolchain/msbuild.py Outdated Show resolved Hide resolved
conan_toolchain = dom.toprettyxml()
conan_toolchain = "\n".join(line for line in conan_toolchain.splitlines() if line.strip())
self._conanfile.output.info("MSBuildToolchain writing %s" % "conan_toolchain.props")
save(main_toolchain_path, conan_toolchain)
Copy link
Contributor

@SSE4 SSE4 Sep 9, 2020

Choose a reason for hiding this comment

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

not sure if needed, but we specified utf-8 encoding in the file itself. maybe it makes sense to specify utf-8 encoding for tools.save as well

Copy link
Member Author

@memsharded memsharded Sep 23, 2020

Choose a reason for hiding this comment

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

utf-8 is already the default in save()

Copy link
Contributor

@SSE4 SSE4 left a comment

I really like the toolchain approach in general and this particular msbuild implementation.
few questions to clarify, the most important thing is definitions - should they specify preprocessor definitions or msbuild properties?
other comments mostly about re-factoring - I don't think need to address them right away, maybe just remember or put some FIXMEs to not forget about them.

@memsharded memsharded merged commit b2632a5 into conan-io:develop Sep 25, 2020
2 checks passed
@memsharded memsharded deleted the feature/msbuild_toolchain branch Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants