forked from jeremy-rifkin/libassert
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cmake integration workflows (jeremy-rifkin#58)
- Loading branch information
1 parent
c5168d5
commit 5a6a1e8
Showing
10 changed files
with
225 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
name: cmake-integration | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
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 libassert/tests/fetchcontent-integration . | ||
mkdir fetchcontent-integration/build | ||
cd fetchcontent-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLIBASSERT_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 | ||
sudo make -j install | ||
sudo /sbin/ldconfig | ||
cd ../.. | ||
cp -rv libassert/tests/findpackage-integration . | ||
mkdir findpackage-integration/build | ||
cd findpackage-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug | ||
make | ||
./main | ||
test-linux-add_subdirectory: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: build | ||
run: | | ||
cd .. | ||
cp -rv libassert/tests/add_subdirectory-integration . | ||
cp -rv libassert add_subdirectory-integration | ||
mkdir add_subdirectory-integration/build | ||
cd add_subdirectory-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 libassert/tests/fetchcontent-integration . | ||
mkdir fetchcontent-integration/build | ||
cd fetchcontent-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLIBASSERT_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 | ||
sudo make -j install | ||
cd ../.. | ||
cp -rv libassert/tests/findpackage-integration . | ||
mkdir findpackage-integration/build | ||
cd findpackage-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug | ||
make | ||
./main | ||
test-macos-add_subdirectory: | ||
runs-on: macos-13 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: test | ||
run: | | ||
cd .. | ||
cp -rv libassert/tests/add_subdirectory-integration . | ||
cp -rv libassert add_subdirectory-integration | ||
mkdir add_subdirectory-integration/build | ||
cd add_subdirectory-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 libassert/tests/fetchcontent-integration . | ||
mkdir fetchcontent-integration/build | ||
cd fetchcontent-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLIBASSERT_TAG="$tag" -DCMAKE_BUILD_TYPE=g++ "-GUnix Makefiles" | ||
make | ||
.\main.exe | ||
test-mingw-add_subdirectory: | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: test | ||
run: | | ||
cd .. | ||
cp -Recurse libassert/tests/add_subdirectory-integration . | ||
cp -Recurse libassert add_subdirectory-integration | ||
mkdir add_subdirectory-integration/build | ||
cd add_subdirectory-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug -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/[email protected] | ||
- name: test | ||
run: | | ||
$tag=$(git rev-parse --abbrev-ref HEAD) | ||
cd .. | ||
cp -Recurse libassert/tests/fetchcontent-integration . | ||
mkdir fetchcontent-integration/build | ||
cd fetchcontent-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLIBASSERT_TAG="$tag" | ||
msbuild demo_project.sln | ||
.\Debug\main.exe | ||
test-windows-add_subdirectory: | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Enable Developer Command Prompt | ||
uses: ilammy/[email protected] | ||
- name: test | ||
run: | | ||
cd .. | ||
cp -Recurse libassert/tests/add_subdirectory-integration . | ||
cp -Recurse libassert add_subdirectory-integration | ||
mkdir add_subdirectory-integration/build | ||
cd add_subdirectory-integration/build | ||
cmake .. -DCMAKE_BUILD_TYPE=Debug | ||
msbuild demo_project.sln | ||
.\Debug\main.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
project(demo_project VERSION 0.0.1 LANGUAGES CXX) | ||
|
||
add_executable(main main.cpp) | ||
|
||
if(WIN32) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | ||
endif() | ||
|
||
add_subdirectory(libassert) | ||
target_link_libraries(main assert) |
2 changes: 1 addition & 1 deletion
2
...ibrary-usage/cmake-fetch-content/main.cpp → tests/add_subdirectory-integration/main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include <assert/assert.hpp> | ||
#include <assert.hpp> | ||
|
||
int main() { | ||
VERIFY(true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
project(demo_project VERSION 0.0.1 LANGUAGES CXX) | ||
|
||
add_executable(main main.cpp) | ||
|
||
set(LIBASSERT_TAG "" CACHE STRING "libassert git tag") | ||
|
||
if(WIN32) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | ||
endif() | ||
|
||
include(FetchContent) | ||
FetchContent_Declare( | ||
assert | ||
GIT_REPOSITORY https://github.com/jeremy-rifkin/libassert.git | ||
GIT_TAG ${LIBASSERT_TAG} | ||
) | ||
FetchContent_MakeAvailable(assert) | ||
target_link_libraries(main assert) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <assert.hpp> | ||
|
||
#include <iostream> | ||
|
||
int main() { | ||
VERIFY(true); | ||
ASSUME(true); | ||
ASSERT(true); | ||
std::cout<<"Good to go"<<std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(assert REQUIRED) | ||
target_link_libraries(main assert::assert) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <assert.hpp> | ||
|
||
#include <iostream> | ||
|
||
int main() { | ||
VERIFY(true); | ||
ASSUME(true); | ||
ASSERT(true); | ||
std::cout<<"Good to go"<<std::endl; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.