add versioning info

dev
4yn 2021-05-05 15:52:01 +08:00
parent 4a189cfb01
commit 3097ea5235
9 changed files with 91 additions and 47 deletions

View File

@ -4,47 +4,59 @@ name: Build
on: on:
push: push:
branches: [gh-actions] branches: dev
pull_request:
branches: [gh-actions]
jobs: jobs:
windows_build: windows_build:
name: Windows build name: Windows build
runs-on: windows-latest runs-on: windows-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')" if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Cache vcpkg - name: Cache vcpkg
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: vcpkg path: vcpkg
key: ${{ runner.os }}-vcpkg-${{ hashFiles('build.windows') }} key: ${{ runner.os }}-vcpkg-${{ hashFiles('build.windows') }}
- name: vcpkg - name: vcpkg
run: | run: |
if(!(Test-Path .\vcpkg)) if(!(Test-Path .\vcpkg))
{ {
git clone https://github.com/microsoft/vcpkg.git git clone https://github.com/microsoft/vcpkg.git
cd vcpkg cd vcpkg
.\bootstrap-vcpkg.bat .\bootstrap-vcpkg.bat
.\vcpkg.exe integrate install .\vcpkg.exe integrate install
.\vcpkg.exe install '@${{ github.workspace }}/build.windows' .\vcpkg.exe install '@${{ github.workspace }}/build.windows'
} }
- name: cmake - name: cmake
run: cmake -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake -G "Visual Studio 16 2019" -A x64 . run: cmake -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake -G "Visual Studio 16 2019" -A x64 .
- name: Setup MSBuild.exe - name: Setup MSBuild.exe
uses: microsoft/Setup-MSBuild@v1.0.2 uses: microsoft/Setup-MSBuild@v1.0.2
- name: MSBuild - name: MSBuild
run: msbuild brokenithm-kb.sln -p:Configuration=Release /m /verbosity:minimal run: msbuild brokenithm-kb.sln -p:Configuration=Release /m /verbosity:minimal
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
with: with:
name: Game name: brokenithm-kb
path: bin path: bin
- name: Zip release
if: startsWith(github.ref, 'refs/tags/v')
uses: montudor/action-zip@v1
with:
args: zip -qq -r brokenithm-kb.zip zip
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
uses: marvinpinto/action-automatic-releases@v1.1.2
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: true
files: brokenithm-kb.zip

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
.vs/ .vs/
build/ build/
res/chart/*
!res/chart/.gitkeep
dist/ dist/
src/src/version.rc

View File

@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
set(CMAKE_SYSTEM_VERSION "10.0.18362") set(CMAKE_SYSTEM_VERSION "10.0.19041")
# set(CMAKE_SYSTEM_VERSION "10.0.19041")
project(brokenithm-kb VERSION 0.2.0) project(brokenithm-kb VERSION 0.1.1)
message("Using kit " "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") message("Using kit " "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")

View File

@ -2,6 +2,12 @@ add_subdirectory(Vendor)
set(SRCROOT ${CMAKE_CURRENT_SOURCE_DIR}/src/) set(SRCROOT ${CMAKE_CURRENT_SOURCE_DIR}/src/)
# Inject version number
configure_file(
${SRCROOT}/version.rc.in
${SRCROOT}/version.rc
@ONLY)
file(GLOB SRC "${SRCROOT}/*.cpp" "${SRCROOT}/*.hpp" "${SRCROOT}/*.rc") file(GLOB SRC "${SRCROOT}/*.cpp" "${SRCROOT}/*.hpp" "${SRCROOT}/*.rc")
source_group("Sources" FILES ${SRC}) source_group("Sources" FILES ${SRC})
@ -17,5 +23,5 @@ target_link_libraries(brokenithm-kb PRIVATE uws optparse spdlog)
add_custom_command( add_custom_command(
TARGET brokenithm-kb POST_BUILD TARGET brokenithm-kb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res/ $<TARGET_FILE_DIR:brokenithm-kb>/res/ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res/ $<TARGET_FILE_DIR:brokenithm-kb>/res/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/scripts/ $<TARGET_FILE_DIR:brokenithm-kb>/ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/static/ $<TARGET_FILE_DIR:brokenithm-kb>/
) )

View File

@ -5,6 +5,8 @@
#include "KeyboardSimulator.hpp" #include "KeyboardSimulator.hpp"
#include "Utils.hpp" #include "Utils.hpp"
#include "version.rc"
std::string banner = R"( std::string banner = R"(
_ _ _ _ _ _ _ _ _ _ _ _ _ _
| |__ _ __ ___ | | _____ _ __ (_) |_| |__ _ __ ___ | | _| |__ | |__ _ __ ___ | | _____ _ __ (_) |_| |__ _ __ ___ | | _| |__
@ -12,8 +14,7 @@ std::string banner = R"(
| |_) | | | (_) | < __/ | | | | |_| | | | | | | | |_____| <| |_) | | |_) | | | (_) | < __/ | | | | |_| | | | | | | | |_____| <| |_) |
|_.__/|_| \___/|_|\_\___|_| |_|_|\__|_| |_|_| |_| |_| |_|\_\_.__/ |_.__/|_| \___/|_|\_\___|_| |_|_|\__|_| |_|_| |_| |_| |_|\_\_.__/
======================================================================= =======================================================================
Brokenithm controller for keyboard output, by github/@4yn Brokenithm controller for keyboard output, by @4yn, v)" VERSION_STRING;
)";
std::string epilog = R"( std::string epilog = R"(
Open the URL displayed on a touch-enabled device (big iPads recommended) Open the URL displayed on a touch-enabled device (big iPads recommended)
@ -24,13 +25,13 @@ correct firewall access is granted.
Built for use with simulators like Seaurchin and SUSPlayer. Built for use with simulators like Seaurchin and SUSPlayer.
Keyboard output follows the Yuancon specification. Keyboard output follows the Yuancon specification.
Find more options with: ./brokenithm-kb.exe -h Read more at https://github.com/4yn/brokenithm-kb)";
)";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
optparse::OptionParser parser = optparse::OptionParser() optparse::OptionParser parser = optparse::OptionParser()
.description(banner.substr(1)) .description(banner.substr(1))
.version(VERSION_STRING)
.epilog(epilog.substr(1)); .epilog(epilog.substr(1));
parser.add_option("-p", "--port").dest("port").type("int").set_default(1116).help("Port to listen on (1-65535)"); parser.add_option("-p", "--port").dest("port").type("int").set_default(1116).help("Port to listen on (1-65535)");

View File

@ -0,0 +1 @@
#define VERSION_STRING "@PROJECT_VERSION@"

26
static/README.txt 100644
View File

@ -0,0 +1,26 @@
_ _ _ _ _ _ _
| |__ _ __ ___ | | _____ _ __ (_) |_| |__ _ __ ___ | | _| |__
| '_ \| '__/ _ \| |/ / _ \ '_ \| | __| '_ \| '_ ` _ \ _____| |/ / '_ \
| |_) | | | (_) | < __/ | | | | |_| | | | | | | | |_____| <| |_) |
|_.__/|_| \___/|_|\_\___|_| |_|_|\__|_| |_|_| |_| |_| |_|\_\_.__/
=======================================================================
Brokenithm controller for keyboard output, by @4yn
Open the URL displayed on a touch-enabled device (big iPads recommended)
connected to the same wifi access point as your windows machine.
Running a hotspot from your windows machine also works. Make sure
correct firewall access is granted.
Built for use with simulators like Seaurchin and SUSPlayer.
Keyboard output follows the Yuancon specification.
Read more at https://github.com/4yn/brokenithm-kb
CHANGELOG
=========
v0.1.1
- Removed openssl/zlib bloat
v0.1
- Initial release