diff options
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/Modules/FindOpenColorIO.cmake | 19 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_apple.cmake | 7 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 2 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32.cmake | 8 |
4 files changed, 28 insertions, 8 deletions
diff --git a/build_files/cmake/Modules/FindOpenColorIO.cmake b/build_files/cmake/Modules/FindOpenColorIO.cmake index 5c0ad89a0b7..21118533ebe 100644 --- a/build_files/cmake/Modules/FindOpenColorIO.cmake +++ b/build_files/cmake/Modules/FindOpenColorIO.cmake @@ -26,7 +26,8 @@ ENDIF() SET(_opencolorio_FIND_COMPONENTS OpenColorIO yaml-cpp - tinyxml + expat + pystring ) SET(_opencolorio_SEARCH_DIRS @@ -60,12 +61,23 @@ FOREACH(COMPONENT ${_opencolorio_FIND_COMPONENTS}) ENDIF() ENDFOREACH() +IF(EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h") + # Search twice, because this symbol changed between OCIO 1.x and 2.x + FILE(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" _opencolorio_version + REGEX "^#define OCIO_VERSION_STR[ \t].*$") + IF(NOT _opencolorio_version) + file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" _opencolorio_version + REGEX "^#define OCIO_VERSION[ \t].*$") + ENDIF() + STRING(REGEX MATCHALL "[0-9]+[.0-9]+" OPENCOLORIO_VERSION ${_opencolorio_version}) +ENDIF() # handle the QUIETLY and REQUIRED arguments and set OPENCOLORIO_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG - _opencolorio_LIBRARIES OPENCOLORIO_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO + REQUIRED_VARS _opencolorio_LIBRARIES OPENCOLORIO_INCLUDE_DIR + VERSION_VAR OPENCOLORIO_VERSION) IF(OPENCOLORIO_FOUND) SET(OPENCOLORIO_LIBRARIES ${_opencolorio_LIBRARIES}) @@ -78,6 +90,7 @@ MARK_AS_ADVANCED( OPENCOLORIO_OPENCOLORIO_LIBRARY OPENCOLORIO_TINYXML_LIBRARY OPENCOLORIO_YAML-CPP_LIBRARY + OPENCOLORIO_VERSION ) UNSET(COMPONENT) diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index e51bdede34b..b95b21da946 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -297,7 +297,12 @@ if(WITH_OPENIMAGEIO) endif() if(WITH_OPENCOLORIO) - find_package(OpenColorIO) + find_package(OpenColorIO 2.0.0) + + if(NOT OPENCOLORIO_FOUND) + set(WITH_OPENCOLORIO OFF) + message(STATUS "OpenColorIO not found") + endif() endif() if(WITH_OPENVDB) diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index fed70c5b8b2..f212741f0b6 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -385,7 +385,7 @@ if(WITH_OPENIMAGEIO) endif() if(WITH_OPENCOLORIO) - find_package_wrapper(OpenColorIO) + find_package_wrapper(OpenColorIO 2.0.0) set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES}) set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 37a3eabc338..06cee51344a 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -500,7 +500,7 @@ if(WITH_OPENIMAGEIO) set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG}) set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0") - set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD") + set(OPENCOLORIO_DEFINITIONS "-DDOpenColorIO_SKIP_IMPORTS") set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe") add_definitions(-DOIIO_STATIC_DEFINE) add_definitions(-DOIIO_NO_SSE=1) @@ -538,11 +538,13 @@ if(WITH_OPENCOLORIO) set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib) set(OPENCOLORIO_LIBRARIES optimized ${OPENCOLORIO_LIBPATH}/OpenColorIO.lib - optimized ${OPENCOLORIO_LIBPATH}/tinyxml.lib optimized ${OPENCOLORIO_LIBPATH}/libyaml-cpp.lib + optimized ${OPENCOLORIO_LIBPATH}/libexpatMD.lib + optimized ${OPENCOLORIO_LIBPATH}/pystring.lib debug ${OPENCOLORIO_LIBPATH}/OpencolorIO_d.lib - debug ${OPENCOLORIO_LIBPATH}/tinyxml_d.lib debug ${OPENCOLORIO_LIBPATH}/libyaml-cpp_d.lib + debug ${OPENCOLORIO_LIBPATH}/libexpatdMD.lib + debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib ) set(OPENCOLORIO_DEFINITIONS) endif() |