forked from cemu-project/Cemu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vcpkg/windows/mac: Avoid dependency on liblzma via tiff
- Loading branch information
Showing
10 changed files
with
558 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake | ||
index ad92218..dd42aba 100644 | ||
--- a/cmake/FindCMath.cmake | ||
+++ b/cmake/FindCMath.cmake | ||
@@ -31,7 +31,7 @@ include(CheckSymbolExists) | ||
include(CheckLibraryExists) | ||
|
||
check_symbol_exists(pow "math.h" CMath_HAVE_LIBC_POW) | ||
-find_library(CMath_LIBRARY NAMES m) | ||
+find_library(CMath_LIBRARY NAMES m PATHS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) | ||
|
||
if(NOT CMath_HAVE_LIBC_POW) | ||
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
vcpkg_from_gitlab( | ||
GITLAB_URL https://gitlab.com | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO libtiff/libtiff | ||
REF "v${VERSION}" | ||
SHA512 ef2f1d424219d9e245069b7d23e78f5e817cf6ee516d46694915ab6c8909522166f84997513d20a702f4e52c3f18467813935b328fafa34bea5156dee00f66fa | ||
HEAD_REF master | ||
PATCHES | ||
FindCMath.patch | ||
) | ||
|
||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS | ||
FEATURES | ||
cxx cxx | ||
jpeg jpeg | ||
jpeg CMAKE_REQUIRE_FIND_PACKAGE_JPEG | ||
libdeflate libdeflate | ||
libdeflate CMAKE_REQUIRE_FIND_PACKAGE_Deflate | ||
lzma lzma | ||
lzma CMAKE_REQUIRE_FIND_PACKAGE_liblzma | ||
tools tiff-tools | ||
webp webp | ||
webp CMAKE_REQUIRE_FIND_PACKAGE_WebP | ||
zip zlib | ||
zip CMAKE_REQUIRE_FIND_PACKAGE_ZLIB | ||
zstd zstd | ||
zstd CMAKE_REQUIRE_FIND_PACKAGE_ZSTD | ||
) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
OPTIONS | ||
${FEATURE_OPTIONS} | ||
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON | ||
-Dtiff-docs=OFF | ||
-Dtiff-contrib=OFF | ||
-Dtiff-tests=OFF | ||
-Djbig=OFF # This is disabled by default due to GPL/Proprietary licensing. | ||
-Djpeg12=OFF | ||
-Dlerc=OFF | ||
-DCMAKE_DISABLE_FIND_PACKAGE_OpenGL=ON | ||
-DCMAKE_DISABLE_FIND_PACKAGE_GLUT=ON | ||
-DZSTD_HAVE_DECOMPRESS_STREAM=ON | ||
-DHAVE_JPEGTURBO_DUAL_MODE_8_12=OFF | ||
OPTIONS_DEBUG | ||
-DCMAKE_DEBUG_POSTFIX=d # tiff sets "d" for MSVC only. | ||
MAYBE_UNUSED_VARIABLES | ||
CMAKE_DISABLE_FIND_PACKAGE_GLUT | ||
CMAKE_DISABLE_FIND_PACKAGE_OpenGL | ||
ZSTD_HAVE_DECOMPRESS_STREAM | ||
) | ||
|
||
vcpkg_cmake_install() | ||
|
||
# CMake config wasn't packaged in the past and is not yet usable now, | ||
# cf. https://gitlab.com/libtiff/libtiff/-/merge_requests/496 | ||
# vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/tiff") | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake" "${CURRENT_PACKAGES_DIR}/debug/lib/cmake") | ||
|
||
set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libtiff-4.pc") | ||
if(EXISTS "${_file}") | ||
vcpkg_replace_string("${_file}" "-ltiff" "-ltiffd") | ||
endif() | ||
vcpkg_fixup_pkgconfig() | ||
|
||
file(REMOVE_RECURSE | ||
"${CURRENT_PACKAGES_DIR}/debug/include" | ||
"${CURRENT_PACKAGES_DIR}/debug/share" | ||
) | ||
|
||
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) | ||
|
||
if ("tools" IN_LIST FEATURES) | ||
vcpkg_copy_tools(TOOL_NAMES | ||
tiffcp | ||
tiffdump | ||
tiffinfo | ||
tiffset | ||
tiffsplit | ||
AUTO_CLEAN | ||
) | ||
endif() | ||
|
||
vcpkg_copy_pdbs() | ||
file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tiff is compatible with built-in CMake targets: | ||
|
||
find_package(TIFF REQUIRED) | ||
target_link_libraries(main PRIVATE TIFF::TIFF) | ||
|
||
tiff provides pkg-config modules: | ||
|
||
# Tag Image File Format (TIFF) library. | ||
libtiff-4 |
104 changes: 104 additions & 0 deletions
104
dependencies/vcpkg_overlay_ports/tiff/vcpkg-cmake-wrapper.cmake.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
cmake_policy(PUSH) | ||
cmake_policy(SET CMP0012 NEW) | ||
cmake_policy(SET CMP0057 NEW) | ||
set(z_vcpkg_tiff_find_options "") | ||
if("REQUIRED" IN_LIST ARGS) | ||
list(APPEND z_vcpkg_tiff_find_options "REQUIRED") | ||
endif() | ||
if("QUIET" IN_LIST ARGS) | ||
list(APPEND z_vcpkg_tiff_find_options "QUIET") | ||
endif() | ||
|
||
_find_package(${ARGS}) | ||
|
||
if(TIFF_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") | ||
include(SelectLibraryConfigurations) | ||
set(z_vcpkg_tiff_link_libraries "") | ||
set(z_vcpkg_tiff_libraries "") | ||
if("@webp@") | ||
find_package(WebP CONFIG ${z_vcpkg_tiff_find_options}) | ||
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:WebP::WebP>") | ||
list(APPEND z_vcpkg_tiff_libraries ${WebP_LIBRARIES}) | ||
endif() | ||
if("@lzma@") | ||
find_package(LibLZMA ${z_vcpkg_tiff_find_options}) | ||
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:LibLZMA::LibLZMA>") | ||
list(APPEND z_vcpkg_tiff_libraries ${LIBLZMA_LIBRARIES}) | ||
endif() | ||
if("@jpeg@") | ||
find_package(JPEG ${z_vcpkg_tiff_find_options}) | ||
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:JPEG::JPEG>") | ||
list(APPEND z_vcpkg_tiff_libraries ${JPEG_LIBRARIES}) | ||
endif() | ||
if("@zstd@") | ||
find_package(zstd CONFIG ${z_vcpkg_tiff_find_options}) | ||
set(z_vcpkg_tiff_zstd_target_property "IMPORTED_LOCATION_") | ||
if(TARGET zstd::libzstd_shared) | ||
set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_shared>") | ||
set(z_vcpkg_tiff_zstd_target zstd::libzstd_shared) | ||
if(WIN32) | ||
set(z_vcpkg_tiff_zstd_target_property "IMPORTED_IMPLIB_") | ||
endif() | ||
else() | ||
set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_static>") | ||
set(z_vcpkg_tiff_zstd_target zstd::libzstd_static) | ||
endif() | ||
get_target_property(z_vcpkg_tiff_zstd_configs "${z_vcpkg_tiff_zstd_target}" IMPORTED_CONFIGURATIONS) | ||
foreach(z_vcpkg_config IN LISTS z_vcpkg_tiff_zstd_configs) | ||
get_target_property(ZSTD_LIBRARY_${z_vcpkg_config} "${z_vcpkg_tiff_zstd_target}" "${z_vcpkg_tiff_zstd_target_property}${z_vcpkg_config}") | ||
endforeach() | ||
select_library_configurations(ZSTD) | ||
if(NOT TARGET ZSTD::ZSTD) | ||
add_library(ZSTD::ZSTD INTERFACE IMPORTED) | ||
set_property(TARGET ZSTD::ZSTD APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_tiff_zstd}) | ||
endif() | ||
list(APPEND z_vcpkg_tiff_link_libraries ${z_vcpkg_tiff_zstd}) | ||
list(APPEND z_vcpkg_tiff_libraries ${ZSTD_LIBRARIES}) | ||
unset(z_vcpkg_tiff_zstd) | ||
unset(z_vcpkg_tiff_zstd_configs) | ||
unset(z_vcpkg_config) | ||
unset(z_vcpkg_tiff_zstd_target) | ||
endif() | ||
if("@libdeflate@") | ||
find_package(libdeflate ${z_vcpkg_tiff_find_options}) | ||
set(z_vcpkg_property "IMPORTED_LOCATION_") | ||
if(TARGET libdeflate::libdeflate_shared) | ||
set(z_vcpkg_libdeflate_target libdeflate::libdeflate_shared) | ||
if(WIN32) | ||
set(z_vcpkg_property "IMPORTED_IMPLIB_") | ||
endif() | ||
else() | ||
set(z_vcpkg_libdeflate_target libdeflate::libdeflate_static) | ||
endif() | ||
get_target_property(z_vcpkg_libdeflate_configs "${z_vcpkg_libdeflate_target}" IMPORTED_CONFIGURATIONS) | ||
foreach(z_vcpkg_config IN LISTS z_vcpkg_libdeflate_configs) | ||
get_target_property(Z_VCPKG_DEFLATE_LIBRARY_${z_vcpkg_config} "${z_vcpkg_libdeflate_target}" "${z_vcpkg_property}${z_vcpkg_config}") | ||
endforeach() | ||
select_library_configurations(Z_VCPKG_DEFLATE) | ||
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:${z_vcpkg_libdeflate_target}>") | ||
list(APPEND z_vcpkg_tiff_libraries ${Z_VCPKG_DEFLATE_LIBRARIES}) | ||
unset(z_vcpkg_config) | ||
unset(z_vcpkg_libdeflate_configs) | ||
unset(z_vcpkg_libdeflate_target) | ||
unset(z_vcpkg_property) | ||
unset(Z_VCPKG_DEFLATE_FOUND) | ||
endif() | ||
if("@zlib@") | ||
find_package(ZLIB ${z_vcpkg_tiff_find_options}) | ||
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:ZLIB::ZLIB>") | ||
list(APPEND z_vcpkg_tiff_libraries ${ZLIB_LIBRARIES}) | ||
endif() | ||
if(UNIX) | ||
list(APPEND z_vcpkg_tiff_link_libraries m) | ||
list(APPEND z_vcpkg_tiff_libraries m) | ||
endif() | ||
|
||
if(TARGET TIFF::TIFF) | ||
set_property(TARGET TIFF::TIFF APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_tiff_link_libraries}) | ||
endif() | ||
list(APPEND TIFF_LIBRARIES ${z_vcpkg_tiff_libraries}) | ||
unset(z_vcpkg_tiff_link_libraries) | ||
unset(z_vcpkg_tiff_libraries) | ||
endif() | ||
unset(z_vcpkg_tiff_find_options) | ||
cmake_policy(POP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "tiff", | ||
"version": "4.6.0", | ||
"port-version": 2, | ||
"description": "A library that supports the manipulation of TIFF image files", | ||
"homepage": "https://libtiff.gitlab.io/libtiff/", | ||
"license": "libtiff", | ||
"dependencies": [ | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
}, | ||
{ | ||
"name": "vcpkg-cmake-config", | ||
"host": true | ||
} | ||
], | ||
"default-features": [ | ||
"jpeg", | ||
"zip" | ||
], | ||
"features": { | ||
"cxx": { | ||
"description": "Build C++ libtiffxx library" | ||
}, | ||
"jpeg": { | ||
"description": "Support JPEG compression in TIFF image files", | ||
"dependencies": [ | ||
"libjpeg-turbo" | ||
] | ||
}, | ||
"libdeflate": { | ||
"description": "Use libdeflate for faster ZIP support", | ||
"dependencies": [ | ||
"libdeflate", | ||
{ | ||
"name": "tiff", | ||
"default-features": false, | ||
"features": [ | ||
"zip" | ||
] | ||
} | ||
] | ||
}, | ||
"tools": { | ||
"description": "Build tools" | ||
}, | ||
"webp": { | ||
"description": "Support WEBP compression in TIFF image files", | ||
"dependencies": [ | ||
"libwebp" | ||
] | ||
}, | ||
"zip": { | ||
"description": "Support ZIP/deflate compression in TIFF image files", | ||
"dependencies": [ | ||
"zlib" | ||
] | ||
}, | ||
"zstd": { | ||
"description": "Support ZSTD compression in TIFF image files", | ||
"dependencies": [ | ||
"zstd" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake | ||
index ad92218..dd42aba 100644 | ||
--- a/cmake/FindCMath.cmake | ||
+++ b/cmake/FindCMath.cmake | ||
@@ -31,7 +31,7 @@ include(CheckSymbolExists) | ||
include(CheckLibraryExists) | ||
|
||
check_symbol_exists(pow "math.h" CMath_HAVE_LIBC_POW) | ||
-find_library(CMath_LIBRARY NAMES m) | ||
+find_library(CMath_LIBRARY NAMES m PATHS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) | ||
|
||
if(NOT CMath_HAVE_LIBC_POW) | ||
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
vcpkg_from_gitlab( | ||
GITLAB_URL https://gitlab.com | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO libtiff/libtiff | ||
REF "v${VERSION}" | ||
SHA512 ef2f1d424219d9e245069b7d23e78f5e817cf6ee516d46694915ab6c8909522166f84997513d20a702f4e52c3f18467813935b328fafa34bea5156dee00f66fa | ||
HEAD_REF master | ||
PATCHES | ||
FindCMath.patch | ||
) | ||
|
||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS | ||
FEATURES | ||
cxx cxx | ||
jpeg jpeg | ||
jpeg CMAKE_REQUIRE_FIND_PACKAGE_JPEG | ||
libdeflate libdeflate | ||
libdeflate CMAKE_REQUIRE_FIND_PACKAGE_Deflate | ||
lzma lzma | ||
lzma CMAKE_REQUIRE_FIND_PACKAGE_liblzma | ||
tools tiff-tools | ||
webp webp | ||
webp CMAKE_REQUIRE_FIND_PACKAGE_WebP | ||
zip zlib | ||
zip CMAKE_REQUIRE_FIND_PACKAGE_ZLIB | ||
zstd zstd | ||
zstd CMAKE_REQUIRE_FIND_PACKAGE_ZSTD | ||
) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
OPTIONS | ||
${FEATURE_OPTIONS} | ||
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON | ||
-Dtiff-docs=OFF | ||
-Dtiff-contrib=OFF | ||
-Dtiff-tests=OFF | ||
-Djbig=OFF # This is disabled by default due to GPL/Proprietary licensing. | ||
-Djpeg12=OFF | ||
-Dlerc=OFF | ||
-DCMAKE_DISABLE_FIND_PACKAGE_OpenGL=ON | ||
-DCMAKE_DISABLE_FIND_PACKAGE_GLUT=ON | ||
-DZSTD_HAVE_DECOMPRESS_STREAM=ON | ||
-DHAVE_JPEGTURBO_DUAL_MODE_8_12=OFF | ||
OPTIONS_DEBUG | ||
-DCMAKE_DEBUG_POSTFIX=d # tiff sets "d" for MSVC only. | ||
MAYBE_UNUSED_VARIABLES | ||
CMAKE_DISABLE_FIND_PACKAGE_GLUT | ||
CMAKE_DISABLE_FIND_PACKAGE_OpenGL | ||
ZSTD_HAVE_DECOMPRESS_STREAM | ||
) | ||
|
||
vcpkg_cmake_install() | ||
|
||
# CMake config wasn't packaged in the past and is not yet usable now, | ||
# cf. https://gitlab.com/libtiff/libtiff/-/merge_requests/496 | ||
# vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/tiff") | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake" "${CURRENT_PACKAGES_DIR}/debug/lib/cmake") | ||
|
||
set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libtiff-4.pc") | ||
if(EXISTS "${_file}") | ||
vcpkg_replace_string("${_file}" "-ltiff" "-ltiffd") | ||
endif() | ||
vcpkg_fixup_pkgconfig() | ||
|
||
file(REMOVE_RECURSE | ||
"${CURRENT_PACKAGES_DIR}/debug/include" | ||
"${CURRENT_PACKAGES_DIR}/debug/share" | ||
) | ||
|
||
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) | ||
|
||
if ("tools" IN_LIST FEATURES) | ||
vcpkg_copy_tools(TOOL_NAMES | ||
tiffcp | ||
tiffdump | ||
tiffinfo | ||
tiffset | ||
tiffsplit | ||
AUTO_CLEAN | ||
) | ||
endif() | ||
|
||
vcpkg_copy_pdbs() | ||
file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tiff is compatible with built-in CMake targets: | ||
|
||
find_package(TIFF REQUIRED) | ||
target_link_libraries(main PRIVATE TIFF::TIFF) | ||
|
||
tiff provides pkg-config modules: | ||
|
||
# Tag Image File Format (TIFF) library. | ||
libtiff-4 |
Oops, something went wrong.