Review: Visual Studio 2010 compile fix Edit


Jeremy Selan <jeremy...@...>
 

http://github.com/imageworks/OpenColorIO/pull/300

Frederik has submitted a bunch of changes related to Visual Studio
2010 compatibility and STATIC linking.

As this touches CMake mojo as used on linux / osx, would those
familiar with package management please check this request out?

Thanks!

-- Jeremy

--------------------------------------------------------------------------------------------------------------

I changed the CMake files to fix the compilation issues I (and
apparently others) had while trying to compile OpenColorIO on Windows
7 using Visual Studio 2010. This works for the STATIC version of
OpenColorIO. I have not tried the SHARED version. Also, I only built
the core OpenColorIO library and not any of the tools.

Notable changes:

Both tinyxml and yaml-cpp can now be found externally using the
USE_EXTERNAL_* options in CMake. This is useful when
ExternalProject_Add doesn't work as it should.
Removed the PkgConfig dependency for yaml-cpp by adding a very raw
FindYAML_CPP.cmake package. The latter has a lot of room for
improvement and is merely intended as a quick-fix. This is useful when
PkqConfig is not present which is rarely the case with Windows
Installations
The static build of OpenColorIO is no longer linked with external
libraries. Static libraries do not incorporate the binary objects of
its dependencies. It is up to the runtime binary that links against
OpenColorIO to link the entire hierarchy of dependencies. In other
words, the target_link_libraries has no effect on archive targets
(ceated with add_library(TARGET_NAME STATIC ...)). Sources:
http://stackoverflow.com/questions/1242820/can-a-c-static-library-link-to-shared-library
http://stackoverflow.com/questions/2157629/linking-static-libraries-to-other-static-libraries
Added the definition OCIO_BUILD_STATIC to static builds so the code
doesn't use __declspec(dllimport) when building statically. This fixes
a lot of linker errors.

Join {ocio-dev@lists.aswf.io to automatically receive all group messages.