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 2 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
34 changes: 11 additions & 23 deletions ports/jansson/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,33 @@ vcpkg_from_github(
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": "91a1df17464d4f869b3ee4670b41260d72535728",
"version": "2.14",
"port-version": 1
},
{
"git-tree": "1a5c55feab368e4bfb40be993b9ea5a39fc82f51",
"version": "2.14",
Expand Down