Skip to content
Merged
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
33 changes: 32 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,40 @@ jobs:
- name: Build
run: cmake --build build --config Release --parallel

- name: Run Tests
- name: Run Tests (Linux)
if: runner.os == 'Linux'
run: ctest --test-dir build --output-on-failure --parallel

- name: Run Tests (Windows)
if: runner.os == 'Windows'
run: ctest --test-dir build --build-config Release --output-on-failure --parallel

- name: Upload Build Artifacts (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: phantomcore-linux-x64
path: |
build/closed_loop_sim
build/latency_benchmark
build/realtime_demo
build/spike_visualizer
build/phantomcore_benchmarks
build/libphantomcore.a
retention-days: 30

- name: Upload Build Artifacts (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: phantomcore-windows-x64
path: |
build/Release/*.exe
build/Release/*.lib
build/examples/Release/*.exe
build/benchmarks/Release/*.exe
retention-days: 30

benchmarks:
name: Benchmarks
runs-on: ubuntu-latest
Expand Down
225 changes: 225 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:

jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version from tag
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: PhantomCore ${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
body: |
## PhantomCore ${{ steps.get_version.outputs.version }}

### Downloads
- **Windows**: PhantomCore-${{ steps.get_version.outputs.version }}-Windows-x64.zip
- **Linux**: PhantomCore-${{ steps.get_version.outputs.version }}-Linux-x64.tar.gz
- **macOS**: PhantomCore-${{ steps.get_version.outputs.version }}-macOS-x64.tar.gz

### Installation
1. Download the appropriate archive for your platform
2. Extract the archive
3. Add the `bin` directory to your PATH

See [README.md](https://github.com/${{ github.repository }}/blob/main/README.md) for usage instructions.

build-windows:
name: Build Windows Release
runs-on: windows-latest
needs: create-release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup CMake
uses: lukka/get-cmake@latest

- name: Configure
run: |
cmake -B build `
-G "Visual Studio 17 2022" `
-DCMAKE_BUILD_TYPE=Release `
-DPHANTOMCORE_BUILD_TESTS=OFF `
-DPHANTOMCORE_BUILD_EXAMPLES=ON `
-DPHANTOMCORE_BUILD_BENCHMARKS=ON `
-DPHANTOMCORE_ENABLE_SIMD=ON

- name: Build
run: cmake --build build --config Release --parallel

- name: Package
run: |
New-Item -ItemType Directory -Path package\bin
New-Item -ItemType Directory -Path package\lib
New-Item -ItemType Directory -Path package\include

# Copy executables
Copy-Item build\Release\*.exe package\bin\ -ErrorAction SilentlyContinue
Copy-Item build\examples\Release\*.exe package\bin\ -ErrorAction SilentlyContinue
Copy-Item build\benchmarks\Release\*.exe package\bin\ -ErrorAction SilentlyContinue

# Copy library
Copy-Item build\Release\*.lib package\lib\ -ErrorAction SilentlyContinue
Copy-Item build\lib\Release\*.lib package\lib\ -ErrorAction SilentlyContinue

# Copy headers
Copy-Item -Recurse include\* package\include\

# Copy documentation
Copy-Item README.md package\
Copy-Item LICENSE package\
Copy-Item CHANGELOG.md package\ -ErrorAction SilentlyContinue

# Create archive
Compress-Archive -Path package\* -DestinationPath PhantomCore-${{ needs.create-release.outputs.version }}-Windows-x64.zip

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./PhantomCore-${{ needs.create-release.outputs.version }}-Windows-x64.zip
asset_name: PhantomCore-${{ needs.create-release.outputs.version }}-Windows-x64.zip
asset_content_type: application/zip

build-linux:
name: Build Linux Release
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup CMake
uses: lukka/get-cmake@latest

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential

- name: Configure
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DPHANTOMCORE_BUILD_TESTS=OFF \
-DPHANTOMCORE_BUILD_EXAMPLES=ON \
-DPHANTOMCORE_BUILD_BENCHMARKS=ON \
-DPHANTOMCORE_ENABLE_SIMD=ON

- name: Build
run: cmake --build build --config Release --parallel

- name: Package
run: |
mkdir -p package/bin
mkdir -p package/lib
mkdir -p package/include

# Copy executables
find build -maxdepth 2 -type f -executable -exec cp {} package/bin/ \; 2>/dev/null || true
find build/examples -maxdepth 1 -type f -executable -exec cp {} package/bin/ \; 2>/dev/null || true
find build/benchmarks -maxdepth 1 -type f -executable -exec cp {} package/bin/ \; 2>/dev/null || true

# Copy library
find build -name "*.a" -exec cp {} package/lib/ \; 2>/dev/null || true
find build -name "*.so*" -exec cp {} package/lib/ \; 2>/dev/null || true

# Copy headers
cp -r include/* package/include/

# Copy documentation
cp README.md LICENSE package/
cp CHANGELOG.md package/ 2>/dev/null || true

# Create archive
tar -czf PhantomCore-${{ needs.create-release.outputs.version }}-Linux-x64.tar.gz -C package .

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./PhantomCore-${{ needs.create-release.outputs.version }}-Linux-x64.tar.gz
asset_name: PhantomCore-${{ needs.create-release.outputs.version }}-Linux-x64.tar.gz
asset_content_type: application/gzip

build-macos:
name: Build macOS Release
runs-on: macos-latest
needs: create-release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup CMake
uses: lukka/get-cmake@latest

- name: Configure
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DPHANTOMCORE_BUILD_TESTS=OFF \
-DPHANTOMCORE_BUILD_EXAMPLES=ON \
-DPHANTOMCORE_BUILD_BENCHMARKS=ON \
-DPHANTOMCORE_ENABLE_SIMD=ON

- name: Build
run: cmake --build build --config Release --parallel

- name: Package
run: |
mkdir -p package/bin
mkdir -p package/lib
mkdir -p package/include

# Copy executables
find build -maxdepth 2 -type f -perm +111 -exec cp {} package/bin/ \; 2>/dev/null || true
find build/examples -maxdepth 1 -type f -perm +111 -exec cp {} package/bin/ \; 2>/dev/null || true
find build/benchmarks -maxdepth 1 -type f -perm +111 -exec cp {} package/bin/ \; 2>/dev/null || true

# Copy library
find build -name "*.a" -exec cp {} package/lib/ \; 2>/dev/null || true
find build -name "*.dylib" -exec cp {} package/lib/ \; 2>/dev/null || true

# Copy headers
cp -r include/* package/include/

# Copy documentation
cp README.md LICENSE package/
cp CHANGELOG.md package/ 2>/dev/null || true

# Create archive
tar -czf PhantomCore-${{ needs.create-release.outputs.version }}-macOS-x64.tar.gz -C package .

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./PhantomCore-${{ needs.create-release.outputs.version }}-macOS-x64.tar.gz
asset_name: PhantomCore-${{ needs.create-release.outputs.version }}-macOS-x64.tar.gz
asset_content_type: application/gzip
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ option(PHANTOMCORE_ENABLE_ONNX "Enable ONNX Runtime for neural network decoders"
# ============================================================================
include(FetchContent)

# Save the original BUILD_TESTING value
set(_ORIGINAL_BUILD_TESTING ${BUILD_TESTING})
set(BUILD_TESTING OFF CACHE BOOL "" FORCE) # Disable tests for dependencies

# IXWebSocket - Modern C++ WebSocket library
FetchContent_Declare(
ixwebsocket
GIT_REPOSITORY https://github.com/machinezone/IXWebSocket.git
GIT_TAG v11.4.4
)
# Disable TLS for simpler build, disable tests
# Disable TLS for simpler build, disable tests, disable zlib
set(USE_TLS OFF CACHE BOOL "" FORCE)
set(USE_WS OFF CACHE BOOL "" FORCE)
set(USE_ZLIB OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(ixwebsocket)
# Remove warnings-as-errors for ixwebsocket (third-party code)
if(TARGET ixwebsocket)
Expand All @@ -68,13 +73,26 @@ endif()
# Note: Using simple binary serialization instead of msgpack to avoid Boost dependency

# Eigen - Linear algebra (for Kalman filter)
set(EIGEN_BUILD_DOC OFF CACHE BOOL "" FORCE)
set(EIGEN_BUILD_PKGCONFIG OFF CACHE BOOL "" FORCE)
FetchContent_Declare(
eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.0
)
FetchContent_MakeAvailable(eigen)

# tl::expected - Error handling (C++23 expected backport)
FetchContent_Declare(
expected
GIT_REPOSITORY https://github.com/TartanLlama/expected.git
GIT_TAG v1.1.0
)
FetchContent_MakeAvailable(expected)

# Restore the original BUILD_TESTING value
set(BUILD_TESTING ${_ORIGINAL_BUILD_TESTING} CACHE BOOL "" FORCE)

# ============================================================================
# CUDA Support (Optional)
# ============================================================================
Expand Down Expand Up @@ -144,6 +162,7 @@ target_include_directories(phantomcore PUBLIC
target_link_libraries(phantomcore PUBLIC
ixwebsocket
Eigen3::Eigen
tl::expected
)

# CUDA support
Expand Down
Loading