Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ports/gdal/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ else()
--with-libdeflate=no
--with-libgrass=no
--with-libkml=no
--with-lz4=no
--with-mdb=no
--with-mrsid=no
--with-mrsid_lidar=no
Expand Down
2 changes: 1 addition & 1 deletion ports/gdal/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gdal",
"version-semver": "3.4.0",
"port-version": 2,
"port-version": 3,
"description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data",
"homepage": "https://gdal.org",
"supports": "!(arm & windows)",
Expand Down
14 changes: 14 additions & 0 deletions ports/libjxl/disable-jxl_extras.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index a366e51..257f87d 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -132,7 +132,9 @@ endif() #!MSVC
include(jxl.cmake)

# Other libraries outside the core jxl library.
+if(JPEGXL_ENABLE_TOOLS)
include(jxl_extras.cmake)
+endif()
include(jxl_threads.cmake)

# Install all the library headers from the source and the generated ones. There
10 changes: 7 additions & 3 deletions ports/libjxl/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
diff --git a/lib/jxl.cmake b/lib/jxl.cmake
--- a/lib/jxl.cmake
+++ b/lib/jxl.cmake
@@ -3,6 +3,16 @@
@@ -3,6 +3,18 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.


+if(JPEGXL_ENABLE_TOOLS)
+find_package(lodepng CONFIG REQUIRED)
+endif()
+find_package(unofficial-brotli CONFIG REQUIRED)
+find_package(lcms2 CONFIG REQUIRED)
+
Expand Down Expand Up @@ -46,7 +48,7 @@ diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
set_property(TARGET hwy PROPERTY INTERFACE_COMPILE_OPTIONS ${HWY_CFLAGS_OTHER})
else()
target_include_directories(hwy INTERFACE ${HWY_INCLUDE_DIRS})
@@ -114,82 +112,10 @@ else()
@@ -114,82 +112,12 @@ else()
endif()

# lodepng
Expand All @@ -57,7 +59,9 @@ diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
-include(lodepng.cmake)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lodepng/LICENSE"
- ${PROJECT_BINARY_DIR}/LICENSE.lodepng COPYONLY)
+if(JPEGXL_ENABLE_TOOLS)
+find_package(lodepng CONFIG REQUIRED)
+endif()

# brotli
-if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/brotli/c/include/brotli/decode.h" OR
Expand Down
15 changes: 15 additions & 0 deletions ports/libjxl/fix-link-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/lib/jxl.cmake b/lib/jxl.cmake
index 63539cc..2e1d617 100644
--- a/lib/jxl.cmake
+++ b/lib/jxl.cmake
@@ -551,8 +551,10 @@ foreach(target IN ITEMS jxl jxl_dec)
# This hides the default visibility symbols from static libraries bundled into
# the shared library. In particular this prevents exposing symbols from hwy
# and skcms in the shared library.
+ if(NOT APPLE AND NOT MSVC)
set_property(TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,--exclude-libs=ALL")
+ endif()
endforeach()

# Only install libjxl shared library. The libjxl_dec is not installed since it
73 changes: 56 additions & 17 deletions ports/libjxl/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
set(JPEGXL_VERSION 0.6.1)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libjxl/libjxl
REF v0.6.1
REF "v${JPEGXL_VERSION}"
SHA512 302935d722160b0b288ac63301f9e95caf82eccf6ad76c4f4da6316a0314ee3562115932b1ceacb0d02708de0a07788992d3478cae73af0b90193f5769f9fb52
HEAD_REF main
PATCHES
fix-install-directories.patch
fix-dependencies.patch
fix-link-flags.patch
disable-jxl_extras.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools JPEGXL_ENABLE_TOOLS
INVERTED_FEATURES
tools CMAKE_DISABLE_FIND_PACKAGE_GIF
tools CMAKE_DISABLE_FIND_PACKAGE_JPEG
tools CMAKE_DISABLE_FIND_PACKAGE_PNG
tools CMAKE_DISABLE_FIND_PACKAGE_ZLIB
)

if(VCPKG_TARGET_IS_UWP)
string(APPEND VCPKG_C_FLAGS " -D_CRT_SECURE_NO_WARNINGS /wd4146")
string(APPEND VCPKG_CXX_FLAGS " -D_CRT_SECURE_NO_WARNINGS /wd4146")

