Add integration tests for cmake (#17)
This commit is contained in:
parent
cfd0a4e762
commit
a8169aba8e
105
.github/workflows/cmake-integration.yml
vendored
Normal file
105
.github/workflows/cmake-integration.yml
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
name: cmake-integration
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
# Awful hackery: github.event.workflow_run.head_sha is defined on push, github.event.pull_request.base.sha is defined on
|
||||
# pull
|
||||
|
||||
|
||||
jobs:
|
||||
test-linux-fetchcontent:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: test
|
||||
run: |
|
||||
tag=$(git rev-parse --abbrev-ref HEAD)
|
||||
cd ..
|
||||
cp -rv cpptrace/test/fetchcontent-integration .
|
||||
mkdir fetchcontent-integration/build
|
||||
cd fetchcontent-integration/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCPPTRACE_TAG=$tag
|
||||
make
|
||||
./main
|
||||
test-linux-findpackage:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build
|
||||
run: |
|
||||
tag=$(git rev-parse --abbrev-ref HEAD)
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=On
|
||||
sudo make -j install
|
||||
cd ../..
|
||||
cp -rv cpptrace/test/findpackage-integration .
|
||||
mkdir findpackage-integration/build
|
||||
cd findpackage-integration/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
./main
|
||||
test-macos-fetchcontent:
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: test
|
||||
run: |
|
||||
tag=$(git rev-parse --abbrev-ref HEAD)
|
||||
cd ..
|
||||
cp -rv cpptrace/test/fetchcontent-integration .
|
||||
mkdir fetchcontent-integration/build
|
||||
cd fetchcontent-integration/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCPPTRACE_TAG=$tag
|
||||
make
|
||||
./main
|
||||
test-macos-findpackage:
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: build
|
||||
run: |
|
||||
tag=$(git rev-parse --abbrev-ref HEAD)
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=On
|
||||
sudo make -j install
|
||||
cd ../..
|
||||
cp -rv cpptrace/test/findpackage-integration .
|
||||
mkdir findpackage-integration/build
|
||||
cd findpackage-integration/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
./main
|
||||
test-mingw-fetchcontent:
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: test
|
||||
run: |
|
||||
$tag=$(git rev-parse --abbrev-ref HEAD)
|
||||
cd ..
|
||||
cp -Recurse cpptrace/test/fetchcontent-integration .
|
||||
mkdir fetchcontent-integration/build
|
||||
cd fetchcontent-integration/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCPPTRACE_TAG="$tag" -DCMAKE_BUILD_TYPE=g++ "-GUnix Makefiles"
|
||||
make
|
||||
.\main.exe
|
||||
test-windows-fetchcontent:
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Enable Developer Command Prompt
|
||||
uses: ilammy/msvc-dev-cmd@v1.10.0
|
||||
- name: test
|
||||
run: |
|
||||
$tag=$(git rev-parse --abbrev-ref HEAD)
|
||||
cd ..
|
||||
cp -Recurse cpptrace/test/fetchcontent-integration .
|
||||
mkdir fetchcontent-integration/build
|
||||
cd fetchcontent-integration/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCPPTRACE_TAG="$tag"
|
||||
msbuild demo_project.sln
|
||||
.\Debug\main.exe
|
||||
@ -4,6 +4,7 @@
|
||||
[](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/test.yml)
|
||||
[](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/performance-tests.yml)
|
||||
[](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/lint.yml)
|
||||
[](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/cmake-integration.yml)
|
||||
<br/>
|
||||
[-Community%20Discord-blue?labelColor=2C3239&color=7289DA&style=flat&logo=discord&logoColor=959DA5)](https://discord.gg/7kv5AuCndG)
|
||||
|
||||
|
||||
16
test/fetchcontent-integration/CMakeLists.txt
Normal file
16
test/fetchcontent-integration/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(demo_project VERSION 0.0.1 LANGUAGES CXX)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
|
||||
set(CPPTRACE_TAG "" CACHE STRING "cpptrace git tag")
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
cpptrace
|
||||
GIT_REPOSITORY https://github.com/jeremy-rifkin/cpptrace.git
|
||||
GIT_TAG ${CPPTRACE_TAG}
|
||||
)
|
||||
FetchContent_MakeAvailable(cpptrace)
|
||||
target_link_libraries(main cpptrace)
|
||||
14
test/fetchcontent-integration/main.cpp
Normal file
14
test/fetchcontent-integration/main.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <cpptrace/cpptrace.hpp>
|
||||
|
||||
void trace() {
|
||||
cpptrace::print_trace();
|
||||
}
|
||||
|
||||
void foo(int) {
|
||||
trace();
|
||||
}
|
||||
|
||||
int main() {
|
||||
foo(0);
|
||||
}
|
||||
|
||||
8
test/findpackage-integration/CMakeLists.txt
Normal file
8
test/findpackage-integration/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(demo_project VERSION 0.0.1 LANGUAGES CXX)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
|
||||
find_package(cpptrace REQUIRED)
|
||||
target_link_libraries(main cpptrace::cpptrace)
|
||||
14
test/findpackage-integration/main.cpp
Normal file
14
test/findpackage-integration/main.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <cpptrace/cpptrace.hpp>
|
||||
|
||||
void trace() {
|
||||
cpptrace::print_trace();
|
||||
}
|
||||
|
||||
void foo(int) {
|
||||
trace();
|
||||
}
|
||||
|
||||
int main() {
|
||||
foo(0);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user