Skip to content

Added VS2017 support (MSVC 1910) - #7797

Merged
opencv-pushbot merged 1 commit into
opencv:masterfrom
patrikhuber:add-vs2017
Dec 6, 2016
Merged

opencv-pushbot merged 1 commit into
opencv:masterfrom
patrikhuber:add-vs2017

Conversation

@patrikhuber

@patrikhuber patrikhuber commented Dec 6, 2016 •

Copy link
Copy Markdown
Contributor

This pullrequest changes

Add support for VS2017 (RC is out, final will be very soon). It's identifier is MSVC 1910 and it's vc15.

Probably there are some changes necessary to the CMake find_package command: VS2017 is supposedly binary-compatible with VS2015, which means that when using the VS2015 generator, find_package should accept binaries created with vc14 as well as vc15, and the VS2017 generator should accept binaries from vc14 as well as vc15 too, but prefer binaries from vc15 (its own version). This can be done in a separate PR.

Even though they're binary compatible it still makes sense to merge this PR which outputs binaries generated with VS2017 into a vc15 folder, since vc15 is its new version number and I think I read in a blog-post that the binaries do differ and some newer features are used if all components that are linked are compiled from VS2017, and no "older" libraries take part in the linking.

So in my opinion it makes sense to output binaries from VS2015 into vc14, and binaries from VS2017 into vc15 - even though they may well be binary compatible.

@patrikhuber

Copy link
Copy Markdown
Contributor Author

Also should I backport this to 2.4.x too? If it is still maintained, then, yes?

@patrikhuber

patrikhuber commented Dec 6, 2016 •

Copy link
Copy Markdown
Contributor Author

This changes makes building OpenCV and the INSTALL target work, but when I try to use it in an app, I get:

-- OpenCV ARCH: x64
-- OpenCV RUNTIME: vc15
-- OpenCV STATIC: ON
-- Found OpenCV 3.1.0 in C:/opencv-git/install-vs2017rc/x64/vc15/lib
-- You might need to add C:\opencv-git\install-vs2017rc\x64\vc15\bin to your PATH to be able to run your applications.
CMake Error at CMakeLists.txt:79 (find_package):
  Found package configuration file:

    C:/opencv-git/install-vs2017rc/OpenCVConfig.cmake

  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.

I had a look at C:/opencv-git/install-vs2017rc/OpenCVConfig.cmake but I can't make sense of it - it never sets OpenCV_FOUND to true, in none of the if/else branches?

@mshabunin

Copy link
Copy Markdown
Contributor

@patrikhuber , looks like cmake sets <package>_FOUND variable to TRUE automatically when it founds <Package>Config.cmake file and then this configuration script can set the variable back to FALSE during processing.

Windows cmake configuration file for OpenCV is split into main OpenCVConfig.cmake located in the install root and <arch>/<platform>/lib/OpenCVConfig.cmake for each arch and platform (x64/vc14 for example).

This behavior looks strange, could you provide cmake commands you used to build OpenCV and test app and CMakeLists.txt for your test app?

@patrikhuber

Copy link
Copy Markdown
Contributor Author

@mshabunin: Ok, forget about the issue with OpenCV_FOUND. It works perfectly fine. There was a problem in my test-app (it had /machine:x64 as well as /machine:x86 set at the same time because earlier I aborted cmake).

Which means the only question left is how you guys want to handle what I mentioned above (I don't have enough knowledge in that area of CMake to make these changes right now):

Probably there are some changes necessary to the CMake find_package command: VS2017 is supposedly binary-compatible with VS2015, which means that when using the VS2015 generator, find_package should accept binaries created with vc14 as well as vc15, and the VS2017 generator should accept binaries from vc14 as well as vc15 too, but prefer binaries from vc15 (its own version). This can be done in a separate PR.

@alalek

alalek commented Dec 6, 2016

Copy link
Copy Markdown
Member

VS2017 is supposedly binary-compatible with VS2015

The current patch looks good to me. 👍
We can improve it later after more experiments/tests (we don't have VS2017 yet).

BTW, Could you add some link with information about binary compatibility?

@opencv-pushbot
opencv-pushbot merged commit bd0a8c7 into opencv:master Dec 6, 2016
@patrikhuber

Copy link
Copy Markdown
Contributor Author

BTW, Could you add some link with information about binary compatibility?

I think the best link is probably this post: http://stackoverflow.com/questions/40854917/is-visual-c-2017-binary-compatible-with-vc-2015
It further links to a talk from Steve Carroll from MS and the person answering the SO question is Andrew Pardoe from the MSVC++ team.

@patrikhuber
patrikhuber deleted the add-vs2017 branch July 6, 2017 18:08
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

port/backport done Label for maintainers. Authors of PR can ignore this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants