From d706a4a73e02f48e3eb459bcdd6d68811af2e82d Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Sat, 20 Mar 2021 09:50:21 -0700 Subject: [PATCH] doc: document BUILD_SHARED_LIBS --- .github/workflows/unittest_windows.yml | 2 +- CMakeLists.txt | 3 ++- docs/CHANGELOG.md | 4 ++++ docs/build.md | 2 +- ixwebsocket/IXWebSocketVersion.h | 2 +- test/IXTest.cpp | 5 ++--- ws/ws.cpp | 14 +++++++------- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/unittest_windows.yml b/.github/workflows/unittest_windows.yml index 71f64f95..0235010b 100644 --- a/.github/workflows/unittest_windows.yml +++ b/.github/workflows/unittest_windows.yml @@ -14,7 +14,7 @@ jobs: - run: | mkdir build cd build - cmake -GNinja -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe -DUSE_WS=1 -DUSE_TEST=1 -DUSE_ZLIB=0 .. + cmake -GNinja -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe -DUSE_WS=1 -DUSE_TEST=1 -DUSE_ZLIB=OFF -DBUILD_SHARED_LIBS=ON .. - run: | cd build ninja diff --git a/CMakeLists.txt b/CMakeLists.txt index b4013a1b..0a63d6b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,7 @@ set( IXWEBSOCKET_HEADERS ixwebsocket/IXWebSocketVersion.h ) +option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF) option(USE_TLS "Enable TLS support" FALSE) if (USE_TLS) @@ -144,7 +145,7 @@ if (USE_TLS) endif() endif() -add_library( ixwebsocket STATIC +add_library( ixwebsocket ${IXWEBSOCKET_SOURCES} ${IXWEBSOCKET_HEADERS} ) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 512f0776..9d7d2ae6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,10 @@ All changes to this project will be documented in this file. +## [11.1.1] - 2021-03-20 + +(cmake) Library can be built as a static or a dynamic library, controlled with BUILD_SHARED_LIBS. Default to static library + ## [11.1.0] - 2021-03-16 (ixwebsocket) Use LEAN_AND_MEAN Windows define to help with undefined link error when building a DLL. Support websocket server disablePerMessageDeflate option correctly. diff --git a/docs/build.md b/docs/build.md index 0c32b899..c287037f 100644 --- a/docs/build.md +++ b/docs/build.md @@ -17,13 +17,13 @@ There is a unittest which can be executed by typing `make test`. Options for building: +* `-DBUILD_SHARED_LIBS=ON` will build the unittest as a shared libary instead of a static library, which is the default * `-DUSE_ZLIB=1` will enable zlib support, required for http client + server + websocket per message deflate extension * `-DUSE_TLS=1` will enable TLS support * `-DUSE_OPEN_SSL=1` will use [openssl](https://www.openssl.org/) for the TLS support (default on Linux and Windows) * `-DUSE_MBED_TLS=1` will use [mbedlts](https://tls.mbed.org/) for the TLS support * `-DUSE_WS=1` will build the ws interactive command line tool * `-DUSE_TEST=1` will build the unittest -* `-DUSE_PYTHON=1` will use Python3 for cobra bots, require Python3 to be installed. If you are on Windows, look at the [appveyor](https://github.com/machinezone/IXWebSocket/blob/master/appveyor.yml) file (not maintained much though) or rather the [github actions](https://github.com/machinezone/IXWebSocket/blob/master/.github/workflows/unittest_windows.yml) which have instructions for building dependencies. diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index d96e2095..e9c97dbf 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "11.1.0" +#define IX_WEBSOCKET_VERSION "11.1.1" diff --git a/test/IXTest.cpp b/test/IXTest.cpp index cb289517..a07caa68 100644 --- a/test/IXTest.cpp +++ b/test/IXTest.cpp @@ -140,9 +140,8 @@ namespace ix file.seekg(0, file.beg); memblock.reserve((size_t) size); - memblock.insert(memblock.begin(), - std::istream_iterator(file), - std::istream_iterator()); + memblock.insert( + memblock.begin(), std::istream_iterator(file), std::istream_iterator()); return memblock; } diff --git a/ws/ws.cpp b/ws/ws.cpp index a5c535e7..0cae3774 100644 --- a/ws/ws.cpp +++ b/ws/ws.cpp @@ -64,9 +64,8 @@ namespace file.seekg(0, file.beg); memblock.reserve((size_t) size); - memblock.insert(memblock.begin(), - std::istream_iterator(file), - std::istream_iterator()); + memblock.insert( + memblock.begin(), std::istream_iterator(file), std::istream_iterator()); return std::make_pair(true, memblock); } @@ -89,9 +88,8 @@ namespace file.seekg(0, file.beg); memblock.reserve((size_t) size); - memblock.insert(memblock.begin(), - std::istream_iterator(file), - std::istream_iterator()); + memblock.insert( + memblock.begin(), std::istream_iterator(file), std::istream_iterator()); std::string bytes(memblock.begin(), memblock.end()); return bytes; @@ -1429,7 +1427,9 @@ namespace ix if (filename.empty()) { - spdlog::error("Cannot save content to disk: No output file supplied, and not filename could be extracted from the url {}", url); + spdlog::error("Cannot save content to disk: No output file supplied, and not " + "filename could be extracted from the url {}", + url); } else {