From f60745abf9a19afc153b1442ab0bb994ca8b8ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Achard?= Date: Tue, 14 Nov 2023 08:53:13 +0000 Subject: [PATCH] Tentative fix yaml-cpp install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Achard --- CMakeLists.txt | 2 ++ setup.py | 1 + .../cmake/macros/ocio_handle_dependency.cmake | 2 ++ share/cmake/modules/Findyaml-cpp.cmake | 2 +- .../modules/install/Installyaml-cpp.cmake | 28 ++++++++----------- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d2ad73654..0a946e66b7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -352,6 +352,7 @@ string(REPLACE ";" ", " _EXT_OPTIONS_STR "${_EXT_OPTIONS}") # Default option set(_OCIO_INSTALL_EXT_PACKAGES "MISSING") +message(STATUS "Incoming OCIO_INSTALL_EXT_PACKAGES: ${OCIO_INSTALL_EXT_PACKAGES}") if(DEFINED OCIO_INSTALL_EXT_PACKAGES) # Case insensitive match @@ -367,6 +368,7 @@ set(OCIO_INSTALL_EXT_PACKAGES "${_OCIO_INSTALL_EXT_PACKAGES}" CACHE STRING "Set the condition for Installing external dependencies" FORCE) set_property(CACHE OCIO_INSTALL_EXT_PACKAGES PROPERTY STRINGS ${_EXT_OPTIONS}) +message(STATUS "Final OCIO_INSTALL_EXT_PACKAGES: ${OCIO_INSTALL_EXT_PACKAGES}") ############################################################################### diff --git a/setup.py b/setup.py index 1d67a70f24..4a960b98cc 100644 --- a/setup.py +++ b/setup.py @@ -183,6 +183,7 @@ def build_extension(self, ext): subprocess.check_call( ["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp ) + print("Command line call args: ", cmake_args) subprocess.check_call( ["cmake", "--build", "."] + build_args, cwd=self.build_temp ) diff --git a/share/cmake/macros/ocio_handle_dependency.cmake b/share/cmake/macros/ocio_handle_dependency.cmake index f7bb593561..67ec609327 100644 --- a/share/cmake/macros/ocio_handle_dependency.cmake +++ b/share/cmake/macros/ocio_handle_dependency.cmake @@ -84,6 +84,8 @@ macro (ocio_handle_dependency dep_name) ${ARGN}) set(ocio_dep_FORCE_INSTALLATION OFF) + message(STATUS "ocio_dep_ALLOW_INSTALL ${ocio_dep_ALLOW_INSTALL}") + message(STATUS "OCIO_INSTALL_EXT_PACKAGES ${OCIO_INSTALL_EXT_PACKAGES}") if(ocio_dep_ALLOW_INSTALL AND OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL) set(ocio_dep_FORCE_INSTALLATION ON) endif() diff --git a/share/cmake/modules/Findyaml-cpp.cmake b/share/cmake/modules/Findyaml-cpp.cmake index 907de3115b..2ad81b3cea 100644 --- a/share/cmake/modules/Findyaml-cpp.cmake +++ b/share/cmake/modules/Findyaml-cpp.cmake @@ -149,7 +149,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} diff --git a/share/cmake/modules/install/Installyaml-cpp.cmake b/share/cmake/modules/install/Installyaml-cpp.cmake index a117fdcff0..3c8c8ab176 100644 --- a/share/cmake/modules/install/Installyaml-cpp.cmake +++ b/share/cmake/modules/install/Installyaml-cpp.cmake @@ -21,9 +21,10 @@ ############################################################################### ### 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) + message(STATUS "Creating yaml-cpp::yaml-cpp target") endif() ############################################################################### @@ -44,6 +45,7 @@ if(NOT yaml-cpp_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PAC set(yaml-cpp_VERSION ${yaml-cpp_FIND_VERSION}) endif() set(yaml-cpp_INCLUDE_DIR "${_EXT_DIST_ROOT}/${CMAKE_INSTALL_INCLUDEDIR}") + message(STATUS "Set yaml-cpp_INCLUDE_DIR to ${yaml-cpp_INCLUDE_DIR}") # Starting from 0.7.0, this is included on all platforms, we could also # override CMAKE_DEBUG_POSTFIX to bypass it. @@ -120,6 +122,7 @@ if(NOT yaml-cpp_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PAC # Hack to let imported target be built from ExternalProject_Add file(MAKE_DIRECTORY ${yaml-cpp_INCLUDE_DIR}) + message(STATUS "Create directory ${yaml-cpp_INCLUDE_DIR}") ExternalProject_Add(yaml-cpp_install GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git" @@ -138,10 +141,10 @@ if(NOT yaml-cpp_FOUND AND OCIO_INSTALL_EXT_PACKAGES AND NOT OCIO_INSTALL_EXT_PAC --parallel ) - add_dependencies(yaml-cpp yaml-cpp_install) - if(OCIO_VERBOSE) + 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() + # endif() endif() endif() @@ -149,23 +152,14 @@ 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} ) + message(STATUS "Set target include dir: ${yaml-cpp_INCLUDE_DIR}") 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)