Closed leavittx closed 11 years ago
OGLplus is a header-only library in the sense that you don't have to build a library if you don't want to, but you can if you want. Generally the library contains larger functions, parsing and compiling of which takes a lot of time. If all such functions are in-lined in all translation units of a larger application (or when building all the ~100 examples) it increases the compilation times. The 'library-mode' allows to compile all those functions once in one translation unit (TU) and the other TUs just declare those functions and their code is linked later.
I'm planning to write a more elaborate tutorial on this topic, but essentialy if you have a large application with many cpp files using oglplus or you are building many smaller applications all using oglplus you can do the following:
1) #define OGLPLUS_LINK_LIBRARY=1 for all TUs (cpp files) being compiled (this just declares the large functions) 2) in one of the cpp files #include the [oglplus/lib.hpp] header file (this will provide the implementations of the 'library' functions) and link the resulting .o/.obj file to the final application(s).
As for the reason why this fails for you: The library contains many functions that require either some C++11 features or modern GL features (version 4.x). If your system does not satisfy some of the requirements then the library is not built and everything is truly header-only and all functions are in-lined (which is not a problem, the building just may take a while longer).
HTH
I've been checking this and I found one other reason for which this may fail on Win/MSVC even if a new version of GLEW is used and the compiler supports most required C++11 features:
OpenGL32.lib not being in the compiler's library search paths. One of of my windows machines this resulted in the warning that the lib cannot be built and copying opengl32.lib to MSVC's lib dir resolved the problem. Maybe this will help you get rid of the warning.
I've also added a brief tutorial on how to compile parts of OGLplus into a library and how to used in applications.
After I've commented lines from the https://github.com/matus-chochlik/oglplus/issues/22 issue, I get the warning
Which is caused by failed try_run() command on https://github.com/matus-chochlik/oglplus/blob/develop/config/OGLplusLib.cmake#L29 line. Tried both with Visual Studio 2012 and Visual Studio 2012 x64. What does that warning mean? How to fix it? Your website says that oglplus is header-only library, so no actual library building should be involved! Can I ignore that warning and still use oglplus? Will I be able to build the examples?