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
57 changes: 57 additions & 0 deletions .github/workflows/build-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CMake

on:
pull_request:
branches: ["main"]
paths:
- ".github/workflows/build-cmake.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/CMakeLists.txt"
- "cmake/*.cmake"
push:
branches: ["main"]
paths:
- ".github/workflows/build-cmake.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/CMakeLists.txt"
- "cmake/*.cmake"

jobs:
linux-build-cmake:
name: Linux
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
compiler: ["gcc", "clang"]
steps:
- uses: actions/checkout@v5
- name: Setup CMake
run: |
CC=${{ matrix.compiler }} cmake -S . -B build
- name: Build
run: |
CC=${{ matrix.compiler }} cmake --build build

windows-build-cmake:
name: Windows
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
compiler: ["cl.exe", "gcc.exe"]
steps:
- uses: actions/checkout@v5
- uses: ilammy/msvc-dev-cmd@v1.13.0
- name: Setup CMake
run: |
cmake -S . -B build
env:
CC: ${{ matrix.compiler }}
- name: Build
run: |
cmake --build build
env:
CC: ${{ matrix.compiler }}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Build and Test
name: Meson

on:
pull_request:
branches: ["main"]
paths:
- ".github/workflows/build.yml"
- ".github/workflows/build-meson.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/meson.build"
push:
branches: ["main"]
paths:
- ".github/workflows/build.yml"
- ".github/workflows/build-meson.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/meson.build"
Expand Down
42 changes: 42 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.30..4.0)
project(libtestrig
LANGUAGES C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

set(LIB_DIR "${CMAKE_SOURCE_DIR}/lib")
set(IPC_DIR "${LIB_DIR}/ipc")
set(EPOS_DIR "${LIB_DIR}/epos2")

set(IPC_SOURCES
"${IPC_DIR}/ipc.c"
"${IPC_DIR}/constants.c"
"${IPC_DIR}/message.c"
"${IPC_DIR}/os.c")

set(EPOS_SOURCES
"${EPOS_DIR}/epos2.c"
"${EPOS_DIR}/connect.c"
"${EPOS_DIR}/definitions.c"
"${EPOS_DIR}/identify.c")

set(LIBTESTRIG_SOURCES ${IPC_SOURCES})

find_package(EPOSCmd)
if (EPOSCmd_FOUND)
list(APPEND LIBTESTRIG_SOURCES ${EPOS_SOURCES})
else()
message("Controller capabilities not being built.")
endif()

add_library(Libtestrig SHARED ${LIBTESTRIG_SOURCES})
target_compile_definitions(Libtestrig PRIVATE COMPILING_TESTRIG_DLL)
target_include_directories(Libtestrig PUBLIC ${LIB_DIR})

if (WIN32)
target_link_libraries(Libtestrig PRIVATE Ws2_32)
endif()

if (EPOSCmd_FOUND)
target_link_libraries(Libtestrig PUBLIC EPOSCmd)
endif()
Empty file added cmake/FindEPOSCmd.cmake
Empty file.
Loading