Skip to content

Commit 872784c

Browse files
remiadoug-walker
andcommitted
Fix yaml-cpp build issues (AcademySoftwareFoundation#1907)
Signed-off-by: Rémi Achard <[email protected]> Co-authored-by: Doug Walker <[email protected]> (cherry picked from commit 41441bb) Signed-off-by: Doug Walker <[email protected]>
1 parent b81b720 commit 872784c

File tree

5 files changed

+39
-27
lines changed

5 files changed

+39
-27
lines changed

.github/workflows/ci_workflow.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
cc-compiler: clang
7878
compiler-desc: Clang
7979
vfx-cy: 2023
80+
install-ext-packages: MISSING
8081
- build: 11
8182
build-type: Release
8283
build-shared: 'ON'
@@ -89,6 +90,7 @@ jobs:
8990
cc-compiler: gcc
9091
compiler-desc: GCC
9192
vfx-cy: 2023
93+
install-ext-packages: ALL
9294
- build: 10
9395
build-type: Release
9496
build-shared: 'OFF'
@@ -101,6 +103,7 @@ jobs:
101103
cc-compiler: gcc
102104
compiler-desc: GCC
103105
vfx-cy: 2023
106+
install-ext-packages: ALL
104107
# -------------------------------------------------------------------
105108
# VFX CY2022 (Python 3.9)
106109
# -------------------------------------------------------------------
@@ -116,6 +119,7 @@ jobs:
116119
cc-compiler: clang
117120
compiler-desc: Clang
118121
vfx-cy: 2022
122+
install-ext-packages: ALL
119123
- build: 8
120124
build-type: Release
121125
build-shared: 'ON'
@@ -128,6 +132,7 @@ jobs:
128132
cc-compiler: gcc
129133
compiler-desc: GCC
130134
vfx-cy: 2022
135+
install-ext-packages: MISSING
131136
- build: 7
132137
build-type: Release
133138
build-shared: 'OFF'
@@ -140,6 +145,7 @@ jobs:
140145
cc-compiler: gcc
141146
compiler-desc: GCC
142147
vfx-cy: 2022
148+
install-ext-packages: ALL
143149
# -------------------------------------------------------------------
144150
# VFX CY2021 (Python 3.7)
145151
# -------------------------------------------------------------------
@@ -155,6 +161,7 @@ jobs:
155161
cc-compiler: clang
156162
compiler-desc: Clang
157163
vfx-cy: 2021
164+
install-ext-packages: MISSING
158165
- build: 5
159166
build-type: Release
160167
build-shared: 'OFF'
@@ -167,6 +174,7 @@ jobs:
167174
cc-compiler: clang
168175
compiler-desc: Clang
169176
vfx-cy: 2021
177+
install-ext-packages: ALL
170178
- build: 4
171179
build-type: Debug
172180
build-shared: 'ON'
@@ -179,6 +187,7 @@ jobs:
179187
cc-compiler: gcc
180188
compiler-desc: GCC
181189
vfx-cy: 2021
190+
install-ext-packages: ALL
182191
# -------------------------------------------------------------------
183192
# VFX CY2020 (Python 3.7)
184193
# -------------------------------------------------------------------
@@ -194,6 +203,7 @@ jobs:
194203
cc-compiler: clang
195204
compiler-desc: Clang
196205
vfx-cy: 2020
206+
install-ext-packages: MISSING
197207
- build: 2
198208
build-type: Debug
199209
build-shared: 'OFF'
@@ -206,6 +216,7 @@ jobs:
206216
cc-compiler: gcc
207217
compiler-desc: GCC
208218
vfx-cy: 2020
219+
install-ext-packages: ALL
209220
- build: 1
210221
build-type: Release
211222
build-shared: 'ON'
@@ -218,6 +229,7 @@ jobs:
218229
cc-compiler: gcc
219230
compiler-desc: GCC
220231
vfx-cy: 2020
232+
install-ext-packages: ALL
221233
env:
222234
CXX: ${{ matrix.cxx-compiler }}
223235
CC: ${{ matrix.cc-compiler }}
@@ -245,7 +257,7 @@ jobs:
245257
-DOCIO_BUILD_GPU_TESTS=OFF \
246258
-DOCIO_USE_SIMD=${{ matrix.use-simd }} \
247259
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \
248-
-DOCIO_INSTALL_EXT_PACKAGES=ALL \
260+
-DOCIO_INSTALL_EXT_PACKAGES=${{ matrix.install-ext-packages }} \
249261
-DOCIO_WARNING_AS_ERROR=ON \
250262
-DPython_EXECUTABLE=$(which python)
251263
working-directory: _build

.github/workflows/dependencies_latest.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
cc-compiler: gcc
5555
compiler-desc: GCC
5656
vfx-cy: 2022
57+
use-oiio: 'ON'
5758
- build: 2
5859
build-docs: 'OFF'
5960
build-openfx: 'OFF'
@@ -62,6 +63,7 @@ jobs:
6263
cc-compiler: gcc
6364
compiler-desc: GCC
6465
vfx-cy: 2021
66+
use-oiio: 'OFF'
6567
# -------------------------------------------------------------------
6668
# Clang
6769
# -------------------------------------------------------------------
@@ -73,6 +75,7 @@ jobs:
7375
cc-compiler: clang
7476
compiler-desc: Clang
7577
vfx-cy: 2022
78+
use-oiio: 'OFF'
7679
- build: 4
7780
build-docs: 'ON'
7881
build-openfx: 'ON'
@@ -81,6 +84,7 @@ jobs:
8184
cc-compiler: clang
8285
compiler-desc: Clang
8386
vfx-cy: 2021
87+
use-oiio: 'ON'
8488
env:
8589
CXX: ${{ matrix.cxx-compiler }}
8690
CC: ${{ matrix.cc-compiler }}
@@ -132,7 +136,7 @@ jobs:
132136
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
133137
-DOCIO_WARNING_AS_ERROR=OFF \
134138
-DPython_EXECUTABLE=$(which python) \
135-
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
139+
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }}
136140
working-directory: _build
137141
- name: Build
138142
run: |
@@ -176,11 +180,13 @@ jobs:
176180
build-openfx: 'ON'
177181
cxx-standard: 17
178182
python-version: '3.11'
183+
use-oiio: 'ON'
179184
- build: 2
180185
build-docs: 'ON'
181186
build-openfx: 'ON'
182187
cxx-standard: 14
183188
python-version: '3.9'
189+
use-oiio: 'OFF'
184190
steps:
185191
- name: Setup Python
186192
uses: actions/setup-python@v4
@@ -235,7 +241,7 @@ jobs:
235241
-DOCIO_INSTALL_EXT_PACKAGES=NONE \
236242
-DOCIO_WARNING_AS_ERROR=OFF \
237243
-DPython_EXECUTABLE=$(which python) \
238-
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
244+
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }}
239245
working-directory: _build
240246
- name: Build
241247
run: |
@@ -279,11 +285,13 @@ jobs:
279285
build-openfx: 'ON'
280286
cxx-standard: 17
281287
python-version: '3.11'
288+
use-oiio: 'ON'
282289
- build: 2
283290
build-docs: 'ON'
284291
build-openfx: 'ON'
285292
cxx-standard: 14
286293
python-version: '3.9'
294+
use-oiio: 'OFF'
287295
steps:
288296
- name: Setup Python
289297
uses: actions/setup-python@v4
@@ -362,7 +370,7 @@ jobs:
362370
-DOCIO_WARNING_AS_ERROR=OFF \
363371
-DPython_EXECUTABLE=$(which python) \
364372
-DOCIO_BUILD_PYTHON=OFF \
365-
-DOCIO_USE_OIIO_CMAKE_CONFIG=ON
373+
-DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }}
366374
shell: bash
367375
working-directory: _build
368376
- name: Build

share/cmake/macros/ocio_handle_dependency.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ macro (ocio_handle_dependency dep_name)
216216
endif()
217217

218218
if(ocio_dep_REQUIRED)
219-
if(NOT ${dep_name}_FOUND AND NOT ocio_dep_VERSION)
219+
if(NOT ${dep_name}_FOUND)
220220
message(SEND_ERROR "${ColorError}${dep_name} is required, will abort at the end.${ColorReset}")
221221
endif()
222222
endif()

share/cmake/modules/Findyaml-cpp.cmake

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ if(yaml-cpp_FIND_QUIETLY)
4545
endif()
4646

4747
if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
48+
set(_yaml-cpp_REQUIRED_VARS yaml-cpp_LIBRARY)
4849

4950
# Search for yaml-cpp-config.cmake
5051
if(NOT DEFINED yaml-cpp_ROOT)
@@ -57,13 +58,15 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
5758
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
5859
endif()
5960

60-
set(yaml-cpp_INCLUDE_DIR ${YAML_CPP_INCLUDE_DIR})
61+
get_target_property(yaml-cpp_INCLUDE_DIR yaml-cpp::yaml-cpp INTERFACE_INCLUDE_DIRECTORIES)
6162
get_target_property(yaml-cpp_LIBRARY yaml-cpp::yaml-cpp LOCATION)
6263
else()
6364

