Skip to content

Added support for building with Visual Studio - #2538

Closed
willyd wants to merge 10 commits into
BVLC:masterfrom
willyd:windows
Closed

Added support for building with Visual Studio#2538
willyd wants to merge 10 commits into
BVLC:masterfrom
willyd:windows

Conversation

@willyd

@willyd willyd commented Jun 2, 2015

Copy link
Copy Markdown
Contributor

This is a first attempt to add support for Visual Studio via the CMake build.

Only static libraries are supported now, but it should not be too hard to add support for shared libraries. Since Visual Studio has no direct equivalent of the --whole-archive option I have included a post build script to generate a header that forces symbol inclusion in caffe.bin and other executable targets.

Dependencies can be hard to build under Windows. To make the dependency compilation easier I provide a super-build project where almost all Caffe dependencies can be built with Visual Studio and a CMake cache file is produced so that Caffe configuration is lot less tedious on Windows (see caffe-windows-dependencies).

I only tested theses changes with Visual Studio 2013 64 bit and CMake 3.2.

@eelstork

Copy link
Copy Markdown
Contributor

C.I. issues with this look easy to fix; one of the configs passes tests.

@willyd

willyd commented Jun 19, 2015

Copy link
Copy Markdown
Contributor Author

@eelstork
Yes I noticed the CI issues. I will resubmit with a fix for them soon.

@Nerei

Nerei commented Jun 19, 2015

Copy link
Copy Markdown

That's cool idea to generate reference header automatically! ;-)

@Nerei

Nerei commented Jun 19, 2015

Copy link
Copy Markdown

In my opinion, it's good idea to make user explicitly enable external projects, i.e. make it off by default and use have to manually set to on in order to run automatic download compilation of glog/gflags. Otherwise it might be a surprise for many users who integrate caffe into own large projects.

(yes I know someone has contributed this before)

Comment thread cmake/Dependencies.cmake Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think this should be done only if user explicitly set special option for this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Some settings of my dependencies made it over in the Caffe CMake files. I will submit again with these settings set through a cache file instead.

@classner

Copy link
Copy Markdown

Good approach! So finally there will even be more than one build system work on Windows! If you stay within CMake already, did you have a look at biicode? It should do the dependency management automatically, and already offer quite some of the dependencies either as blocks or precompiled (including boost) in a well-structured way.

@willyd

willyd commented Jun 22, 2015

Copy link
Copy Markdown
Contributor Author

@ChrisLS I stumbled upon biicode some time ago but they were missing binary blocks at that time. Maybe it is worth to reconsider using this now that they support it (although it seems a bit like a hack: http://blog.biicode.com/upload-to-biicode-precompiled-binaries-sfml/).

@willyd

willyd commented Jul 27, 2015

Copy link
Copy Markdown
Contributor Author

Closing this one in favor of my second attempt (PR #2816).

@willyd willyd closed this Jul 27, 2015
@willyd
willyd deleted the windows branch September 22, 2015 17:43
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.

4 participants