Skip to content

Commit 11973e1

Browse files
authored
Merge pull request #9 from stevenlafl/feat/linux-client
feat: Add Linux client support with cross-platform build system, fix Ctrl+C handling
2 parents 4e45434 + bf53029 commit 11973e1

29 files changed

Lines changed: 513 additions & 297 deletions

.github/workflows/build-cs2remoteconsole-client-windows.yaml

Lines changed: 0 additions & 113 deletions
This file was deleted.

.github/workflows/build-cs2remoteconsole-server-linux.yaml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/build-cs2remoteconsole-server-windows.yaml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/build.yaml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Build CS2RemoteConsole
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- 'libvconsole/**'
8+
- 'CS2RemoteConsole-client/**'
9+
- 'CS2RemoteConsole-server/**'
10+
- 'common/**'
11+
- 'CMakeLists.txt'
12+
pull_request:
13+
branches: [ master ]
14+
paths:
15+
- 'libvconsole/**'
16+
- 'CS2RemoteConsole-client/**'
17+
- 'CS2RemoteConsole-server/**'
18+
- 'common/**'
19+
- 'CMakeLists.txt'
20+
workflow_dispatch:
21+
22+
jobs:
23+
build:
24+
strategy:
25+
matrix:
26+
include:
27+
- os: ubuntu-latest
28+
os_name: linux
29+
- os: windows-latest
30+
os_name: windows
31+
32+
runs-on: ${{ matrix.os }}
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
# Linux setup
39+
- name: Install dependencies (Linux)
40+
if: matrix.os == 'ubuntu-latest'
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y libncurses-dev
44+
45+
# Windows setup
46+
- name: Add MSBuild to PATH (Windows)
47+
if: matrix.os == 'windows-latest'
48+
uses: microsoft/setup-msbuild@v2
49+
50+
- name: Set up Visual Studio shell (Windows)
51+
if: matrix.os == 'windows-latest'
52+
uses: egor-tensin/vs-shell@v2
53+
with:
54+
arch: x64
55+
56+
# Build - Linux (CMake)
57+
- name: Configure CMake (Linux)
58+
if: matrix.os == 'ubuntu-latest'
59+
run: |
60+
mkdir build
61+
cd build
62+
cmake .. -DCMAKE_BUILD_TYPE=Release
63+
64+
- name: Build (Linux)
65+
if: matrix.os == 'ubuntu-latest'
66+
run: |
67+
cd build
68+
make -j$(nproc)
69+
70+
# Build - Windows (MSBuild)
71+
- name: Build libvconsole (Windows)
72+
if: matrix.os == 'windows-latest'
73+
run: |
74+
cd libvconsole
75+
msbuild libvconsole.vcxproj /p:Configuration=Release /p:Platform=x64
76+
77+
- name: Prepare libvconsole for client (Windows)
78+
if: matrix.os == 'windows-latest'
79+
run: |
80+
if not exist "CS2RemoteConsole-client\lib" mkdir "CS2RemoteConsole-client\lib"
81+
copy "libvconsole\x64\Release\libvconsole.lib" "CS2RemoteConsole-client\lib\"
82+
shell: cmd
83+
84+
- name: Build CS2RemoteConsole-client (Windows)
85+
if: matrix.os == 'windows-latest'
86+
run: |
87+
cd CS2RemoteConsole-client
88+
msbuild CS2RemoteConsole-client.vcxproj /p:Configuration=Release /p:Platform=x64
89+
90+
- name: Build CS2RemoteConsole-server (Windows)
91+
if: matrix.os == 'windows-latest'
92+
run: |
93+
cd CS2RemoteConsole-server
94+
msbuild CS2RemoteConsole-server.vcxproj /p:Configuration=Release /p:Platform=x64
95+
96+
# Prepare artifacts - Linux
97+
- name: Prepare client artifact (Linux)
98+
if: matrix.os == 'ubuntu-latest'
99+
run: |
100+
mkdir -p artifact-client
101+
cp build/bin/CS2RemoteConsole-client artifact-client/
102+
cp CS2RemoteConsole-client/config.ini artifact-client/
103+
104+
- name: Prepare server artifact (Linux)
105+
if: matrix.os == 'ubuntu-latest'
106+
run: |
107+
mkdir -p artifact-server
108+
cp build/bin/CS2RemoteConsole-server artifact-server/
109+
110+
# Prepare artifacts - Windows
111+
- name: Prepare client artifact (Windows)
112+
if: matrix.os == 'windows-latest'
113+
run: |
114+
mkdir artifact-client
115+
copy "CS2RemoteConsole-client\x64\Release\CS2RemoteConsole-client.exe" "artifact-client\"
116+
copy "CS2RemoteConsole-client\config.ini" "artifact-client\"
117+
shell: cmd
118+
119+
- name: Prepare server artifact (Windows)
120+
if: matrix.os == 'windows-latest'
121+
run: |
122+
mkdir artifact-server
123+
copy "CS2RemoteConsole-server\x64\Release\CS2RemoteConsole-server.exe" "artifact-server\"
124+
shell: cmd
125+
126+
# Upload artifacts
127+
- name: Upload client artifact
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: CS2RemoteConsole-client-${{ matrix.os_name }}
131+
path: artifact-client
132+
133+
- name: Upload server artifact
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: CS2RemoteConsole-server-${{ matrix.os_name }}
137+
path: artifact-server

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ x86/
3535
[Aa][Rr][Mm]/
3636
[Aa][Rr][Mm]64/
3737
bld/
38+
build/
3839
[Bb]in/
3940
[Oo]bj/
4041
[Ll]og/

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(CS2RemoteConsole VERSION 1.0.0 LANGUAGES CXX)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
# Build options
8+
option(BUILD_CLIENT "Build the CS2RemoteConsole client" ON)
9+
option(BUILD_SERVER "Build the CS2RemoteConsole server" ON)
10+
11+
# Add subdirectories
12+
add_subdirectory(libvconsole)
13+
14+
if(BUILD_CLIENT)
15+
add_subdirectory(CS2RemoteConsole-client)
16+
endif()
17+
18+
if(BUILD_SERVER)
19+
add_subdirectory(CS2RemoteConsole-server)
20+
endif()

0 commit comments

Comments
 (0)