Skip to content

Commit dbeac02

Browse files
committed
Add cross-platform Linux support
- Add CMake build system for native C++ library (Linux) - Update C# project for cross-platform native library loading - Add build scripts for Windows and Linux - Add GitHub Actions CI/CD workflow - Add documentation (BUILD.md, QUICKSTART.md) - Add pre-commit hooks for code quality - Add .editorconfig and .gitattributes for consistent formatting
1 parent 18c10e4 commit dbeac02

22 files changed

Lines changed: 1286 additions & 53 deletions

.editorconfig

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# EditorConfig - consistent coding styles across editors
2+
# https://editorconfig.org
3+
4+
root = true
5+
6+
# Default settings for all files
7+
[*]
8+
indent_style = space
9+
indent_size = 4
10+
end_of_line = lf
11+
charset = utf-8
12+
trim_trailing_whitespace = true
13+
insert_final_newline = true
14+
15+
# C# files
16+
[*.cs]
17+
indent_size = 4
18+
dotnet_sort_system_directives_first = true
19+
20+
# C# formatting
21+
csharp_new_line_before_open_brace = all
22+
csharp_new_line_before_else = true
23+
csharp_new_line_before_catch = true
24+
csharp_new_line_before_finally = true
25+
csharp_indent_case_contents = true
26+
csharp_indent_switch_labels = true
27+
csharp_space_after_cast = false
28+
csharp_space_after_keywords_in_control_flow_statements = true
29+
30+
# C++ files
31+
[*.{cpp,h,hpp}]
32+
indent_size = 4
33+
34+
# CMake files
35+
[CMakeLists.txt]
36+
indent_size = 4
37+
38+
[*.cmake]
39+
indent_size = 4
40+
41+
# Shell scripts (must be LF)
42+
[*.sh]
43+
end_of_line = lf
44+
45+
# Windows batch/PowerShell (must be CRLF)
46+
[*.{bat,cmd,ps1}]
47+
end_of_line = crlf
48+
49+
# JSON files
50+
[*.json]
51+
indent_size = 2
52+
53+
# YAML files
54+
[*.{yaml,yml}]
55+
indent_size = 2
56+
57+
# Markdown
58+
[*.md]
59+
trim_trailing_whitespace = false
60+
61+
# XML/csproj files
62+
[*.{xml,csproj,vcxproj}]
63+
indent_size = 2

.gitattributes

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Source code - use LF
5+
*.cs text eol=lf
6+
*.cpp text eol=lf
7+
*.h text eol=lf
8+
*.csproj text eol=lf
9+
*.sln text eol=lf
10+
*.json text eol=lf
11+
*.yaml text eol=lf
12+
*.yml text eol=lf
13+
*.md text eol=lf
14+
*.txt text eol=lf
15+
16+
# Shell scripts - must use LF
17+
*.sh text eol=lf
18+
19+
# Windows batch files - must use CRLF
20+
*.bat text eol=crlf
21+
*.cmd text eol=crlf
22+
*.ps1 text eol=crlf
23+
24+
# Binary files
25+
*.dll binary
26+
*.exe binary
27+
*.so binary
28+
*.png binary
29+
*.jpg binary
30+
*.ico binary
31+
32+
# Visual Studio files
33+
*.vcxproj text eol=crlf
34+
*.vcxproj.filters text eol=crlf

.github/workflows/build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-linux:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
with:
18+
submodules: recursive
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v3
22+
with:
23+
dotnet-version: '7.0.x'
24+
25+
- name: Install dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y build-essential cmake
29+
30+
- name: Build project
31+
run: |
32+
chmod +x build-linux.sh
33+
./build-linux.sh Release
34+
35+
- name: Upload artifacts
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: linux-module
39+
path: SLVRCFT/SLExtTrackingModule/bin/Release/net7.0/
40+
41+
build-windows:
42+
runs-on: windows-latest
43+
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v3
47+
with:
48+
submodules: recursive
49+
50+
- name: Setup .NET
51+
uses: actions/setup-dotnet@v3
52+
with:
53+
dotnet-version: '7.0.x'
54+
55+
- name: Setup MSBuild
56+
uses: microsoft/setup-msbuild@v1.1
57+
58+
- name: Build project
59+
run: |
60+
.\build-windows.ps1 -BuildType Release
61+
62+
- name: Upload artifacts
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: windows-module
66+
path: SLVRCFT\SLExtTrackingModule\bin\Release\net7.0\

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ msbuild.err
1414
msbuild.wrn
1515

1616
*.vcxproj.user
17-
*.vcxproj.filters
17+
*.vcxproj.filters

.pre-commit-config.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Pre-commit hooks configuration
2+
# Install: pip install pre-commit && pre-commit install
3+
# Run manually: pre-commit run --all-files
4+
5+
repos:
6+
# General hooks
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v4.5.0
9+
hooks:
10+
- id: trailing-whitespace
11+
args: [--markdown-linebreak-ext=md]
12+
- id: end-of-file-fixer
13+
- id: check-yaml
14+
- id: check-json
15+
- id: check-added-large-files
16+
args: ['--maxkb=1000']
17+
- id: check-merge-conflict
18+
- id: mixed-line-ending
19+
args: ['--fix=lf']
20+
exclude: '\.bat$'
21+
- id: mixed-line-ending
22+
args: ['--fix=crlf']
23+
files: '\.bat$'
24+
25+
# .NET / C# formatting (only for SLVRCFT project, not submodules)
26+
- repo: local
27+
hooks:
28+
- id: dotnet-format
29+
name: dotnet format
30+
entry: dotnet format SLVRCFT/SLExtTrackingModule/SLExtTrackingModule.csproj --verify-no-changes --no-restore
31+
language: system
32+
files: 'SLVRCFT/.*\.cs$'
33+
pass_filenames: false
34+
35+
# Shell script linting
36+
- repo: https://github.com/shellcheck-py/shellcheck-py
37+
rev: v0.9.0.6
38+
hooks:
39+
- id: shellcheck
40+
files: '\.sh$'
41+
42+
# CMake formatting
43+
- repo: https://github.com/cheshirekow/cmake-format-precommit
44+
rev: v0.6.13
45+
hooks:
46+
- id: cmake-format
47+
additional_dependencies: [pyyaml>=5.1]

0 commit comments

Comments
 (0)