vcpkg/ports/openimageio/fix-dependency.patch

168 lines
5.5 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a5f120..37d048c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,18 @@ 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
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")