[openimageio] update to 2.1.9.0 and fix static build.

This commit is contained in:
JackBoosY 2019-12-24 21:42:31 -08:00
parent 23c806dc25
commit 0fba1ab2bc
6 changed files with 63 additions and 182 deletions

View File

@ -1,5 +1,5 @@
Source: openimageio
Version: 2019-10-10-1
Version: 2.1.9.0
Homepage: https://github.com/OpenImageIO/oiio
Description: A library for reading and writing images, and a bunch of related classes, utilities, and application
Build-Depends: libjpeg-turbo, tiff, libpng, openexr, boost-thread, boost-smart-ptr, boost-foreach, boost-regex, boost-type-traits, boost-static-assert, boost-unordered, boost-config, boost-algorithm, boost-filesystem, boost-system, boost-thread, boost-asio, boost-random, robin-map, boost-stacktrace

View File

@ -1,177 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a5f120..6789963 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,17 @@ include (compiler)
# Helpful macros for our project
include (oiio_macros)
+option (USE_FFMPEG "Use ffmpeg if found" ON)
+option (USE_DCMTK "Use DCMTK if found" ON)
+option (USE_FIELD3D "Use Field3D if found" ON)
+option (USE_FREETYPE "Use FreeType if found" ON)
+option (USE_GIF "Use Gif if found" ON)
+option (USE_NUKE "Use Nuke if found" ON)
+option (USE_OPENCV "Use OpenCV if found" ON)
+option (USE_OPENJPEG "Use OpenJPEG if found" ON)
+option (USE_PTEX "Use Ptex if found" ON)
+option (USE_QT "Use QT if found" ON)
+option (USE_WEBP "Use WebP if found" ON)
option (VERBOSE "Print lots of messages while compiling" OFF)
set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING
@@ -86,6 +97,10 @@ set (CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library naming postfix for Debug build
set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_SOURCE_DIR}/.." CACHE PATH
"Location of oiio-images, openexr-images, libtiffpic, etc.." )
+
+if (BUILD_SHARED_LIBS)
+ add_definitions (-DOpenImageIO_EXPORTS=1 -DOpenImageIO_Util_EXPORTS=1)
+endif()
if (NOT OIIO_THREAD_ALLOW_DCLP)
add_definitions ("-DOIIO_THREAD_ALLOW_DCLP=0")
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index 2410d84..2a8e076 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -182,10 +182,17 @@ oiio_find_package (PNG REQUIRED)
oiio_find_package (TIFF 3.0 REQUIRED)
# IlmBase & OpenEXR
-oiio_find_package (OpenEXR 2.0 REQUIRED)
+find_package (Threads)
+if (CMAKE_USE_PTHREADS_INIT)
+ set (ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT})
+endif ()
+find_package (OpenEXR 2.0 REQUIRED)
# We use Imath so commonly, may as well include it everywhere.
-include_directories ("${OPENEXR_INCLUDES}" "${ILMBASE_INCLUDES}"
- "${ILMBASE_INCLUDES}/OpenEXR")
+set(ILMBASE_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_PTHREADS} CACHE STRING "The libraries needed to use IlmBase")
+set(OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES} CACHE STRING "The libraries needed to use OpenEXR")
+set(ILMBASE_INCLUDE_DIR ${OPENEXR_INCLUDE_DIR})
+set(ILMBASE_FOUND TRUE)
+include_directories ("${OPENEXR_INCLUDE_DIR}")
# JPEG -- prefer Turbo-JPEG to regular libjpeg
oiio_find_package (JPEGTurbo
@@ -217,41 +224,72 @@ if (NOT BZIP2_FOUND)
set (BZIP2_LIBRARIES "") # TODO: why does it break without this?
endif ()
-oiio_find_package (Freetype
- DEFINITIONS -DUSE_FREETYPE=1 )
+if (USE_FREETYPE)
+ oiio_find_package (Freetype
+ DEFINITIONS -DUSE_FREETYPE=1 )
+endif()
oiio_find_package (HDF5
ISDEPOF Field3D)
oiio_find_package (OpenColorIO
DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1)
-oiio_find_package (OpenCV
- DEFINITIONS -DUSE_OPENCV=1)
-
+if (USE_OPENCV)
+ oiio_find_package (OpenCV
+ DEFINITIONS -DUSE_OPENCV=1)
+endif()
# Intel TBB
oiio_find_package (TBB 2017
DEFINITIONS -DUSE_TBB=1
ISDEPOF OpenVDB)
-oiio_find_package (DCMTK 3.6.1) # For DICOM images
-oiio_find_package (FFmpeg 2.6)
-oiio_find_package (Field3D
- DEPS HDF5
- DEFINITIONS -DUSE_FIELD3D=1)
-oiio_find_package (GIF 4)
+if (USE_DCMTK)
+ oiio_find_package (DCMTK 3.6.1) # For DICOM images
+else()
+ set(DCMTK_FOUND OFF)
+endif()
+if (USE_FFMPEG)
+ oiio_find_package (FFmpeg 2.6)
+else()
+ set(FFMPEG_FOUND OFF)
+endif()
+if (USE_FIELD3D)
+ oiio_find_package (Field3D
+ DEPS HDF5
+ DEFINITIONS -DUSE_FIELD3D=1)
+endif()
+if (USE_GIF)
+ oiio_find_package (GIF 4)
+else()
+ set(GIF_FOUND OFF)
+endif()
oiio_find_package (Libheif 1.3) # For HEIF/HEIC format
oiio_find_package (LibRaw)
-oiio_find_package (OpenJpeg)
+if (USE_OPENJPEG)
+ oiio_find_package (OpenJpeg)
+else()
+ set(OPENJPEG_FOUND OFF)
+endif()
oiio_find_package (OpenVDB 5.0
DEPS TBB
DEFINITIONS -DUSE_OPENVDB=1)
-oiio_find_package (PTex)
-oiio_find_package (Webp)
+if (USE_PTEX)
+ oiio_find_package (PTex)
+else()
+ set (PTEX_FOUND FALSE)
+endif()
+if (USE_WEBP)
+ oiio_find_package (Webp)
+else()
+ set (WEBP_FOUND FALSE)
+endif()
option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF)
oiio_find_package (R3DSDK) # RED camera
set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target")
-oiio_find_package (Nuke)
+if (USE_NUKE)
+ oiio_find_package (Nuke)
+endif()
oiio_find_package (OpenGL) # used for iv
@@ -260,11 +298,12 @@ set (qt5_modules Core Gui Widgets)
if (OPENGL_FOUND)
list (APPEND qt5_modules OpenGL)
endif ()
-option (USE_QT "Use Qt if found" ON)
-oiio_find_package (Qt5 COMPONENTS ${qt5_modules})
-if (USE_QT AND NOT Qt5_FOUND AND APPLE)
- message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,")
- message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH")
+if (USE_QT)
+ oiio_find_package (Qt5 COMPONENTS ${qt5_modules})
+ if (NOT Qt5_FOUND AND APPLE)
+ message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,")
+ message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH")
+ endif()
endif ()
diff --git a/src/raw.imageio/CMakeLists.txt b/src/raw.imageio/CMakeLists.txt
index f629ff9..43c7b85 100644
--- a/src/raw.imageio/CMakeLists.txt
+++ b/src/raw.imageio/CMakeLists.txt
@@ -1,7 +1,7 @@
if (LIBRAW_FOUND)
add_oiio_plugin (rawinput.cpp
INCLUDE_DIRS ${LibRaw_INCLUDE_DIR}
- LINK_LIBRARIES ${LibRaw_r_LIBRARIES}
+ LINK_LIBRARIES ${LibRaw_LIBRARIES}
DEFINITIONS "-DUSE_LIBRAW=1")
else ()
message (WARNING "Raw plugin will not be built")

