diff options
-rw-r--r-- | CMakeLists.txt | 41 | ||||
-rw-r--r-- | build_files/cmake/Modules/FindOpenImageIO.cmake | 70 | ||||
-rw-r--r-- | build_files/cmake/macros.cmake | 2 | ||||
-rw-r--r-- | intern/cycles/CMakeLists.txt | 4 | ||||
-rw-r--r-- | intern/cycles/app/CMakeLists.txt | 2 |
5 files changed, 98 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a32742daf9c..b08ee065e1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -522,17 +522,23 @@ if(UNIX AND NOT APPLE) endif() if(WITH_OPENIMAGEIO) + + # temp, update if(CYCLES_OIIO) - set(OPENIMAGEIO ${CYCLES_OIIO} CACHE PATH "OpenImageIO Directory") + set(OPENIMAGEIO_ROOT_DIR ${CYCLES_OIIO}) unset(CYCLES_OIIO CACHE) - else() - set(OPENIMAGEIO "/usr" CACHE PATH "OpenImageIO Directory") endif() - set(OPENIMAGEIO_INCLUDE_DIR ${OPENIMAGEIO}/include) - set(OPENIMAGEIO_LIBRARY OpenImageIO ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES}) - set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib) + find_package(OpenImageIO) + + set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES}) + set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere set(OPENIMAGEIO_DEFINITIONS) + + if(NOT OPENIMAGEIO_FOUND) + set(WITH_OPENIMAGEIO OFF) + endif() + endif() # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed @@ -843,10 +849,10 @@ elseif(WIN32) endif() if(WITH_OPENIMAGEIO) - set(OPENIMAGEIO ${LIBDIR}/openimageio) - set(OPENIMAGEIO_INCLUDE_DIR ${OPENIMAGEIO}/include) - set(OPENIMAGEIO_LIBRARY OpenImageIO) - set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib) + set(OPENIMAGEIO_ROOT_DIR ${LIBDIR}/openimageio) + set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_ROOT_DIR}/include) + set(OPENIMAGEIO_LIBRARIES OpenImageIO) + set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO_ROOT_DIR}/lib) set(OPENIMAGEIO_DEFINITIONS) endif() @@ -978,10 +984,10 @@ elseif(WIN32) endif() if(WITH_OPENIMAGEIO) - set(OPENIMAGEIO ${LIBDIR}/openimageio) - set(OPENIMAGEIO_INCLUDE_DIR ${OPENIMAGEIO}/include) - set(OPENIMAGEIO_LIBRARY OpenImageIO) - set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib) + set(OPENIMAGEIO_ROOT_DIR ${LIBDIR}/openimageio) + set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_ROOT_DIR}/include) + set(OPENIMAGEIO_LIBRARIES OpenImageIO) + set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO_ROOT_DIR}/lib) set(OPENIMAGEIO_DEFINITIONS) endif() @@ -1205,9 +1211,9 @@ elseif(APPLE) if(WITH_OPENIMAGEIO) set(OPENIMAGEIO ${LIBDIR}/openimageio) - set(OPENIMAGEIO_INCLUDE_DIR ${OPENIMAGEIO}/include) - set(OPENIMAGEIO_LIBRARY OpenImageIO ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) - set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH}) + set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_ROOT_DIR}/include) + set(OPENIMAGEIO_LIBRARIES OpenImageIO ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) + set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO_ROOT_DIR}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH}) set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD") endif() @@ -1529,6 +1535,7 @@ if(FIRST_RUN) info_cfg_option(WITH_IMAGE_OPENJPEG) info_cfg_option(WITH_IMAGE_REDCODE) info_cfg_option(WITH_IMAGE_TIFF) + info_cfg_option(WITH_OPENIMAGEIO) info_cfg_text("Audio:") info_cfg_option(WITH_OPENAL) diff --git a/build_files/cmake/Modules/FindOpenImageIO.cmake b/build_files/cmake/Modules/FindOpenImageIO.cmake new file mode 100644 index 00000000000..7512b93e09e --- /dev/null +++ b/build_files/cmake/Modules/FindOpenImageIO.cmake @@ -0,0 +1,70 @@ +# - Find OpenImageIO library +# Find the native OpenImageIO includes and library +# This module defines +# OPENIMAGEIO_INCLUDE_DIRS, where to find openimageio.h, Set when +# OPENIMAGEIO_INCLUDE_DIR is found. +# OPENIMAGEIO_LIBRARIES, libraries to link against to use OpenImageIO. +# OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO. +# This can also be an environment variable. +# OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO. +# +# also defined, but not for general use are +# OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If OPENIMAGEIO_ROOT_DIR was defined in the environment, use it. +IF(NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "") + SET(OPENIMAGEIO_ROOT_DIR $ENV{OPENIMAGEIO_ROOT_DIR}) +ENDIF() + +SET(_openimageio_SEARCH_DIRS + ${OPENIMAGEIO_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(OPENIMAGEIO_INCLUDE_DIR + NAMES + OpenImageIO/imageio.h + HINTS + ${_openimageio_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(OPENIMAGEIO_LIBRARY + NAMES + OpenImageIO + HINTS + ${_openimageio_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG + OPENIMAGEIO_LIBRARY OPENIMAGEIO_INCLUDE_DIR) + +IF(OPENIMAGEIO_FOUND) + SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY}) + SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR}) +ENDIF(OPENIMAGEIO_FOUND) + +MARK_AS_ADVANCED( + OPENIMAGEIO_INCLUDE_DIR + OPENIMAGEIO_LIBRARY +) diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 236c20cf8d3..9671bffe2bd 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -279,7 +279,7 @@ macro(setup_liblinks target_link_libraries(${target} ${TIFF_LIBRARY}) endif() if(WITH_OPENIMAGEIO) - target_link_libraries(${target} ${OPENIMAGEIO_LIBRARY}) + target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES}) endif() if(WITH_BOOST) target_link_libraries(${target} ${BOOST_LIBRARIES}) diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 0041f11c288..d0b24c879a1 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -59,8 +59,8 @@ add_definitions(-DWITH_MULTI) include_directories( ${BOOST_INCLUDE_DIR} - ${OPENIMAGEIO_INCLUDE_DIR} - ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO) + ${OPENIMAGEIO_INCLUDE_DIRS} + ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO) # Subdirectories diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt index 4ef5fd6857d..ef6a80fbe5d 100644 --- a/intern/cycles/app/CMakeLists.txt +++ b/intern/cycles/app/CMakeLists.txt @@ -19,7 +19,7 @@ set(LIBRARIES ${BOOST_LIBRARIES} ${OPENGL_LIBRARIES} ${CYCLES_GLEW_LIBRARY} - ${OPENIMAGEIO_LIBRARY}) + ${OPENIMAGEIO_LIBRARIES}) link_directories(${OPENIMAGEIO_LIBPATH} ${BOOST_LIBPATH}) |