From f152ba3cc08787c5bc2e638a73753048f0678def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MACHIZAUD=20Andr=C3=A9a?= Date: Mon, 16 Sep 2019 18:08:41 +0200 Subject: [PATCH] OCIO 1.1.1 port added (#8006) --- .../0001-lcms-dependency-search.patch | 39 +++++++ ports/opencolorio/0002-msvc-cpluscplus.patch | 84 ++++++++++++++ .../0003-osx-self-assign-field.patch | 13 +++ .../0004-yaml-dependency-search.patch | 108 ++++++++++++++++++ .../0005-tinyxml-dependency-search.patch | 18 +++ ports/opencolorio/CONTROL | 9 ++ ports/opencolorio/portfile.cmake | 101 ++++++++++++++++ ports/yaml-cpp/0003-cxx-std-features.patch | 16 +++ ports/yaml-cpp/portfile.cmake | 1 + 9 files changed, 389 insertions(+) create mode 100644 ports/opencolorio/0001-lcms-dependency-search.patch create mode 100644 ports/opencolorio/0002-msvc-cpluscplus.patch create mode 100644 ports/opencolorio/0003-osx-self-assign-field.patch create mode 100644 ports/opencolorio/0004-yaml-dependency-search.patch create mode 100644 ports/opencolorio/0005-tinyxml-dependency-search.patch create mode 100644 ports/opencolorio/CONTROL create mode 100644 ports/opencolorio/portfile.cmake create mode 100644 ports/yaml-cpp/0003-cxx-std-features.patch diff --git a/ports/opencolorio/0001-lcms-dependency-search.patch b/ports/opencolorio/0001-lcms-dependency-search.patch new file mode 100644 index 000000000..27edc73f1 --- /dev/null +++ b/ports/opencolorio/0001-lcms-dependency-search.patch @@ -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") diff --git a/ports/opencolorio/0002-msvc-cpluscplus.patch b/ports/opencolorio/0002-msvc-cpluscplus.patch new file mode 100644 index 000000000..c4349ea12 --- /dev/null +++ b/ports/opencolorio/0002-msvc-cpluscplus.patch @@ -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 ++ $<$: ++ /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 ++ $<$: ++ /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 ++ $<$: ++ /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() diff --git a/ports/opencolorio/0003-osx-self-assign-field.patch b/ports/opencolorio/0003-osx-self-assign-field.patch new file mode 100644 index 000000000..18947bbbd --- /dev/null +++ b/ports/opencolorio/0003-osx-self-assign-field.patch @@ -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; + } diff --git a/ports/opencolorio/0004-yaml-dependency-search.patch b/ports/opencolorio/0004-yaml-dependency-search.patch new file mode 100644 index 000000000..30c01d41a --- /dev/null +++ b/ports/opencolorio/0004-yaml-dependency-search.patch @@ -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 diff --git a/ports/opencolorio/0005-tinyxml-dependency-search.patch b/ports/opencolorio/0005-tinyxml-dependency-search.patch new file mode 100644 index 000000000..319f88b73 --- /dev/null +++ b/ports/opencolorio/0005-tinyxml-dependency-search.patch @@ -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}) diff --git a/ports/opencolorio/CONTROL b/ports/opencolorio/CONTROL new file mode 100644 index 000000000..0d53dd6c6 --- /dev/null +++ b/ports/opencolorio/CONTROL @@ -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] diff --git a/ports/opencolorio/portfile.cmake b/ports/opencolorio/portfile.cmake new file mode 100644 index 000000000..8246926eb --- /dev/null +++ b/ports/opencolorio/portfile.cmake @@ -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) diff --git a/ports/yaml-cpp/0003-cxx-std-features.patch b/ports/yaml-cpp/0003-cxx-std-features.patch new file mode 100644 index 000000000..ac09c86c1 --- /dev/null +++ b/ports/yaml-cpp/0003-cxx-std-features.patch @@ -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}" diff --git a/ports/yaml-cpp/portfile.cmake b/ports/yaml-cpp/portfile.cmake index ff2892bde..380f65aee 100644 --- a/ports/yaml-cpp/portfile.cmake +++ b/ports/yaml-cpp/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( PATCHES 0001-noexcept.patch 0002-fix-include-path.patch + 0003-cxx-std-features.patch ) vcpkg_configure_cmake(