# Temporary workaround for #9390
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
list(APPEND FEATURE_OPTIONS -DCMAKE_SYSTEM_PROCESSOR=x86)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
list(APPEND FEATURE_OPTIONS -DCMAKE_SYSTEM_PROCESSOR=AMD64)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
list(APPEND FEATURE_OPTIONS -DCMAKE_SYSTEM_PROCESSOR=ARM)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
list(APPEND FEATURE_OPTIONS -DCMAKE_SYSTEM_PROCESSOR=ARM64)
else()
message(FATAL_ERROR "Unsupported uwp VCPKG_TARGET_ARCHITECTURE \"${VCPKG_TARGET_ARCHITECTURE}\"")
endif()
# Workaround for vcpkg-cmake bug, proper fix in #21857
set(_TARGETTING_UWP 1)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DJPEGXL_VERSION=${JPEGXL_VERSION}"
-DJPEGXL_FORCE_SYSTEM_HWY=ON
-DJPEGXL_FORCE_SYSTEM_BROTLI=ON
${FEATURE_OPTIONS}
-DJPEGXL_ENABLE_FUZZERS=OFF
-DJPEGXL_ENABLE_MANPAGES=OFF
Expand All @@ -27,9 +59,14 @@ vcpkg_cmake_configure(
-DJPEGXL_ENABLE_OPENEXR=OFF
-DJPEGXL_ENABLE_PLUGINS=OFF
-DJPEGXL_ENABLE_SKCMS=OFF
-DJPEGXL_FORCE_SYSTEM_HWY=ON
-DJPEGXL_FORCE_SYSTEM_BROTLI=ON
-DJPEGXL_ENABLE_TCMALLOC=OFF
-DBUILD_TESTING=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=1
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_GIF
CMAKE_DISABLE_FIND_PACKAGE_JPEG
CMAKE_DISABLE_FIND_PACKAGE_PNG
CMAKE_DISABLE_FIND_PACKAGE_ZLIB
)

vcpkg_cmake_install()
Expand All @@ -47,32 +84,34 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
"${CURRENT_PACKAGES_DIR}/bin"
"${CURRENT_PACKAGES_DIR}/debug/bin"
)
file(REMOVE
set(FILES_TO_REMOVE
"${CURRENT_PACKAGES_DIR}/lib/jxl.lib"
"${CURRENT_PACKAGES_DIR}/lib/jxl_threads.lib"
"${CURRENT_PACKAGES_DIR}/debug/lib/jxl.lib"
"${CURRENT_PACKAGES_DIR}/debug/lib/jxl_threads.lib"
)
else()
file(GLOB FILES "${CURRENT_PACKAGES_DIR}/lib/*.so*")
file(REMOVE ${FILES})
file(GLOB FILES "${CURRENT_PACKAGES_DIR}/debug/lib/*.so*")
file(REMOVE ${FILES})
file(GLOB FILES_TO_REMOVE
"${CURRENT_PACKAGES_DIR}/lib/*.so*"
"${CURRENT_PACKAGES_DIR}/lib/*.dylib*"
"${CURRENT_PACKAGES_DIR}/debug/lib/*.so*"
"${CURRENT_PACKAGES_DIR}/debug/lib/*.dylib*"
)
endif()
else()
if(VCPKG_TARGET_IS_WINDOWS)
file(GLOB FILES "${CURRENT_PACKAGES_DIR}/lib/*-static.lib")
file(REMOVE ${FILES})
file(GLOB FILES "${CURRENT_PACKAGES_DIR}/debug/lib/*-static.lib")
file(REMOVE ${FILES})
file(GLOB FILES_TO_REMOVE
"${CURRENT_PACKAGES_DIR}/lib/*-static.lib"
"${CURRENT_PACKAGES_DIR}/debug/lib/*-static.lib"
)
else()
file(GLOB FILES "${CURRENT_PACKAGES_DIR}/lib/*.a")
file(REMOVE ${FILES})
file(GLOB FILES "${CURRENT_PACKAGES_DIR}/debug/lib/*.a")
file(REMOVE ${FILES})
file(GLOB FILES_TO_REMOVE
"${CURRENT_PACKAGES_DIR}/lib/*.a"
"${CURRENT_PACKAGES_DIR}/debug/lib/*.a"
)
endif()
endif()

file(REMOVE ${FILES_TO_REMOVE})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
11 changes: 9 additions & 2 deletions ports/libjxl/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
{
"name": "libjxl",
"version-semver": "0.6.1",
"port-version": 1,
"description": "JPEG XL image format reference implementation",
"homepage": "https://github.com/libjxl/libjxl",
"license": "BSD-3-Clause",
"dependencies": [
"brotli",
"highway",
"lcms",
"lodepng",
{
"name": "vcpkg-cmake",
"host": true
}
],
"features": {
"tools": {
"description": "Build user tools: cjxl and djxl"
"description": "Build user tools: cjxl and djxl",
"dependencies": [
"giflib",
"libjpeg-turbo",
"libpng",
"lodepng",
"zlib"
]
}
}
}
23 changes: 0 additions & 23 deletions ports/lodepng-c/CMakeLists.txt

This file was deleted.

34 changes: 1 addition & 33 deletions ports/lodepng-c/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,33 +1 @@
if (EXISTS ${CURRENT_INSTALLED_DIR}/share/lodepng/copyright)
message(FATAL_ERROR "${PORT} conflict with lodepng, please remove lodepng before install ${PORT}.")
endif()

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lvandeve/lodepng
REF e34ac04553e51a6982ae234d98ce6b76dd57a6a1
SHA512 ab79fb2c6403e5d7bdf0b94a3f93f6513889eda8e6b74fb2b569fbc6f95fb79474654818cb0e71eff88214ca7c42ebd7c95f734a2faa77259fe06bfddcb6967a
HEAD_REF master
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=ON
-DDISABLE_INSTALL_TOOLS=ON
-DDDISABLE_INSTALL_EXAMPLES=ON
)

