From 8844317936b8735eebfefe7c20bef4711fa9f9c7 Mon Sep 17 00:00:00 2001 From: Slendi Date: Sat, 26 Jul 2025 00:44:03 +0300 Subject: [PATCH] Add actions Signed-off-by: Slendi --- .gitea/workflows/cmake.yml | 36 ++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 5 +---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .gitea/workflows/cmake.yml diff --git a/.gitea/workflows/cmake.yml b/.gitea/workflows/cmake.yml new file mode 100644 index 0000000..75dbb4c --- /dev/null +++ b/.gitea/workflows/cmake.yml @@ -0,0 +1,36 @@ +name: CMake + +on: + push: + branches: + - master + - 'release-*' + pull_request: + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest] + shared: ["ON", "OFF"] + pthread_support: ["ON", "OFF"] + posix_support: ["ON", "OFF"] + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} - shared=${{ matrix.shared }} + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake build-essential + - name: Configure + run: | + cmake -Bbuild -S . \ + -DDCFG_BUILD_SHARED=${{ matrix.shared }} \ + -DDCFG_PTHREAD_SUPPORT=${{ matrix.pthread_support }} \ + -DDCFG_POSIX_SUPPORT=${{ matrix.posix_support }} + - name: Build + run: | + cmake --build build + diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b46b4c..a8d549e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,6 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) option(DCFG_BUILD_SHARED "Build DCFG as a shared library" ON) -option(DCFG_BUILD_STATIC "Build DCFG as a static library" OFF) option(DCFG_PTHREAD_SUPPORT "Enable pthreads support" ON) option(DCFG_POSIX_SUPPORT "Enable POSIX support" ON) @@ -31,9 +30,7 @@ if(DCFG_BUILD_SHARED) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "dcfg") install(TARGETS ${PROJECT_NAME} DESTINATION lib) -endif() - -if(DCFG_BUILD_STATIC) +else() add_library(${PROJECT_NAME}_static STATIC ${SRC_DIR}/dcfg.c) target_include_directories(${PROJECT_NAME}_static PUBLIC ${INCLUDE_DIR})