Skip to content

CMake: set c++ standard using target_compile_features #793

CMake: set c++ standard using target_compile_features

CMake: set c++ standard using target_compile_features #793

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [master]
jobs:
linux-glibc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build tests
run: |
echo "::add-matcher::.github/gcc.json"
docker buildx build . --target test -t spectrum:tests
- name: Run tests
run: docker run -tt spectrum:tests
linux-clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build tests
run: docker buildx build . --target test-clang -t spectrum:tests-clang
- name: Run tests
run: docker run -tt spectrum:tests-clang
linux-musl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build tests
run: docker buildx build . --target test-musl -t spectrum:tests-musl
- name: Run tests
run: docker run -tt --env LANG=en_US.UTF-8 spectrum:tests-musl
macos:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install MacPorts
run: |
curl -L -O "https://github.com/macports/macports-base/releases/download/v2.9.0/MacPorts-2.9.0-14-Sonoma.pkg"
sudo installer -store -pkg MacPorts-2.9.0-14-Sonoma.pkg -target /
echo "https://packages.spectrum.im/macports/ports.tar.bz2" | sudo tee -a /opt/local/etc/macports/sources.conf
- name: Install dependencies
run: |
export PATH=$PATH:/opt/local/bin
sudo rm -rf /usr/local/*
sudo port -v selfupdate && sudo port -q install cppunit log4cxx popt jsoncpp protobuf3-cpp pkgconfig boost cmake zlib libswiften
- name: Configure build
run: |
export PATH=$PATH:/opt/local/bin:/usr/local/bin
cmake -DCMAKE_BUILD_TYPE=MacPorts -DENABLE_TESTS=ON -DCMAKE_UNITY_BUILD=ON .
- name: Build
run: make -j4
- name: Run tests
run: |
install_name_tool -change libSwiften.4.dylib @rpath/libSwiften.4.dylib tests/libtransport/libtransport_test
install_name_tool -add_rpath /opt/local/lib tests/libtransport/libtransport_test
install_name_tool -change libSwiften.4.dylib @rpath/libSwiften.4.dylib libtransport/libtransport.2.0.dylib
install_name_tool -add_rpath /opt/local/lib libtransport/libtransport.2.0.dylib
make test
windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
curl -L -O https://packages.spectrum.im/deps32.zip
7z x deps32.zip
shell: cmd
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Configure build
run: |
set CMAKE_PREFIX_PATH=%cd%\deps32
set PATH=%PATH%;%cd%\deps32\bin;%cd%\deps32\tools\bin
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTS=ON -DENABLE_IRC=OFF -DENABLE_FROTZ=OFF -DENABLE_PURPLE=OFF -DENABLE_MYSQL=OFF -DENABLE_PQXX=OFF -DCMAKE_INSTALL_PREFIX=dist .
shell: cmd
- name: Build solution
run: msbuild /t:Build INSTALL.vcxproj /p:Configuration=RelWithDebInfo /p:Platform=Win32 /m
- name: Run tests
shell: cmd
run: |
set PATH=%PATH%;%cd%\deps32\bin
cd tests\libtransport\RelWithDebInfo
libtransport_test