OCIO 1.1.1 port added (#8006)

This commit is contained in:
MACHIZAUD Andréa 2019-09-16 18:08:41 +02:00 committed by Curtis J Bezault
parent 8a44d47f76
commit f152ba3cc0
9 changed files with 389 additions and 0 deletions

View File

@ -0,0 +1,39 @@
diff --git a/src/apps/ociobakelut/CMakeLists.txt b/src/apps/ociobakelut/CMakeLists.txt
index d31b4e3..778b631 100644
--- a/src/apps/ociobakelut/CMakeLists.txt
+++ b/src/apps/ociobakelut/CMakeLists.txt
@@ -5,6 +5,34 @@ if(LCMS_FOUND AND (LCMS_VERSION VERSION_EQUAL 2.1 OR LCMS_VERSION VERSION_GREATE
FIND_PACKAGE_MESSAGE(LCMS "Found lcms: ${LCMS_LIBRARIES}"
"${LCMS_INCLUDE_DIR}")
else()
+ find_path(LCMS_INCLUDE_DIRS
+ NAMES
+ lcms2.h
+ lcms2_plugin.h
+ HINTS
+ ${LCMS_INCLUDEDIR}
+ ${LCMS_INCLUDE_DIRS}
+ )
+
+ find_library(LCMS_LIBRARIES
+ LIBRARY_NAMES
+ lcms2
+ HINTS
+ ${LCMS_LIBRARY_DIRS}
+ )
+
+ get_filename_component(LCMS_LIBRARY_DIRS ${LCMS_LIBRARIES} DIRECTORY)
+
+ find_package_handle_standard_args(LCMS
+ REQUIRED_VARS
+ LCMS_LIBRARIES
+ LCMS_LIBRARY_DIRS
+ LCMS_INCLUDE_DIRS
+ )
+ mark_as_advanced(LCMS_LIBRARIES LCMS_INCLUDE_DIRS LCMS_LIBRARY_DIRS LCMS_FOUND)
+endif()
+
+if(NOT LCMS_FOUND)
find_package(Git)
if(NOT GIT_EXECUTABLE)
message("Git not found, could not build external LCMS as we cannot apply patch")

View File

@ -0,0 +1,84 @@
diff --git a/src/apps/ocioconvert/CMakeLists.txt b/src/apps/ocioconvert/CMakeLists.txt
index 82b0792..7d16bdf 100644
--- a/src/apps/ocioconvert/CMakeLists.txt
+++ b/src/apps/ocioconvert/CMakeLists.txt
@@ -6,16 +6,23 @@ if (OIIO_FOUND)
${OIIO_INCLUDES}
${ILMBASE_INCLUDES}
)
-
+
file(GLOB_RECURSE share_src_files "${CMAKE_SOURCE_DIR}/src/apps/share/*.cpp")
-
+
add_executable(ocioconvert ${share_src_files} main.cpp)
-
+
+ target_compile_options(ocioconvert
+ PRIVATE
+ $<$<CXX_COMPILER_ID:MSVC>:
+ /Zc:__cplusplus # Enable updated __cplusplus macro
+ >
+ )
+
set_target_properties(ocioconvert PROPERTIES COMPILE_FLAGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
target_link_libraries(ocioconvert ${OIIO_LIBRARIES} ${CMAKE_DL_LIBS})
-
+
target_link_OCIO(ocioconvert)
-
+
install(TARGETS ocioconvert EXPORT OpenColorIO DESTINATION ${CMAKE_INSTALL_EXEC_PREFIX}/bin)
endif()
diff --git a/src/apps/ociodisplay/CMakeLists.txt b/src/apps/ociodisplay/CMakeLists.txt
index d11b9e1..0f27d86 100644
--- a/src/apps/ociodisplay/CMakeLists.txt
+++ b/src/apps/ociodisplay/CMakeLists.txt
@@ -11,6 +11,13 @@ if (OIIO_FOUND)
add_executable(ociodisplay main.cpp)
+ target_compile_options(ociodisplay
+ PRIVATE
+ $<$<CXX_COMPILER_ID:MSVC>:
+ /Zc:__cplusplus # Enable updated __cplusplus macro
+ >
+ )
+
# set_target_properties(ociodisplay PROPERTIES INSTALL_RPATH ${OIIO_LIBRARIES} )
set_target_properties(ociodisplay PROPERTIES COMPILE_FLAGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
target_link_libraries(ociodisplay ${GLEW_LIBRARIES} ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${OIIO_LIBRARIES})
diff --git a/src/apps/ociolutimage/CMakeLists.txt b/src/apps/ociolutimage/CMakeLists.txt
index 528333f..821155d 100644
--- a/src/apps/ociolutimage/CMakeLists.txt
+++ b/src/apps/ociolutimage/CMakeLists.txt
@@ -6,16 +6,23 @@ if (OIIO_FOUND)
${OIIO_INCLUDES}
${ILMBASE_INCLUDES}
)
-
+
file(GLOB_RECURSE share_src_files "${CMAKE_SOURCE_DIR}/src/apps/share/*.cpp")
-
+
add_executable(ociolutimage ${share_src_files} main.cpp)
-
+
+ target_compile_options(ociolutimage
+ PRIVATE
+ $<$<CXX_COMPILER_ID:MSVC>:
+ /Zc:__cplusplus # Enable updated __cplusplus macro
+ >
+ )
+
set_target_properties(ociolutimage PROPERTIES COMPILE_FLAGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
target_link_libraries(ociolutimage ${OIIO_LIBRARIES} ${CMAKE_DL_LIBS})
-
+
target_link_OCIO(ociolutimage)
-
+
install(TARGETS ociolutimage EXPORT OpenColorIO DESTINATION ${CMAKE_INSTALL_EXEC_PREFIX}/bin)
endif()

View File

@ -0,0 +1,13 @@
diff --git a/src/core/Config.cpp b/src/core/Config.cpp
index f5cb379..5ea178e 100644
--- a/src/core/Config.cpp
+++ b/src/core/Config.cpp
@@ -330,7 +330,7 @@ OCIO_NAMESPACE_ENTER
sanitytext_ = rhs.sanitytext_;
cacheids_ = rhs.cacheids_;
- cacheidnocontext_ = cacheidnocontext_;
+ cacheidnocontext_ = rhs.cacheidnocontext_;
}
return *this;
}

View File

@ -0,0 +1,108 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4f3119..5cfa601 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -244,34 +244,49 @@ else(USE_EXTERNAL_TINYXML)
endif()
set_target_properties(TINYXML_LIB PROPERTIES FOLDER External)
endif(USE_EXTERNAL_TINYXML)
-
+
###############################################################################
### YAML ###
if(USE_EXTERNAL_YAML)
- # Set minimum yaml version for non-patched sources.
- set(YAML_VERSION_MIN "0.3.0")
- include(FindPkgConfig)
- pkg_check_modules(PC_YAML_CPP REQUIRED QUIET yaml-cpp)
- find_path(YAML_CPP_INCLUDE_DIR yaml-cpp/yaml.h
- HINTS ${PC_YAML_CPP_INCLUDEDIR} ${PC_YAML_CPP_INCLUDE_DIRS} )
- find_library(YAML_CPP_LIBRARY LIBRARY_NAMES yaml-cpp libyaml-cpp
- HINTS ${PC_YAML_CPP_LIBRARY_DIRS} )
- set(YAML_CPP_LIBRARIES ${YAML_CPP_LIBRARY})
- set(YAML_CPP_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR})
- set(YAML_CPP_VERSION ${PC_YAML_CPP_VERSION})
-
- if(YAML_CPP_VERSION VERSION_LESS ${YAML_VERSION_MIN})
- message(FATAL_ERROR "ERROR: yaml-cpp ${YAML_VERSION_MIN} or greater is required.")
- endif()
+ find_package(yaml-cpp 0.3.0)
+ if(yaml-cpp_FOUND)
+ include(FindPackageMessage)
+
+ set(YAML_CPP_FOUND ${yaml-cpp_FOUND})
+ set(YAML_CPP_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR})
+ set(YAML_CPP_VERSION ${yaml-cpp_VERSION})
+ set(YAML_CPP_LIBRARIES yaml-cpp)
+
+ find_package_message(yaml-cpp
+ "Found yaml ${YAML_CPP_VERSION}: ${YAML_CPP_INCLUDE_DIRS}"
+ "${YAML_CPP_INCLUDE_DIRS}:${YAML_CPP_LIBRARIES}"
+ )
+ else()
+ # Set minimum yaml version for non-patched sources.
+ set(YAML_VERSION_MIN "0.3.0")
+ include(FindPkgConfig)
+ pkg_check_modules(PC_YAML_CPP REQUIRED QUIET yaml-cpp)
+ find_path(YAML_CPP_INCLUDE_DIR yaml-cpp/yaml.h
+ HINTS ${PC_YAML_CPP_INCLUDEDIR} ${PC_YAML_CPP_INCLUDE_DIRS} )
+ find_library(YAML_CPP_LIBRARY LIBRARY_NAMES yaml-cpp libyaml-cpp
+ HINTS ${PC_YAML_CPP_LIBRARY_DIRS} )
+ set(YAML_CPP_LIBRARIES ${YAML_CPP_LIBRARY})
+ set(YAML_CPP_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR})
+ set(YAML_CPP_VERSION ${PC_YAML_CPP_VERSION})
+
+ if(YAML_CPP_VERSION VERSION_LESS ${YAML_VERSION_MIN})
+ message(FATAL_ERROR "ERROR: yaml-cpp ${YAML_VERSION_MIN} or greater is required.")
+ endif()
- find_package_handle_standard_args(yaml-cpp
- REQUIRED_VARS YAML_CPP_LIBRARIES YAML_CPP_INCLUDE_DIRS )
- set(YAML_CPP_FOUND ${YAML-CPP_FOUND})
- mark_as_advanced(YAML_CPP_INCLUDE_DIR YAML_CPP_LIBRARY YAML-CPP_FOUND)
+ find_package_handle_standard_args(yaml-cpp
+ REQUIRED_VARS YAML_CPP_LIBRARIES YAML_CPP_INCLUDE_DIRS )
+ set(YAML_CPP_FOUND ${YAML-CPP_FOUND})
+ mark_as_advanced(YAML_CPP_INCLUDE_DIR YAML_CPP_LIBRARY YAML-CPP_FOUND)
+ endif()
if(YAML_CPP_FOUND)
- if(YAML_CPP_VERSION VERSION_GREATER "0.5.0")
+ if(YAML_CPP_VERSION VERSION_GREATER "0.5.0" AND YAML_CPP_VERSION VERSION_LESS "0.6.0")
# Need to also get the boost headers here, as yaml-cpp 0.5.0+ requires them.
# Don't bother doing this step if we are already including the boost headers for shared_ptr
if(NOT OCIO_USE_BOOST_PTR)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 4b931ef..12a1dbf 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -77,7 +77,14 @@ endif()
if(OCIO_BUILD_STATIC)
list(REMOVE_ITEM core_src_files ${CMAKE_SOURCE_DIR}/src/core/UnitTest.cpp)
add_library(OpenColorIO_STATIC STATIC ${EXTERNAL_OBJECTS} ${core_src_files})
- add_dependencies(OpenColorIO_STATIC TINYXML_LIB YAML_CPP_LIB)
+ add_dependencies(OpenColorIO_STATIC TINYXML_LIB)
+
+ if(USE_EXTERNAL_YAML)
+ target_link_libraries(OpenColorIO_STATIC ${YAML_CPP_LIBRARIES})
+ else(USE_EXTERNAL_YAML)
+ add_dependencies(OpenColorIO_STATIC YAML_CPP_LIB)
+ endif()
+
if(EXTERNAL_LIBRARIES)
target_link_libraries(OpenColorIO_STATIC ${EXTERNAL_LIBRARIES})
endif()
diff --git a/src/core/OCIOYaml.cpp b/src/core/OCIOYaml.cpp
index aeee4d1..f1c662d 100644
--- a/src/core/OCIOYaml.cpp
+++ b/src/core/OCIOYaml.cpp
@@ -69,7 +69,7 @@ namespace YAML {
#ifdef WIN32
#pragma warning( push )
-#pragma warning( disable: 4146 )
+#pragma warning( disable: 4146 4251 )
#endif
#include <yaml-cpp/yaml.h>

View File

@ -0,0 +1,18 @@
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 45e55f9..f4b687d 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -77,7 +77,12 @@ endif()
if(OCIO_BUILD_STATIC)
list(REMOVE_ITEM core_src_files ${CMAKE_SOURCE_DIR}/src/core/UnitTest.cpp)
add_library(OpenColorIO_STATIC STATIC ${EXTERNAL_OBJECTS} ${core_src_files})
- add_dependencies(OpenColorIO_STATIC TINYXML_LIB)
+
+ if(USE_EXTERNAL_TINYXML)
+ target_link_libraries(OpenColorIO_STATIC ${TINYXML_LIBRARIES})
+ else(USE_EXTERNAL_TINYXML)
+ add_dependencies(OpenColorIO_STATIC TINYXML_LIB)
+ endif(USE_EXTERNAL_TINYXML)
if(USE_EXTERNAL_YAML)
target_link_libraries(OpenColorIO_STATIC ${YAML_CPP_LIBRARIES})

View File

@ -0,0 +1,9 @@
Source: opencolorio
Version: 1.1.1
Homepage: https://opencolorio.org/
Description: OpenColorIO (OCIO) is a complete color management solution geared towards motion picture production with an emphasis on visual effects and computer animation. OCIO provides a straightforward and consistent user experience across all supporting applications while allowing for sophisticated back-end configuration options suitable for high-end production usage. OCIO is compatible with the Academy Color Encoding Specification (ACES) and is LUT-format agnostic, supporting many popular formats.
Build-Depends: glew[core], freeglut[core], lcms[core], yaml-cpp[core], tinyxml[core]
Feature: applications
Description: Enable OpenColorIO tools
Build-Depends: openimageio[core], openexr[core]

View File

@ -0,0 +1,101 @@
include(vcpkg_common_definitions)
include(vcpkg_common_functions)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(_BUILD_SHARED OFF)
set(_BUILD_STATIC ON)
else()
set(_BUILD_SHARED ON)
set(_BUILD_STATIC OFF)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO imageworks/OpenColorIO
REF v1.1.1
SHA512 bed722f9ddce1887d28aacef2882debccd7c3f3c0c708d2723fea58a097de9f02721af9e85453e089ffda5406aef593ab6536c6886307823c132aa787e492e33
HEAD_REF master
PATCHES
0001-lcms-dependency-search.patch
0002-msvc-cpluscplus.patch
0003-osx-self-assign-field.patch
0004-yaml-dependency-search.patch
0005-tinyxml-dependency-search.patch
)
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
applications OCIO_BUILD_APPS
)
vcpkg_find_acquire_program(PYTHON2)
get_filename_component(PYTHON2_PATH ${PYTHON2} DIRECTORY)
vcpkg_add_to_path(PREPEND ${PYTHON2_PATH})
# TODO(theblackunknown) build additional targets based on feature
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
-DOCIO_BUILD_SHARED:BOOL=${_BUILD_SHARED}
-DOCIO_BUILD_STATIC:BOOL=${_BUILD_STATIC}
-DOCIO_BUILD_TRUELIGHT:BOOL=OFF
-DOCIO_BUILD_NUKE:BOOL=OFF
-DOCIO_BUILD_DOCS:BOOL=OFF
-DOCIO_BUILD_TESTS:BOOL=OFF
-DOCIO_BUILD_PYGLUE:BOOL=OFF
-DOCIO_BUILD_JNIGLUE:BOOL=OFF
-DOCIO_STATIC_JNIGLUE:BOOL=OFF
-DUSE_EXTERNAL_TINYXML:BOOL=ON
-DUSE_EXTERNAL_YAML:BOOL=ON
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH "cmake")
vcpkg_copy_pdbs()
if("applications" IN_LIST FEATURES)
# port applications to tools
file(MAKE_DIRECTORY
"${CURRENT_PACKAGES_DIR}/tools/${PORT}"
"${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}"
)
file(GLOB_RECURSE _TOOLS
"${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
)
foreach(_TOOL IN LISTS _TOOLS)
get_filename_component(_NAME ${_TOOL} NAME)
file(RENAME "${_TOOL}" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${_NAME}")
endforeach()
file(GLOB_RECURSE _TOOLS
"${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
)
foreach(_TOOL IN LISTS _TOOLS)
get_filename_component(_NAME ${_TOOL} NAME)
file(RENAME "${_TOOL}" "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}/${_NAME}")
endforeach()
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}")
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}")
endif()
# Clean redundant files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# CMake Configs leftovers
file(REMOVE
${CURRENT_PACKAGES_DIR}/OpenColorIOConfig.cmake
${CURRENT_PACKAGES_DIR}/debug/OpenColorIOConfig.cmake
)
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)

View File

@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4d4be1..174264d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,6 +279,11 @@ set_target_properties(yaml-cpp PROPERTIES
COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
)
+target_compile_features(yaml-cpp
+ PUBLIC
+ cxx_std_11
+)
+
set_target_properties(yaml-cpp PROPERTIES
VERSION "${YAML_CPP_VERSION}"
SOVERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}"

View File

@ -8,6 +8,7 @@ vcpkg_from_github(
PATCHES
0001-noexcept.patch
0002-fix-include-path.patch
0003-cxx-std-features.patch
)
vcpkg_configure_cmake(