diff --git a/.gitignore b/.gitignore index 280d1a1e..0c902ce9 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ # IDEA .idea cmake-build-debug +cmake-build-release # Editor files/directories /.vscode @@ -51,3 +52,4 @@ cmake-build-debug # Other .tmp.dprobes.h libquicr.spdx + diff --git a/CMakeLists.txt b/CMakeLists.txt index ef6f47fe..c6a0bee6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,10 +13,24 @@ else() endif() project(quicr - VERSION 1.0.0.0 - DESCRIPTION "quicr library" + VERSION 1.0.0 + DESCRIPTION "QuicR, a Media over QUIC Library" LANGUAGES CXX) +configure_file( src/version.h.in ${CMAKE_BINARY_DIR}/include/quicr/version.h ) +include_directories(${CMAKE_BINARY_DIR}/include ) + +IF (NOT LINUX AND NOT APPLE) + message(FATAL_ERROR "Unsupported platform, Linux and Apple are the only supported platforms") +endif () + +set (supported_archs arm64 x86_64) +if (NOT ${CMAKE_SYSTEM_PROCESSOR} IN_LIST supported_archs) + message(FATAL_ERROR "Unsupported system architecture '${CMAKE_SYSTEM_PROCESSOR}'. Supported is arm64 and x86_64") +endif() + +message(STATUS "Building for ${CMAKE_SYSTEM_PROCESSOR}") + option(LINT "Perform linting with clang-tidy" OFF) option(QUICR_BUILD_SHARED "Build quicr as a SHARED library" OFF) option(PLATFORM_ESP_IDF "Enabble support for esp-idf (Default OFF)" OFF) diff --git a/README.md b/README.md index c09b7a03..f10e17b6 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,51 @@ libquicr An API library that implements publish/subscribe protocol [draft-ietf-moq-transport-04](https://datatracker.ietf.org/doc/html/draft-ietf-moq-transport-04). The API supports both client and server. Server is intended to be implemented as a relay. +API documentation can be found under https://quicr.github.io/libquicr + ## Build +### Dependencies + +#### Linux + +``` +sudo apt-get update && sudo apt-get install -y gcc g++ golang pkgconf cmake make +``` + +### Apple/Mac + +Both Apple Intel and Silicon are supported. + + +> #### (1) Install Xcode + +> [!NOTE] +> You **MUST** install xcode from Apple in order to get the base development programs. + + +Open the **App Store** and search for **Xcode** and install. + +#### (2) Install Xcode Command Line Tools + +You can install them via xcode UI or you can install them using `xcode-select --install` from a shell/terminal. + + +#### (3) Install Homebrew + +Install via https://brew.sh instructions. + +#### (4) Install packages via brew + +``` +brew install cmake clang-format +``` + +#### (5) Install GoLang +Golang is required for BoringSSL build. Install via https://go.dev/doc/install instructions. + +--- + ### CMake Generate the cmake build directory: @@ -42,6 +85,12 @@ Use `make cclean` to clean build files. Server requires a TLS certificate and key file. For development and testing, use a self-signed certificate. Below are the steps to create a self-signed certificate and private ey. +### Create cert under cmd/examples + +``` +make cert +``` + ### OpenSSL/BorningSSL ``` @@ -59,6 +108,8 @@ openssl req -nodes -x509 -newkey ec:<(openssl ecparam -name prime256v1) -days 36 -keyout server-key.pem -out server-cert.pem ``` +OR + ``` openssl ecparam -name prime256v1 -genkey -noout -out server-key-ec.pem openssl req -nodes -x509 -key server-key-ec.pem -days 365 \ diff --git a/cmd/examples/client.cpp b/cmd/examples/client.cpp index 27ef1302..fd8b751d 100644 --- a/cmd/examples/client.cpp +++ b/cmd/examples/client.cpp @@ -230,6 +230,11 @@ InitConfig(cxxopts::ParseResult& cli_opts, bool& enable_pub, bool& enable_sub) spdlog::set_level(spdlog::level::debug); } + if (cli_opts.count("version") && cli_opts["version"].as() == true) { + SPDLOG_INFO("QuicR library version: {}", QUICR_VERSION); + exit(0); + } + if (cli_opts.count("pub_namespace") && cli_opts.count("pub_name")) { enable_pub = true; SPDLOG_INFO("Publisher enabled using track namespace: {0} name: {1}", @@ -267,14 +272,16 @@ main(int argc, char* argv[]) { int result_code = EXIT_SUCCESS; - cxxopts::Options options("qclient", "MOQ Example Client"); + cxxopts::Options options("qclient", + std::string("MOQ Example Client using QuicR Version: ") + std::string(QUICR_VERSION)); options.set_width(75) .set_tab_expansion() //.allow_unrecognised_options() .add_options()("h,help", "Print help")("d,debug", "Enable debugging") // a bool parameter + ("v,version", "QuicR Version") // a bool parameter ("r,url", "Relay URL", cxxopts::value()->default_value("moq://localhost:1234"))( "e,endpoint_id", "This client endpoint ID", cxxopts::value()->default_value("moq-client"))( - "q,qlog", "Enable qlog using path", cxxopts::value()); // end of options + "q,qlog", "Enable qlog using path", cxxopts::value()); options.add_options("Publisher")("pub_namespace", "Track namespace", cxxopts::value())( "pub_name", "Track name", cxxopts::value())( diff --git a/cmd/examples/server.cpp b/cmd/examples/server.cpp index f664e70b..de8d0e3f 100644 --- a/cmd/examples/server.cpp +++ b/cmd/examples/server.cpp @@ -504,6 +504,11 @@ InitConfig(cxxopts::ParseResult& cli_opts) spdlog::default_logger()->set_level(spdlog::level::debug); } + if (cli_opts.count("version") && cli_opts["version"].as() == true) { + SPDLOG_INFO("QuicR library version: {}", QUICR_VERSION); + exit(0); + } + config.endpoint_id = cli_opts["endpoint_id"].as(); config.server_bind_ip = cli_opts["bind_ip"].as(); @@ -524,9 +529,11 @@ main(int argc, char* argv[]) { int result_code = EXIT_SUCCESS; - cxxopts::Options options("qclient", "MOQ Example Client"); + cxxopts::Options options("qclient", + std::string("MOQ Example Server using QuicR Version: ") + std::string(QUICR_VERSION)); options.set_width(75).set_tab_expansion().allow_unrecognised_options().add_options()("h,help", "Print help")( "d,debug", "Enable debugging") // a bool parameter + ("v,version", "QuicR Version") // a bool parameter ("b,bind_ip", "Bind IP", cxxopts::value()->default_value("127.0.0.1"))( "p,port", "Listening port", cxxopts::value()->default_value("1234"))( "e,endpoint_id", "This relay/server endpoint ID", cxxopts::value()->default_value("moq-server"))( diff --git a/include/quicr/config.h b/include/quicr/config.h index 94dcbdc8..f856b9b6 100644 --- a/include/quicr/config.h +++ b/include/quicr/config.h @@ -3,6 +3,7 @@ #pragma once +#include "quicr/version.h" #include #include diff --git a/src/version.h.in b/src/version.h.in new file mode 100644 index 00000000..40a39073 --- /dev/null +++ b/src/version.h.in @@ -0,0 +1,6 @@ +#pragma once + +#define QUICR_VERSION "@PROJECT_VERSION@" +#define QUICR_NAME "@PROJECT_NAME@" +#define QUICR_DESCRIPTION "@PROJECT_DESCRIPTION@" +