mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 04:09:00 +08:00
[freeimage] use vcpkg-provided openexr
This commit is contained in:
parent
14deb3a440
commit
a051d0cb8a
@ -16,6 +16,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
find_package(WEBP REQUIRED)
|
||||
find_package(JXR REQUIRED)
|
||||
find_package(LibRaw REQUIRED)
|
||||
find_package(OpenEXR REQUIRED)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
option(INSTALL_HEADERS "Install the development headers" ON)
|
||||
@ -25,35 +26,6 @@ set(REAL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Source)
|
||||
# Add a debug postfix
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
|
||||
# For now the internal copy of OpenEXR is used (as a private always static library)
|
||||
file(GLOB OPENEXR_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/OpenEXR/Half/*.h
|
||||
${REAL_SOURCE_DIR}/OpenEXR/Iex/*.h
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IexMath/*.h
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IlmImf/*.h
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IlmThread/*.h
|
||||
${REAL_SOURCE_DIR}/OpenEXR/Imath/*.h
|
||||
${REAL_SOURCE_DIR}/OpenEXR/*.h)
|
||||
|
||||
file(GLOB OPENEXR_SRCS ${REAL_SOURCE_DIR}/OpenEXR/Half/*.cpp
|
||||
${REAL_SOURCE_DIR}/OpenEXR/Iex/*.cpp
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IexMath/*.cpp
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IlmImf/*.cpp
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IlmThread/*.cpp
|
||||
${REAL_SOURCE_DIR}/OpenEXR/Imath/*.cpp)
|
||||
|
||||
add_library(FreeImage_Private_OpenEXR STATIC ${OPENEXR_PRIVATE_HEADERS} ${OPENEXR_SRCS})
|
||||
|
||||
set(FreeImage_Private_OpenEXR_INCLUDE_DIRS ${REAL_SOURCE_DIR}/OpenEXR
|
||||
${REAL_SOURCE_DIR}/OpenEXR/Half
|
||||
${REAL_SOURCE_DIR}/OpenEXR/Iex
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IexMath
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IlmImf
|
||||
${REAL_SOURCE_DIR}/OpenEXR/IlmThread
|
||||
${REAL_SOURCE_DIR}/OpenEXR/Imath)
|
||||
|
||||
target_include_directories(FreeImage_Private_OpenEXR PRIVATE ${FreeImage_Private_OpenEXR_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS})
|
||||
|
||||
# List the public header files
|
||||
set(PUBLIC_HEADERS ${REAL_SOURCE_DIR}/FreeImage.h)
|
||||
|
||||
@ -124,7 +96,7 @@ target_include_directories(FreeImage PRIVATE ${REAL_SOURCE_DIR}
|
||||
${WEBP_INCLUDE_DIRS}
|
||||
${JXR_INCLUDE_DIRS}
|
||||
${LibRaw_INCLUDE_DIRS}
|
||||
${FreeImage_Private_OpenEXR_INCLUDE_DIRS}
|
||||
${OpenEXR_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
|
||||
@ -136,7 +108,7 @@ target_link_libraries(FreeImage ${ZLIB_LIBRARIES}
|
||||
${WEBP_LIBRARIES}
|
||||
${JXR_LIBRARIES}
|
||||
${LibRaw_LIBRARIES}
|
||||
FreeImage_Private_OpenEXR)
|
||||
${OpenEXR_LIBRARIES})
|
||||
|
||||
target_compile_definitions(FreeImage PRIVATE ${PNG_DEFINITIONS})
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: freeimage
|
||||
Version: 3.17.0-1
|
||||
Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp, libraw, jxrlib
|
||||
Version: 3.17.0-2
|
||||
Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp, libraw, jxrlib, openexr
|
||||
Description: Support library for graphics image formats
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef FREEIMAGE_CONFIG_H
|
||||
#define FREEIMAGE_CONFIG_H
|
||||
|
||||
#undef FREEIMAGE_LIB
|
||||
|
||||
#endif
|
||||
|
28
ports/freeimage/cmake/FindOpenEXR.cmake
Normal file
28
ports/freeimage/cmake/FindOpenEXR.cmake
Normal file
@ -0,0 +1,28 @@
|
||||
find_path(OpenEXR_INCLUDE_DIRS OpenEXR/OpenEXRConfig.h)
|
||||
|
||||
file(STRINGS "${OpenEXR_INCLUDE_DIRS}/OpenEXR/OpenEXRConfig.h" OPENEXR_CONFIG_H)
|
||||
|
||||
string(REGEX REPLACE "^.*define OPENEXR_VERSION_MAJOR ([0-9]+).*$" "\\1" OpenEXR_VERSION_MAJOR "${OPENEXR_CONFIG_H}")
|
||||
string(REGEX REPLACE "^.*define OPENEXR_VERSION_MINOR ([0-9]+).*$" "\\1" OpenEXR_VERSION_MINOR "${OPENEXR_CONFIG_H}")
|
||||
set(OpenEXR_LIB_SUFFIX "${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}")
|
||||
|
||||
find_library(OpenEXR_LIBRARY IlmImf-${OpenEXR_LIB_SUFFIX})
|
||||
find_library(OpenEXR_UTIL_LIBRARY IlmImfUtil-${OpenEXR_LIB_SUFFIX})
|
||||
|
||||
find_library(OpenEXR_HALF_LIBRARY Half)
|
||||
find_library(OpenEXR_IEX_LIBRARY Iex-${OpenEXR_LIB_SUFFIX})
|
||||
find_library(OpenEXR_THREAD_LIBRARY IlmThread-${OpenEXR_LIB_SUFFIX})
|
||||
find_library(OpenEXR_IEXMATH_LIBRARY IexMath-${OpenEXR_LIB_SUFFIX})
|
||||
find_library(OpenEXR_MATH_LIBRARY Imath-${OpenEXR_LIB_SUFFIX})
|
||||
|
||||
set(OpenEXR_LIBRARIES
|
||||
${OpenEXR_LIBRARY}
|
||||
${OpenEXR_MATH_LIBRARY}
|
||||
${OpenEXR_IEXMATH_LIBRARY}
|
||||
${OpenEXR_UTIL_LIBRARY}
|
||||
${OpenEXR_HALF_LIBRARY}
|
||||
${OpenEXR_IEX_LIBRARY}
|
||||
${OpenEXR_THREAD_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR REQUIRED_VARS OpenEXR_LIBRARIES OpenEXR_INCLUDE_DIRS)
|
@ -18,7 +18,6 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake DESTINATION ${SOURCE_PATH})
|
||||
|
||||
# This is not strictly necessary, but to make sure
|
||||
# that no "internal" libraries are used by removing them
|
||||
# Note that the only "internal" dependency used is OpenEXR
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibJPEG)
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibPNG)
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibTIFF4)
|
||||
@ -27,6 +26,7 @@ file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibOpenJPEG)
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibJXR)
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibWebP)
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibRawLite)
|
||||
file(REMOVE_RECURSE ${SOURCE_PATH}/Source/OpenEXR)
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
@ -38,6 +38,7 @@ vcpkg_apply_patches(
|
||||
"${CMAKE_CURRENT_LIST_DIR}/use-external-png-zlib.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/use-external-rawlib.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/use-external-webp.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/use-external-openexr.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/use-freeimage-config-include.patch"
|
||||
)
|
||||
|
||||
|
44
ports/freeimage/use-external-openexr.patch
Normal file
44
ports/freeimage/use-external-openexr.patch
Normal file
@ -0,0 +1,44 @@
|
||||
diff --git a/Source/FreeImage/PluginEXR.cpp b/Source/FreeImage/PluginEXR.cpp
|
||||
index b286430..82b3b72 100644
|
||||
--- a/Source/FreeImage/PluginEXR.cpp
|
||||
+++ b/Source/FreeImage/PluginEXR.cpp
|
||||
@@ -28,16 +28,16 @@
|
||||
#pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
#endif
|
||||
|
||||
-#include "../OpenEXR/IlmImf/ImfIO.h"
|
||||
-#include "../OpenEXR/Iex/Iex.h"
|
||||
-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
|
||||
-#include "../OpenEXR/IlmImf/ImfInputFile.h"
|
||||
-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
|
||||
-#include "../OpenEXR/IlmImf/ImfChannelList.h"
|
||||
-#include "../OpenEXR/IlmImf/ImfRgba.h"
|
||||
-#include "../OpenEXR/IlmImf/ImfArray.h"
|
||||
-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
|
||||
-#include "../OpenEXR/Half/half.h"
|
||||
+#include <OpenEXR/ImfIO.h>
|
||||
+#include <OpenEXR/Iex.h>
|
||||
+#include <OpenEXR/ImfOutputFile.h>
|
||||
+#include <OpenEXR/ImfInputFile.h>
|
||||
+#include <OpenEXR/ImfRgbaFile.h>
|
||||
+#include <OpenEXR/ImfChannelList.h>
|
||||
+#include <OpenEXR/ImfRgba.h>
|
||||
+#include <OpenEXR/ImfArray.h>
|
||||
+#include <OpenEXR/ImfPreviewImage.h>
|
||||
+#include <OpenEXR/half.h>
|
||||
|
||||
|
||||
// ==========================================================
|
||||
diff --git a/Source/FreeImage/PluginTIFF.cpp b/Source/FreeImage/PluginTIFF.cpp
|
||||
index 562fdd7..ce12649 100644
|
||||
--- a/Source/FreeImage/PluginTIFF.cpp
|
||||
+++ b/Source/FreeImage/PluginTIFF.cpp
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "Utilities.h"
|
||||
#include <tiffio.h>
|
||||
#include "../Metadata/FreeImageTag.h"
|
||||
-#include "../OpenEXR/Half/half.h"
|
||||
+#include <OpenEXR/half.h>
|
||||
|
||||
#include "FreeImageIO.h"
|
||||
#include "PSDParser.h"
|
Loading…
Reference in New Issue
Block a user