windows环境下配置libwebsocket

编程入门 行业动态 更新时间:2024-10-15 12:29:57

windows<a href=https://www.elefans.com/category/jswz/34/1771403.html style=环境下配置libwebsocket"/>

windows环境下配置libwebsocket

1. 下载cmake:

下载链接:

/

安装版本:

cmake-3.21.0-windows-x86_64.msi

2.下载openssl:

下载链接:

.html

安装版本:

Win64 OpenSSL v1.1.1k Light MSI

其他老版本下载:

/

3. 安装cmake和openssl

4.下载libwebsocket源代码

/

示例详解:

5.代码解压编译

libwebsocket代码放在桌面

C:\Users\ASUS\Desktop\libwebsocket\libwebsockets-main\libwebsockets-main

cd进去代码根目录

mkdir build   创建编译目录

cd build

编译,需配置openssl的编译环境:

cmake .. -DLIB_SUFFIX=32 -DLWS_HTTP2=1 -DLWS_OPENSSL_INCLUDE_DIRS=S:\OpenSSL-Win64\include\openssl -DLWS_OPENSSL_LIBRARIES=S:\OpenSSL-Win64\lib

编译结果:

C:\Users\ASUS\Desktop\libwebsocket\libwebsockets-main\libwebsockets-main\build>cmake .. -DLIB_SUFFIX=32 -DLWS_HTTP2=1 -DLWS_OPENSSL_INCLUDE_DIRS=S:\OpenSSL-Win64\include\openssl -DLWS_OPENSSL_LIBRARIES=S:\OpenSSL-Win64\lib
-- Compiled with LWS_WITH_DIR and LWS_WITH_LEJP_CONF
SMD requires pthreads
-- Could NOT find Git (missing: GIT_EXECUTABLE)
No afunix.h found. Disabling LWS_UNIX_SOCK.
Compiling with SSL support
OpenSSL include dir: S:/OpenSSL-Win64/include/openssl
OpenSSL libraries: S:/OpenSSL-Win64/lib
Searching for OpenSSL executable and dlls
OpenSSL executable: OPENSSL_EXECUTABLE-NOTFOUNDGENCERTS = 0
DIR C:/Users/ASUS/Desktop/libwebsocket/libwebsockets-main/libwebsockets-main CMP C:/Users/ASUS/Desktop/libwebsocket/libwebsockets-main/libwebsockets-main/cmake
-- Configuring done
WARNING: Target "websockets" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "websockets" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "websockets" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "websockets" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "websockets_shared" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "websockets_shared" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "websockets_shared" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "websockets_shared" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-server" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-server" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-server" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-server" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-lejp" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-lejp" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-lejp" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-lejp" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-client" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-client" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-client" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "test-client" requests linking to directory "S:/OpenSSL-Win64/lib".  Targets may link only to libraries.  CMake is dropping the item.
-- Generating done
-- Build files have been written to: C:/Users/ASUS/Desktop/libwebsocket/libwebsockets-main/libwebsockets-main

根目录生成了sln工程文件,可以用vs打开了,编译完成。

更多推荐

windows环境下配置libwebsocket

本文发布于:2024-03-23 18:42:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1741521.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:环境   windows   libwebsocket

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!