Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libssl-dev
sudo apt-get install -y libcurl4-openssl-dev libssl-dev nlohmann-json3-dev

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install openssl@3
run: brew install openssl@3 nlohmann-json

- name: Install OpenSSL (Windows)
if: runner.os == 'Windows'
Expand All @@ -42,7 +42,7 @@ jobs:
if: runner.os == 'Windows'
shell: bash
run: |
"$VCPKG_INSTALLATION_ROOT/vcpkg" install --triplet x64-windows curl
"$VCPKG_INSTALLATION_ROOT/vcpkg" install --triplet x64-windows curl nlohmann-json

- name: Configure (Ubuntu)
if: runner.os == 'Linux'
Expand All @@ -69,3 +69,32 @@ jobs:

- name: Test
run: ctest --test-dir build --output-on-failure -C Release

- name: Install package
run: cmake --install build --prefix "${{ github.workspace }}/install" --config Release

- name: Configure consumer smoke (Ubuntu)
if: runner.os == 'Linux'
run: |
cmake -S tests/consumer_smoke -B consumer-build \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install"

- name: Configure consumer smoke (macOS)
if: runner.os == 'macOS'
run: |
cmake -S tests/consumer_smoke -B consumer-build \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" \
-DOPENSSL_ROOT_DIR="$(brew --prefix openssl@3)"

- name: Configure consumer smoke (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cmake -S tests/consumer_smoke -B consumer-build \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=x64-windows \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" \
-DOPENSSL_ROOT_DIR="C:/Program Files/OpenSSL"

- name: Build consumer smoke
run: cmake --build consumer-build --config Release
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ project(moonbase_cpp
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

option(MOONBASE_BUILD_TESTS "Build Moonbase C++ SDK tests" ON)
option(MOONBASE_BUILD_EXAMPLES "Build Moonbase C++ SDK examples" ON)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(MOONBASE_IS_TOP_LEVEL ON)
else()
set(MOONBASE_IS_TOP_LEVEL OFF)
endif()

option(MOONBASE_BUILD_TESTS "Build Moonbase C++ SDK tests" ${MOONBASE_IS_TOP_LEVEL})
option(MOONBASE_BUILD_EXAMPLES "Build Moonbase C++ SDK examples" ${MOONBASE_IS_TOP_LEVEL})
option(MOONBASE_BUILD_JUCE_EXAMPLE
"Build the JUCE bridge example (fetches JUCE; off by default)" OFF)

Expand Down Expand Up @@ -90,6 +96,7 @@ if(MOONBASE_BUILD_TESTS)
tests/main.cpp
tests/client_tests.cpp
tests/fingerprint_tests.cpp
tests/header_smoke_tests.cpp
tests/licensing_tests.cpp
tests/process_dedup_tests.cpp
tests/store_tests.cpp
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ The build provides three options, all useful when consuming the SDK as a subproj

| Option | Default | Purpose |
| --- | --- | --- |
| `MOONBASE_BUILD_TESTS` | `ON` | Build the doctest-based unit and live tests. |
| `MOONBASE_BUILD_EXAMPLES` | `ON` | Build the standalone activation example under `examples/`. |
| `MOONBASE_BUILD_TESTS` | `ON` for the top-level project, `OFF` as a subproject | Build the doctest-based unit and live tests. |
| `MOONBASE_BUILD_EXAMPLES` | `ON` for the top-level project, `OFF` as a subproject | Build the standalone activation example under `examples/`. |
| `MOONBASE_BUILD_JUCE_EXAMPLE` | `OFF` | Fetch JUCE and build the JUCE bridge example (see below). |

Set `MOONBASE_BUILD_TESTS` and `MOONBASE_BUILD_EXAMPLES` to `OFF` when integrating via `add_subdirectory` or `FetchContent` to avoid building artifacts you don't need.
Override `MOONBASE_BUILD_TESTS` and `MOONBASE_BUILD_EXAMPLES` explicitly when you want a subproject integration to build SDK artifacts too.

## Basic Usage

Expand All @@ -72,6 +72,8 @@ options.endpoint = "https://demo.moonbase.sh";
options.product_id = "demo-app";
options.public_key = public_key_pem;
options.account_id = "tenant-id"; // optional issuer check
options.http_connect_timeout = std::chrono::seconds(10);
options.http_request_timeout = std::chrono::seconds(30);

moonbase::licensing licensing(options);

Expand Down Expand Up @@ -156,7 +158,9 @@ The default fingerprint provider builds a stable, native hardware fingerprint
from platform identity parameters such as SMBIOS fields on Windows,
`IOPlatformUUID` on macOS, and board/BIOS/CPU fields on Linux. Use a custom
`fingerprint_provider` when you need an exact legacy fingerprint or any other
application-specific device ID.
application-specific device ID. If you include narrow SDK headers instead of
`<moonbase/moonbase.hpp>`, include `<moonbase/default_fingerprint.hpp>` for the
native provider and `<moonbase/http_curl.hpp>` for the default CURL transport.

## JUCE Plugins

Expand Down
4 changes: 2 additions & 2 deletions docs/juce.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ through the existing `PropertiesFile` you used for the JUCE flow.

## CMake note

The SDK's standard build (`MOONBASE_BUILD_EXAMPLES=ON`) does not pull in
JUCE — only the small `examples/activation.cpp` is compiled. JUCE is only
The SDK's top-level example build (`MOONBASE_BUILD_EXAMPLES=ON`) does not pull
in JUCE — only the small `examples/activation.cpp` is compiled. JUCE is only
fetched when you opt in with `-DMOONBASE_BUILD_JUCE_EXAMPLE=ON` (see
above), or when you integrate `MoonbaseJuceBridge.h` into your own
JUCE/Projucer/CMake project alongside `target_link_libraries(your_target
Expand Down
8 changes: 8 additions & 0 deletions include/moonbase/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ class license_client {
request.method = "POST";
request.url = url;
request.headers = detail::default_headers("application/json");
request.connect_timeout = options_.http_connect_timeout;
request.request_timeout = options_.http_request_timeout;
request.body = payload.dump();

const auto response = transport_->send(request);
Expand All @@ -192,6 +194,8 @@ class license_client {
request.method = "POST";
request.url = url;
request.headers = detail::default_headers("text/plain");
request.connect_timeout = options_.http_connect_timeout;
request.request_timeout = options_.http_request_timeout;
request.body = std::string(token);

const auto response = transport_->send(request);
Expand All @@ -211,6 +215,8 @@ class license_client {
request.method = "POST";
request.url = url;
request.headers = detail::default_headers("text/plain");
request.connect_timeout = options_.http_connect_timeout;
request.request_timeout = options_.http_request_timeout;
request.body = std::string(token);

const auto response = transport_->send(request);
Expand All @@ -226,6 +232,8 @@ class license_client {
request.method = "GET";
request.url = activation.request_url;
request.headers = detail::default_headers();
request.connect_timeout = options_.http_connect_timeout;
request.request_timeout = options_.http_request_timeout;

const auto response = transport_->send(request);
if (response.status_code == 204 || response.status_code == 404) {
Expand Down
Loading
Loading