diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 460cebb4..8ce37ab0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,9 +57,17 @@ jobs: shell: bash run: brew install ninja popt - - name: Configure Build & Test + - name: Configure + shell: bash + run: cmake --preset ci-macos + + - name: Build + shell: bash + run: cmake --build --preset ci-macos + + - name: Test shell: bash - run: ./travis.sh macos + run: ctest --preset ci-macos build-win32: runs-on: windows-latest diff --git a/.gitignore b/.gitignore index d43d5211..652f76f7 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ /libtool /ltmain.sh /missing +/out /stamp-h1 /test-suite.log INSTALL diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..13ee950c --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,43 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 22, + "patch": 0 + }, + "configurePresets": [ + { + "name": "ci-macos", + "displayName": "Continuous integration for MacOS", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_C_FLAGS": "-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Werror", + "OPENSSL_ROOT_DIR": "/usr/local/opt/openssl@1.1", + "BUILD_EXAMPLES": "ON", + "BUILD_TESTING": "ON", + "BUILD_TOOLS": "ON" + } + } + ], + "buildPresets": [ + { + "name": "ci-macos", + "description": "", + "displayName": "", + "configurePreset": "ci-macos", + "targets": [ + "install" + ] + } + ], + "testPresets": [ + { + "name": "ci-macos", + "description": "", + "displayName": "", + "configurePreset": "ci-macos" + } + ] +} \ No newline at end of file diff --git a/travis.sh b/travis.sh index e1182aee..eb4a6fcc 100755 --- a/travis.sh +++ b/travis.sh @@ -20,14 +20,6 @@ build_framing() { ctest -V . } -build_macos() { - mkdir $PWD/_build && cd $PWD/_build - cmake .. -GNinja -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON -DCMAKE_INSTALL_PREFIX=$PWD/../_install -DCMAKE_C_FLAGS="-Wall -Wextra -Wstrict-prototypes -Wno-unused-function -Werror" \ - -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl@1.1" - cmake --build . --target install - ctest -V . -} - build_format() { sudo apt-get install -y clang-format ./travis/run-clang-format/run-clang-format.py \ @@ -73,7 +65,7 @@ build_scan-build() { } if [ "$#" -ne 1 ]; then - echo "Usage: $0 {cmake|framing|macos|format|coverage|asan|tsan|scan-build}" + echo "Usage: $0 {cmake|framing|format|coverage|asan|tsan|scan-build}" exit 1 fi