6465
# As yaml-cpp-config.cmake search fails, search an installed library
6566
# using yaml-cpp.pc .
6667

68+
list(APPEND _yaml-cpp_REQUIRED_VARS yaml-cpp_INCLUDE_DIR yaml-cpp_VERSION)
69+
6770
# Search for yaml-cpp.pc
6871
find_package(PkgConfig ${quiet})
6972
pkg_check_modules(PC_yaml-cpp ${quiet} "yaml-cpp>=${yaml-cpp_FIND_VERSION}")
@@ -131,14 +134,10 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
131134
set(yaml-cpp_FIND_REQUIRED FALSE)
132135
endif()
133136

134-
set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}")
135-
136137
include(FindPackageHandleStandardArgs)
137138
find_package_handle_standard_args(yaml-cpp
138139
REQUIRED_VARS
139-
yaml-cpp_LIBRARY
140-
yaml-cpp_INCLUDE_DIR
141-
yaml-cpp_VERSION
140+
${_yaml-cpp_REQUIRED_VARS}
142141
VERSION_VAR
143142
yaml-cpp_VERSION
144143
)
@@ -149,7 +148,7 @@ endif()
149148
###############################################################################
150149
### Create target
151150

152-
if (NOT TARGET yaml-cpp::yaml-cpp)
151+
if (yaml-cpp_FOUND AND NOT TARGET yaml-cpp::yaml-cpp)
153152
add_library(yaml-cpp::yaml-cpp UNKNOWN IMPORTED GLOBAL)
154153
set_target_properties(yaml-cpp::yaml-cpp PROPERTIES
155154
IMPORTED_LOCATION ${yaml-cpp_LIBRARY}
@@ -163,8 +162,11 @@ if (NOT TARGET yaml-cpp::yaml-cpp)
163162
if (NOT TARGET yaml-cpp)
164163
add_library(yaml-cpp ALIAS yaml-cpp::yaml-cpp)
165164
endif ()
165+
endif ()
166166

167+
if (yaml-cpp_FOUND)
167168
# TODO: Remove this variable and use the `yaml-cpp::yaml-cpp` target
168169
# directly when the minimum version of yaml-cpp is updated to 0.8.
170+
get_target_property(YAML_CPP_INCLUDE_DIR yaml-cpp::yaml-cpp INCLUDE_DIRECTORIES)
169171
set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)
170172
endif ()

share/cmake/modules/install/Installyaml-cpp.cmake

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
###############################################################################
2222
### Create target (if previous 'find_package' call hasn't) ###
2323

24-
if(NOT TARGET yaml-cpp)
25-
add_library(yaml-cpp UNKNOWN IMPORTED GLOBAL)
24+
if(NOT TARGET yaml-cpp::yaml-cpp)
25+
add_library(yaml-cpp::yaml-cpp UNKNOWN IMPORTED GLOBAL)
2626
set(_yaml-cpp_TARGET_CREATE TRUE)
2727
endif()
2828

@@ -138,7 +138,7 @@ if(NOT yaml-cpp_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PAC
138138
--parallel
139139
)
140140

141-
add_dependencies(yaml-cpp yaml-cpp_install)
141+
add_dependencies(yaml-cpp::yaml-cpp yaml-cpp_install)
142142
if(OCIO_VERBOSE)
143143
message(STATUS "Installing yaml-cpp: ${yaml-cpp_LIBRARY} (version \"${yaml-cpp_VERSION}\")")
144144
endif()
@@ -149,23 +149,13 @@ endif()
149149
### Configure target ###
150150

151151
if(_yaml-cpp_TARGET_CREATE)
152-
set_target_properties(yaml-cpp PROPERTIES
152+
set_target_properties(yaml-cpp::yaml-cpp PROPERTIES
153153
IMPORTED_LOCATION ${yaml-cpp_LIBRARY}
154154
INTERFACE_INCLUDE_DIRECTORIES ${yaml-cpp_INCLUDE_DIR}
155155
)
156156

157157
mark_as_advanced(yaml-cpp_INCLUDE_DIR yaml-cpp_LIBRARY yaml-cpp_VERSION)
158158
endif()
159159

160-
###############################################################################
161-
### Set variables for compatibility ###
162-
163-
if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
164-
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
165-
endif()
166-
167-
if(yaml-cpp_INCLUDE_DIR)
168-
set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}")
169-
endif()
170-
160+
set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}")
171161
set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)

0 commit comments

Comments
 (0)