Skip to content

Commit

Permalink
[opencolorio/lcms] Fix dependency (microsoft#21960)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhoebeHui authored Jan 12, 2022
1 parent 8f11bd8 commit c7ea630
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ports/lcms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(BUILD_SHARED_LIBS)
endif()
target_compile_options(lcms2 PRIVATE -DUNICODE -D_UNICODE)

target_include_directories(lcms2 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
target_include_directories(lcms2 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
set_target_properties(lcms2 PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/include/lcms2.h;${CMAKE_CURRENT_LIST_DIR}/include/lcms2_plugin.h")

# Generate pkg-config file
Expand Down
2 changes: 1 addition & 1 deletion ports/lcms/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lcms",
"version": "2.12",
"port-version": 2,
"port-version": 3,
"description": "Little CMS.",
"homepage": "https://github.com/mm2/Little-CMS",
"dependencies": [
Expand Down
102 changes: 102 additions & 0 deletions ports/opencolorio/fix-dependency.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
diff --git a/share/cmake/modules/FindExtPackages.cmake b/share/cmake/modules/FindExtPackages.cmake
index 86a0225..4df4656 100644
--- a/share/cmake/modules/FindExtPackages.cmake
+++ b/share/cmake/modules/FindExtPackages.cmake
@@ -26,15 +26,15 @@ set(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY ON CACHE BOOL

# expat
# https://github.com/libexpat/libexpat
-find_package(expat 2.2.8 REQUIRED)
+find_package(expat CONFIG REQUIRED)

# yaml-cpp
# https://github.com/jbeder/yaml-cpp
-find_package(yaml-cpp 0.6.3 REQUIRED)
+find_package(yaml-cpp CONFIG REQUIRED)

# pystring
# https://github.com/imageworks/pystring
-find_package(pystring 1.1.3 REQUIRED)
+find_package(pystring CONFIG REQUIRED)

# Half
# NOTE: OCIO_USE_IMATH_HALF needs to be an integer for use in utils/Half.h.in
@@ -42,7 +42,7 @@ if(NOT OCIO_USE_OPENEXR_HALF)

# Imath (>=3.0)
# https://github.com/AcademySoftwareFoundation/Imath
- find_package(Imath 3.1.2 REQUIRED)
+ find_package(Imath CONFIG REQUIRED)

set(OCIO_HALF_LIB Imath::Imath CACHE STRING "Half library target" FORCE)
set(OCIO_USE_IMATH_HALF "1" CACHE STRING "Whether 'half' type will be sourced from the Imath library (>=v3.0)" FORCE)
@@ -65,7 +65,7 @@ if(OCIO_BUILD_APPS)

# lcms2
# https://github.com/mm2/Little-CMS
- find_package(lcms2 2.2 REQUIRED)
+ find_package(lcms2 CONFIG REQUIRED)
endif()

if(OCIO_BUILD_OPENFX)
diff --git a/src/OpenColorIO/CMakeLists.txt b/src/OpenColorIO/CMakeLists.txt
index be50b7b..c66191e 100644
--- a/src/OpenColorIO/CMakeLists.txt
+++ b/src/OpenColorIO/CMakeLists.txt
@@ -204,7 +204,9 @@ if(BUILD_SHARED_LIBS AND WIN32)
endif()

target_include_directories(OpenColorIO
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
+ "$<INSTALL_INTERFACE:include>"
)

target_link_libraries(OpenColorIO
@@ -214,8 +216,8 @@ target_link_libraries(OpenColorIO
expat::expat
${OCIO_HALF_LIB}
pystring::pystring
- sampleicc::sampleicc
- utils::strings
+ "$<BUILD_INTERFACE:sampleicc::sampleicc>"
+ "$<BUILD_INTERFACE:utils::strings>"
yaml-cpp
)

@@ -229,13 +231,13 @@ endif()

if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(OpenColorIO
- PRIVATE
+ PUBLIC
OpenColorIO_SKIP_IMPORTS
)
else()
# Only exports selected symbols.
target_compile_definitions(OpenColorIO
- PRIVATE
+ PUBLIC
OpenColorIO_EXPORTS
)
endif()
diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in
index eebb2c1..7147dc3 100644
--- a/src/cmake/Config.cmake.in
+++ b/src/cmake/Config.cmake.in
@@ -2,4 +2,14 @@

include(CMakeFindDependencyMacro)

+find_dependency(expat CONFIG REQUIRED)
+find_dependency(imath CONFIG REQUIRED)
+find_dependency(pystring CONFIG REQUIRED)
+find_dependency(yaml-cpp CONFIG REQUIRED)
+
+if(@OCIO_BUILD_APPS@)
+ find_dependency(lcms2 CONFIG REQUIRED)
+ find_dependency(GLEW)
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/@[email protected])
13 changes: 12 additions & 1 deletion ports/opencolorio/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ vcpkg_from_github(
REF v2.1.0
SHA512 a0f4fb62c768b392ca1129e2046df96d670d785fc057d4103768440b7adb65d8faf5b7d39729060791794e83e6cd4e67821aed9b30f3f04b410c60809cd72267
HEAD_REF master
PATCHES
fix-dependency.patch
)

file(REMOVE "${SOURCE_PATH}/share/cmake/modules/Findexpat.cmake")
file(REMOVE "${SOURCE_PATH}/share/cmake/modules/FindImath.cmake")
file(REMOVE "${SOURCE_PATH}/share/cmake/modules/Findpystring.cmake")
file(REMOVE "${SOURCE_PATH}/share/cmake/modules/Findyaml-cpp.cmake")
file(REMOVE "${SOURCE_PATH}/share/cmake/modules/Findlcms2.cmake")

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools OCIO_BUILD_APPS
Expand All @@ -21,14 +29,17 @@ vcpkg_cmake_configure(
-DOCIO_BUILD_TESTS:BOOL=OFF
-DOCIO_BUILD_GPU_TESTS:BOOL=OFF
-DOCIO_BUILD_PYTHON:BOOL=OFF
-DOCIO_BUILD_OPENFX:BOOL=OFF
-DOCIO_BUILD_JAVA:BOOL=OFF
-DOCIO_USE_OPENEXR_HALF:BOOL=OFF
-DOCIO_INSTALL_EXT_PACKAGES=NONE
-DCMAKE_DISABLE_FIND_PACKAGE_OpenImageIO=On
${FEATURE_OPTIONS}
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/OpenColorIO")
vcpkg_cmake_config_fixup(PACKAGE_NAME OpenColorIO CONFIG_PATH "lib/cmake/OpenColorIO")

vcpkg_copy_pdbs()

Expand Down
2 changes: 1 addition & 1 deletion ports/opencolorio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencolorio",
"version-semver": "2.1.0",
"port-version": 1,
"port-version": 2,
"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.",
"homepage": "https://opencolorio.org/",
"supports": "!uwp",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3278,7 +3278,7 @@
},
"lcms": {
"baseline": "2.12",
"port-version": 2
"port-version": 3
},
"leaf": {
"baseline": "0.2.2",
Expand Down Expand Up @@ -4950,7 +4950,7 @@
},
"opencolorio": {
"baseline": "2.1.0",
"port-version": 1
"port-version": 2
},
"opencolorio-tools": {
"baseline": "1.1.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/lcms.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5e1b890660ea5d2a869407a0714d4385e949b4d6",
"version": "2.12",
"port-version": 3
},
{
"git-tree": "27ea0f07f8132e37a1e265ee54216eb0abc185dd",
"version": "2.12",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/opencolorio.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5b4c12d0a01185796534d2925a87fe3b874f1b91",
"version-semver": "2.1.0",
"port-version": 2
},
{
"git-tree": "512f32dd15d09dbb73d83b778898c99bf0697aa2",
"version-semver": "2.1.0",
Expand Down

0 comments on commit c7ea630

Please sign in to comment.