-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
foxglove-websocket: add version 0.0.1 #8662
Changes from 6 commits
7bd4e2c
dde284f
4e86e50
7b02355
42b672f
d6b38c8
e74d211
786c853
5db6087
60416ef
6896162
db6ff52
86b5dea
97ed9ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
0.0.1: | ||
url: https://github.com/foxglove/ws-protocol/archive/refs/tags/releases/cpp/v0.0.1.tar.gz | ||
sha256: 94766f44973f0c0ce7e87039b9ef9d5b4a8bc73727047568170ac61262625c9b |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
|
||
class FoxgloveWebSocketConan(ConanFile): | ||
name = "foxglove-websocket" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/foxglove/ws-protocol" | ||
description = "A C++ server implementation of the Foxglove WebSocket Protocol" | ||
license = "MIT" | ||
topics = ("foxglove", "websocket") | ||
|
||
settings = ("os", "compiler", "build_type", "arch") | ||
requires = ("nlohmann_json/3.10.5", "websocketpp/0.8.2") | ||
generators = "cmake" | ||
|
||
_source_root = "source_root" | ||
_source_package_path = os.path.join(_source_root, "cpp", "foxglove-websocket") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_root) | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
tools.check_min_cppstd(self, "17") | ||
if (self.settings.compiler == "gcc" or self.settings.compiler == "clang") and tools.Version(self.settings.compiler.version) <= 5: | ||
raise ConanInvalidConfiguration("Compiler version is not supported, c++17 support is required") | ||
|
||
def configure(self): | ||
self.options["websocketpp"].asio = "standalone" | ||
|
||
def package(self): | ||
self.copy("LICENSE", dst="licenses", src=self._source_package_path) | ||
self.copy("include/*", src=self._source_package_path) | ||
|
||
def package_id(self): | ||
self.info.header_only() |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,8 @@ | ||||
cmake_minimum_required(VERSION 3.1) | ||||
project(test_package CXX) | ||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||||
conan_basic_setup() | ||||
|
||||
add_executable(test_package test_package.cpp) | ||||
target_link_libraries(test_package ${CONAN_LIBS}) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking quickly you'll need to configure C++17 here ... here's an example
I'll take a better look tomorrow of theres anything else I can find There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that helped for setting the language standard but still running into problems with the standard library version. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = ("os", "arch", "compiler", "build_type") | ||
generators = "cmake" | ||
jtbandes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <string_view> | ||
#include <foxglove/websocket/server.hpp> | ||
|
||
int main() { | ||
foxglove::websocket::Server server{0, "example"}; | ||
server.getEndpoint().set_timer(0, [&](std::error_code const& ec) { | ||
server.stop(); | ||
}); | ||
server.run(); | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
0.0.1: | ||
folder: all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. The default value is "boost", without it, this package would be invalid.