Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jansson] Fix UWP build #24466

Merged
merged 9 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
38 changes: 13 additions & 25 deletions ports/jansson/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,50 +1,38 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO akheron/jansson
REF 684e18c927e89615c2d501737e90018f4930d6c5 # v2.14
SHA512 e2cac3567bc860d10d9aa386ce370876cb21ff083a970abeb48112b6586b91cd101694a98cb05a06795fb04498e6bc2df3615fedb86635f5a998b68e5670e5b3
REF e9ebfa7e77a6bee77df44e096b100e7131044059 # v2.14
SHA512 88a59c1cf5150699def17c86192ca9bacdfe6669319f770c3fbf14fa8edc48b4bb015a4a634a09db40fba9054320ac7c133c4d156f813af540a636f7825f0610
HEAD_REF master
)

if(VCPKG_CRT_LINKAGE STREQUAL static)
set(JANSSON_STATIC_CRT ON)
else()
set(JANSSON_STATIC_CRT OFF)
endif()


if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(JANSSON_BUILD_SHARED_LIBS ON)
else()
set(JANSSON_BUILD_SHARED_LIBS OFF)
endif()
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" JANSSON_STATIC_CRT)
Copy link
Contributor

Choose a reason for hiding this comment

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

Reading the CMakeLists.txt this is probably not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if we set the same flags, but even if we do, we should keep this in case upstream decides to do additional things with JANSSON_STATIC_CRT

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" JANSSON_BUILD_SHARED_LIBS)

# Jansson tries to random-seed its hash table with system-provided entropy.
# This is not ported to UWP yet.
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if(VCPKG_TARGET_IS_UWP)
set(USE_WINDOWS_CRYPTOAPI OFF)
else()
set(USE_WINDOWS_CRYPTOAPI ON)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DJANSSON_STATIC_CRT=${JANSSON_STATIC_CRT}
-DJANSSON_EXAMPLES=OFF
-DJANSSON_WITHOUT_TESTS=ON
-DJANSSON_BUILD_DOCS=OFF
-DJANSSON_BUILD_SHARED_LIBS=${JANSSON_BUILD_SHARED_LIBS}
-DUSE_WINDOWS_CRYPTOAPI=${USE_WINDOWS_CRYPTOAPI}
-DJANSSON_INSTALL_CMAKE_DIR:STRING=share/jansson
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

vcpkg_cmake_install()
vcpkg_copy_pdbs()

vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
14 changes: 13 additions & 1 deletion ports/jansson/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "jansson",
"version": "2.14",
"port-version": 1,
"description": "Jansson is a C library for encoding, decoding and manipulating JSON data",
"homepage": "https://github.com/akheron/jansson"
"homepage": "https://github.com/akheron/jansson",
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3014,7 +3014,7 @@
},
"jansson": {
"baseline": "2.14",
"port-version": 0
"port-version": 1
},
"jasper": {
"baseline": "2.0.33",
Expand Down
5 changes: 5 additions & 0 deletions versions/j-/jansson.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c66c91ab7beed92891f98c73ec8feafbe7afe735",
"version": "2.14",
"port-version": 1
},
{
"git-tree": "1a5c55feab368e4bfb40be993b9ea5a39fc82f51",
"version": "2.14",
Expand Down