Minimal MSVC compatibility adjustments - #2136
Conversation
|
@ChrisLS Have you tried to execute tests? I suspect it may not work. If I am not mistaken, |
|
@ChrisLS Btw, great work with caffe-brewer!!! This is exactly what I wanted to create but haven't found time slot yet. No, this is better that what I wanted ;-) I found answer on my previous question, you use I hope this would be solved in future in more conventional way by adding |
|
Hi @Nerei, Sure, it would be a lot more convenient if Microsoft offered a way to force full static linking. However, as I wrote in the README.MD, /OPT:NOREF did not force the linkage of static global objects, hence resulting in unregistered layers. |
|
The static linking of caffe object as given me a hard time. The /OPT:NOREF is just useless. The one thing that comes closest to the whole-archive option is the "Use Library Dependency Inputs" which forces a project to link the object files of another instead of the produced library. CMake does not support this option yet (see this post: https://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=13032&graph=relation) so it's not possible to use this without modifying the VS projects by hand after CMake generation. Even then you can use this option only within the same solution so you cannot install the library and use it from a consuming project. The workaround I found is to modify the layer ans class instantiation macros to define additional symbols that can be easily referenced to force symbol linking. So I added a post build script that parses the Caffe sources and generates a header file that when included in the consuming projects forces the linking of the objects. This is suboptimal but works. See my PR for details #2538 |
Second attempt to submit my minimal changeset for full MSVC compatibility.
These adjustments are as non-invasive and minimal as possible, in the hope to be merged into the main branch. This would enable "external" build systems to build caffe out-of-the box on Windows (for example the caffe-brewer.