mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 01:39:01 +08:00
[libsodium] Rework CMake build to match autoconf (#16730)
* !wip Use targets to organize build * !wip Add separate file list for MSVC builds * Restructure to match autoconf I re-ordered everything so it is easier to compare directly with the project's autoconf build files. * Move config files to expected location * Convert CONTROL file to manifest file Use vcpkg helper ports. * Use sqlite3's approach to creating config file * Fix MSVC source list I was originally using libsodium:master as a reference, not the release. * Turn off tests * Fix definition scope * Fix JSON formatting Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * Update libsodium version metadata * [libsodium] Fix x64-windows-static[-md] builds * [libsodium] Update port version metadata Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * Glob headers and sources on Windows * [libsodium] Fix GLOB on Windows * [libsodium] Update verson hash Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
This commit is contained in:
parent
38c073dc7a
commit
2980294114
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
||||
Source: libsodium
|
||||
Version: 1.0.18
|
||||
Port-Version: 3
|
||||
Description: A modern and easy-to-use crypto library
|
||||
Homepage: https://github.com/jedisct1/libsodium
|
@ -6,50 +6,38 @@ vcpkg_from_github(
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
|
||||
${SOURCE_PATH}/CMakeLists.txt
|
||||
COPYONLY
|
||||
)
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/sodiumConfig.cmake.in
|
||||
${SOURCE_PATH}/sodiumConfig.cmake.in
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DBUILD_TESTING=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_fixup_cmake_targets(
|
||||
CONFIG_PATH lib/cmake/unofficial-sodium
|
||||
TARGET_PATH share/unofficial-sodium
|
||||
vcpkg_cmake_config_fixup(
|
||||
PACKAGE_NAME unofficial-sodium
|
||||
)
|
||||
|
||||
file(REMOVE_RECURSE
|
||||
${CURRENT_PACKAGES_DIR}/debug/include
|
||||
${CURRENT_PACKAGES_DIR}/debug/share
|
||||
)
|
||||
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/include/Makefile.am)
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
vcpkg_replace_string(
|
||||
${CURRENT_PACKAGES_DIR}/include/sodium/export.h
|
||||
"#ifdef SODIUM_STATIC"
|
||||
"#if 1 //#ifdef SODIUM_STATIC"
|
||||
)
|
||||
endif ()
|
||||
|
||||
configure_file(
|
||||
${SOURCE_PATH}/LICENSE
|
||||
${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/sodiumConfig.cmake.in
|
||||
${CURRENT_PACKAGES_DIR}/share/unofficial-sodium/unofficial-sodiumConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
@ -1,61 +1,7 @@
|
||||
# sodium cmake module
|
||||
# This module sets the following variables in your project:
|
||||
#
|
||||
# sodium_FOUND - true if sodium found on the system
|
||||
# sodium_INCLUDE_DIR - the directory containing sodium headers
|
||||
# sodium_LIBRARY_DEBUG
|
||||
# sodium_LIBRARY_RELEASE
|
||||
# sodium_LIBRARIES
|
||||
# sodium_VERSION
|
||||
#
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
if (NOT TARGET @TARGET_NAME@)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-@PROJECT_NAME@Targets.cmake")
|
||||
|
||||
set(@PROJECT_NAME@_VERSION @VERSION@)
|
||||
|
||||
get_target_property(@PROJECT_NAME@_INCLUDE_DIR @TARGET_NAME@ INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
get_target_property(@PROJECT_NAME@_LIBRARY_DEBUG @TARGET_NAME@ IMPORTED_IMPLIB_DEBUG)
|
||||
if (@PROJECT_NAME@_LIBRARY_DEBUG MATCHES ".*-NOTFOUND")
|
||||
get_target_property(@PROJECT_NAME@_LIBRARY_DEBUG @TARGET_NAME@ IMPORTED_LOCATION_DEBUG)
|
||||
else ()
|
||||
get_target_property(@PROJECT_NAME@_DLL_DEBUG @TARGET_NAME@ IMPORTED_LOCATION_DEBUG)
|
||||
endif ()
|
||||
|
||||
get_target_property(@PROJECT_NAME@_LIBRARY_RELEASE @TARGET_NAME@ IMPORTED_IMPLIB_RELEASE)
|
||||
if (@PROJECT_NAME@_LIBRARY_RELEASE MATCHES ".*-NOTFOUND")
|
||||
get_target_property(@PROJECT_NAME@_LIBRARY_RELEASE @TARGET_NAME@ IMPORTED_LOCATION_RELEASE)
|
||||
else ()
|
||||
get_target_property(@PROJECT_NAME@_DLL_RELEASE @TARGET_NAME@ IMPORTED_LOCATION_RELEASE)
|
||||
endif ()
|
||||
|
||||
select_library_configurations(@PROJECT_NAME@)
|
||||
endif ()
|
||||
|
||||
find_package_handle_standard_args(
|
||||
@PROJECT_NAME@
|
||||
REQUIRED_VARS
|
||||
@PROJECT_NAME@_INCLUDE_DIR
|
||||
@PROJECT_NAME@_LIBRARIES
|
||||
VERSION_VAR
|
||||
@PROJECT_NAME@_VERSION
|
||||
)
|
||||
|
||||
mark_as_advanced(@PROJECT_NAME@_INCLUDE_DIR)
|
||||
|
||||
if (WIN32)
|
||||
mark_as_advanced(@PROJECT_NAME@_DLL_DEBUG)
|
||||
mark_as_advanced(@PROJECT_NAME@_DLL_RELEASE)
|
||||
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32)
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Threads)
|
||||
endif()
|
||||
|
||||
|
||||
# References:
|
||||
# https://github.com/jedisct1/libsodium/blob/master/contrib/Findsodium.cmake
|
||||
# https://github.com/QuantStack/xeus/blob/master/xeusConfig.cmake.in
|
||||
# https://github.com/zeromq/libzmq/blob/master/builds/cmake/ZeroMQConfig.cmake.in
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/unofficial-sodiumTargets.cmake)
|
||||
|
17
ports/libsodium/vcpkg.json
Normal file
17
ports/libsodium/vcpkg.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "libsodium",
|
||||
"version-string": "1.0.18",
|
||||
"port-version": 4,
|
||||
"description": "A modern and easy-to-use crypto library",
|
||||
"homepage": "https://github.com/jedisct1/libsodium",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
@ -3434,7 +3434,7 @@
|
||||
},
|
||||
"libsodium": {
|
||||
"baseline": "1.0.18",
|
||||
"port-version": 3
|
||||
"port-version": 4
|
||||
},
|
||||
"libsoundio": {
|
||||
"baseline": "2.0.0-3",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "6ec1ee39e69052d50e773857064d2d06968ee8c3",
|
||||
"version-string": "1.0.18",
|
||||
"port-version": 4
|
||||
},
|
||||
{
|
||||
"git-tree": "fc00e8b0dba7ee227aa5d53860c1b5cfe92b8819",
|
||||
"version-string": "1.0.18",
|
||||
|
Loading…
Reference in New Issue
Block a user