From 73bd1eb5f7be2ce070459914812d705104d16f34 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Sat, 19 Feb 2022 21:42:14 -0500 Subject: [PATCH 1/5] Add simple test environment. --- CMakeLists.txt | 6 + autobahn/wamp_auth_utils.hpp | 8 +- cmake/Includes/CMakeLists.txt | 2 +- test/CMakeLists.txt | 24 ++ test/auth/auth.cpp | 130 +++++++ test/auth/crossbar/.crossbar/config.json | 204 ++++++++++ test/calls/calls.cpp | 53 +++ test/calls/crossbar/.crossbar/config.json | 100 +++++ test/calls/crossbar/backend.py | 26 ++ test/pubsub/crossbar/.crossbar/config.json | 195 ++++++++++ test/pubsub/crossbar/backend.py | 25 ++ test/pubsub/pubsub.cpp | 64 ++++ test/run_test.sh | 12 + test/wamp_test.hpp | 417 +++++++++++++++++++++ 14 files changed, 1258 insertions(+), 8 deletions(-) create mode 100644 test/CMakeLists.txt create mode 100644 test/auth/auth.cpp create mode 100644 test/auth/crossbar/.crossbar/config.json create mode 100644 test/calls/calls.cpp create mode 100644 test/calls/crossbar/.crossbar/config.json create mode 100644 test/calls/crossbar/backend.py create mode 100644 test/pubsub/crossbar/.crossbar/config.json create mode 100644 test/pubsub/crossbar/backend.py create mode 100644 test/pubsub/pubsub.cpp create mode 100755 test/run_test.sh create mode 100644 test/wamp_test.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 63365a7d..19b44600 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(autobahn-cpp) option(AUTOBAHN_BUILD_EXAMPLES "Build examples" ON) option(AUTOBAHN_BUILD_EXAMPLES_BOTAN "Build Botan cryptosign example" OFF) +option(AUTOBAHN_TESTS "Test" ON) option(AUTOBAHN_USE_LIBCXX "Use libc++ instead of libstdc++ when building with Clang" ON) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/CMakeLists.txt) @@ -11,3 +12,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/CMakeLists.txt) if(AUTOBAHN_BUILD_EXAMPLES) add_subdirectory(examples) endif(AUTOBAHN_BUILD_EXAMPLES) + +if (AUTOBAHN_TESTS) + include(CTest) + add_subdirectory(test) +endif() \ No newline at end of file diff --git a/autobahn/wamp_auth_utils.hpp b/autobahn/wamp_auth_utils.hpp index e3877983..4160619e 100644 --- a/autobahn/wamp_auth_utils.hpp +++ b/autobahn/wamp_auth_utils.hpp @@ -166,13 +166,7 @@ inline std::string compute_wcs( HMAC_Final(&hmac, hash, &len); HMAC_CTX_cleanup(&hmac); #else - HMAC_CTX *hmac = HMAC_CTX_new(); - if (!hmac) - return ""; - HMAC_Init_ex(hmac, key.data(), (int) key.length(), EVP_sha256(), NULL); - HMAC_Update(hmac, ( unsigned char* ) challenge.data(), challenge.length()); - HMAC_Final(hmac, hash, &len); - HMAC_CTX_free(hmac); + HMAC(EVP_sha256(), key.data(), static_cast(key.length()), reinterpret_cast(challenge.data()), challenge.length(), hash, &len); #endif std::string str_out; diff --git a/cmake/Includes/CMakeLists.txt b/cmake/Includes/CMakeLists.txt index 0e9ef287..c41396dc 100644 --- a/cmake/Includes/CMakeLists.txt +++ b/cmake/Includes/CMakeLists.txt @@ -54,7 +54,7 @@ else() set(Boost_USE_STATIC_LIBS ON ) endif() -find_package(Boost REQUIRED COMPONENTS program_options system thread random) +find_package(Boost REQUIRED COMPONENTS program_options filesystem system thread random) find_package(msgpack REQUIRED) find_package(websocketpp REQUIRED) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..f07af1f0 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,24 @@ +Include(FetchContent) +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.0.0-preview3 +) +FetchContent_MakeAvailable(Catch2) +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.0.0-preview3 +) +find_package(Botan2 REQUIRED) +function(make_test name src) + add_executable(${name} ${src} wamp_test.hpp ${PUBLIC_HEADERS}) + target_link_libraries(${name} PRIVATE Catch2::Catch2WithMain autobahn_cpp Botan2::Botan2) + target_include_directories(${name} PRIVATE ${BOTAN_INCLUDE_DIRS}) + string(REPLACE "test_" "" pure_name ${name}) + add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh "${CMAKE_CURRENT_SOURCE_DIR}/${pure_name}" "${CMAKE_CURRENT_BINARY_DIR}/${name}" ) +endfunction() + +make_test(test_auth auth/auth.cpp) +make_test(test_pubsub pubsub/pubsub.cpp) +make_test(test_calls calls/calls.cpp) diff --git a/test/auth/auth.cpp b/test/auth/auth.cpp new file mode 100644 index 00000000..4414fa77 --- /dev/null +++ b/test/auth/auth.cpp @@ -0,0 +1,130 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Crossbar.io Technologies GmbH and contributors +// +// Boost Software License - Version 1.0 - August 17th, 2003 +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "test/wamp_test.hpp" +#include + +struct Config +{ + std::string realm{"realm1"}; + std::string uri{"ws://127.0.0.1:8080/ws"}; + bool debug{false}; +}; + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.auth.cra") +{ + bool joined_realm_with_success = join_realm( + "client1_cra", + wamp_test::Secret("client1_secret"), + [&](Transport& transport, Session& session) + { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client1_cra"); + REQUIRE(welcome_details["authrole"].as() == "frontend"); + }); + REQUIRE(true == joined_realm_with_success); + joined_realm_with_success = join_realm( + "client2_cra", + wamp_test::Secret("client2_secret"), + [&](Transport& transport, Session& session) + { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client2_cra"); + REQUIRE(welcome_details["authrole"].as() == "backend"); + }); + REQUIRE(true == joined_realm_with_success); + REQUIRE(false == join_realm("client3", wamp_test::Secret("unknown"))); +} + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.auth.ticket") +{ + bool joined_realm_with_success = join_realm( + "client1", + wamp_test::Ticket("client1_ticket"), + [&](Transport& transport, Session& session) + { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client1"); + REQUIRE(welcome_details["authrole"].as() == "frontend"); + }); + REQUIRE(true == joined_realm_with_success); + joined_realm_with_success = join_realm( + "client2", + wamp_test::Ticket("client2_ticket"), + [&](Transport& transport, Session& session) + { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE(welcome_details["authid"].as() == "client2"); + REQUIRE(welcome_details["authrole"].as() == "backend"); + }); + REQUIRE(true == joined_realm_with_success); + REQUIRE(false == join_realm("client3", wamp_test::Ticket("unknown"))); +} + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.auth.cryptosign") +{ + bool joined_realm_with_success = join_realm( + "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29", + wamp_test::Cryptosign(Botan::secure_vector(32, 0)), + [&](Transport& transport, Session& session) + { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE( + welcome_details["authid"].as() + == "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29"); + REQUIRE(welcome_details["authrole"].as() == "frontend"); + }); + REQUIRE(true == joined_realm_with_success); + joined_realm_with_success = join_realm( + "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c", + wamp_test::Cryptosign(Botan::secure_vector(32, 1)), + [&](Transport& transport, Session& session) + { + auto welcome_details = session.welcome_details(); + REQUIRE(welcome_details["authprovider"].as() == "static"); + REQUIRE(welcome_details["realm"].as() == "realm1"); + REQUIRE( + welcome_details["authid"].as() + == "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c"); + REQUIRE(welcome_details["authrole"].as() == "backend"); + }); + REQUIRE(true == joined_realm_with_success); + REQUIRE(false == join_realm("unknown", wamp_test::Cryptosign(Botan::secure_vector(32, 3)))); +} diff --git a/test/auth/crossbar/.crossbar/config.json b/test/auth/crossbar/.crossbar/config.json new file mode 100644 index 00000000..08d7f078 --- /dev/null +++ b/test/auth/crossbar/.crossbar/config.json @@ -0,0 +1,204 @@ +{ + "version": 2, + "workers": [ + { + "type": "router", + "options": { + "pythonpath": [ + ".." + ] + }, + "realms": [ + { + "name": "realm1", + "roles": [ + { + "name": "backend", + "permissions": [ + { + "uri": "", + "match": "prefix", + "allow": { + "call": true, + "register": true, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic2", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + }, + { + "name": "frontend", + "permissions": [ + { + "uri": "com.example.shutdown", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.add2", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.", + "match": "prefix", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic2", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.foobar.topic1", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + } + ] + } + ], + "transports": [ + { + "type": "web", + "endpoint": { + "type": "tcp", + "port": 8080 + }, + "paths": { + "/": { + "type": "static", + "directory": "../web" + }, + "shared": { + "type": "static", + "directory": "../../../../_shared-web-resources" + }, + "ws": { + "type": "websocket", + "auth": { + "cryptosign": { + "type": "static", + "principals": { + "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29": { + "role": "frontend", + "authorized_keys": [ + "3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29" + ] + }, + "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c": { + "role": "backend", + "authorized_keys": [ + "8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c" + ] + } + } + }, + "ticket": { + "type": "static", + "principals": { + "client1": { + "ticket": "client1_ticket", + "role": "frontend" + }, + "client2": { + "ticket": "client2_ticket", + "role": "backend" + } + } + }, + "wampcra": { + "type": "static", + "users": { + "client1_cra": { + "secret": "client1_secret", + "role": "frontend" + }, + "client2_cra": { + "secret": "client2_secret", + "role": "backend" + } + } + } + } + } + } + } + ], + "components": [ + ] + } + ] +} diff --git a/test/calls/calls.cpp b/test/calls/calls.cpp new file mode 100644 index 00000000..486b008b --- /dev/null +++ b/test/calls/calls.cpp @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Crossbar.io Technologies GmbH and contributors +// +// Boost Software License - Version 1.0 - August 17th, 2003 +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "test/wamp_test.hpp" +#include + +struct Config +{ + std::string realm{"realm1"}; + std::string uri{"ws://127.0.0.1:8080/ws"}; + bool debug{false}; +}; + +TEST_CASE_METHOD(wamp_test::fixture, "wamp.calls.simple") +{ + bool joined_realm_with_success = join_realm( + "client1", + wamp_test::Ticket("ticket"), + [&](Transport& transport, Session& session) + { + REQUIRE(3 == call("com.example.add2", std::tuple(1, 2)).get()); + REQUIRE(5 == call("com.example.add2", std::tuple(2, 3)).get()); + REQUIRE(!call("com.example.unknown", std::tuple(3, 4, 5)).has_value()); + }); + REQUIRE(true == joined_realm_with_success); +} diff --git a/test/calls/crossbar/.crossbar/config.json b/test/calls/crossbar/.crossbar/config.json new file mode 100644 index 00000000..2da03fd6 --- /dev/null +++ b/test/calls/crossbar/.crossbar/config.json @@ -0,0 +1,100 @@ +{ + "version": 2, + "workers": [ + { + "type": "router", + "options": { + "pythonpath": [ + ".." + ] + }, + "realms": [ + { + "name": "realm1", + "roles": [ + { + "name": "backend", + "permissions": [ + { + "uri": "", + "match": "prefix", + "allow": { + "call": false, + "register": true, + "publish": false, + "subscribe": false + } + } + ] + }, + { + "name": "frontend", + "permissions": [ + { + "uri": "com.example.add2", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + } + ] + } + ], + "transports": [ + { + "type": "web", + "endpoint": { + "type": "tcp", + "port": 8080 + }, + "paths": { + "/": { + "type": "static", + "directory": "../web" + }, + "shared": { + "type": "static", + "directory": "../../../../_shared-web-resources" + }, + "ws": { + "type": "websocket", + "auth": { + "ticket": { + "type": "static", + "principals": { + "client1": { + "ticket": "ticket", + "role": "frontend" + }, + "client2": { + "ticket": "ticket", + "role": "backend" + } + } + } + } + } + } + } + ], + "components": [ + { + "type": "class", + "classname": "backend.BackendSession", + "realm": "realm1", + "role": "backend" + } + ] + } + ] +} diff --git a/test/calls/crossbar/backend.py b/test/calls/crossbar/backend.py new file mode 100644 index 00000000..54fb620e --- /dev/null +++ b/test/calls/crossbar/backend.py @@ -0,0 +1,26 @@ +import os +import signal + +from autobahn.twisted.wamp import ApplicationSession +from twisted.internet import reactor +from twisted.internet.defer import Deferred +from twisted.internet.defer import inlineCallbacks + + +class BackendSession(ApplicationSession): + + @inlineCallbacks + def onJoin(self, details): + print("Backend session joined: {}".format(details)) + + ## REGISTER a procedure for remote calling + ## + def add2(x, y): + print("add2() called with {} and {}".format(x, y)) + return x + y + + try: + reg = yield self.register(add2, 'com.example.add2') + print("procedure add2() registered") + except Exception as e: + print("could not register procedure: {}".format(e)) diff --git a/test/pubsub/crossbar/.crossbar/config.json b/test/pubsub/crossbar/.crossbar/config.json new file mode 100644 index 00000000..54cb1e22 --- /dev/null +++ b/test/pubsub/crossbar/.crossbar/config.json @@ -0,0 +1,195 @@ +{ + "version": 2, + "workers": [ + { + "type": "router", + "options": { + "pythonpath": [ + ".." + ] + }, + "realms": [ + { + "name": "realm1", + "roles": [ + { + "name": "backend", + "permissions": [ + { + "uri": "", + "match": "prefix", + "allow": { + "call": true, + "register": true, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.publish", + "match": "exact", + "allow": { + "call": false, + "register": true, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + }, + { + "name": "frontend", + "permissions": [ + { + "uri": "com.example.publish", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.add2", + "match": "exact", + "allow": { + "call": true, + "register": false, + "publish": false, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.", + "match": "prefix", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.example.topic", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": true + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + }, + { + "uri": "com.foobar.topic1", + "match": "exact", + "allow": { + "call": false, + "register": false, + "publish": true, + "subscribe": false + }, + "disclose": { + "caller": false, + "publisher": false + }, + "cache": true + } + ] + } + ] + } + ], + "transports": [ + { + "type": "web", + "endpoint": { + "type": "tcp", + "port": 8080 + }, + "paths": { + "/": { + "type": "static", + "directory": "../web" + }, + "shared": { + "type": "static", + "directory": "../../../../_shared-web-resources" + }, + "ws": { + "type": "websocket", + "auth": { + "ticket": { + "type": "static", + "principals": { + "client1": { + "ticket": "ticket", + "role": "frontend" + }, + "client2": { + "ticket": "ticket", + "role": "backend" + } + } + } + } + } + } + } + ], + "components": [ + { + "type": "class", + "classname": "backend.BackendSession", + "realm": "realm1", + "role": "backend" + } + ] + } + ] +} diff --git a/test/pubsub/crossbar/backend.py b/test/pubsub/crossbar/backend.py new file mode 100644 index 00000000..cd717d69 --- /dev/null +++ b/test/pubsub/crossbar/backend.py @@ -0,0 +1,25 @@ +import os +import signal + +from autobahn.twisted.wamp import ApplicationSession +from twisted.internet import reactor +from twisted.internet.defer import Deferred +from twisted.internet.defer import inlineCallbacks + + +class BackendSession(ApplicationSession): + counter = 0 + + @inlineCallbacks + def onJoin(self, details): + print("Backend session joined: {}".format(details)) + + def pub(): + self.counter += 1 + self.publish('com.example.topic', "data='{}'".format(self.counter)) + return self.counter + + try: + yield self.register(pub, 'com.example.publish') + except Exception as e: + print("could not register procedure: {}".format(e)) diff --git a/test/pubsub/pubsub.cpp b/test/pubsub/pubsub.cpp new file mode 100644 index 00000000..d139989b --- /dev/null +++ b/test/pubsub/pubsub.cpp @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Crossbar.io Technologies GmbH and contributors +// +// Boost Software License - Version 1.0 - August 17th, 2003 +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "test/wamp_test.hpp" +#include + +struct Config +{ + std::string realm{"realm1"}; + std::string uri{"ws://127.0.0.1:8080/ws"}; + bool debug{false}; +}; + +TEST_CASE_METHOD(wamp_test::fixture, "WAMP AUTH: TICKET") +{ + bool joined_realm_with_success = join_realm( + "client1", + wamp_test::Ticket("ticket"), + [&](Transport& transport, Session& session) + { + std::string received_data; + session.subscribe( + "com.example.topic", + [&received_data](const autobahn::wamp_event& event) + { + received_data = event->argument(0); + } + ); + REQUIRE(1 == call("com.example.publish", std::tuple<>()).get()); + REQUIRE("data='1'" == received_data); + REQUIRE(2 == call("com.example.publish", std::tuple<>()).get()); + REQUIRE("data='2'" == received_data); + REQUIRE(3 == call("com.example.publish", std::tuple<>()).get()); + REQUIRE("data='3'" == received_data); + }); + REQUIRE(true == joined_realm_with_success); +} diff --git a/test/run_test.sh b/test/run_test.sh new file mode 100755 index 00000000..d5831a3c --- /dev/null +++ b/test/run_test.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +CROSSBAR_PATH=${1}/crossbar +TEST_BINARY=${2} +cd "${CROSSBAR_PATH}" || exit 1 +/opt/homebrew/bin/crossbar start --cbdir .crossbar > /dev/null 2>&1 & +PID=$! +sleep 3 +${TEST_BINARY} +RET=$? +kill ${PID} +exit ${RET} diff --git a/test/wamp_test.hpp b/test/wamp_test.hpp new file mode 100644 index 00000000..5f8ebe45 --- /dev/null +++ b/test/wamp_test.hpp @@ -0,0 +1,417 @@ +// +// Created by Alexander Arlt on 08.02.22. +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace wamp_test +{ + +struct websocket_transport_base +{ + websocketpp::client ws_client; + boost::asio::io_service io; + websocket_transport_base() { ws_client.init_asio(&io); } +}; + +struct websocket_transport: public websocket_transport_base, + public autobahn::wamp_websocketpp_websocket_transport +{ + typedef websocket_transport Transport; + + websocket_transport(std::string uri, bool debug) + : autobahn::wamp_websocketpp_websocket_transport(ws_client, uri, debug) + { + } +}; + +class Secret +{ +public: + Secret() = default; + explicit Secret(std::string _secret): m_secret(std::move(_secret)) {} + const std::string& secret() { return m_secret; } + +private: + std::string m_secret{}; +}; + +class Ticket +{ +public: + Ticket() = default; + explicit Ticket(std::string _ticket): m_ticket(std::move(_ticket)) {} + const std::string& ticket() { return m_ticket; } + +private: + std::string m_ticket{}; +}; + +class Cryptosign +{ +public: + explicit Cryptosign(const Botan::secure_vector& _privateKey): m_private_key(_privateKey) {} + + const std::vector& publicKey() { return m_private_key.get_public_key(); } + + std::vector sign(const std::vector& _data) + { + Botan::AutoSeeded_RNG rng; + Botan::PK_Signer signer(m_private_key, rng, "Pure"); + signer.update(_data); + return signer.signature(rng); + } + const Botan::Ed25519_PrivateKey& privateKey() const { return m_private_key; } + +private: + Botan::Ed25519_PrivateKey m_private_key; + Botan::secure_vector m_publickey{}; +}; + +class test_session: public autobahn::wamp_session +{ +public: + virtual const std::vector& authmethods() = 0; + virtual std::map authextras() { return {}; }; + +protected: + test_session(boost::asio::io_service& io_service, bool debug_enabled = false) + : autobahn::wamp_session(io_service, debug_enabled) + { + } +}; + +class cra_session: public test_session +{ +public: + const std::vector& authmethods() + { + static std::vector authmethods = {"wampcra"}; + return authmethods; + } + + typedef cra_session Session; + + cra_session(boost::asio::io_service& io, bool debug, Secret _secret) + : test_session(io, debug), m_secret(std::move(_secret)) + { + } + + boost::promise challenge_future; + boost::future on_challenge(const autobahn::wamp_challenge& challenge) + { + std::string signature = compute_wcs(m_secret.secret(), challenge.challenge()); + challenge_future.set_value(autobahn::wamp_authenticate(signature)); + return challenge_future.get_future(); + } + +private: + Secret m_secret; +}; + +class cryptosign_session: public test_session +{ +public: + const std::vector& authmethods() override + { + static std::vector authmethods = {"cryptosign"}; + return authmethods; + } + + std::map authextras() override + { + return {{"pubkey", Botan::hex_encode(m_privateKey.publicKey(), false)}}; + }; + + typedef cra_session Session; + + cryptosign_session(boost::asio::io_service& io, bool debug, Cryptosign _privateKey) + : test_session(io, debug), m_privateKey(std::move(_privateKey)) + { + } + + boost::promise challenge_future; + boost::future on_challenge(const autobahn::wamp_challenge& challenge) override + { + Botan::AutoSeeded_RNG rng; + Botan::PK_Signer signer(m_privateKey.privateKey(), rng, "Pure"); + signer.update(Botan::hex_decode(challenge.challenge())); + std::string signature = Botan::hex_encode(signer.signature(rng)); + challenge_future.set_value(autobahn::wamp_authenticate(signature + challenge.challenge())); + return challenge_future.get_future(); + } + +private: + Cryptosign m_privateKey; +}; + +class ticket_session: public test_session +{ +public: + const std::vector& authmethods() override + { + static std::vector authmethods = {"ticket"}; + return authmethods; + } + + typedef ticket_session Session; + + ticket_session(boost::asio::io_service& io, bool debug, Ticket _ticket) + : test_session(io, debug), m_ticket(std::move(_ticket)) + { + } + + boost::promise challenge_future; + boost::future on_challenge(const autobahn::wamp_challenge& challenge) override + { + challenge_future.set_value(autobahn::wamp_authenticate(m_ticket.ticket())); + return challenge_future.get_future(); + } + +private: + Ticket m_ticket; +}; + +template +struct fixture: public TConfig +{ + typedef typename TTransport::Transport Transport; + typedef test_session Session; + + template + bool join_realm( + const std::string& _realm, + const std::string& _authid, + const TAuthenticateWith _authenticate_with, + std::function _on_success = [](Transport& transport, Session& session) {}) + { + std::shared_ptr transport = std::make_shared(TConfig::uri, TConfig::debug); + return join_realm(*transport, _realm, _authid, _authenticate_with, _on_success); + } + + template + bool join_realm( + const std::string& _authid, + const TAuthenticateWith _authenticate_with, + std::function _on_success = [](Transport& transport, Session& session) {}) + { + std::shared_ptr transport = std::make_shared(TConfig::uri, TConfig::debug); + return join_realm(*transport, TConfig::realm, _authid, _authenticate_with, _on_success); + } + + template + boost::optional call(const std::string& procedure, TArguments _arguments) + { + autobahn::wamp_call_options call_options; + call_options.set_timeout(std::chrono::seconds(10)); + return m_session->call(procedure, _arguments, call_options) + .then( + [&](boost::future _result) + { + boost::optional result; + try + { + result = _result.get().argument(0); + } + catch (const std::exception& e) + { + result.reset(); + } + return result; + }) + .get(); + } + +protected: + Transport* m_transport; + Session* m_session; + +private: + bool join_realm( + Transport& _transport, + const std::string& _realm, + const std::string& _authid, + const Ticket& _ticket, + std::function _on_success) + { + std::shared_ptr session + = std::make_shared(_transport.io, TConfig::debug, _ticket); + _transport.attach(std::static_pointer_cast(session)); + return join(_transport, *session, _realm, _authid, _on_success); + } + + bool join_realm( + Transport& _transport, + const std::string& _realm, + const std::string& _authid, + const Secret& _secret, + std::function _on_success) + { + std::shared_ptr session = std::make_shared(_transport.io, TConfig::debug, _secret); + _transport.attach(std::static_pointer_cast(session)); + return join(_transport, *session, _realm, _authid, _on_success); + } + + bool join_realm( + Transport& _transport, + const std::string& _realm, + const std::string& _authid, + const Cryptosign& _privateKey, + std::function _on_success) + { + std::shared_ptr session + = std::make_shared(_transport.io, TConfig::debug, _privateKey); + _transport.attach(std::static_pointer_cast(session)); + return join(_transport, *session, _realm, _authid, _on_success); + } + + bool join( + Transport& _transport, + Session& _session, + const std::string& _realm, + const std::string& _authid, + std::function _on_success) + { + m_transport = &_transport; + m_session = &_session; + + bool result = false; + // Make sure the continuation futures we use do not run out of scope prematurely. + // Since we are only using one thread here this can cause the io service to block + // as a future generated by a continuation will block waiting for its promise to be + // fulfilled when it goes out of scope. This would prevent the session from receiving + // responses from the router. + boost::future connect_future; + boost::future start_future; + boost::future join_future; + boost::future leave_future; + boost::future stop_future; + + connect_future = _transport.connect().then( + [&](boost::future connected) + { + try + { + connected.get(); + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << e.what() << std::endl; + _transport.io.stop(); + return; + } + if (TConfig::debug) + std::cerr << "transport connected" << std::endl; + + result = true; + + start_future = _session.start().then( + [&](boost::future started) + { + try + { + started.get(); + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << e.what() << std::endl; + _transport.io.stop(); + result = false; + return; + } + + if (TConfig::debug) + std::cerr << "session started" << std::endl; + + join_future = _session.join(_realm, _session.authmethods(), _authid, _session.authextras()) + .then( + [&](boost::future joined) + { + try + { + auto j = joined.get(); + if (TConfig::debug) + std::cerr << "joined realm: " << j << std::endl; + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << e.what() << std::endl; + _transport.io.stop(); + result = false; + return; + } + + _on_success(_transport, _session); + + leave_future = _session.leave().then( + [&](boost::future reason) + { + try + { + auto r = reason.get(); + if (TConfig::debug) + std::cerr << "left session (" << r << ")" + << std::endl; + } + catch (const std::exception& e) + { + if (TConfig::debug) + std::cerr << "failed to leave session: " << e.what() + << std::endl; + _transport.io.stop(); + result = false; + return; + } + + stop_future = _session.stop().then( + [&](boost::future stopped) + { + if (TConfig::debug) + std::cerr << "stopped session" << std::endl; + _transport.io.stop(); + }); + }); + }); + }); + }); + + try + { + if (TConfig::debug) + std::cerr << "starting io service" << std::endl; + _transport.io.run(); + if (TConfig::debug) + std::cerr << "stopped io service" << std::endl; + + connect_future.get(); + } + catch (...) + { + result = false; + } + + m_transport = nullptr; + m_session = nullptr; + + return result; + } +}; + +} // namespace wamp_test From a9e1bf704b66a8163061d36ae89d812b44ca0cda Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Sun, 20 Feb 2022 17:02:35 -0500 Subject: [PATCH 2/5] Initial vcpkg support. --- CMakeLists.txt | 21 ++- cmake/Includes/CMakeLists.txt | 223 +++++++++++----------------- cmake/Modules/FindBotan2.cmake | 41 ----- cmake/Modules/FindMsgpack.cmake | 35 ----- cmake/Modules/FindWebsocketpp.cmake | 35 ----- examples/CMakeLists.txt | 15 +- test/CMakeLists.txt | 17 +-- test/auth/auth.cpp | 2 +- test/calls/calls.cpp | 2 +- test/pubsub/pubsub.cpp | 2 +- 10 files changed, 110 insertions(+), 283 deletions(-) delete mode 100644 cmake/Modules/FindBotan2.cmake delete mode 100644 cmake/Modules/FindMsgpack.cmake delete mode 100644 cmake/Modules/FindWebsocketpp.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 19b44600..e3aa06f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,26 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.21) + +set(vcpkg "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") +if (NOT CMAKE_TOOLCHAIN_FILE AND EXISTS "${vcpkg}") + set(CMAKE_TOOLCHAIN_FILE "${vcpkg}" + CACHE FILEPATH "CMake toolchain file") + message(STATUS "vcpkg toolchain found: ${CMAKE_TOOLCHAIN_FILE}") +endif () project(autobahn-cpp) +set(CMAKE_CXX_STANDARD 20) + option(AUTOBAHN_BUILD_EXAMPLES "Build examples" ON) -option(AUTOBAHN_BUILD_EXAMPLES_BOTAN "Build Botan cryptosign example" OFF) option(AUTOBAHN_TESTS "Test" ON) -option(AUTOBAHN_USE_LIBCXX "Use libc++ instead of libstdc++ when building with Clang" ON) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/CMakeLists.txt) - -if(AUTOBAHN_BUILD_EXAMPLES) +if (AUTOBAHN_BUILD_EXAMPLES) add_subdirectory(examples) -endif(AUTOBAHN_BUILD_EXAMPLES) +endif (AUTOBAHN_BUILD_EXAMPLES) if (AUTOBAHN_TESTS) include(CTest) add_subdirectory(test) -endif() \ No newline at end of file +endif() + diff --git a/cmake/Includes/CMakeLists.txt b/cmake/Includes/CMakeLists.txt index c41396dc..3073b456 100644 --- a/cmake/Includes/CMakeLists.txt +++ b/cmake/Includes/CMakeLists.txt @@ -1,152 +1,105 @@ -# AutobahnC++ cmake build script. -# -# This script uses the following environment variables (if defined): -# -# * BOOST_ROOT -# * MSGPACK_ROOT -# * WEBSOCKETPP_ROOT -# -# When those are defined, they take precedence over any host system -# installations for the respective library. When an explicit library -# root location hasn't been set, cmake will look in other places. - -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "-Wno-unused-local-typedefs -Wno-unknown-warning-option ${CMAKE_CXX_FLAGS}") - if(AUTOBAHN_USE_LIBCXX) - set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") - endif() - if ("${CMAKE_GENERATOR}" STREQUAL "Ninja") - set(CMAKE_CXX_FLAGS "-fcolor-diagnostics ${CMAKE_CXX_FLAGS}") - endif() -endif() - -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0") # i.e. if >= 4.9.0 - if (CMAKE_GENERATOR STREQUAL "Ninja") - set(CMAKE_CXX_FLAGS "-fdiagnostics-color=always ${CMAKE_CXX_FLAGS}") - else() - set(CMAKE_CXX_FLAGS "-fdiagnostics-color=auto ${CMAKE_CXX_FLAGS}") - endif() - endif() -endif() - -if(NOT MSVC) - # https://stackoverflow.com/a/31010221/884770 - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror -Wno-unused-variable ${CMAKE_CXX_FLAGS}") -endif() - -set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") - find_package(Threads REQUIRED) find_package(OpenSSL REQUIRED) -if(BUILD_SHARED_LIBS) - set(Boost_USE_STATIC_LIBS OFF ) -else() - # https://stackoverflow.com/a/3176086/884770 - set(Boost_USE_STATIC_LIBS ON ) -endif() - +set(Boost_NO_WARN_NEW_VERSIONS ON) find_package(Boost REQUIRED COMPONENTS program_options filesystem system thread random) -find_package(msgpack REQUIRED) -find_package(websocketpp REQUIRED) +find_package(msgpack CONFIG REQUIRED) +find_package(websocketpp CONFIG REQUIRED) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(BOTAN2 botan-2 REQUIRED) -MESSAGE( STATUS "AUTOBAHN_BUILD_EXAMPLES: " ${AUTOBAHN_BUILD_EXAMPLES} ) -MESSAGE( STATUS "AUTOBAHN_USE_LIBCXX: " ${AUTOBAHN_USE_LIBCXX} ) -MESSAGE( STATUS "CMAKE_ROOT: " ${CMAKE_ROOT} ) -MESSAGE( STATUS "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX} ) -MESSAGE( STATUS "Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS} ) -MESSAGE( STATUS "Boost_LIBRARIES: " ${Boost_LIBRARIES} ) -MESSAGE( STATUS "msgpack_INCLUDE_DIRS: " ${msgpack_INCLUDE_DIRS} ) -MESSAGE( STATUS "msgpack_LIBRARIES: " ${msgpack_LIBRARIES} ) -MESSAGE( STATUS "websocketpp_INCLUDE_DIRS: " ${websocketpp_INCLUDE_DIRS} ) -MESSAGE( STATUS "websocketpp_LIBRARIES: " ${websocketpp_LIBRARIES} ) +MESSAGE(STATUS "AUTOBAHN_BUILD_EXAMPLES: " ${AUTOBAHN_BUILD_EXAMPLES}) +MESSAGE(STATUS "AUTOBAHN_USE_LIBCXX: " ${AUTOBAHN_USE_LIBCXX}) +MESSAGE(STATUS "CMAKE_ROOT: " ${CMAKE_ROOT}) +MESSAGE(STATUS "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX}) +MESSAGE(STATUS "Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS}) +MESSAGE(STATUS "Boost_LIBRARIES: " ${Boost_LIBRARIES}) +get_target_property(MSGPACKC_INCLUDE_DIR msgpackc INTERFACE_INCLUDE_DIRECTORIES) +get_target_property(MSGPACKC_LIBRARIES msgpackc IMPORTED_LOCATION_RELEASE) +MESSAGE(STATUS "MSGPACKC_INCLUDE_DIR: " ${MSGPACKC_INCLUDE_DIR}) +MESSAGE(STATUS "MSGPACKC_LIBRARIES: " ${MSGPACKC_LIBRARIES}) +MESSAGE(STATUS "WEBSOCKETPP_INCLUDE_DIR: " ${WEBSOCKETPP_INCLUDE_DIR}) set(PUBLIC_HEADERS - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/autobahn.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/boost_config.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/exceptions.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_arguments.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_auth_utils.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event_handler.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_procedure.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_uds_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.ipp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.ipp - ) + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/autobahn.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/boost_config.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/exceptions.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_arguments.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_auth_utils.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_authenticate.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_options.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_call_result.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_challenge.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_event_handler.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_invocation.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_message_type.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_procedure.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publication.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_publish_options.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_rawsocket_transport.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_register_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_registration.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_session.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_options.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscribe_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_subscription.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_tcp_transport.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport_handler.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_uds_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unregister_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_unsubscribe_request.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocket_transport.ipp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/autobahn/wamp_websocketpp_websocket_transport.ipp + ) add_library(autobahn_cpp INTERFACE) target_include_directories(autobahn_cpp INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} - ${Boost_INCLUDE_DIRS} - ${OPENSSL_INCLUDE_DIR} - ${websocketpp_INCLUDE_DIRS} - ${msgpack_INCLUDE_DIRS}) + ${CMAKE_CURRENT_SOURCE_DIR} + ${OPENSSL_INCLUDE_DIR} + ${BOTAN2_INCLUDE_DIRS} + ${WEBSOCKETPP_INCLUDE_DIR} + ${MSGPACKC_INCLUDE_DIR}) target_link_libraries(autobahn_cpp INTERFACE - ${Boost_LIBRARIES} - ${OPENSSL_LIBRARIES} - ${websocketpp_LIBRARIES} - ${msgpack_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_DL_LIBS}) + Boost::boost Boost::thread + websocketpp::websocketpp + msgpackc msgpackc-cxx + OpenSSL::SSL OpenSSL::Crypto + ${BOTAN2_LINK_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${CMAKE_DL_LIBS}) foreach(h ${PUBLIC_HEADERS}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "include/" include "${h}") diff --git a/cmake/Modules/FindBotan2.cmake b/cmake/Modules/FindBotan2.cmake deleted file mode 100644 index f99ec1b3..00000000 --- a/cmake/Modules/FindBotan2.cmake +++ /dev/null @@ -1,41 +0,0 @@ -if(MSVC OR MINGW) - message(FATAL_ERROR "Using system Botan 2 library in Window not supported") -endif() - -if(TARGET Botan2::Botan2) - message(STATUS "Target Botan::Botan already exists. Skipping searching") - return() -endif() - -find_package(PkgConfig REQUIRED QUIET) -find_package(PackageHandleStandardArgs REQUIRED QUIET) - - -pkg_check_modules(Botan2 - botan-2 - ) - -find_library(Botan2_FullLibraryPath - ${Botan2_LIBRARIES} - PATHS ${Botan2_LIBRARY_DIRS} - NO_DEFAULT_PATH - ) - -find_package_handle_standard_args(Botan2 - REQUIRED_VARS Botan2_LIBRARIES Botan2_INCLUDE_DIRS - VERSION_VAR Botan2_VERSION - ) -message("Botan2_INCLUDE_DIRS ${Botan2_INCLUDE_DIRS}") - -if(Botan2_FOUND) - if(NOT TARGET Botan2::Botan2) - add_library(Botan2::Botan2 - UNKNOWN IMPORTED GLOBAL - ) - set_target_properties(Botan2::Botan2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${Botan2_INCLUDE_DIRS} - IMPORTED_LOCATION ${Botan2_FullLibraryPath} - LINK_FLAGS ${Botan2_LDFLAGS_OTHER} - ) - endif() -endif() diff --git a/cmake/Modules/FindMsgpack.cmake b/cmake/Modules/FindMsgpack.cmake deleted file mode 100644 index 0677e3d3..00000000 --- a/cmake/Modules/FindMsgpack.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# - Try to find msgpack -# Once done this will define -# msgpack_FOUND - System has msgpack -# msgpack_INCLUDE_DIRS - The msgpack include directories - -set(_env "$ENV{MSGPACK_ROOT}") -if(_env) - - set(msgpack_FOUND TRUE) - set(msgpack_INCLUDE_DIRS "$ENV{MSGPACK_ROOT}/include") - set(msgpack_LIBRARIES "$ENV{MSGPACK_ROOT}/libs") - -else() - - find_package(PkgConfig QUIET) - - if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_MSGPACK QUIET msgpack) - endif (PKG_CONFIG_FOUND) - - find_path(msgpack_INCLUDE_DIR msgpack.hpp - HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}) - - set(msgpack_INCLUDE_DIRS ${msgpack_INCLUDE_DIR}) - - include(FindPackageHandleStandardArgs) - # handle the QUIETLY and REQUIRED arguments and set Msgpack_FOUND to TRUE - # if all listed variables are TRUE - find_package_handle_standard_args(msgpack DEFAULT_MSG - msgpack_INCLUDE_DIR - msgpack_INCLUDE_DIRS) - - mark_as_advanced(msgpack_INCLUDE_DIR) - -endif() diff --git a/cmake/Modules/FindWebsocketpp.cmake b/cmake/Modules/FindWebsocketpp.cmake deleted file mode 100644 index b1e230e5..00000000 --- a/cmake/Modules/FindWebsocketpp.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# - Try to find websocketpp -# Once done this will define -# websocketpp_FOUND - System has websocketpp -# websocketpp_INCLUDE_DIRS - The websocketpp include directories - -set(_env "$ENV{WEBSOCKETPP_ROOT}") -if(_env) - - set(websocketpp_FOUND TRUE) - set(websocketpp_INCLUDE_DIRS "$ENV{WEBSOCKETPP_ROOT}/include") - set(websocketpp_LIBRARIES "$ENV{WEBSOCKETPP_ROOT}/libs") - -else() - - find_package(PkgConfig QUIET) - - if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_WEBSOCKETPP QUIET websocketpp) - endif (PKG_CONFIG_FOUND) - - find_path(websocketpp_INCLUDE_DIR websocketpp - HINTS ${PC_WEBSOCKETPP_INCLUDEDIR} ${PC_WEBSOCKETPP_INCLUDE_DIRS}) - - set(websocketpp_INCLUDE_DIRS ${websocketpp_INCLUDE_DIR}) - - include(FindPackageHandleStandardArgs) - # handle the QUIETLY and REQUIRED arguments and set websocketpp_FOUND to TRUE - # if all listed variables are TRUE - find_package_handle_standard_args(websocketpp DEFAULT_MSG - websocketpp_INCLUDE_DIR - websocketpp_INCLUDE_DIRS) - - mark_as_advanced(websocketpp_INCLUDE_DIR) - -endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 54f44c68..7b95980e 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,11 +1,5 @@ -if (!APPLE) - set(CMAKE_EXE_LINKER_FLAGS " -static") -endif() - add_library(examples_parameters parameters.cpp parameters.hpp) -target_include_directories(examples_parameters PUBLIC ${Boost_INCLUDE_DIRS}) -target_link_libraries(examples_parameters PRIVATE ${Boost_LIBRARIES}) -target_compile_definitions(examples_parameters PRIVATE ${Boost_DEFINITIONS}) +target_link_libraries(examples_parameters PRIVATE Boost::boost Boost::thread Boost::program_options) function(make_example name src) add_executable(${name} ${src} ${PUBLIC_HEADERS}) @@ -20,12 +14,7 @@ make_example(subscriber subscriber.cpp) make_example(wampcra wampcra.cpp) make_example(websocket_callee websocket_callee.cpp) make_example(cryptosign-openssl cryptosign-openssl.cpp) -if (AUTOBAHN_BUILD_EXAMPLES_BOTAN) - find_package(Botan2 REQUIRED) - make_example(cryptosign-botan cryptosign-botan.cpp) - target_include_directories(cryptosign-botan PRIVATE ${BOTAN_INCLUDE_DIRS}) - target_link_libraries(cryptosign-botan Botan2::Botan2) -endif() +make_example(cryptosign-botan cryptosign-botan.cpp) if(UNIX) make_example(uds uds.cpp) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f07af1f0..54886fb2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,19 +1,8 @@ -Include(FetchContent) -FetchContent_Declare( - Catch2 - GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.0.0-preview3 -) -FetchContent_MakeAvailable(Catch2) -FetchContent_Declare( - Catch2 - GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.0.0-preview3 -) -find_package(Botan2 REQUIRED) +find_package(Catch2 CONFIG REQUIRED) + function(make_test name src) add_executable(${name} ${src} wamp_test.hpp ${PUBLIC_HEADERS}) - target_link_libraries(${name} PRIVATE Catch2::Catch2WithMain autobahn_cpp Botan2::Botan2) + target_link_libraries(${name} PRIVATE Catch2::Catch2 Catch2::Catch2WithMain autobahn_cpp) target_include_directories(${name} PRIVATE ${BOTAN_INCLUDE_DIRS}) string(REPLACE "test_" "" pure_name ${name}) add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh "${CMAKE_CURRENT_SOURCE_DIR}/${pure_name}" "${CMAKE_CURRENT_BINARY_DIR}/${name}" ) diff --git a/test/auth/auth.cpp b/test/auth/auth.cpp index 4414fa77..e0dbd2c0 100644 --- a/test/auth/auth.cpp +++ b/test/auth/auth.cpp @@ -29,7 +29,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "test/wamp_test.hpp" -#include +#include struct Config { diff --git a/test/calls/calls.cpp b/test/calls/calls.cpp index 486b008b..6e9e22f9 100644 --- a/test/calls/calls.cpp +++ b/test/calls/calls.cpp @@ -29,7 +29,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "test/wamp_test.hpp" -#include +#include struct Config { diff --git a/test/pubsub/pubsub.cpp b/test/pubsub/pubsub.cpp index d139989b..6be46961 100644 --- a/test/pubsub/pubsub.cpp +++ b/test/pubsub/pubsub.cpp @@ -29,7 +29,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "test/wamp_test.hpp" -#include +#include struct Config { From ac6e1046fa0225800bb1d15e2868c4e1ca846c4a Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Sun, 20 Feb 2022 17:31:24 -0500 Subject: [PATCH 3/5] Add vcpkg as submodule. --- .gitmodules | 3 +++ vcpkg | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 vcpkg diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..fe07c999 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg diff --git a/vcpkg b/vcpkg new file mode 160000 index 00000000..5cf60186 --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit 5cf60186a241e84e8232641ee973395d4fde90e1 From c09f3b5c2aac8fdec03823a3b746e2c373fbc776 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Sun, 20 Feb 2022 18:06:05 -0500 Subject: [PATCH 4/5] Add vcpkg manifest vcpkg.json. --- vcpkg.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 vcpkg.json diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 00000000..e0a7f7cc --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "autobahn", + "version-string": "0.1.0", + "port-version": 1, + "description": "WAMP for C++ in Boost/Asio", + "homepage": "https://crossbar.io/autobahn", + "dependencies": [ + "boost-filesystem", + "boost-program-options", + "boost-random", + "boost-asio", + "boost-thread", + "msgpack", + "websocketpp", + "botan", + "openssl", + "catch2" + ] +} From dc6df340fa8732b402c85b8f6f5423eced4697f6 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Sun, 20 Feb 2022 18:29:09 -0500 Subject: [PATCH 5/5] Add new workflow. --- .github/workflows/ci-linux.yaml | 88 ------ .github/workflows/ci-windows.yaml | 50 ---- .github/workflows/hosted-pure-workflow.yml | 94 +++++++ CMakePresets.json | 51 ++++ examples/CMakeLists.txt | 8 +- .../VS2015/autobahn-cpp-examples.vs2015.sln | 94 ------- examples/projects/VS2015/autobahn-cpp.vcxproj | 185 ------------- examples/projects/VS2015/callee.vcxproj | 259 ------------------ examples/projects/VS2015/caller.vcxproj | 259 ------------------ .../projects/VS2015/provide_prefix.vcxproj | 259 ------------------ examples/projects/VS2015/publisher.vcxproj | 259 ------------------ examples/projects/VS2015/subscriber.vcxproj | 259 ------------------ examples/projects/VS2015/wampcra.vcxproj | 259 ------------------ examples/projects/VS2015/websocket.vcxproj | 259 ------------------ test/CMakeLists.txt | 19 +- test/auth/auth.cpp | 2 +- test/calls/calls.cpp | 2 +- test/pubsub/pubsub.cpp | 2 +- test/run_test.sh | 7 +- vcpkg.json | 7 +- 20 files changed, 174 insertions(+), 2248 deletions(-) delete mode 100644 .github/workflows/ci-linux.yaml delete mode 100644 .github/workflows/ci-windows.yaml create mode 100644 .github/workflows/hosted-pure-workflow.yml create mode 100644 CMakePresets.json delete mode 100644 examples/projects/VS2015/autobahn-cpp-examples.vs2015.sln delete mode 100644 examples/projects/VS2015/autobahn-cpp.vcxproj delete mode 100644 examples/projects/VS2015/callee.vcxproj delete mode 100644 examples/projects/VS2015/caller.vcxproj delete mode 100644 examples/projects/VS2015/provide_prefix.vcxproj delete mode 100644 examples/projects/VS2015/publisher.vcxproj delete mode 100644 examples/projects/VS2015/subscriber.vcxproj delete mode 100644 examples/projects/VS2015/wampcra.vcxproj delete mode 100644 examples/projects/VS2015/websocket.vcxproj diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml deleted file mode 100644 index c19594bc..00000000 --- a/.github/workflows/ci-linux.yaml +++ /dev/null @@ -1,88 +0,0 @@ -name: Linux CI - -on: [push, pull_request] - -jobs: - ci: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - - env: - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 - - strategy: - fail-fast: false - matrix: - include: - - name: ubuntu-20.04-gcc-10 - os: ubuntu-20.04 - compiler: gcc - version: "10" - - - name: ubuntu-20.04-gcc-10-conan - os: ubuntu-20.04 - compiler: gcc - version: "10" - conan: true - cmake-args: -DCMAKE_PREFIX_PATH=`pwd`/build -DCMAKE_MODULE_PATH=`pwd`/build - - - name: ubuntu-20.04-clang-10 - os: ubuntu-20.04 - compiler: clang - version: "10" - cmake-args: -DAUTOBAHN_USE_LIBCXX=NO - - - name: ubuntu-20.04-clang-10-conan - os: ubuntu-20.04 - compiler: clang - version: "10" - conan: true - cmake-args: -DCMAKE_PREFIX_PATH=`pwd`/build -DCMAKE_MODULE_PATH=`pwd`/build -DAUTOBAHN_USE_LIBCXX=NO - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Set env vars - run: | - echo "CC=${{ matrix.compiler }}-${{ matrix.version }}" >> $GITHUB_ENV - if [ "${{ matrix.compiler }}" == "clang" ]; then - echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV - else - echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV - fi - - - name: Install - run: | - python -m pip install cmake==3.22.2 conan==1.44.1 --upgrade - - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main' -y - sudo apt update - - if [ "${{ matrix.compiler }}" = "gcc" ]; then - sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib - else - sudo apt-get install -y clang-${{ matrix.version }} clang-tidy-${{ matrix.version }} g++-multilib - fi - - - name: Install dependencies (system) - run: sudo apt-get install -y libboost-all-dev libmsgpack-dev libwebsocketpp-dev - if: ${{ !matrix.conan }} - - - name: Install dependencies (conan) - run: | - conan profile new default --detect --force - conan profile update settings.compiler.libcxx=libstdc++11 default - mkdir -p build && cd build - conan install .. --build=missing - if: ${{ matrix.conan }} - - - name: Build - run: | - cmake -S . -B build ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Debug - cmake --build build --config Debug diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml deleted file mode 100644 index 16379e76..00000000 --- a/.github/workflows/ci-windows.yaml +++ /dev/null @@ -1,50 +0,0 @@ -name: Windows CI - -on: [push, pull_request] - -jobs: - ci: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - - env: - CTEST_OUTPUT_ON_FAILURE: ON - CTEST_PARALLEL_LEVEL: 2 - - strategy: - fail-fast: false - matrix: - include: - - name: windows-2019-cl-x86 - os: windows-2019 - generator: Visual Studio 16 2019 - type: Debug - platform: Win32 - conan_arch: x86 - - - name: windows-2019-cl-x64 - os: windows-2019 - generator: Visual Studio 16 2019 - type: Debug - platform: x64 - conan_arch: x86_64 - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install - run: | - python -m pip install cmake==3.22.2 conan==1.44.1 --upgrade - conan profile new default --detect --force - mkdir -p build && cd build - conan install .. --build=missing -s arch=${{ matrix.conan_arch }} -s build_type=${{ matrix.type }} - - - name: Build - shell: bash # CMake doesn't like paths with backslashes. - run: | - cmake -S . -B build -G "${{ matrix.generator }}" -A ${{ matrix.platform }} -DCMAKE_PREFIX_PATH=`pwd`/build -DCMAKE_MODULE_PATH=`pwd`/build - cmake --build build --config ${{ matrix.type }} diff --git a/.github/workflows/hosted-pure-workflow.yml b/.github/workflows/hosted-pure-workflow.yml new file mode 100644 index 00000000..004b52df --- /dev/null +++ b/.github/workflows/hosted-pure-workflow.yml @@ -0,0 +1,94 @@ +# Copyright (c) 2021 Luca Cappa +# Released under the term specified in file LICENSE.txt +# SPDX short identifier: MIT + +# A "pure" GitHub workflow using CMake, Ninja and vcpkg to build a C/C++ codebase. +# It leverages both CMakePresets.json and vcpkg.json to have consistent build locallly +# and on continuous integration servers (aka build agents). +# It is called "pure workflow" because it is an example which minimizes the usage of +# custom GitHub actions, but leverages directly the tools that could be easily run on +# your development machines (i.e. CMake, vcpkg, Ninja) to ensure a perfectly identical +# and reproducible build locally (on your development machine) and remotely (on build agents). +name: hosted-pure-workflow +on: [ push, workflow_dispatch ] + +jobs: + job: + name: ${{ matrix.os }}-${{ github.workflow }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + include: + - os: windows-latest + triplet: x64-windows + - os: ubuntu-latest + triplet: x64-linux + - os: macos-latest + triplet: x64-osx + env: + # Indicates the location of the vcpkg as a Git submodule of the project repository. + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + # Tells vcpkg where binary packages are stored. + VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/bincache + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" + run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE + shell: bash + + # Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. + - uses: lukka/get-cmake@latest + + - uses: docker-practice/actions-setup-docker@master + - run: | + if [ "$RUNNER_OS" != "Windows" ]; then + docker pull crossbario/crossbar + else + echo "Skipping on Windows." + fi + shell: bash + # Restore both vcpkg and its artifacts from the GitHub cache service. + - name: Restore Dependency Cache. + uses: actions/cache@v2 + with: + # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the + # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + !${{ env.VCPKG_ROOT }}/installed + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} + # On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK. + - uses: ilammy/msvc-dev-cmd@v1 + + # Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install the dependencies as specified in vcpkg.json. + - name: Install Dependencies. + run: | + cmake --preset ninja-multi-vcpkg + + # Build the whole project with Ninja (which is spawn by CMake). Debug configuration. + - name: Build. + run: | + cmake --build --preset ninja-multi-vcpkg-debug + # Test the whole project with CTest. + - name: Run Tests. + run: | + if [ "$RUNNER_OS" != "Windows" ]; then + ctest --preset ninja-multi-vcpkg-debug + else + echo "Skipping on Windows." + fi + shell: bash \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..7fbd77a1 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,51 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "ninja-multi-vcpkg", + "displayName": "Ninja Multi-Config", + "description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations", + "binaryDir": "${sourceDir}/builds/${presetName}", + "generator": "Ninja Multi-Config", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": { + "type": "FILEPATH", + "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + } + } + } + ], + "buildPresets": [ + { + "name": "ninja-multi-vcpkg-debug", + "configurePreset": "ninja-multi-vcpkg", + "displayName": "Build ninja-multi-vcpkg-debug", + "description": "Build ninja-multi-vcpkg Debug configuration", + "configuration": "Debug" + }, + { + "name": "ninja-multi-vcpkg-release", + "configurePreset": "ninja-multi-vcpkg", + "displayName": "Build ninja-multi-vcpkg-release", + "description": "Build ninja-multi-vcpkg Release configuration", + "configuration": "RelWithDebInfo" + } + ], + "testPresets": [ + { + "name": "ninja-multi-vcpkg-debug", + "configurePreset": "ninja-multi-vcpkg", + "configuration": "Debug" + }, + { + "name": "ninja-multi-vcpkg-release", + "configurePreset": "ninja-multi-vcpkg", + "configuration": "RelWithDebInfo" + } + ] +} \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7b95980e..6bf97890 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -16,12 +16,14 @@ make_example(websocket_callee websocket_callee.cpp) make_example(cryptosign-openssl cryptosign-openssl.cpp) make_example(cryptosign-botan cryptosign-botan.cpp) -if(UNIX) +if (UNIX) make_example(uds uds.cpp) -endif() +endif () # By default MSVC has a 2^16 limit on the number of sections in an object file, # and this needs more than that. if (MSVC) set_source_files_properties(websocket_callee.cpp PROPERTIES COMPILE_FLAGS /bigobj) -endif() + set_source_files_properties(cryptosign-openssl.cpp PROPERTIES COMPILE_FLAGS /bigobj) + set_source_files_properties(cryptosign-botan.cpp PROPERTIES COMPILE_FLAGS /bigobj) +endif () diff --git a/examples/projects/VS2015/autobahn-cpp-examples.vs2015.sln b/examples/projects/VS2015/autobahn-cpp-examples.vs2015.sln deleted file mode 100644 index 4eaecce9..00000000 --- a/examples/projects/VS2015/autobahn-cpp-examples.vs2015.sln +++ /dev/null @@ -1,94 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wampcra", "wampcra.vcxproj", "{4357F288-DC34-40E3-9AAA-80C1E3EFD633}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "autobahn-cpp", "autobahn-cpp.vcxproj", "{94DB2E6B-5051-43EB-A4BD-D41F4D70D597}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "callee", "callee.vcxproj", "{5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "caller", "caller.vcxproj", "{BF87E140-28C2-41F8-BF65-7776DD215B87}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "publisher", "publisher.vcxproj", "{352DB303-2BBA-4C01-B22F-35A1196FDE4C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subscriber", "subscriber.vcxproj", "{62501761-0470-453F-99BC-36FC69B339FA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "provide_prefix", "provide_prefix.vcxproj", "{B18D21E0-843C-4AC5-8365-495BED662808}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "websocket", "websocket.vcxproj", "{DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x64.ActiveCfg = Debug|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x64.Build.0 = Debug|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x86.ActiveCfg = Debug|Win32 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Debug|x86.Build.0 = Debug|Win32 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x64.ActiveCfg = Release|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x64.Build.0 = Release|x64 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x86.ActiveCfg = Release|Win32 - {4357F288-DC34-40E3-9AAA-80C1E3EFD633}.Release|x86.Build.0 = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Debug|x64.ActiveCfg = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Debug|x86.ActiveCfg = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Release|x64.ActiveCfg = Release|Win32 - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597}.Release|x86.ActiveCfg = Release|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x64.ActiveCfg = Debug|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x64.Build.0 = Debug|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x86.ActiveCfg = Debug|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Debug|x86.Build.0 = Debug|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x64.ActiveCfg = Release|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x64.Build.0 = Release|x64 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x86.ActiveCfg = Release|Win32 - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE}.Release|x86.Build.0 = Release|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x64.ActiveCfg = Debug|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x64.Build.0 = Debug|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x86.ActiveCfg = Debug|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Debug|x86.Build.0 = Debug|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x64.ActiveCfg = Release|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x64.Build.0 = Release|x64 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x86.ActiveCfg = Release|Win32 - {BF87E140-28C2-41F8-BF65-7776DD215B87}.Release|x86.Build.0 = Release|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x64.ActiveCfg = Debug|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x64.Build.0 = Debug|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x86.ActiveCfg = Debug|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Debug|x86.Build.0 = Debug|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x64.ActiveCfg = Release|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x64.Build.0 = Release|x64 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x86.ActiveCfg = Release|Win32 - {352DB303-2BBA-4C01-B22F-35A1196FDE4C}.Release|x86.Build.0 = Release|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x64.ActiveCfg = Debug|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x64.Build.0 = Debug|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x86.ActiveCfg = Debug|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Debug|x86.Build.0 = Debug|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x64.ActiveCfg = Release|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x64.Build.0 = Release|x64 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x86.ActiveCfg = Release|Win32 - {62501761-0470-453F-99BC-36FC69B339FA}.Release|x86.Build.0 = Release|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x64.ActiveCfg = Debug|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x64.Build.0 = Debug|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x86.ActiveCfg = Debug|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Debug|x86.Build.0 = Debug|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x64.ActiveCfg = Release|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x64.Build.0 = Release|x64 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x86.ActiveCfg = Release|Win32 - {B18D21E0-843C-4AC5-8365-495BED662808}.Release|x86.Build.0 = Release|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x64.ActiveCfg = Debug|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x64.Build.0 = Debug|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x86.ActiveCfg = Debug|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Debug|x86.Build.0 = Debug|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x64.ActiveCfg = Release|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x64.Build.0 = Release|x64 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x86.ActiveCfg = Release|Win32 - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/examples/projects/VS2015/autobahn-cpp.vcxproj b/examples/projects/VS2015/autobahn-cpp.vcxproj deleted file mode 100644 index 21a0bc48..00000000 --- a/examples/projects/VS2015/autobahn-cpp.vcxproj +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {94DB2E6B-5051-43EB-A4BD-D41F4D70D597} - Win32Proj - autobahncpp - 8.1 - - - - true - v140 - Unicode - - - StaticLibrary - false - v140 - true - Unicode - - - StaticLibrary - true - v140 - Unicode - - - StaticLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - - - - - - - Level3 - Disabled - _DEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - true - true - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions) - - - Windows - true - true - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/callee.vcxproj b/examples/projects/VS2015/callee.vcxproj deleted file mode 100644 index 443bfcd6..00000000 --- a/examples/projects/VS2015/callee.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {5D930CE9-EC02-4F5F-AEC9-D790E6D40DBE} - Win32Proj - autobahncppexamples - 8.1 - callee - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/caller.vcxproj b/examples/projects/VS2015/caller.vcxproj deleted file mode 100644 index 005dbbde..00000000 --- a/examples/projects/VS2015/caller.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {BF87E140-28C2-41F8-BF65-7776DD215B87} - Win32Proj - autobahncppexamples - 8.1 - caller - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/provide_prefix.vcxproj b/examples/projects/VS2015/provide_prefix.vcxproj deleted file mode 100644 index 702cc769..00000000 --- a/examples/projects/VS2015/provide_prefix.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {B18D21E0-843C-4AC5-8365-495BED662808} - Win32Proj - autobahncppexamples - 8.1 - provide_prefix - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/publisher.vcxproj b/examples/projects/VS2015/publisher.vcxproj deleted file mode 100644 index 2fe0c93b..00000000 --- a/examples/projects/VS2015/publisher.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {352DB303-2BBA-4C01-B22F-35A1196FDE4C} - Win32Proj - autobahncppexamples - 8.1 - publisher - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/subscriber.vcxproj b/examples/projects/VS2015/subscriber.vcxproj deleted file mode 100644 index b2a00d27..00000000 --- a/examples/projects/VS2015/subscriber.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {62501761-0470-453F-99BC-36FC69B339FA} - Win32Proj - autobahncppexamples - 8.1 - subscriber - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/wampcra.vcxproj b/examples/projects/VS2015/wampcra.vcxproj deleted file mode 100644 index 98c01ecf..00000000 --- a/examples/projects/VS2015/wampcra.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {4357F288-DC34-40E3-9AAA-80C1E3EFD633} - Win32Proj - autobahncppexamples - 8.1 - wampcra - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../ - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/projects/VS2015/websocket.vcxproj b/examples/projects/VS2015/websocket.vcxproj deleted file mode 100644 index 87cf2a2f..00000000 --- a/examples/projects/VS2015/websocket.vcxproj +++ /dev/null @@ -1,259 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {DF547C71-C634-4F5F-81AE-C0FF0E2A0F73} - Win32Proj - autobahncppexamples - 8.1 - websocket - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreadedDebug - - - Console - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(BOOST_DIR);$(OPENSSL_DIR)\inc32;$(MSGPACK_DIR)\include;../../../;C:\Projects\OpenSource\websocketpp - MultiThreaded - - - Console - true - true - true - $(BOOST_DIR)\stage\lib;$(OPENSSL_DIR)\build\Win32\VC14\DLL Release;%(AdditionalLibraryDirectories) - libeay32.lib;ssleay32.lib;%(AdditionalDependencies) - - - @if NOT [%BOOST_DIR%] ==[] GOTO CHECKMSGPACK -@ECHO Boost directory not defined. Set environment variable BOOST_DIR or change project settings - - -:CHECKMSGPACK -@if NOT [%MSGPACK_DIR%] ==[] GOTO CHECKOPENSSL -@ECHO MsgPack-c directory not defined. Set environment variable MSGPACK_DIR or change project settings - - -:CHECKOPENSSL -@if NOT [%OPENSSL_DIR%] ==[] GOTO SUCCESS -ECHO OpenSSL directory not defined. Set environment variable OPENSSL_DIR or change project settings - - -:SUCCESS -EXIT 0 - - - Checking project config - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 54886fb2..2162fe6e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,11 +1,22 @@ -find_package(Catch2 CONFIG REQUIRED) +Include(FetchContent) +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.0.0-preview3 +) +FetchContent_MakeAvailable(Catch2) function(make_test name src) + # By default MSVC has a 2^16 limit on the number of sections in an object file, + # and this needs more than that. + if (MSVC) + set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS /bigobj) + endif () + add_executable(${name} ${src} wamp_test.hpp ${PUBLIC_HEADERS}) - target_link_libraries(${name} PRIVATE Catch2::Catch2 Catch2::Catch2WithMain autobahn_cpp) - target_include_directories(${name} PRIVATE ${BOTAN_INCLUDE_DIRS}) + target_link_libraries(${name} PRIVATE Catch2::Catch2WithMain autobahn_cpp) string(REPLACE "test_" "" pure_name ${name}) - add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh "${CMAKE_CURRENT_SOURCE_DIR}/${pure_name}" "${CMAKE_CURRENT_BINARY_DIR}/${name}" ) + add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh "${CMAKE_CURRENT_SOURCE_DIR}/${pure_name}" "$") endfunction() make_test(test_auth auth/auth.cpp) diff --git a/test/auth/auth.cpp b/test/auth/auth.cpp index e0dbd2c0..35ac8363 100644 --- a/test/auth/auth.cpp +++ b/test/auth/auth.cpp @@ -29,7 +29,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "test/wamp_test.hpp" -#include +#include struct Config { diff --git a/test/calls/calls.cpp b/test/calls/calls.cpp index 6e9e22f9..2ed216ec 100644 --- a/test/calls/calls.cpp +++ b/test/calls/calls.cpp @@ -29,7 +29,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "test/wamp_test.hpp" -#include +#include struct Config { diff --git a/test/pubsub/pubsub.cpp b/test/pubsub/pubsub.cpp index 6be46961..689748cb 100644 --- a/test/pubsub/pubsub.cpp +++ b/test/pubsub/pubsub.cpp @@ -29,7 +29,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "test/wamp_test.hpp" -#include +#include struct Config { diff --git a/test/run_test.sh b/test/run_test.sh index d5831a3c..7827c0a9 100755 --- a/test/run_test.sh +++ b/test/run_test.sh @@ -3,10 +3,9 @@ CROSSBAR_PATH=${1}/crossbar TEST_BINARY=${2} cd "${CROSSBAR_PATH}" || exit 1 -/opt/homebrew/bin/crossbar start --cbdir .crossbar > /dev/null 2>&1 & -PID=$! -sleep 3 +docker run -d -v $PWD:/node -u 0 --rm --name=crossbar -it -p 8080:8080 crossbario/crossbar +sleep 15 ${TEST_BINARY} RET=$? -kill ${PID} +docker container stop crossbar exit ${RET} diff --git a/vcpkg.json b/vcpkg.json index e0a7f7cc..9eacde48 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "autobahn", - "version-string": "0.1.0", + "version-string": "0.0.1", "port-version": 1, "description": "WAMP for C++ in Boost/Asio", "homepage": "https://crossbar.io/autobahn", @@ -10,10 +10,9 @@ "boost-random", "boost-asio", "boost-thread", - "msgpack", - "websocketpp", "botan", + "msgpack", "openssl", - "catch2" + "websocketpp" ] }