Skip to content
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

next release candidate 1.1.0 #11

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
build-and-test:
Expand All @@ -28,7 +29,7 @@ jobs:
chmod +x ./build/test/tests

- name: Integration tests
working-directory: ${{github.workspace}}/tools
working-directory: ${{github.workspace}}/test/webthing-tester
run: |
chmod +x ./run-webthing-tester.sh
./run-webthing-tester.sh
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
build-and-test:
Expand All @@ -28,7 +29,7 @@ jobs:
chmod +x ./build/test/tests

- name: Integration tests
working-directory: ${{github.workspace}}/tools
working-directory: ${{github.workspace}}/test/webthing-tester
run: |
chmod +x ./run-webthing-tester.sh
./run-webthing-tester.sh
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
build-and-test:
Expand All @@ -30,7 +31,7 @@ jobs:
.\build.bat clean release

- name: Integration tests
working-directory: .\tools
working-directory: .\test\webthing-tester
run: |
python run-webthing-tester-windows.py

Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build/
lib/
tools/bruno/
tools/vcpkg/
tools/webthing-tester/
test/webthing-tester/webthing-tester/
test/webthing-tester/webthing-tester-venv/
.vscode/
todo.md
todo*
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
cmake_minimum_required(VERSION 3.1)
cmake_policy(SET CMP0091 NEW)
project(Webthing-CPP VERSION 1.0.5 DESCRIPTION "Webthing implementation for C++" LANGUAGES CXX)

message(STATUS "Read contents from vcpkg.json")
file(READ "${CMAKE_SOURCE_DIR}/vcpkg.json" VCPKG_JSON_CONTENT)

message(STATUS "Extract version from vcpkg.json")
string(REGEX MATCH "\"version-string\"[ \t]*:[ \t]*\"([^\"]+)\"" VERSION_MATCH "${VCPKG_JSON_CONTENT}")
if (VERSION_MATCH)
string(REGEX REPLACE "\"version-string\"[ \t]*:[ \t]*\"([^\"]+)\"" "\\1" WEBTHING_CPP_VERSION "${VERSION_MATCH}")
message(STATUS "Extracted version from vcpkg.json: ${WEBTHING_CPP_VERSION}")
else()
message(FATAL_ERROR "Could not extract version from vcpkg.json")
endif()

message(STATUS "Generate version.hpp using version: ${WEBTHING_CPP_VERSION}")
configure_file(
"${CMAKE_SOURCE_DIR}/tools/templates/version.hpp.in"
"${CMAKE_SOURCE_DIR}/include/bw/webthing/version.hpp"
)

project(Webthing-CPP VERSION ${WEBTHING_CPP_VERSION} DESCRIPTION "Webthing-CPP a modern CPP implementation of the WebThings API." LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)

if(WIN32)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Webthing-CPP is licensed under the MIT License

Copyright (c) 2023-2024 Benno Waldhauer
Copyright (c) 2023-present Benno Waldhauer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ echo Project SSL support: %ssl_support%
copy %vcpkg_file% vcpkg.json

cmake -B "%build_dir%" -S . -DWT_WITH_SSL=%ssl_support% -DCMAKE_BUILD_TYPE=%build_type% -DCMAKE_TOOLCHAIN_FILE="%toolchain_file%" -DVCPKG_TARGET_TRIPLET="%vcpkg_triplet%" -G "Visual Studio 17 2022" -A "%build_arch%"
cmake --build "%build_dir%" --config "%build_type%"
cmake --build "%build_dir%" --config "%build_type%" --parallel %NUMBER_OF_PROCESSORS%

ctest --test-dir "%build_dir%\test\"
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ cp $vcpkg_file vcpkg.json


cmake -B build -S . -D"WT_WITH_SSL=$ssl_support" -D"CMAKE_BUILD_TYPE=$build_type" -D"CMAKE_TOOLCHAIN_FILE=$toolchain_file" -D"CMAKE_MAKE_PROGRAM:PATH=make" -D"CMAKE_CXX_COMPILER=g++"
cmake --build build
cmake --build build --parallel $(nproc)

ctest --test-dir build/test/
8 changes: 8 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
message(STATUS "Generate gui-html.hpp using gui.html content")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gui.html)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/gui.html" GUI_HTML_CONTENT)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/gui-html.hpp.in"
"${CMAKE_CURRENT_SOURCE_DIR}/gui-html.hpp"
)

set(LIBS_FOR_EXAMPLES
${LIBUSOCKETS_STATIC}
nlohmann_json::nlohmann_json
Expand Down
7 changes: 4 additions & 3 deletions examples/gui-html.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// SPDX-FileCopyrightText: 2023-present Benno Waldhauer
// SPDX-License-Identifier: MIT

// This is a CMake generated file. DO NOT EDIT.

#pragma once

constexpr char gui_html[] = R"""(
<!doctype html>
constexpr char gui_html[] = R"""(<!doctype html>
<html lang="en">
<head>
<title>Slot Machine GUI</title>
Expand Down Expand Up @@ -399,4 +400,4 @@ constexpr char gui_html[] = R"""(
</div>
</body>
</html>
)""";
)""";
9 changes: 9 additions & 0 deletions examples/gui-html.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Webthing-CPP
// SPDX-FileCopyrightText: 2023-present Benno Waldhauer
// SPDX-License-Identifier: MIT

// This is a CMake generated file. DO NOT EDIT.

#pragma once

constexpr char gui_html[] = R"""(@GUI_HTML_CONTENT@)""";
2 changes: 2 additions & 0 deletions examples/gui-thing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ auto make_gui_thing()
{
auto thing = make_thing("urn:gui-thing-123", "The WebThing Slot Machine", "SLOT_MACHINE_THING", "A slot machine thing with GUI");
thing->set_ui_href("/gui");
thing->configure_event_storage({24});
thing->configure_action_storage({42, true});

link_property(thing, "coins", slot_machine.coins_inserted, {
{"title", "coins"},
Expand Down
Loading