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

[question] Visual Studio minimum version and settings support #10610

Closed
1 task done
tonka3000 opened this issue Feb 17, 2022 · 7 comments · Fixed by #10808
Closed
1 task done

[question] Visual Studio minimum version and settings support #10610

tonka3000 opened this issue Feb 17, 2022 · 7 comments · Fixed by #10808
Milestone

Comments

@tonka3000
Copy link
Contributor

tonka3000 commented Feb 17, 2022

As @memsharded suggest here is the parallel thread to conan-io/tribe#32 (comment)

So defining a older toolset would search for the older compiler? Do I need VS 2017 always to get back to 2012 and 2015 corresponding toolset?

@tonka3000 yes, this is the idea, but if it is going to be a blocker, lets talk.

For me this could be a showstopper for 2.0. Right now I need to support VS 2012, 2015 and 2017. Hopefully I can drop support this year for at least VS 2012. The main problem is that me and my team need to integrate into a lot of big applications which are closed source and require often older compiler versions.

I think VS 2015 might be more doable, up to my knowledge, VS2015 is relatively similar to VS2017, while VS 2012 might be a bit more challenging.

Can you clarify if you are using native VS, or are you using CMake generated solutions? Also, as the tooling is already there in 1.45, we have time to experiment with it. Have you already tried the new integrations? Maybe it is worth to open a parallel thread to try things, to not pollute this thread too much with experiment details, and then come back here with our findings. Do you want to file an issue (for the Conan repo, we can assign a look-into for next 1.46 release) and we can check there?

@tonka3000
Copy link
Contributor Author

tonka3000 commented Feb 17, 2022

Hi @memsharded ,

Can you clarify if you are using native VS, or are you using CMake generated solutions?

All is done via cmake. Conan itself is triggered via your awesome cmake-conan project. So maybe the wrapper can set the correct toolset version, which would help (but I guess it makes the cmake wrapper more complicated). Users use mostly the VSCode-cmake integrations where only the cmake generator names are available. Setting the toolset is possible but make the DX worse (but technical possible of course).

Using Ninja could also be a way to work around the problem because it would skip solution/projects files as a whole.

Have you already tried the new integrations?

Sadly no.

This issue explains the complexity really we https://gitlab.kitware.com/cmake/cmake/-/issues/22257

@memsharded
Copy link
Member

Thanks for submitting the issue.

We don't even have installed such older versions of VS, but if you have them installed a good initial test is to try (with latest Conan 1.45 version) conan new hello/0.1 --template=cmake_lib and conan new hello_app/0.1 --template=cmake_exe, and then conan create . applying your profile with such VS versions. In those templates we integrate and update the latest build system integrations via CMakeDeps and CMakeToolchain and CMake.

@tonka3000
Copy link
Contributor Author

tonka3000 commented Feb 22, 2022

I've now create the small conan recipe via conan new hello_app/0.1 --template=cmake_exe. I use conan 1.45.0.
I can compile when I use compiler.version=190, which should be Visual Studio 2015

Command line: conan create . -s compiler.version=190 -s compiler="msvc" -s compiler.cppstd=14 -s compiler.runtime=dynamic

It uses -G "Visual Studio 14 2015" in the logs, so it seems to work for Visual Studio 2015.

hello_app/0.1: CMake command: cmake -G "Visual Studio 14 2015" -DCMAKE_TOOLCHAIN_FILE="C:/Users/tbam/.conan/data/hello_app/0.1///build/2c16320a32e587ffeed448e7910c2f703cbb2f99/build/conan/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/tbam/.conan/data/hello_app/0.1///package/2c16320a32e587ffeed448e7910c2f703cbb2f99" "C:\Users\tbam.conan\data\hello_app\0.1__\build\2c16320a32e587ffeed448e7910c2f703cbb2f99."

I tried it with compiler.version=120 but I get this