View File

@ -0,0 +1,13 @@
diff --git a/src/raw.imageio/CMakeLists.txt b/src/raw.imageio/CMakeLists.txt
index 81a0ff5..23326a0 100644
--- a/src/raw.imageio/CMakeLists.txt
+++ b/src/raw.imageio/CMakeLists.txt
@@ -5,7 +5,7 @@
if (LIBRAW_FOUND)
add_oiio_plugin (rawinput.cpp
INCLUDE_DIRS ${LibRaw_INCLUDE_DIR}
- LINK_LIBRARIES ${LibRaw_r_LIBRARIES}
+ LINK_LIBRARIES ${LibRaw_LIBRARIES}
DEFINITIONS "-DUSE_LIBRAW=1")
else ()
message (WARNING "Raw plugin will not be built")

View File

@ -0,0 +1,13 @@
diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake
index 4f4f31c..a18895e 100644
--- a/src/cmake/compiler.cmake
+++ b/src/cmake/compiler.cmake
@@ -451,7 +451,7 @@ set (EXTRA_DSO_LINK_ARGS "" CACHE STRING "Extra command line definitions when bu
#
option (BUILD_SHARED_LIBS "Build shared libraries (set to OFF to build static libs)" ON)
if (NOT BUILD_SHARED_LIBS)
- add_definitions (-D${PROJECT_NAME}_STATIC_DEFINE=1)
+ add_definitions (-D${PROJECT_NAME}_STATIC_DEFINE=1 -DOIIO_STATIC_DEFINE=1)
endif ()

View File

@ -1,11 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OpenImageIO/oiio
REF 781bc97c35a74cb2e24387075b69414080bca9e1
SHA512 b75b7c3f36c7ba7daeb014312c3dfaeaae4d24e0826e439bdb19a4879866fb3eb4a09baf4eb8f706e68afcccf9409b6d168ded3dc8d81d0f3299b603958f8953
REF fdd982a9922ff508b8b22e5d024356b582572f46 #2.1.9.0
SHA512 1d076cb035b1b2cb603343465ed810ca47223211870d58f48c177d40d71a9cf82e53548b0c70127daf5dbd06f1b24772919e49e55110d914a542bcb62b99f6e8
HEAD_REF master
PATCHES
fix-dependency.patch
fix_libraw.patch
use-vcpkg-find-openexr.patch
fix_static_build.patch
)
file(REMOVE_RECURSE "${SOURCE_PATH}/ext")
@ -15,6 +17,12 @@ file(REMOVE "${SOURCE_PATH}/src/cmake/modules/FindOpenEXR.cmake")
file(MAKE_DIRECTORY "${SOURCE_PATH}/ext/robin-map/tsl")
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(LINKSTATIC ON)
else()
set(LINKSTATIC OFF)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
libraw USE_LIBRAW
opencolorio USE_OCIO
@ -59,4 +67,4 @@ file(COPY ${SOURCE_PATH}/src/cmake/modules/FindOpenImageIO.cmake DESTINATION ${C
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -0,0 +1,24 @@
diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake
index 2f4f7ce..eb40d91 100644
--- a/src/cmake/externalpackages.cmake
+++ b/src/cmake/externalpackages.cmake
@@ -169,10 +169,17 @@ checked_find_package (PNG REQUIRED)
checked_find_package (TIFF 3.0 REQUIRED)
# IlmBase & OpenEXR
+find_package (Threads)
+if (CMAKE_USE_PTHREADS_INIT)
+ set (ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT})
+endif ()
checked_find_package (OpenEXR 2.0 REQUIRED)
# We use Imath so commonly, may as well include it everywhere.
-include_directories ("${OPENEXR_INCLUDES}" "${ILMBASE_INCLUDES}"
- "${ILMBASE_INCLUDES}/OpenEXR")
+set(ILMBASE_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_PTHREADS} CACHE STRING "The libraries needed to use IlmBase")
+set(OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES} CACHE STRING "The libraries needed to use OpenEXR")
+set(ILMBASE_INCLUDE_DIR ${OPENEXR_INCLUDE_DIR})
+set(ILMBASE_FOUND TRUE)
+include_directories ("${OPENEXR_INCLUDE_DIR}")
if (CMAKE_COMPILER_IS_CLANG AND OPENEXR_VERSION VERSION_LESS 2.3)
# clang C++ >= 11 doesn't like 'register' keyword in old exr headers
add_compile_options (-Wno-deprecated-register)