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
2 changes: 0 additions & 2 deletions .clang-format

This file was deleted.

12 changes: 12 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Checks: "readability-identifier-naming"
HeaderFileExtensions: ["h"]
ImplementationFileExtensions: ["c"]
ExcludeHeaderFilterRegex: "./lib/epos2/definitions.h"
CheckOptions:
readability-identifier-naming.DefaultCase: lower_case
readability-identifier-naming.ParameterCase: lower_case
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
readability-identifier-naming.GlobalConstantCase: UPPER_CASE
readability-identifier-naming.GlobalConstantPointerCase: UPPER_CASE
readability-identifier-naming.EnumCase: UPPER_CASE
readability-identifier-naming.EnumConstantCase: UPPER_CASE
20 changes: 5 additions & 15 deletions .github/workflows/build-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,33 @@ jobs:
strategy:
fail-fast: true
matrix:
compiler: ["gcc", "clang"]
preset: ["linux-gcc", "linux-clang"]
steps:
- uses: actions/checkout@v5
- name: Install Build Dependencies
run: echo | python "${{ github.workspace }}/bin/acquire_epos_cmdlib.py"
- name: Setup CMake
run: |
CC=${{ matrix.compiler }} cmake -S . -B build
cmake -S . -B build --preset=${{ matrix.preset }}
- name: Build
run: |
CC=${{ matrix.compiler }} cmake --build build
- name: Verbosely Test
run: |
ctest --verbose --output-on-failure --test-dir build/test
cmake --build build

windows-build-cmake:
name: Windows
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
compiler: ["gcc.exe"] #, "cl.exe"]
preset: ["windows-mingw"] #, "cl.exe"]
steps:
- uses: actions/checkout@v5
#- uses: ilammy/msvc-dev-cmd@v1.13.0
- name: Install Build Dependencies
run: echo "" | python "${{ github.workspace }}/bin/acquire_epos_cmdlib.py"
- name: Setup CMake
run: |
cmake -S . -B build
env:
CC: ${{ matrix.compiler }}
cmake -S . -B build --preset=${{ matrix.preset }}
- name: Build
run: |
cmake --build build
env:
CC: ${{ matrix.compiler }}
- name: Verbosely Test
run: |
ctest --verbose --output-on-failure --test-dir build/test -C Debug
80 changes: 0 additions & 80 deletions .github/workflows/build-meson.yml

This file was deleted.

45 changes: 30 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
cmake_minimum_required(VERSION 3.30..4.0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

project(libtestrig
LANGUAGES C)

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

include(target_copy_dll)
include(target_output_to_bin)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
set(IPC_DIR "${LIB_DIR}/ipc")
set(EPOS_DIR "${LIB_DIR}/epos2")
set(BIN_DIR "${CMAKE_SOURCE_DIR}/bin")

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

Expand All @@ -23,25 +25,38 @@ set(EPOS_SOURCES
"${EPOS_DIR}/manage.c"
"${EPOS_DIR}/identify.c")

set(LIBTESTRIG_SOURCES ${IPC_SOURCES})
set(LIBTESTRIG_SOURCES ${IPC_SOURCES} ${EPOS_SOURCES})

if (WIN32)
add_library(EposCmd SHARED IMPORTED)
set_target_properties(EposCmd PROPERTIES
IMPORTED_LOCATION "${BIN_DIR}/EposCmd64.dll"
IMPORTED_IMPLIB "${BIN_DIR}/EposCmd64.lib")

find_package(EPOSCmd)
if (EPOSCmd_FOUND)
list(APPEND LIBTESTRIG_SOURCES ${EPOS_SOURCES})
set(EposCmd-FOUND TRUE)
else()
message("Controller capabilities not being built.")
add_library(EposCmd SHARED IMPORTED)
set_target_properties(EposCmd PROPERTIES
IMPORTED_LOCATION "${BIN_DIR}/libEposCmd.so"
IMPORTED_IMPLIB "")

set(EposCmd-FOUND TRUE)
endif()

add_library(testrig SHARED ${LIBTESTRIG_SOURCES})
target_compile_definitions(testrig PRIVATE COMPILING_TESTRIG_DLL)
target_include_directories(testrig PUBLIC ${LIB_DIR})
add_library(libtestrig SHARED ${LIBTESTRIG_SOURCES})
target_compile_definitions(libtestrig PRIVATE COMPILING_TESTRIG_DLL)
target_include_directories(libtestrig PUBLIC ${LIB_DIR})
target_link_libraries(libtestrig PUBLIC EposCmd)
target_output_to_bin(libtestrig)

if (WIN32)
target_link_libraries(testrig PRIVATE Ws2_32)
target_link_libraries(libtestrig PUBLIC Ws2_32 Kernel32)
endif()

if (EPOSCmd_FOUND)
target_link_libraries(testrig PUBLIC EPOSCmd)
if (MSVC)
add_compile_options("/W4")
else()
add_compile_options("-Wall")
endif()

add_subdirectory("${CMAKE_SOURCE_DIR}/test")
add_subdirectory("${CMAKE_SOURCE_DIR}/src")
74 changes: 74 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 30,
"patch": 0
},

"configurePresets": [
{
"name": "default",
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
"CMAKE_COLOR_DIAGNOSTICS": "ON"
}
},
{
"name": "windows-only",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "linux-only",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},

{
"name": "windows-mingw",
"inherits": [ "default", "windows-only" ],
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc"
}
},
{
"name": "linux-gcc",
"inherits": [ "default", "linux-only" ],
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc"
}
},
{
"name": "linux-clang",
"inherits": [ "default", "linux-only" ],
"cacheVariables": {
"CMAKE_C_COMPILER": "clang"
}
}
],

"buildPresets": [
{
"name": "windows-mingw",
"configurePreset": "windows-mingw"
},
{
"name": "linux-gcc",
"configurePreset": "linux-gcc"
},
{
"name": "linux-clang",
"configurePreset": "linux-clang"
}
]
}
2 changes: 1 addition & 1 deletion bin/acquire_epos_cmdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def attempt_dl(link: str, outf: str|os.PathLike, operating: str) -> int:
stripped = f.split(extension)[0] + extension
actual_bin = stripped if i_am == "Linux" else f

wherestrip = join(dirs["lib_dir"], stripped)
wherestrip = join(dirs["lib_dir"], actual_bin)
os.replace(join(root, f), wherestrip)
bins.append(wherestrip)

Expand Down
1 change: 0 additions & 1 deletion cmake/FindEPOSCmd.cmake

This file was deleted.

5 changes: 5 additions & 0 deletions cmake/target_output_to_bin.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function(target_output_to_bin IN_TARGET)
set_target_properties(${IN_TARGET} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${BIN_DIR}")
set_target_properties(${IN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BIN_DIR}")
set_target_properties(${IN_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BIN_DIR}")
endfunction(target_output_to_bin IN_TARGET)
6 changes: 6 additions & 0 deletions lib/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Checks: "readability-identifier-naming"
HeaderFileExtensions: ["h"]
ImplementationFileExtensions: ["c"]
ExcludeHeaderFilterRegex: "./lib/epos2/definitions.h"
CheckOptions:
readability-identifier-naming.FunctionPrefix: vscl_
Loading