Traceback (most recent call last):
  File "c:\python38\lib\site-packages\conans\client\command.py", line 2241, in run
    method(args[0][1:])
  File "c:\python38\lib\site-packages\conans\client\command.py", line 382, in create
    info = self._conan.create(args.path, name=name, version=version, user=user,
  File "c:\python38\lib\site-packages\conans\client\conan_api.py", line 93, in wrapper
    return f(api, *args, **kwargs)
  File "c:\python38\lib\site-packages\conans\client\conan_api.py", line 388, in create
    create(self.app, ref, graph_info, remotes, update, build_modes,
  File "c:\python38\lib\site-packages\conans\client\cmd\create.py", line 72, in create
    install_build_and_test(app, test_conanfile_path,
  File "c:\python38\lib\site-packages\conans\client\cmd\test.py", line 35, in install_build_and_test
    deps_install(app=app,
  File "c:\python38\lib\site-packages\conans\client\manager.py", line 58, in deps_install
    deps_graph = graph_manager.load_graph(ref_or_path, create_reference, graph_info, build_modes,
  File "c:\python38\lib\site-packages\conans\client\graph\graph_manager.py", line 125, in load_graph
    deps_graph = self._resolve_graph(root_node, profile_host, profile_build, graph_lock,
  File "c:\python38\lib\site-packages\conans\client\graph\graph_manager.py", line 287, in _resolve_graph
    deps_graph = self._load_graph(root_node, check_updates, update,
  File "c:\python38\lib\site-packages\conans\client\graph\graph_manager.py", line 408, in _load_graph
    self._recurse_build_requires(graph, builder, check_updates, update, build_mode,
  File "c:\python38\lib\site-packages\conans\client\graph\graph_manager.py", line 334, in _recurse_build_requires
    self._binary_analyzer.evaluate_graph(graph, build_mode, update, remotes, nodes_subset, root)
  File "c:\python38\lib\site-packages\conans\client\graph\graph_binaries.py", line 414, in evaluate_graph
    self._compute_package_id(node, default_package_id_mode, default_python_requires_id_mode)
  File "c:\python38\lib\site-packages\conans\client\graph\graph_binaries.py", line 376, in _compute_package_id
    msvc_compatible = conanfile.info.msvc_compatible()
  File "c:\python38\lib\site-packages\conans\model\info.py", line 591, in msvc_compatible
    visual_version = msvc_version_to_vs_ide_version(version)
  File "c:\python38\lib\site-packages\conan\tools\microsoft\visual.py", line 15, in msvc_version_to_vs_ide_version
    return _visuals[str(version)]
KeyError: '120'

but this was kind of expected 😄
image

Not quite sure if I tested the right thing 😄

@memsharded
Copy link
Member

Hi @tonka3000

Yes, there was some previous versions missing there, I have done #10808 to address this.
I added a unit test, but I didn't manage to get an older VS installed, so it would be great if you could run from my source branch there, to see if things are looking ok.

@memsharded
Copy link
Member

This was closed automatically when merging #10808, but please @tonka3000, if you could report (now that is merged, you can even test it from PyPI-test) if it is working for your use cases, it would be fantastic. The conan-io/tribe#32 proposal is still open waiting for this, if this works, I guess you might change your downvote? (check the comments there too proposing changes too) Thanks!

@tonka3000
Copy link
Contributor Author

@memsharded I will check it

@tonka3000
Copy link
Contributor Author

@memsharded It works for version 170 and 190 👏 . I have no 180, but I guess it works too 😄 .

I used the small default project via conan new hello_app/0.1 --template=cmake_exe.

Command lines where conan create . -s compiler.version=170 -s compiler="msvc" -s compiler.cppstd=14 -s compiler.runtime=dynamic and conan create . -s compiler.version=190 -s compiler="msvc" -s compiler.cppstd=14 -s compiler.runtime=dynamic

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

Successfully merging a pull request may close this issue.

2 participants