Skip to content

Commit 901bb81

Browse files
committed
setup build pipeline.
1 parent 3565f60 commit 901bb81

File tree

2 files changed

+73
-14
lines changed

2 files changed

+73
-14
lines changed

.ygithub/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: RTL Build
2+
3+
on:
4+
push:
5+
branches: [ release ]
6+
pull_request:
7+
branches: [ release ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Build (${{ matrix.os }} / ${{ matrix.compiler }})
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest]
18+
compiler: [gcc, clang, msvc]
19+
exclude:
20+
- os: windows-latest
21+
compiler: gcc
22+
- os: windows-latest
23+
compiler: clang
24+
- os: ubuntu-latest
25+
compiler: msvc
26+
27+
steps:
28+
- name: Checkout source
29+
uses: actions/checkout@v4
30+
31+
# Linux builds
32+
- name: Install dependencies (Linux)
33+
if: runner.os == 'Linux'
34+
run: |
35+
sudo apt update
36+
sudo apt install -y ninja-build g++ clang
37+
38+
- name: Configure (Linux)
39+
if: runner.os == 'Linux'
40+
run: |
41+
if [ "${{ matrix.compiler }}" = "gcc" ]; then
42+
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++;
43+
else
44+
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++;
45+
fi
46+
47+
# Windows builds (MSVC)
48+
- name: Configure (Windows / MSVC)
49+
if: runner.os == 'Windows'
50+
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
51+
52+
# Build
53+
- name: Build
54+
run: cmake --build build --config Release --parallel
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
# CMakeLists.txt for ReflectionTemplateLib
22

3-
# Set the minimum required CMake version
43
cmake_minimum_required(VERSION 3.20)
54

6-
# Set the project name
7-
project(ReflectionTemplateLib)
5+
# Project definition
6+
project(ReflectionTemplateLib LANGUAGES CXX)
87

8+
# Require C++20
99
set(CMAKE_CXX_STANDARD 20)
10+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11+
set(CMAKE_CXX_EXTENSIONS OFF)
1012

11-
SET(CXX_LIB_NAME ReflectionTemplateLib)
13+
# Library target
14+
add_library(${PROJECT_NAME} STATIC)
1215

13-
ADD_LIBRARY(${PROJECT_NAME} STATIC "")
16+
# Public include directories
17+
target_include_directories(${PROJECT_NAME}
18+
PUBLIC
19+
${CMAKE_CURRENT_SOURCE_DIR}/common
20+
${CMAKE_CURRENT_SOURCE_DIR}/detail/inc
21+
${CMAKE_CURRENT_SOURCE_DIR}/access/inc
22+
${CMAKE_CURRENT_SOURCE_DIR}/builder/inc
23+
)
1424

15-
INCLUDE_DIRECTORIES(common)
16-
INCLUDE_DIRECTORIES(detail/inc)
17-
INCLUDE_DIRECTORIES(access/inc)
18-
INCLUDE_DIRECTORIES(builder/inc)
19-
20-
# Add the source directory
21-
INCLUDE(detail/src/CMakeLists.txt)
22-
INCLUDE(access/src/CMakeLists.txt)
23-
INCLUDE(builder/CMakeLists.txt)
25+
# Add subdirectories for sources
26+
add_subdirectory(detail/src)
27+
add_subdirectory(access/src)
28+
add_subdirectory(builder)

0 commit comments

Comments
 (0)