#uWebSocket cmake

24 messages · Page 1 of 1 (latest)

ionic umbra
#

I would be glad if you give me such tho. Mine is literally unbuildable.

Having something like this :

cmake_minimum_required(VERSION 4.0)
project(prj)

set(CMAKE_CXX_STANDARD 20)

add_executable(prj src/main.cpp)

#============================DOWNLOAD-WEBSOCKET-LIBRARY==========================
set(BUILD_SHARED_LIBS OFF)
include(FetchContent)
FetchContent_Declare(
        uWS
        GIT_REPOSITORY https://github.com/uNetworking/uWebSockets.git
        GIT_TAG v20.73.0
)
FetchContent_MakeAvailable(uWS)

# µWebSockets requires OpenSSL and zlib. Find them on the system.
# OpenSSL::SSL and OpenSSL::Crypto are used for secure connections (WSS).
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)

(... other libs, whatever)

#============================END-DOWNLOAD-WEBSOCKET-LIBRARY======================

target_link_libraries(prj PRIVATE
        OpenSSL::SSL
        OpenSSL::Crypto
        ZLIB::ZLIB
        uWS
)

what errors into this at compilation stage:

[ 11%] Built target asio
[ 58%] Built target spdlog
[ 64%] Linking CXX executable low_latency_daemon
/usr/sbin/ld: cannot find -luWS: No such file or directory
collect2: error: ld returned 1 exit status

linking it with uWS:uWS just fails just by the same way :

[ 11%] Built target asio
[ 58%] Built target spdlog
[ 64%] Linking CXX executable low_latency_daemon
/usr/sbin/ld: cannot find -luWS:uWS: No such file or directory
tepid leafBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

austere wolf
#

this is cmake

#

uWS not use cmake

#

did you even read makefile and build.c?

#

@ionic umbra

ionic umbra
austere wolf
#

are you sure you can

FetchContent_Declare(
        uWS
        GIT_REPOSITORY https://github.com/uNetworking/uWebSockets.git
        GIT_TAG v20.73.0
)
FetchContent_MakeAvailable(uWS)

?

#

look at build.c

ionic umbra
austere wolf
#

it clearly just build from .a and sources

#

btw i see no windows signature

#

is uWS unix only?

ionic umbra
ionic umbra
# austere wolf btw i see no windows signature

Based on what I've read right now from one of issues, this is possible to build on windows
Hey! I’m not sure if you still need help, but just in case — you can use the vcpkg package manager to install uWebSockets much more easily than doing it manually. Setting it up by hand usually requires multiple tools like Microsoft Build Tools, OpenSSL, zlib, and other essential libraries, plus manual environment configuration.

austere wolf
#

yes it have win signatures, but only in source

ionic umbra
tepid leafBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

vocal trout
#

the library doesn't seem to have cmake whatsoever, just build usockets manually and add include paths and link

#

uwebsockets itself seems to be header only, you don't need to do anything other than set up include paths

ionic umbra
vocal trout
#

nothing i said has anything to do with “being bloated”

austere wolf
#

uSocket sublib used to make examples have TU's

#

but seems like it only non-header-only-lib

 strcat(CXXFLAGS, " -march=native -O3 -Wpedantic -Wall -Wextra -Wsign-conversion -Wconversion -std=c++2b -Isrc -IuSockets/src");
    strcat(LDFLAGS, " uSockets/*.o");```