Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.
Closed
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
162 changes: 162 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Build ConnectTool

on:
push:
paths-ignore:
- "docs/**"
- "README.md"
- ".github/ISSUE_TEMPLATE/**"
tags:
- "v*"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BUILD_TYPE: Release

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: Windows-x64
steam_lib: steam_api64.dll
steam_lib_path: win64/steam_api64.dll
artifact_ext: .exe
- os: ubuntu-latest
name: Linux-x64
steam_lib: libsteam_api.so
steam_lib_path: linux64/libsteam_api.so
artifact_ext: ""
- os: macos-latest
name: macOS
steam_lib: libsteam_api.dylib
steam_lib_path: osx/libsteam_api.dylib
artifact_ext: ""

runs-on: ${{ matrix.os }}
name: Build (${{ matrix.name }})

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache vcpkg (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
C:\vcpkg\installed
~\AppData\Local\vcpkg\archives
key: vcpkg-windows-x64-static-${{ hashFiles('CMakeLists.txt') }}
restore-keys: vcpkg-windows-x64-static-

- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
vcpkg integrate install
vcpkg install glfw3:x64-windows-static boost-asio:x64-windows-static
env:
VCPKG_ROOT: C:\vcpkg

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libglfw3-dev libboost-all-dev libgl1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install glfw boost

- name: Download Steamworks SDK
shell: bash
run: |
SDK_URL="${{ secrets.STEAMWORKS_SDK_URL }}"
if [ -z "$SDK_URL" ]; then echo "::error::STEAMWORKS_SDK_URL secret not set"; exit 1; fi
curl -fSLo steamworks_sdk.zip "$SDK_URL"
unzip -q steamworks_sdk.zip -d steamworks_temp
mkdir -p steamworks
if [ -d "steamworks_temp/sdk" ]; then cp -r steamworks_temp/sdk/* steamworks/; else cp -r steamworks_temp/* steamworks/; fi
rm -rf steamworks_sdk.zip steamworks_temp

- name: Verify Steamworks SDK
shell: bash
run: |
[ -d "steamworks/public/steam" ] || { echo "::error::Steamworks SDK headers not found"; exit 1; }
[ -f "steamworks/redistributable_bin/${{ matrix.steam_lib_path }}" ] || { echo "::error::${{ matrix.steam_lib }} not found"; exit 1; }

- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static

- name: Configure CMake (Unix)
if: runner.os != 'Windows'
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}

- name: Build
run: cmake --build build --config ${{ env.BUILD_TYPE }}

- name: Prepare artifacts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "artifacts"
$buildDir = "build/${{ env.BUILD_TYPE }}"
if (Test-Path "$buildDir/ConnectTool.exe") { Copy-Item "$buildDir/ConnectTool.exe" -Destination "artifacts/" }
if (Test-Path "$buildDir/steam_api64.dll") { Copy-Item "$buildDir/steam_api64.dll" -Destination "artifacts/" }
if (Test-Path "$buildDir/steam_appid.txt") { Copy-Item "$buildDir/steam_appid.txt" -Destination "artifacts/" }
Copy-Item "C:\Windows\Fonts\msyh.ttc" -Destination "artifacts/font.ttf"

- name: Prepare artifacts (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y fonts-noto-cjk
mkdir -p artifacts
[ -f "build/ConnectTool" ] && cp build/ConnectTool artifacts/ && chmod +x artifacts/ConnectTool
[ -f "build/${{ matrix.steam_lib }}" ] && cp build/${{ matrix.steam_lib }} artifacts/
[ -f "build/steam_appid.txt" ] && cp build/steam_appid.txt artifacts/
cp /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc artifacts/font.ttf

- name: Prepare artifacts (macOS)
if: runner.os == 'macOS'
run: |
mkdir -p artifacts
[ -f "build/ConnectTool" ] && cp build/ConnectTool artifacts/ && chmod +x artifacts/ConnectTool
[ -f "build/${{ matrix.steam_lib }}" ] && cp build/${{ matrix.steam_lib }} artifacts/
[ -f "build/steam_appid.txt" ] && cp build/steam_appid.txt artifacts/
curl -L "https://github.com/googlefonts/noto-cjk/raw/main/Sans/OTF/SimplifiedChinese/NotoSansCJKsc-Regular.otf" -o artifacts/font.ttf

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ConnectTool-${{ matrix.name }}
path: artifacts/
retention-days: 30

- name: Create release archive
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
cd artifacts
if [ "${{ runner.os }}" == "Windows" ]; then
7z a -tzip ../ConnectTool-${{ matrix.name }}.zip *
else
zip -r ../ConnectTool-${{ matrix.name }}.zip *
fi

- name: Upload to Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: ConnectTool-${{ matrix.name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "imgui"]
path = imgui
url = https://github.com/ocornut/imgui.git

[submodule "nanoid_cpp"]
path = nanoid_cpp
url = https://github.com/mcmikecreations/nanoid_cpp.git
25 changes: 17 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ project(ConnectTool)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Use UTF-8 encoding for MSVC to handle Chinese characters
if(MSVC)
add_compile_options(/utf-8)
endif()

# Find packages
find_package(OpenGL REQUIRED)
find_package(glfw3 REQUIRED)
find_package(Boost REQUIRED)

# Use static linking for glfw on all platforms
set(GLFW_LIBRARY glfw)

# Include directories
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/imgui)
Expand Down Expand Up @@ -54,10 +62,11 @@ endfunction()

# Platform-specific Steam API linking
if(WIN32)
# Windows 64-bit
find_steam_api(STEAM_API_LIB "win64/steam_api64.dll")
# Windows 64-bit - link against .lib, copy .dll at runtime
find_steam_api(STEAM_API_LIB "win64/steam_api64.lib")
find_steam_api(STEAM_API_DLL "win64/steam_api64.dll")
target_link_libraries(ConnectTool
glfw
${GLFW_LIBRARY}
OpenGL::GL
Boost::headers
${STEAM_API_LIB}
Expand All @@ -66,7 +75,7 @@ if(WIN32)
# Copy steam_api64.dll to output directory for runtime
add_custom_command(TARGET ConnectTool POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${STEAM_API_LIB}
${STEAM_API_DLL}
$<TARGET_FILE_DIR:ConnectTool>/steam_api64.dll
)
elseif(UNIX AND NOT APPLE)
Expand All @@ -75,7 +84,7 @@ elseif(UNIX AND NOT APPLE)
# x86_64 Linux
find_steam_api(STEAM_API_LIB "linux64/libsteam_api.so")
target_link_libraries(ConnectTool
glfw
${GLFW_LIBRARY}
OpenGL::GL
Boost::headers
${STEAM_API_LIB}
Expand All @@ -90,7 +99,7 @@ elseif(UNIX AND NOT APPLE)
# x86 32-bit Linux
find_steam_api(STEAM_API_LIB "linux32/libsteam_api.so")
target_link_libraries(ConnectTool
glfw
${GLFW_LIBRARY}
OpenGL::GL
Boost::headers
${STEAM_API_LIB}
Expand All @@ -105,7 +114,7 @@ elseif(UNIX AND NOT APPLE)
# ARM64 Linux
find_steam_api(STEAM_API_LIB "linuxarm64/libsteam_api.so")
target_link_libraries(ConnectTool
glfw
${GLFW_LIBRARY}
OpenGL::GL
Boost::headers
${STEAM_API_LIB}
Expand All @@ -123,7 +132,7 @@ elseif(APPLE)
# macOS
find_steam_api(STEAM_API_LIB "osx/libsteam_api.dylib")
target_link_libraries(ConnectTool
glfw
${GLFW_LIBRARY}
OpenGL::GL
Boost::headers
${STEAM_API_LIB}
Expand Down