From 95638557398fe8044e3c68f52ca6125da928111a Mon Sep 17 00:00:00 2001 From: M4X1K02 Date: Mon, 29 Dec 2025 12:46:02 +0100 Subject: [PATCH 1/2] chore: fix CI build system and modernize CMake configuration --- .github/workflows/ci.yaml | 1 + CMakeLists.txt | 9 ++++++--- flake.lock | 6 +++--- flake.nix | 12 +++++++++--- simd/CMakeLists.txt | 6 ++++-- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 59edbab..f602a43 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,6 +36,7 @@ jobs: -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release + -DBUILD_SIMD=OFF -S ${{ github.workspace }} - name: Build diff --git a/CMakeLists.txt b/CMakeLists.txt index 40be4b9..85e3767 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.15) project(simapi VERSION 1.0.1 DESCRIPTION "Telemetry Mapping Library for Racing Sims") include(GNUInstallDirs) add_library(simapi SHARED simapi/simmapper.c simapi/getpid.c simapi/mapping/acmapper.c simapi/mapping/pcars2mapper.c simapi/mapping/rf2mapper.c simapi/mapping/scs2mapper.c simapi/mapping/outgaugemapper.c) @@ -14,11 +14,14 @@ set_target_properties(simapi PROPERTIES PUBLIC_HEADER "${SIMAPI_PUBLIC_HEADERS}") configure_file(simapi.pc.in simapi.pc @ONLY) -target_include_directories(simapi PRIVATE include simapi) +target_include_directories(simapi PUBLIC include simapi) install(TARGETS simapi LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES ${CMAKE_BINARY_DIR}/simapi.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) -add_subdirectory(simd) +option(BUILD_SIMD "Build the simd tool" ON) +if(BUILD_SIMD) + add_subdirectory(simd) +endif() diff --git a/flake.lock b/flake.lock index b7dc8c9..c5720d7 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1766070988, - "narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=", + "lastModified": 1766902085, + "narHash": "sha256-coBu0ONtFzlwwVBzmjacUQwj3G+lybcZ1oeNSQkgC0M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c6245e83d836d0433170a16eb185cefe0572f8b8", + "rev": "c0b0e0fddf73fd517c3471e546c0df87a42d53f4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ef2be8c..d9d3a7e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,6 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - self.submodules = true; }; outputs = { nixpkgs, ... }: @@ -14,9 +13,13 @@ src = ./.; - buildInputs = [ + nativeBuildInputs = [ pkgs.cmake ]; + + cmakeFlags = [ + "-DBUILD_SIMD=OFF" + ]; }; simd = pkgs.stdenv.mkDerivation { @@ -29,10 +32,13 @@ cd simd ''; + nativeBuildInputs = [ + pkgs.cmake + ]; + buildInputs = [ simapi - pkgs.cmake pkgs.libuv pkgs.yder pkgs.libconfig diff --git a/simd/CMakeLists.txt b/simd/CMakeLists.txt index d800de8..0e81b72 100644 --- a/simd/CMakeLists.txt +++ b/simd/CMakeLists.txt @@ -15,6 +15,7 @@ find_library(ARGTABLE3_LIBRARY argtable3) if (ARGTABLE3_INCLUDE_DIR AND ARGTABLE3_LIBRARY) add_compile_definitions(HAVE_ARGTABLE3) set(ARGTABLE_LIBS ${ARGTABLE3_LIBRARY}) + set(ARGTABLE_INCLUDE_DIR ${ARGTABLE3_INCLUDE_DIR}) else() find_path(ARGTABLE2_INCLUDE_DIR argtable2.h) find_library(ARGTABLE2_LIBRARY argtable2) @@ -22,6 +23,7 @@ else() if (ARGTABLE2_INCLUDE_DIR AND ARGTABLE2_LIBRARY) add_compile_definitions(HAVE_ARGTABLE2) set(ARGTABLE_LIBS ${ARGTABLE2_LIBRARY}) + set(ARGTABLE_INCLUDE_DIR ${ARGTABLE2_INCLUDE_DIR}) else() message(FATAL_ERROR "Neither argtable3 nor argtable2 found") endif() @@ -30,7 +32,7 @@ endif() add_executable(simd simd.c parameters.c confighelper.c dirhelper.c poke.c ../simmap/mapsimdata.c) target_link_libraries(simd m uv yder ${ARGTABLE_LIBS} config simapi) -target_include_directories(simd PUBLIC) +target_include_directories(simd PRIVATE ${ARGTABLE_INCLUDE_DIR}) # used for enabling additional compiler options if supported include(CheckCXXCompilerFlag) @@ -63,7 +65,7 @@ else() # GCC/Clang warning option if(analyze) message("-- Analyzer is on") - target_compile_options(monocoque PRIVATE -fanalyzer -Wno-analyzer-possible-null-argument -Wno-analyzer-possible-null-dereference) + target_compile_options(simd PRIVATE -fanalyzer -Wno-analyzer-possible-null-argument -Wno-analyzer-possible-null-dereference) endif() enable_cxx_compiler_flag_if_supported("-Wall") From c36048697318bc8ec5f3d8484b98439ad943f322 Mon Sep 17 00:00:00 2001 From: M4X1K02 Date: Mon, 29 Dec 2025 12:47:06 +0100 Subject: [PATCH 2/2] add cache to gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8f28023..9b71924 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /build tests/setsimdata simd/build - +.cache