vcpkg/ports/freeimage/CMakeLists.txt
Stefano Sinigardi f1e7a3f167
[opencv4] update to v4.3 (#11130)
* [opencv4] draft update to v4.3

* restore uwp patch

* fix qt and ipp features

* fix libepoxy and meson on osx

* fix baseline, trigger a full rebuild due to meson tool changes

* remove jpeg feature on windows due to a bug with MSVC

* minor fixes for some features

* ffmpeg x11 lib not required anymore on apple for downstream projects

* small fixes for ogre and qt5

* remove a broken module

* fix installation path

* fix openexr which was broken and regressed opencv downstream projects

* first round of ci passes

* improve compatibility with android toolchain

* [openexr] upgrade to v2.5.0 to fix regressions, might require fixes in dependent projects and might deserve its own PR

* fix OpenEXR link for downstream projects

* do not install unrequested features

* fix compatibility with newer OpenEXR

* [OpenCV3] update to v3.4.10

* fix openexr on windows, was creating symlinks that broke vcpkg

* fix openexr wrapper

* [openexr] cmake config files are installed into a lowered-case folder

* remove mangled paths trying to fix android setup

* disable dnn on android, fix mangled cmake config paths again

* fix downstream CUDA dependency

* fix compatibility with vs16.6

* remove from baseline ports now passing tests

* [alembic] fixes for new openexr

* fix baseline

* [field3d] fixes for new openexr

* [field3d] improve fixes, windows still unsupported despite what is said upstream

* apply fixes required from review

* add missing field3d patch

* [field3d] disable mpi integration

* [opencv2] remove cublas integration

* [vtk] do not create libharu::libharu target if already existing

* Update ports/opencv4/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/opencv3/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* improve compatibility with newer CUDNN

* [OpenCV3, OpenCV4] improve compatibility with CUDA 11

* [OpenCV2] improve compatibility with CUDA 11

* [field3d] regenerate patch ignoring space at eol

* [vcpkg] Use SSH keys instead of password authentication when minting Linux scale sets (#11999)

* [field3d] regenerate patch ignoring space at eol

* [field3d] regenerate patch, again

* [field3d] fixes for windows

* [libass] fix regression

* ci.baseline.txt update

* [CUDA11] use FindCUDA from CMake 3.18 to ease transition later

* re-bump vtk and ffmpeg, which were lost with merges from master

* [OpenCV4] Halide feature is not broken anymore

* [field3d] regenerate hdf5 patch

* [OpenCV4] remove GTK features: it can be built only on *nix but GTK on vcpkg cannot be built on *nix systems...

* merge ci.baseline.txt from master and fix field3d patch

* remove rebuilding

* restore vtk CONTROL file

* update CONTROL files

* Trigger rebuild

* Update ports/freeimage/CONTROL

* Update ports/freeimage/CONTROL

* [opencv3/4] avoid tesseract dependency on uwp builds

* [opencv] add missing module search

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
2020-07-27 17:43:23 -07:00

150 lines
5.9 KiB
CMake

cmake_minimum_required(VERSION 3.4)
include(GNUInstallDirs)
project(FreeImage C CXX)
if(MSVC)
add_definitions("-D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_CXX_FLAGS "/wd4828 ${CMAKE_CXX_FLAGS}")
endif()
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
find_package(JPEG REQUIRED)
find_package(TIFF REQUIRED)
find_package(OpenJPEG REQUIRED)
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)
set(REAL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Source)
# Add a debug postfix
set(CMAKE_DEBUG_POSTFIX "d")
# List the public header files
set(PUBLIC_HEADERS ${REAL_SOURCE_DIR}/FreeImage.h)
# List the private header files
set(ROOT_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/CacheFile.h
${REAL_SOURCE_DIR}/FreeImageIO.h
${REAL_SOURCE_DIR}/MapIntrospector.h
${REAL_SOURCE_DIR}/Plugin.h
${REAL_SOURCE_DIR}/Quantizers.h
${REAL_SOURCE_DIR}/ToneMapping.h
${REAL_SOURCE_DIR}/Utilities.h)
file(GLOB FREEIMAGE_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/FreeImage/*.h)
file(GLOB FREEIMAGE_TOOLKIT_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/FreeImageToolkit/*.h)
file(GLOB METADATA_PRIVATE_HEADERS ${REAL_SOURCE_DIR}/Metadata/*.h)
set(PRIVATE_HEADERS ${ROOT_PRIVATE_HEADERS}
${FREEIMAGE_PRIVATE_HEADERS}
${FREEIMAGE_TOOLKIT_PRIVATE_HEADERS}
${METADATA_PRIVATE_HEADERS})
# List the source files
file(GLOB DEPRECATION_SRCS ${REAL_SOURCE_DIR}/DeprecationManager/*.cpp)
file(GLOB FREEIMAGE_TOOLKIT_SRCS ${REAL_SOURCE_DIR}/FreeImageToolkit/*.cpp)
file(GLOB FREEIMAGE_SRCS ${REAL_SOURCE_DIR}/FreeImage/*.cpp)
file(GLOB METADATA_SRCS ${REAL_SOURCE_DIR}/Metadata/*.cpp)
# The G3 plugin is disabled because it require the private copy of tiff
list(REMOVE_ITEM FREEIMAGE_SRCS ${REAL_SOURCE_DIR}/FreeImage/PluginG3.cpp)
# The JPEGTransform plugin is disable because it requires a private copy of jpeg
list(REMOVE_ITEM FREEIMAGE_TOOLKIT_SRCS ${REAL_SOURCE_DIR}/FreeImageToolkit/JPEGTransform.cpp)
set(SRCS ${DEPRECATION_SRCS}
${FREEIMAGE_SRCS}
${FREEIMAGE_TOOLKIT_SRCS}
${METADATA_SRCS}
)
# If FreeImage is used as a static library, FREEIMAGE_LIB
# needs to be defined (at the C preprocessor level) to correctly
# define (to nothing instead of _declspec(dllimport) ) the DLL_API macro.
# For this purpouse we include (depending on the BUILD_SHARED_LIBS )
# the appropriate FreeImageConfig.h .
if(BUILD_SHARED_LIBS)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-dynamic.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h)
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-static.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h)
endif()
list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h)
add_library(FreeImage ${SRCS} ${PRIVATE_HEADERS} ${PUBLIC_HEADERS})
if(BUILD_SHARED_LIBS)
target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_EXPORTS)
else()
target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_LIB)
endif()
target_include_directories(FreeImage PRIVATE ${REAL_SOURCE_DIR}
${ZLIB_INCLUDE_DIRS}
${JPEG_INCLUDE_DIRS}
${TIFF_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${OPENJPEG_INCLUDE_DIRS}
${WEBP_INCLUDE_DIRS}
${JXR_INCLUDE_DIRS}
${LibRaw_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(FreeImage ${ZLIB_LIBRARIES}
${JPEG_LIBRARIES}
${TIFF_LIBRARIES}
${PNG_LIBRARIES}
${OPENJPEG_LIBRARIES}
${WEBP_LIBRARIES}
${JXR_LIBRARIES}
${LibRaw_LIBRARIES}
OpenEXR::IlmImf)
target_compile_definitions(FreeImage PRIVATE ${PNG_DEFINITIONS})
# FreeImagePlus
file(GLOB FREEIMAGEPLUS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Wrapper/FreeImagePlus/src/*.cpp)
add_library(FreeImagePlus
${FREEIMAGEPLUS_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/Wrapper/FreeImagePlus/FreeImagePlus.h
${CMAKE_CURRENT_SOURCE_DIR}/Wrapper/FreeImagePlus/FreeImagePlus.rc)
if(BUILD_SHARED_LIBS)
target_compile_definitions(FreeImagePlus PRIVATE -DFIP_EXPORTS)
else()
target_compile_definitions(FreeImagePlus PRIVATE -DFREEIMAGE_LIB)
endif()
target_include_directories(FreeImagePlus PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Wrapper/FreeImagePlus
${CMAKE_CURRENT_BINARY_DIR}
${REAL_SOURCE_DIR})
target_link_libraries(FreeImagePlus PUBLIC FreeImage)
list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Wrapper/FreeImagePlus/FreeImagePlus.h)
install(TARGETS FreeImage
COMPONENT runtime
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib)
install(TARGETS FreeImagePlus
COMPONENT runtime-cpp
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib)
if(INSTALL_HEADERS)
install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()