diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index d1ed372ae0..9ac6e75443 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -77,6 +77,7 @@ jobs: cc-compiler: clang compiler-desc: Clang vfx-cy: 2023 + install-ext-packages: MISSING - build: 11 build-type: Release build-shared: 'ON' @@ -89,6 +90,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2023 + install-ext-packages: ALL - build: 10 build-type: Release build-shared: 'OFF' @@ -101,6 +103,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2023 + install-ext-packages: ALL # ------------------------------------------------------------------- # VFX CY2022 (Python 3.9) # ------------------------------------------------------------------- @@ -116,6 +119,7 @@ jobs: cc-compiler: clang compiler-desc: Clang vfx-cy: 2022 + install-ext-packages: ALL - build: 8 build-type: Release build-shared: 'ON' @@ -128,6 +132,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2022 + install-ext-packages: MISSING - build: 7 build-type: Release build-shared: 'OFF' @@ -140,6 +145,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2022 + install-ext-packages: ALL # ------------------------------------------------------------------- # VFX CY2021 (Python 3.7) # ------------------------------------------------------------------- @@ -155,6 +161,7 @@ jobs: cc-compiler: clang compiler-desc: Clang vfx-cy: 2021 + install-ext-packages: MISSING - build: 5 build-type: Release build-shared: 'OFF' @@ -167,6 +174,7 @@ jobs: cc-compiler: clang compiler-desc: Clang vfx-cy: 2021 + install-ext-packages: ALL - build: 4 build-type: Debug build-shared: 'ON' @@ -179,6 +187,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2021 + install-ext-packages: ALL # ------------------------------------------------------------------- # VFX CY2020 (Python 3.7) # ------------------------------------------------------------------- @@ -194,6 +203,7 @@ jobs: cc-compiler: clang compiler-desc: Clang vfx-cy: 2020 + install-ext-packages: MISSING - build: 2 build-type: Debug build-shared: 'OFF' @@ -206,6 +216,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2020 + install-ext-packages: ALL - build: 1 build-type: Release build-shared: 'ON' @@ -218,6 +229,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2020 + install-ext-packages: ALL env: CXX: ${{ matrix.cxx-compiler }} CC: ${{ matrix.cc-compiler }} @@ -245,7 +257,7 @@ jobs: -DOCIO_BUILD_GPU_TESTS=OFF \ -DOCIO_USE_SIMD=${{ matrix.use-simd }} \ -DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} \ - -DOCIO_INSTALL_EXT_PACKAGES=ALL \ + -DOCIO_INSTALL_EXT_PACKAGES=${{ matrix.install-ext-packages }} \ -DOCIO_WARNING_AS_ERROR=ON \ -DPython_EXECUTABLE=$(which python) working-directory: _build diff --git a/.github/workflows/dependencies_latest.yml b/.github/workflows/dependencies_latest.yml index 0b59bd8774..d37a9882eb 100644 --- a/.github/workflows/dependencies_latest.yml +++ b/.github/workflows/dependencies_latest.yml @@ -54,6 +54,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2022 + use-oiio: 'ON' - build: 2 build-docs: 'OFF' build-openfx: 'OFF' @@ -62,6 +63,7 @@ jobs: cc-compiler: gcc compiler-desc: GCC vfx-cy: 2021 + use-oiio: 'OFF' # ------------------------------------------------------------------- # Clang # ------------------------------------------------------------------- @@ -73,6 +75,7 @@ jobs: cc-compiler: clang compiler-desc: Clang vfx-cy: 2022 + use-oiio: 'OFF' - build: 4 build-docs: 'ON' build-openfx: 'ON' @@ -81,6 +84,7 @@ jobs: cc-compiler: clang compiler-desc: Clang vfx-cy: 2021 + use-oiio: 'ON' env: CXX: ${{ matrix.cxx-compiler }} CC: ${{ matrix.cc-compiler }} @@ -132,7 +136,7 @@ jobs: -DOCIO_INSTALL_EXT_PACKAGES=NONE \ -DOCIO_WARNING_AS_ERROR=OFF \ -DPython_EXECUTABLE=$(which python) \ - -DOCIO_USE_OIIO_CMAKE_CONFIG=ON + -DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} working-directory: _build - name: Build run: | @@ -176,11 +180,13 @@ jobs: build-openfx: 'ON' cxx-standard: 17 python-version: '3.11' + use-oiio: 'ON' - build: 2 build-docs: 'ON' build-openfx: 'ON' cxx-standard: 14 python-version: '3.9' + use-oiio: 'OFF' steps: - name: Setup Python uses: actions/setup-python@v4 @@ -235,7 +241,7 @@ jobs: -DOCIO_INSTALL_EXT_PACKAGES=NONE \ -DOCIO_WARNING_AS_ERROR=OFF \ -DPython_EXECUTABLE=$(which python) \ - -DOCIO_USE_OIIO_CMAKE_CONFIG=ON + -DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} working-directory: _build - name: Build run: | @@ -279,11 +285,13 @@ jobs: build-openfx: 'ON' cxx-standard: 17 python-version: '3.11' + use-oiio: 'ON' - build: 2 build-docs: 'ON' build-openfx: 'ON' cxx-standard: 14 python-version: '3.9' + use-oiio: 'OFF' steps: - name: Setup Python uses: actions/setup-python@v4 @@ -362,7 +370,7 @@ jobs: -DOCIO_WARNING_AS_ERROR=OFF \ -DPython_EXECUTABLE=$(which python) \ -DOCIO_BUILD_PYTHON=OFF \ - -DOCIO_USE_OIIO_CMAKE_CONFIG=ON + -DOCIO_USE_OIIO_FOR_APPS=${{ matrix.use-oiio }} shell: bash working-directory: _build - name: Build diff --git a/share/cmake/macros/ocio_handle_dependency.cmake b/share/cmake/macros/ocio_handle_dependency.cmake index f7bb593561..dd848494ef 100644 --- a/share/cmake/macros/ocio_handle_dependency.cmake +++ b/share/cmake/macros/ocio_handle_dependency.cmake @@ -216,7 +216,7 @@ macro (ocio_handle_dependency dep_name) endif() if(ocio_dep_REQUIRED) - if(NOT ${dep_name}_FOUND AND NOT ocio_dep_VERSION) + if(NOT ${dep_name}_FOUND) message(SEND_ERROR "${ColorError}${dep_name} is required, will abort at the end.${ColorReset}") endif() endif() diff --git a/share/cmake/modules/Findyaml-cpp.cmake b/share/cmake/modules/Findyaml-cpp.cmake index 907de3115b..110ae2e4ca 100644 --- a/share/cmake/modules/Findyaml-cpp.cmake +++ b/share/cmake/modules/Findyaml-cpp.cmake @@ -45,6 +45,7 @@ if(yaml-cpp_FIND_QUIETLY) endif() if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL) + set(_yaml-cpp_REQUIRED_VARS yaml-cpp_LIBRARY) # Search for yaml-cpp-config.cmake if(NOT DEFINED yaml-cpp_ROOT) @@ -57,13 +58,15 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL) add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp) endif() - set(yaml-cpp_INCLUDE_DIR ${YAML_CPP_INCLUDE_DIR}) + get_target_property(yaml-cpp_INCLUDE_DIR yaml-cpp::yaml-cpp INTERFACE_INCLUDE_DIRECTORIES) get_target_property(yaml-cpp_LIBRARY yaml-cpp::yaml-cpp LOCATION) else() # As yaml-cpp-config.cmake search fails, search an installed library # using yaml-cpp.pc . + list(APPEND _yaml-cpp_REQUIRED_VARS yaml-cpp_INCLUDE_DIR yaml-cpp_VERSION) + # Search for yaml-cpp.pc find_package(PkgConfig ${quiet}) 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) set(yaml-cpp_FIND_REQUIRED FALSE) endif() - set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}") - include(FindPackageHandleStandardArgs) find_package_handle_standard_args(yaml-cpp REQUIRED_VARS - yaml-cpp_LIBRARY - yaml-cpp_INCLUDE_DIR - yaml-cpp_VERSION + ${_yaml-cpp_REQUIRED_VARS} VERSION_VAR yaml-cpp_VERSION ) @@ -149,7 +148,7 @@ endif() ############################################################################### ### Create target -if (NOT TARGET yaml-cpp::yaml-cpp) +if (yaml-cpp_FOUND AND NOT TARGET yaml-cpp::yaml-cpp) add_library(yaml-cpp::yaml-cpp UNKNOWN IMPORTED GLOBAL) set_target_properties(yaml-cpp::yaml-cpp PROPERTIES IMPORTED_LOCATION ${yaml-cpp_LIBRARY} @@ -163,8 +162,11 @@ if (NOT TARGET yaml-cpp::yaml-cpp) if (NOT TARGET yaml-cpp) add_library(yaml-cpp ALIAS yaml-cpp::yaml-cpp) endif () +endif () +if (yaml-cpp_FOUND) # TODO: Remove this variable and use the `yaml-cpp::yaml-cpp` target # directly when the minimum version of yaml-cpp is updated to 0.8. + get_target_property(YAML_CPP_INCLUDE_DIR yaml-cpp::yaml-cpp INCLUDE_DIRECTORIES) set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp) endif () diff --git a/share/cmake/modules/install/Installyaml-cpp.cmake b/share/cmake/modules/install/Installyaml-cpp.cmake index a117fdcff0..6b05497996 100644 --- a/share/cmake/modules/install/Installyaml-cpp.cmake +++ b/share/cmake/modules/install/Installyaml-cpp.cmake @@ -21,8 +21,8 @@ ############################################################################### ### Create target (if previous 'find_package' call hasn't) ### -if(NOT TARGET yaml-cpp) - add_library(yaml-cpp UNKNOWN IMPORTED GLOBAL) +if(NOT TARGET yaml-cpp::yaml-cpp) + add_library(yaml-cpp::yaml-cpp UNKNOWN IMPORTED GLOBAL) set(_yaml-cpp_TARGET_CREATE TRUE) endif() @@ -138,7 +138,7 @@ if(NOT yaml-cpp_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PAC --parallel ) - add_dependencies(yaml-cpp yaml-cpp_install) + add_dependencies(yaml-cpp::yaml-cpp yaml-cpp_install) if(OCIO_VERBOSE) message(STATUS "Installing yaml-cpp: ${yaml-cpp_LIBRARY} (version \"${yaml-cpp_VERSION}\")") endif() @@ -149,7 +149,7 @@ endif() ### Configure target ### if(_yaml-cpp_TARGET_CREATE) - set_target_properties(yaml-cpp PROPERTIES + set_target_properties(yaml-cpp::yaml-cpp PROPERTIES IMPORTED_LOCATION ${yaml-cpp_LIBRARY} INTERFACE_INCLUDE_DIRECTORIES ${yaml-cpp_INCLUDE_DIR} ) @@ -157,15 +157,5 @@ if(_yaml-cpp_TARGET_CREATE) mark_as_advanced(yaml-cpp_INCLUDE_DIR yaml-cpp_LIBRARY yaml-cpp_VERSION) endif() -############################################################################### -### Set variables for compatibility ### - -if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp) - add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp) -endif() - -if(yaml-cpp_INCLUDE_DIR) - set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}") -endif() - +set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}") set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)