mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-13 15:09:01 +08:00
47d206e149
* [many ports] improve compatibility with WSL and mixed case filesystems * [treehopper] express dependency on libusb, which was not working on non-win32 platforms and is still broken there * [libharu] add compatibility with non-win32 platforms * [geogram] fix openblas on linux [clapack] better integration with linux environment [visit-struct] put cmake config file in the expected folder [geogram] remove trailing underscore to enable compatibility with OpenBLAS * [openblas] playing with underscore, without success * [openblas/lapack] fix library integration * [clapack] improve target handling in cmake module * [openblas] promote self-generated config to default cmake module, otherwise internal ones thinks wrongly that openblas can also solve lapack libs * [clapack,openblas] improve libraries integration * [many ports] fix cmake unnecessary target paths, wrong config paths, empty default dependencies, unnecessary [core] tags * [suitesparse] improve integration with new lapack/openblas mechanism * [suitesparse] add no underscore postfix also for linux * [ceres] fix integration with newer openblas/lapack configs * [aws-c-event-stream] fix regression * [systemc] fix regression * [libwebp,geogram] trigger rebuild * [libwebp,pthread4w] fix regressions * [glbinding] fix cmake module installation * [globjects] disentangle unnecessary dependency from qt5 * [jasper] remove broken and unnecessary patches * [libwebp] fix regression * [many ports] avoid using BUILD_SHARED_LIBS which is uninitialized in port files * [clapack] correctly find dlls * [clapack] use a generic blas as dependency * [fizz,g2o] restore expected version * fix mistake * [many ports] remove WIN32, APPLE and UNIX (again, they keep creeping in) from ports since they are broken and usually break non-win32 ports * [libressl,openssl] do not try to build one if the other is already installed * [itk] update ref and patch to avoid regression * [libressl,openssl] implement full strategy to fix CI * [libwebp] disable components that are broken on macOS * [ogre] enable macOS build * [freeimage,jxrlib,ogre,openexr,protobuf] port patches from #5169 * [ogre] add missing install command * [ffmpeg] enable wrapper for cmake module * [ffmpeg] add avresample module finder * [ffmpeg] improve module detection and exported symbols * [ffmpeg] add variables to cache * [thrift] remove unnecessary build option * [allegro5] fix shared/static inversion * [protobuf] cleanup * [libressl] cleanup * [moos-core] cleanup * commented features must not be separated from other features, otherwise vcpkg complains * [itk] fix regression * [shogun,itk] fix regressions * [ogre] fix regression * [opusfile] add compatibility with non-win32 * [itk] fix regression * [sndfile,libsndfile] remove duplicate, redirect sndfile to libsndfile * add missing dependencies * [ismrmrd] fix regression * [ffmpeg] trigger rebuild * [clapack,openblas,libogg] fix regressions on macOS * [libtins] fix regression * force rebuild windows regressions, unable to reproduce locally * [mosquitto] enable non-win32 builds * [json-dto] force rebuild, unable to reproduce regression locally * [many ports] uniform naming and path length requests * fix regression * fix regression * [ffmpeg] fixes for downstream projects * clean up - thanks to reviewers * trigger rebuild of regressions on macOS * trigger rebuild of regressions on macOS - part2 * Add core back * Use VCPKG_CONCURRENCY * Add core back to suitesparse * Add core back to curl * Add core back to magnum * Add core back to magnum * Add core back to magnum * Add core back to cgal
155 lines
6.0 KiB
CMake
155 lines
6.0 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()
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
add_definitions("-DOPENEXR_DLL")
|
|
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}
|
|
${OpenEXR_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_LIBRARIES})
|
|
|
|
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()
|