Warning, /graphics/krita/cmake/modules/FindOpenColorIO.cmake is written in an unsupported language. File is not indexed.
0001 # Module to find OpenColorIO 0002 # 0003 # This module will first look into the directories hinted by the variables: 0004 # - OpenColorIO_ROOT 0005 # 0006 # This module defines the following variables: 0007 # 0008 # OPENCOLORIO_FOUND - True if OpenColorIO was found. 0009 # OPENCOLORIO_INCLUDES - where to find OpenColorIO.h 0010 # OPENCOLORIO_LIBRARIES - list of libraries to link against when using OpenColorIO 0011 # OPENCOLORIO_DEFINITIONS - Definitions needed when using OpenColorIO 0012 # 0013 # SPDX-FileCopyrightText: 2008 Contributors to the OpenImageIO project 0014 # SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me> 0015 # SPDX-License-Identifier: BSD-3-Clause 0016 0017 include (FindPackageHandleStandardArgs) 0018 include (FindPackageMessage) 0019 0020 find_path (OPENCOLORIO_INCLUDE_DIR 0021 OpenColorIO.h 0022 HINTS 0023 ${OPENCOLORIO_INCLUDE_PATH} 0024 ENV OPENCOLORIO_INCLUDE_PATH 0025 PATHS 0026 /sw/include 0027 /opt/local/include 0028 PATH_SUFFIXES OpenColorIO OpenColorIO1 0029 DOC "The directory where OpenColorIO.h resides") 0030 0031 if (EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorABI.h") 0032 # Search twice, because this symbol changed between OCIO 1.x and 2.x 0033 file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorABI.h" TMP 0034 REGEX "^#define OCIO_VERSION_STR[ \t].*$") 0035 if (NOT TMP) 0036 file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorABI.h" TMP 0037 REGEX "^#define OCIO_VERSION[ \t].*$") 0038 endif () 0039 string (REGEX MATCHALL "([0-9]+)\\.([0-9]+)\\.[0-9]+" OPENCOLORIO_VERSION ${TMP}) 0040 set (OPENCOLORIO_VERSION_MAJOR ${CMAKE_MATCH_1}) 0041 set (OPENCOLORIO_VERSION_MINOR ${CMAKE_MATCH_2}) 0042 endif () 0043 0044 find_library (OPENCOLORIO_LIBRARY 0045 NAMES 0046 OpenColorIO 0047 OpenColorIO_${OPENCOLORIO_VERSION_MAJOR}_${OPENCOLORIO_VERSION_MINOR} 0048 OpenColorIO${OPENCOLORIO_VERSION_MAJOR} 0049 HINTS 0050 ${OPENCOLORIO_LIBRARY_PATH} 0051 ENV OPENCOLORIO_LIBRARY_PATH 0052 PATHS 0053 /usr/lib64 0054 /usr/local/lib64 0055 /sw/lib 0056 /opt/local/lib 0057 DOC "The OCIO library") 0058 0059 find_package_handle_standard_args (OpenColorIO 0060 REQUIRED_VARS OPENCOLORIO_INCLUDE_DIR OPENCOLORIO_LIBRARY 0061 FOUND_VAR OPENCOLORIO_FOUND 0062 VERSION_VAR OPENCOLORIO_VERSION 0063 ) 0064 0065 if (OpenColorIO_FOUND) 0066 set (OPENCOLORIO_INCLUDES ${OPENCOLORIO_INCLUDE_DIR}) 0067 set (OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY}) 0068 set (OPENCOLORIO_DEFINITIONS "") 0069 if (NOT TARGET OpenColorIO::OpenColorIO) 0070 add_library(OpenColorIO::OpenColorIO UNKNOWN IMPORTED) 0071 set_target_properties(OpenColorIO::OpenColorIO PROPERTIES 0072 INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}") 0073 0074 set_property(TARGET OpenColorIO::OpenColorIO APPEND PROPERTY 0075 IMPORTED_LOCATION "${OPENCOLORIO_LIBRARIES}") 0076 if (LINKSTATIC) 0077 target_compile_definitions(OpenColorIO::OpenColorIO 0078 INTERFACE "-DOpenColorIO_STATIC") 0079 endif() 0080 endif () 0081 if (NOT TARGET OpenColorIO::OpenColorIOHeaders) 0082 add_library(OpenColorIO::OpenColorIOHeaders INTERFACE IMPORTED) 0083 set_target_properties(OpenColorIO::OpenColorIOHeaders PROPERTIES 0084 INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}") 0085 endif () 0086 endif () 0087 0088 if (OpenColorIO_FOUND AND LINKSTATIC) 0089 # Is this necessary? 0090 set (OPENCOLORIO_DEFINITIONS "-DOpenColorIO_STATIC") 0091 find_library (TINYXML_LIBRARY NAMES tinyxml) 0092 if (TINYXML_LIBRARY) 0093 set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${TINYXML_LIBRARY}" CACHE STRING "" FORCE) 0094 endif () 0095 find_library (YAML_LIBRARY NAMES yaml-cpp) 0096 if (YAML_LIBRARY) 0097 set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${YAML_LIBRARY}" CACHE STRING "" FORCE) 0098 endif () 0099 find_library (LCMS2_LIBRARY NAMES lcms2) 0100 if (LCMS2_LIBRARY) 0101 set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${LCMS2_LIBRARY}" CACHE STRING "" FORCE) 0102 endif () 0103 endif () 0104