mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 06:03:02 +08:00
commit
2da08053d6
@ -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)
|
||||
@ -24,35 +25,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"
|
4
ports/openexr/CONTROL
Normal file
4
ports/openexr/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: openexr
|
||||
Version: 2.2.0
|
||||
Description: OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications
|
||||
Build-Depends: zlib, ilmbase
|
13
ports/openexr/add-missing-export.patch
Normal file
13
ports/openexr/add-missing-export.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/IlmImf/ImfHeader.h b/IlmImf/ImfHeader.h
|
||||
index 756a62e..dd71e0e 100644
|
||||
--- a/IlmImf/ImfHeader.h
|
||||
+++ b/IlmImf/ImfHeader.h
|
||||
@@ -493,7 +493,7 @@ class Header::ConstIterator
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
-void staticInitialize ();
|
||||
+IMF_EXPORT void staticInitialize ();
|
||||
|
||||
|
||||
//-----------------
|
54
ports/openexr/portfile.cmake
Normal file
54
ports/openexr/portfile.cmake
Normal file
@ -0,0 +1,54 @@
|
||||
set(OPENEXR_VERSION 2.2.0)
|
||||
set(OPENEXR_HASH 017abbeeb6b814508180721bc8e8940094965c4c55b135a198c6bcb109a04bf7f72e4aee81ee72cb2185fe818a41d892b383e8d2d59f40c673198948cb79279a)
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openexr-${OPENEXR_VERSION})
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://download.savannah.nongnu.org/releases/openexr/openexr-${OPENEXR_VERSION}.tar.gz"
|
||||
FILENAME "openexr-${OPENEXR_VERSION}.zip"
|
||||
SHA512 ${OPENEXR_HASH})
|
||||
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-missing-export.patch)
|
||||
|
||||
# Ensure helper executables can run during build
|
||||
set(ENV{PATH} "$ENV{PATH};${CURRENT_INSTALLED_DIR}/bin")
|
||||
|
||||
# In debug build buildsystem cannot locate IlmBase headers
|
||||
set(VCPKG_C_FLAGS_DEBUG "${VCPKG_C_FLAGS_DEBUG}")
|
||||
set(VCPKG_CXX_FLAGS_DEBUG "${VCPKG_CXX_FLAGS_DEBUG} -I\"${CURRENT_INSTALLED_DIR}/include/OpenExr\"")
|
||||
|
||||
vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS_DEBUG
|
||||
-DILMBASE_PACKAGE_PREFIX=${CURRENT_INSTALLED_DIR}/debug
|
||||
OPTIONS_RELEASE
|
||||
-DILMBASE_PACKAGE_PREFIX=${CURRENT_INSTALLED_DIR})
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
foreach(SUBDIR "" "/debug")
|
||||
file(GLOB DLLS ${CURRENT_PACKAGES_DIR}${SUBDIR}/lib/*.dll)
|
||||
file(COPY ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}${SUBDIR}/bin)
|
||||
file(REMOVE ${DLLS})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/include/OpenEXR/ImfExport.h HEADER_FILE)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
string(REPLACE "defined(OPENEXR_DLL)" "1" HEADER_FILE "${HEADER_FILE}")
|
||||
else()
|
||||
string(REPLACE "defined(OPENEXR_DLL)" "0" HEADER_FILE "${HEADER_FILE}")
|
||||
endif()
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/include/OpenEXR/ImfExport.h "${HEADER_FILE}")
|
||||
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openexr)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/openexr/LICENSE ${CURRENT_PACKAGES_DIR}/share/openexr/copyright)
|
Loading…
Reference in New Issue
Block a user