vcpkg_install_cmake()
vcpkg_copy_pdbs()

# Moves all .cmake files from /debug/share/lodepng/ to /share/lodepng/
vcpkg_fixup_cmake_targets()

file(INSTALL "${SOURCE_PATH}/lodepng.h" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
9 changes: 5 additions & 4 deletions ports/lodepng-c/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "lodepng-c",
"version-date": "2021-03-01",
"port-version": 1,
"description": "PNG encoder and decoder in C",
"homepage": "https://github.com/lvandeve/lodepng"
"version-string": "deprecated",
"description": "Legacy port. Use port lodepng instead.",
"dependencies": [
"lodepng"
]
}
18 changes: 13 additions & 5 deletions ports/lodepng/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.8.0)
project(lodepng)

add_library(lodepng lodepng.cpp lodepng_util.cpp)
add_library(lodepng lodepng.cpp)
target_include_directories(lodepng PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
Expand All @@ -13,10 +13,18 @@ install(TARGETS lodepng EXPORT lodepng-targets)

install(EXPORT lodepng-targets DESTINATION share/lodepng/)

if(NOT DDISABLE_INSTALL_EXAMPLES)
install(DIRECTORY examples DESTINATION share/lodepng/)
endif()
add_library(lodepng-c lodepng.c)
target_include_directories(lodepng-c PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

file(WRITE "${CMAKE_BINARY_DIR}/lodepng-c-config.cmake" "include(\"\${CMAKE_CURRENT_LIST_DIR}/lodepng-c-targets.cmake\")")
install(FILES "${CMAKE_BINARY_DIR}/lodepng-c-config.cmake" DESTINATION "share/lodepng-c/")

install(TARGETS lodepng-c EXPORT lodepng-c-targets)

install(EXPORT lodepng-c-targets DESTINATION share/lodepng-c/)

if(NOT DISABLE_INSTALL_HEADERS)
install(FILES lodepng.h lodepng_util.h DESTINATION include)
install(FILES lodepng.h DESTINATION include)
endif()
31 changes: 15 additions & 16 deletions ports/lodepng/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,27 @@ endif()
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lvandeve/lodepng
REF e34ac04553e51a6982ae234d98ce6b76dd57a6a1
SHA512 ab79fb2c6403e5d7bdf0b94a3f93f6513889eda8e6b74fb2b569fbc6f95fb79474654818cb0e71eff88214ca7c42ebd7c95f734a2faa77259fe06bfddcb6967a
HEAD_REF master
OUT_SOURCE_PATH SOURCE_PATH
REPO lvandeve/lodepng
REF 8c6a9e30576f07bf470ad6f09458a2dcd7a6a84a
SHA512 2e0abc063be45dc04a070656260e9a2b9fa1172433cdd7d4988f0afc11751ad28aa802350598ef0e2b27c2c011fd9d9f7ab7f267b0bfcdf28f9f708b888c4411
HEAD_REF master
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
configure_file("${SOURCE_PATH}/lodepng.cpp" "${SOURCE_PATH}/lodepng.c" COPYONLY)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
-DDISABLE_INSTALL_HEADERS=ON
-DDISABLE_INSTALL_TOOLS=ON
-DDDISABLE_INSTALL_EXAMPLES=ON
-DDISABLE_INSTALL_HEADERS=ON
)

vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()

# Moves all .cmake files from /debug/share/lodepng/ to /share/lodepng/
vcpkg_fixup_cmake_targets()
vcpkg_cmake_config_fixup()
vcpkg_cmake_config_fixup(PACKAGE_NAME lodepng-c)

file(INSTALL ${SOURCE_PATH}/lodepng.h DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
9 changes: 9 additions & 0 deletions ports/lodepng/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The package lodepng provides CMake targets:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage is not installed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reminder. I see the benefit. However:

  • For vpkg install lodepng, it makes no difference. The usage file is also displayed when installing a cached binary artifact which does not contain the installed file. This is worrying, due to a possible version mismatch.
  • Given that vcpkg install doesn't indicate the errror, it is no surprise that there are more ports which don't seem install the usage file:
$ for I in ports/*/usage; do grep -q '/usage' ${I%/usage}/portfile.cmake || echo $I; done 
ports/boost/usage
ports/bullet3/usage
ports/colmap/usage
ports/dcmtk/usage
ports/farmhash/usage
ports/ffmpeg/usage
ports/googleapis/usage
ports/gtest/usage
ports/imgui-sfml/usage
ports/libgeotiff/usage
ports/nmap/usage
ports/opengl/usage
ports/pthreads/usage
ports/unixodbc/usage
ports/vulkan/usage
ports/xerces-c/usage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For vpkg install lodepng, it makes no difference. The usage file is also displayed when installing a cached binary artifact which does not contain the installed file. This is worrying, due to a possible version mismatch.

vcpkg should print the cmake usage automaticly. If not, we should add usage such like this and install it. Otherwise it will not be printed.

Given that vcpkg install doesn't indicate the errror, it is no surprise that there are more ports which don't seem install the usage file:

I think they are left over from history.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For vpkg install lodepng, it makes no difference. The usage file is also displayed when installing a cached binary artifact which does not contain the installed file. This is worrying, due to a possible version mismatch.

vcpkg should print the cmake usage automaticly. If not, we should add usage such like this and install it. Otherwise it will not be printed.

My point is: vcpkg should print the installed file, not the source file. Then there can't be a version mismatch, and the maintainer would notice the issue befroe committing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/microsoft/vcpkg-tool/blob/56228f80dcf757494a8dc45b206fe224a23c2129/include/vcpkg/installedpaths.h#L25:

        Path usage_file(const PackageSpec& p) const { return share_dir(p) / "usage"; }

vcpkg should print the installed file, not the source file

That's correct, see https://github.com/microsoft/vcpkg-tool/blob/56228f80dcf757494a8dc45b206fe224a23c2129/src/vcpkg/install.cpp#L613.
vcpkg will extract the target in add_library according to the generated target.cmake content, and combine to generate the prompt information of find_package/target_link_libraries.


# C API
find_package(lodepng-c CONFIG REQUIRED)
target_link_libraries(main PRIVATE lodepng-c)

# C++ API
find_package(lodepng CONFIG REQUIRED)
target_link_libraries(main PRIVATE lodepng)
Loading