[libwebsockets] Fix usage, export include path (#17003)

* [libwebsockets] Fix usage, export include path

* update version record
This commit is contained in:
Jack·Boos·Yu 2021-04-08 04:12:01 +08:00 committed by GitHub
parent 3320069be1
commit ff615bb6a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 10 deletions

View File

@ -1,7 +0,0 @@
Source: libwebsockets
Version: 4.1.6
Port-Version: 0
Build-Depends: zlib, openssl, libuv, pthreads (windows)
Homepage: https://github.com/warmcat/libwebsockets
Description: Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources, and provide fast throughput in both directions as client or server.
Supports: !(arm|uwp)

View File

@ -0,0 +1,48 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06d9eec..5606601 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -840,8 +840,8 @@ else()
set(DEF_INSTALL_CMAKE_DIR lib${LIB_SUFFIX}/cmake/libwebsockets)
endif()
-if (DEFINED REL_INCLUDE_DIR)
- set(LWS__INCLUDE_DIRS "\${LWS_CMAKE_DIR}/${REL_INCLUDE_DIR}")
+if (1)
+ set(LWS__INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/../include")
endif()
configure_file(${PROJECT_SOURCE_DIR}/cmake/libwebsockets-config.cmake.in
@@ -853,10 +853,6 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/libwebsockets-config-version.cmake.in
${PROJECT_BINARY_DIR}/libwebsockets-config-version.cmake
@ONLY)
-# Generate the config file for the build-tree.
-set(LWS__INCLUDE_DIRS
- "${PROJECT_SOURCE_DIR}/lib"
- "${PROJECT_BINARY_DIR}")
set(LIBWEBSOCKETS_INCLUDE_DIRS ${LWS__INCLUDE_DIRS} CACHE PATH "Libwebsockets include directories")
configure_file(${PROJECT_SOURCE_DIR}/cmake/libwebsockets-config.cmake.in
${PROJECT_BINARY_DIR}/libwebsockets-config.cmake
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 82b9170..eab2bf0 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -153,7 +153,7 @@ if (LWS_WITH_STATIC)
add_library(websockets STATIC ${SOURCES})# ${HDR_PUBLIC})
set_target_properties(websockets PROPERTIES LINKER_LANGUAGE C)
list(APPEND LWS_LIBRARIES websockets)
- target_include_directories(websockets PRIVATE ${LWS_LIB_BUILD_INC_PATHS})
+ target_include_directories(websockets PRIVATE $<BUILD_INTERFACE:${LWS_LIB_BUILD_INC_PATHS}> PUBLIC $<INSTALL_INTERFACE:include>)
if (WIN32)
# Windows uses the same .lib ending for static libraries and shared
@@ -173,7 +173,7 @@ if (LWS_WITH_SHARED)
add_library(websockets_shared SHARED ${SOURCES} ${RESOURCES})# ${HDR_PUBLIC})
set_target_properties(websockets_shared PROPERTIES LINKER_LANGUAGE C)
list(APPEND LWS_LIBRARIES websockets_shared)
- target_include_directories(websockets_shared PRIVATE ${LWS_LIB_BUILD_INC_PATHS})
+ target_include_directories(websockets_shared PRIVATE $<BUILD_INTERFACE:${LWS_LIB_BUILD_INC_PATHS}> PUBLIC $<INSTALL_INTERFACE:include>)
# We want the shared lib to be named "libwebsockets"
# not "libwebsocket_shared".

View File

@ -7,8 +7,9 @@ vcpkg_from_github(
SHA512 7632439f8cdc87d275a0524b87ea5cd19c3401c1b7bb7fcf673eef3e1ab36c0ec022d2dce050d07bc106af3166575882507a56ac829a4361329311484dc2c5c4
HEAD_REF master
PATCHES
CMakeLists.patch
fix-build-error.patch
fix-dependency-libuv.patch
fix-build-error.patch
export-include-path.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LWS_WITH_STATIC)

View File

@ -0,0 +1,17 @@
{
"name": "libwebsockets",
"version-semver": "4.1.6",
"port-version": 1,
"description": "Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources, and provide fast throughput in both directions as client or server.",
"homepage": "https://github.com/warmcat/libwebsockets",
"supports": "!(arm | uwp)",
"dependencies": [
"libuv",
"openssl",
{
"name": "pthreads",
"platform": "!windows"
},
"zlib"
]
}

View File

@ -3602,7 +3602,7 @@
},
"libwebsockets": {
"baseline": "4.1.6",
"port-version": 0
"port-version": 1
},
"libxdiff": {
"baseline": "0.23",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1846ac46a72330104a9a4c13042cdb19ae8a42c4",
"version-semver": "4.1.6",
"port-version": 1
},
{
"git-tree": "d980cd5098de3cfba2ecd8e63490cf1013545dfd",
"version-string": "4.1.6",