mirror of https://github.com/microsoft/vcpkg.git
[libsodium] support non-MSVC compilers on Windows via the make-based … (#52803)
Co-authored-by: Martijn Otto <martijn@resolume.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
db4723bd0a
commit
7012bf7bc3
|
|
@ -13,7 +13,19 @@ vcpkg_from_github(
|
|||
001-mingw-i386.patch
|
||||
)
|
||||
|
||||
# The msbuild solution only builds with MSVC; other compilers targeting
|
||||
# windows (e.g. clang, in cross builds or clang-based triplets) go through
|
||||
# the make-based path like every other platform.
|
||||
set(USE_MSBUILD OFF)
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "[/\\\\]cl\\.exe$")
|
||||
set(USE_MSBUILD ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_MSBUILD)
|
||||
set(lib_linkage "LIB")
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
set(lib_linkage "DLL")
|
||||
|
|
@ -55,6 +67,20 @@ else()
|
|||
if(NOT VCPKG_TARGET_IS_MINGW)
|
||||
list(APPEND OPTIONS --disable-pie)
|
||||
endif()
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
message(FATAL_ERROR "Shared libsodium is not implemented for non-MSVC compilers on Windows: libtool silently builds an unusable static archive for this target. Build libsodium static, or with MSVC.")
|
||||
endif()
|
||||
# getpid links via the oldnames.lib compatibility alias, so
|
||||
# configure's link check false-passes; no header declares it for
|
||||
# the MSVC CRT, breaking compilation. The msbuild-built binaries
|
||||
# never define HAVE_GETPID either.
|
||||
list(APPEND OPTIONS "ac_cv_func_getpid=no")
|
||||
# The library's own objects must not reference its symbols through
|
||||
# dllimport; export.h defaults to that when neither SODIUM_STATIC nor
|
||||
# SODIUM_DLL_EXPORT is defined, which the make build does not do.
|
||||
vcpkg_replace_string("${SOURCE_PATH}/src/libsodium/include/sodium/export.h" "#ifdef SODIUM_STATIC" "#if 1")
|
||||
endif()
|
||||
|
||||
vcpkg_make_configure(
|
||||
AUTORECONF
|
||||
|
|
@ -72,7 +98,7 @@ endif()
|
|||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sodium/export.h" "#ifdef SODIUM_STATIC" "#if 1")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sodium/export.h" "#ifdef SODIUM_STATIC" "#if 1" IGNORE_UNCHANGED)
|
||||
endif()
|
||||
|
||||
# vcpkg legacy
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
{
|
||||
"name": "libsodium",
|
||||
"version": "1.0.22",
|
||||
"port-version": 1,
|
||||
"description": "A modern and easy-to-use crypto library",
|
||||
"homepage": "https://libsodium.org/",
|
||||
"license": "ISC",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-make",
|
||||
"name": "vcpkg-cmake-get-vars",
|
||||
"host": true,
|
||||
"platform": "!windows | mingw"
|
||||
"platform": "windows & !mingw"
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-make",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-msbuild",
|
||||
|
|
|
|||
|
|
@ -5690,7 +5690,7 @@
|
|||
},
|
||||
"libsodium": {
|
||||
"baseline": "1.0.22",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"libsonic": {
|
||||
"baseline": "0.2.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "95eb2b61a8632cbfe65fd3cf259f8805b8792364",
|
||||
"version": "1.0.22",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "74ee7dfd5fc96bb0b291f6ebe61d3bef57f80512",
|
||||
"version": "1.0.22",
|
||||
|
|
|
|||
Loading…
Reference in New Issue