mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 06:59:07 +08:00
[libgeotiff] support linux build (#3843)
* [libgeotiff] fix compile on linux Fix cmake libtiff functions detetion failure caused by finding no functions in libm. Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [libgeotiff] fix utility binary handling in linux Signed-off-by: Hiroshi Miura <miurahr@linux.com> * [tiff] Fix static transitive dependencies * [libgeotiff] Fix .dll and .exe manipulation * [leptonica] Find dependencies in installed cmake config file * [tiff] Do not add cmake targets to TIFF_LIBRARIES * [tiff] Link consumers against m on unix platforms
This commit is contained in:
parent
09ccd053db
commit
3eeaf564d1
@ -1,4 +1,4 @@
|
||||
Source: leptonica
|
||||
Version: 1.74.4-3
|
||||
Version: 1.74.4-5
|
||||
Description: An open source library containing software that is broadly useful for image processing and image analysis applications
|
||||
Build-Depends: libjpeg-turbo, zlib, libpng, tiff, giflib
|
||||
|
18
ports/leptonica/find-dependency.patch
Normal file
18
ports/leptonica/find-dependency.patch
Normal file
@ -0,0 +1,18 @@
|
||||
diff --git a/cmake/templates/LeptonicaConfig.cmake.in b/cmake/templates/LeptonicaConfig.cmake.in
|
||||
index d53904a..2aa2fea 100644
|
||||
--- a/cmake/templates/LeptonicaConfig.cmake.in
|
||||
+++ b/cmake/templates/LeptonicaConfig.cmake.in
|
||||
@@ -20,6 +20,13 @@
|
||||
#
|
||||
# ===================================================================================
|
||||
|
||||
+include(CMakeFindDependencyMacro)
|
||||
+find_dependency(TIFF)
|
||||
+find_dependency(ZLIB)
|
||||
+find_dependency(PNG)
|
||||
+find_dependency(JPEG)
|
||||
+find_dependency(GIF)
|
||||
+
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/LeptonicaTargets.cmake)
|
||||
|
||||
# ======================================================
|
@ -6,13 +6,10 @@ vcpkg_from_github(
|
||||
REF 1.74.4
|
||||
SHA512 3b9d0be937883f733f72cbdf0b624ec245d9256a8b4622997f437d309efd7ad9695ad1cbe2224d543eb3ef8c44833567b3cc9a95e9a774ef9046b7acaf0ae744
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix-cmakelists.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/use-tiff-libraries.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/find-dependency.patch
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATIC)
|
||||
|
@ -1,36 +0,0 @@
|
||||
From bc0003ab3d94f271b27f6897259b734709a5d6cf Mon Sep 17 00:00:00 2001
|
||||
From: Hiroshi Miura <miurahr@linux.com>
|
||||
Date: Wed, 14 Feb 2018 12:32:11 +0900
|
||||
Subject: [PATCH 3/5] Fix cmake TIFF detection
|
||||
|
||||
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
|
||||
---
|
||||
CMakeLists.txt | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 55ececf..1e2fe3d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -191,7 +191,8 @@ IF(WITH_TIFF)
|
||||
IF(TIFF_FOUND)
|
||||
# Confirm required API is available
|
||||
INCLUDE(CheckFunctionExists)
|
||||
- SET(CMAKE_REQUIRED_LIBRARIES ${TIFF_LIBRARIES})
|
||||
+ FIND_PACKAGE(LibLZMA)
|
||||
+ SET(CMAKE_REQUIRED_LIBRARIES ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${LIBLZMA_LIBRARIES})
|
||||
|
||||
CHECK_FUNCTION_EXISTS(TIFFOpen HAVE_TIFFOPEN)
|
||||
IF(NOT HAVE_TIFFOPEN)
|
||||
@@ -204,7 +205,7 @@ IF(WITH_TIFF)
|
||||
SET(TIFF_FOUND) # ReSET to NOT found for TIFF library
|
||||
MESSAGE(FATAL_ERROR "Failed to link with libtiff - TIFFMergeFieldInfo function not found. libtiff 3.6.0 Beta or later required. Please upgrade or use an older version of libgeotiff")
|
||||
ENDIF()
|
||||
-
|
||||
+ SET(CMAKE_REQUIRED_LIBRARIES)
|
||||
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(-DHAVE_TIFF=1)
|
||||
ENDIF(TIFF_FOUND)
|
||||
--
|
||||
2.16.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: libgeotiff
|
||||
Version: 1.4.2-3
|
||||
Version: 1.4.2-4
|
||||
Description: Libgeotiff is an open source library normally hosted on top of libtiff for reading, and writing GeoTIFF information tags.
|
||||
Build-Depends: tiff, proj4, zlib, libjpeg-turbo
|
||||
|
@ -2,55 +2,57 @@ include(vcpkg_common_functions)
|
||||
|
||||
set(LIBGEOTIFF_VERSION 1.4.2)
|
||||
set(LIBGEOTIFF_HASH 059c6e05eb0c47f17b102c7217a2e1636e76d622c4d1bdcf0bd89fb3505f3130bffa881e21c73cfd2ca0d6863b81322f85784658ba3539b53b63c3a8f38d1deb)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libgeotiff-${LIBGEOTIFF_VERSION})
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/1/libgeotiff-${LIBGEOTIFF_VERSION})
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-${LIBGEOTIFF_VERSION}.tar.gz"
|
||||
FILENAME "libgeotiff-${LIBGEOTIFF_VERSION}.tar.gz"
|
||||
SHA512 ${LIBGEOTIFF_HASH})
|
||||
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src/1)
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-Updates-to-CMake-configuration-to-align-with-other-C.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/0002-Fix-directory-output.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/0003-Fix-cmake-TIFF-detection.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/0004-Fix-libxtiff-installation.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/0005-Control-shared-library-build-with-option.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/0006-Fix-utility-link-error.patch"
|
||||
)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
else()
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
|
||||
-DWITH_TIFF=ON
|
||||
-DWITH_PROJ4=ON
|
||||
-DWITH_ZLIB=ON
|
||||
-DWITH_JPEG=ON
|
||||
OPTIONS
|
||||
-DWITH_TIFF=ON
|
||||
-DWITH_PROJ4=ON
|
||||
-DWITH_ZLIB=ON
|
||||
-DWITH_JPEG=ON
|
||||
OPTIONS_RELEASE -DWITH_UTILITIES=ON
|
||||
OPTIONS_DEBUG -DWITH_UTILITIES=OFF
|
||||
)
|
||||
|
||||
vcpkg_build_cmake()
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libgeotiff RENAME copyright)
|
||||
|
||||
file(GLOB GEOTIFF_UTILS ${CURRENT_PACKAGES_DIR}/bin/*.exe)
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
file(GLOB GEOTIFF_UTILS ${CURRENT_PACKAGES_DIR}/bin/*)
|
||||
else()
|
||||
file(GLOB GEOTIFF_UTILS ${CURRENT_PACKAGES_DIR}/bin/*.exe)
|
||||
endif()
|
||||
|
||||
file(INSTALL ${GEOTIFF_UTILS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/libgeotiff/)
|
||||
file(REMOVE ${GEOTIFF_UTILS})
|
||||
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/libgeotiff)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
|
||||
if(EXES)
|
||||
file(REMOVE ${EXES})
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR (VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/bin)
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: tiff
|
||||
Version: 4.0.9
|
||||
Version: 4.0.9-4
|
||||
Build-Depends: zlib, libjpeg-turbo, liblzma (windows)
|
||||
Description: A library that supports the manipulation of TIFF image files
|
||||
|
@ -42,6 +42,12 @@ file(REMOVE_RECURSE
|
||||
${CURRENT_PACKAGES_DIR}/debug/share
|
||||
${CURRENT_PACKAGES_DIR}/share
|
||||
)
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/tiff)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
|
||||
${CURRENT_PACKAGES_DIR}/share/tiff
|
||||
@ONLY
|
||||
)
|
||||
file(INSTALL
|
||||
${SOURCE_PATH}/COPYRIGHT
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/share/tiff
|
||||
|
24
ports/tiff/vcpkg-cmake-wrapper.cmake
Normal file
24
ports/tiff/vcpkg-cmake-wrapper.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
_find_package(${ARGS})
|
||||
|
||||
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
|
||||
set(TIFF_EXTRA_LIBRARIES)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
find_package(LibLZMA)
|
||||
list(APPEND TIFF_EXTRA_LIBRARIES ${LIBLZMA_LIBRARIES})
|
||||
endif()
|
||||
|
||||
find_package(JPEG)
|
||||
list(APPEND TIFF_EXTRA_LIBRARIES ${JPEG_LIBRARIES})
|
||||
|
||||
find_package(ZLIB)
|
||||
|
||||
if(TARGET TIFF::TIFF)
|
||||
set_property(TARGET TIFF::TIFF APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${TIFF_EXTRA_LIBRARIES} ZLIB::ZLIB)
|
||||
endif()
|
||||
if(TIFF_LIBRARIES)
|
||||
list(APPEND TIFF_LIBRARIES ${TIFF_EXTRA_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
if(UNIX)
|
||||
list(APPEND TIFF_LIBRARIES m)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user