From baf1c6f64b6b1852702a5c8aeecfad8fec476ed2 Mon Sep 17 00:00:00 2001 From: Cong Date: Tue, 16 Nov 2021 23:52:56 +1100 Subject: Create cmake.yml (fixes #71) --- .github/workflows/cmake.yml | 44 ++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 24 ------------------------ README.md | 2 +- tinydir.h | 9 +++++++-- 4 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/cmake.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..d4204de --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,44 @@ +name: CMake + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-latest + CC: clang + - os: ubuntu-latest + CC: gcc + + steps: + - uses: actions/checkout@v2 + + - name: Build + env: + CC: ${{ matrix.CC }} + run: | + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} tests + cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -C ${{env.BUILD_TYPE}} + + - name: Build (samples) + env: + CC: ${{ matrix.CC }} + run: | + rm -rf ${{github.workspace}}/build + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} samples + cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4eaef76..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -sudo: false - -language: c - -compiler: - - gcc - - clang - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-4.8 - -before_script: - # force newer gcc version - - if [ "$CC" = "gcc" ]; then export CC="gcc-4.8"; fi - # show which tests failed - - export CTEST_OUTPUT_ON_FAILURE=1 - -script: - - mkdir build && cd build && cmake ../samples && make -j2 && cd .. && rm -rf build - - mkdir build && cd build && cmake ../tests && make -j2 && make test && cd .. && rm -rf build diff --git a/README.md b/README.md index 635f0ca..497b434 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ TinyDir ======= -[![Build Status](https://travis-ci.com/cxong/tinydir.svg?branch=master)](https://travis-ci.com/github/cxong/tinydir) +[![CMake](https://github.com/cxong/tinydir/actions/workflows/cmake.yml/badge.svg)](https://github.com/cxong/tinydir/actions/workflows/cmake.yml) [![Release](http://img.shields.io/github/release/cxong/tinydir.svg)](https://github.com/cxong/tinydir/releases/latest) Lightweight, portable and easy to integrate C directory and file reader. TinyDir wraps dirent for POSIX and FindFirstFile for Windows. diff --git a/tinydir.h b/tinydir.h index e08eb84..bd76d28 100644 --- a/tinydir.h +++ b/tinydir.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2019, tinydir authors: +Copyright (c) 2013-2021, tinydir authors: - Cong Xu - Lautis Sun - Baudouin Feildel @@ -125,8 +125,13 @@ extern "C" { # define _TINYDIR_FUNC static __inline #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # define _TINYDIR_FUNC static __inline__ -#else +#elif defined(__cplusplus) # define _TINYDIR_FUNC static inline +#elif defined(__GNUC__) +/* Suppress unused function warning */ +# define _TINYDIR_FUNC __attribute__((unused)) static +#else +# define _TINYDIR_FUNC static #endif /* readdir_r usage; define TINYDIR_USE_READDIR_R to use it (if supported) */ -- cgit v1.2.3