mirror of
https://github.com/progsource/maddy.git
synced 2026-03-25 16:00:39 +01:00
Merge pull request #39 from progsource/build_update
Use GitHub workflow instead of external tools. Update cmake and gtest and add gtest via cmake instead of github submodule.
This commit is contained in:
61
.github/workflows/run-tests.yml
vendored
Normal file
61
.github/workflows/run-tests.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
name: run-tests
|
||||||
|
run-name: test ${{ github.ref }}
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
test-on-ubuntu:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: lukka/get-cmake@latest
|
||||||
|
with:
|
||||||
|
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
|
||||||
|
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
mkdir tmp
|
||||||
|
cd tmp
|
||||||
|
cmake -DMADDY_BUILD_WITH_TESTS=ON ..
|
||||||
|
make -j4
|
||||||
|
- name: run tests
|
||||||
|
run: |
|
||||||
|
./build/MaddyTests
|
||||||
|
test-on-windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: lukka/get-cmake@latest
|
||||||
|
with:
|
||||||
|
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
|
||||||
|
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
mkdir tmp
|
||||||
|
cd tmp
|
||||||
|
cmake -G "Visual Studio 17 2022" -A x64 -DMADDY_BUILD_WITH_TESTS=ON ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
- name: run tests
|
||||||
|
run: |
|
||||||
|
./build/Debug/MaddyTests.exe
|
||||||
|
test-on-osx:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: lukka/get-cmake@latest
|
||||||
|
with:
|
||||||
|
cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version
|
||||||
|
ninjaVersion: "^1.11.1" # <--= optional, use most recent 1.x version
|
||||||
|
- name: build
|
||||||
|
run: |
|
||||||
|
mkdir tmp
|
||||||
|
cd tmp
|
||||||
|
cmake -DMADDY_BUILD_WITH_TESTS=ON ..
|
||||||
|
make -j4
|
||||||
|
- name: run tests
|
||||||
|
run: |
|
||||||
|
./build/MaddyTests
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "libs/gtest"]
|
|
||||||
path = libs/gtest
|
|
||||||
url = https://github.com/google/googletest.git
|
|
||||||
32
.travis.yml
32
.travis.yml
@@ -1,32 +0,0 @@
|
|||||||
sudo: false
|
|
||||||
language: cpp
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: linux
|
|
||||||
dist: xenial
|
|
||||||
sudo: require
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode10
|
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang && CXX=clang++"
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
# This is necessary to solve https://github.com/travis-ci/travis-ci/issues/9649
|
|
||||||
- eval "${MATRIX_EVAL}"
|
|
||||||
|
|
||||||
script:
|
|
||||||
- mkdir tmp
|
|
||||||
- cd tmp
|
|
||||||
- cmake ..
|
|
||||||
- make -j4
|
|
||||||
- ../build/MaddyTests
|
|
||||||
@@ -16,6 +16,11 @@ maddy uses [semver versioning](https://semver.org/).
|
|||||||
|
|
||||||
*  Added Changelog
|
*  Added Changelog
|
||||||
*  Added contribution guideline
|
*  Added contribution guideline
|
||||||
|
*  updated cmake minimum required version to 3.25
|
||||||
|
*  gtest is now loaded via cmake and not a git submodule any longer - updated gtest version to 1.13.0
|
||||||
|
*  tests are only run if the cmake option `MADDY_BUILD_WITH_TESTS` is on, moved test cmake code to the `tests` subfolder
|
||||||
|
*  travis CI and appveyor
|
||||||
|
*  GitHub workflow
|
||||||
* ?
|
* ?
|
||||||
|
|
||||||
## version 1.1.2 2020-10-04
|
## version 1.1.2 2020-10-04
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
# This project is licensed under the MIT license. For more information see the
|
# This project is licensed under the MIT license. For more information see the
|
||||||
# LICENSE file.
|
# LICENSE file.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
|
|
||||||
project(maddy)
|
project(maddy)
|
||||||
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
set(MADDY_CPP_VERSION 14)
|
set(MADDY_CPP_VERSION 14)
|
||||||
@@ -20,8 +18,15 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
|||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
option(MADDY_BUILD_WITH_TESTS "enable building tests" OFF)
|
||||||
|
|
||||||
|
if(${MADDY_BUILD_WITH_TESTS})
|
||||||
|
enable_testing()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
set(MADDY_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
|
set(MADDY_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
|
||||||
file(GLOB_RECURSE MADDY_TESTS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/maddy/*.cpp)
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -30,11 +35,6 @@ if (UNIX)
|
|||||||
CMAKE_CXX_FLAGS
|
CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions -fsanitize=address -fno-omit-frame-pointer"
|
"${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions -fsanitize=address -fno-omit-frame-pointer"
|
||||||
)
|
)
|
||||||
else()
|
|
||||||
set(
|
|
||||||
CMAKE_CXX_FLAGS
|
|
||||||
"${CMAKE_CXX_FLAGS} -std=c++${MADDY_CPP_VERSION}"
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -54,12 +54,6 @@ endif()
|
|||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/gtest/googlemock)
|
|
||||||
add_subdirectory(libs)
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
add_library(maddy INTERFACE)
|
add_library(maddy INTERFACE)
|
||||||
target_include_directories(maddy INTERFACE
|
target_include_directories(maddy INTERFACE
|
||||||
${MADDY_INCLUDE_DIR}
|
${MADDY_INCLUDE_DIR}
|
||||||
@@ -67,14 +61,6 @@ target_include_directories(maddy INTERFACE
|
|||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
add_executable(
|
if(${MADDY_BUILD_WITH_TESTS})
|
||||||
MaddyTests
|
add_subdirectory(tests)
|
||||||
${MADDY_TESTS_FILES}
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tests/main.cpp
|
|
||||||
)
|
|
||||||
target_include_directories(MaddyTests PUBLIC
|
|
||||||
${LIBS_INCLUDE_DIRS}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tests
|
|
||||||
)
|
|
||||||
target_link_libraries(MaddyTests maddy gmock_main)
|
|
||||||
add_test(MaddyTests ${CMAKE_CURRENT_SOURCE_DIR}/build/MaddyTests)
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ It is tested to work on:
|
|||||||
|
|
||||||
* Linux (gcc)
|
* Linux (gcc)
|
||||||
* OSX (clang)
|
* OSX (clang)
|
||||||
* Windows (Visual Studio 2017)
|
* Windows (Visual Studio 17 2022, mingw)
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
@@ -63,10 +63,9 @@ Open your preferred terminal and type:
|
|||||||
```shell
|
```shell
|
||||||
git clone https://github.com/progsource/maddy.git
|
git clone https://github.com/progsource/maddy.git
|
||||||
cd maddy
|
cd maddy
|
||||||
git submodule update --init --recursive
|
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
cd tmp
|
cd tmp
|
||||||
cmake ..
|
cmake -DMADDY_BUILD_WITH_TESTS=ON ..
|
||||||
make
|
make
|
||||||
make test # or run the executable in ../build/MaddyTests
|
make test # or run the executable in ../build/MaddyTests
|
||||||
```
|
```
|
||||||
|
|||||||
15
appveyor.yml
15
appveyor.yml
@@ -1,15 +0,0 @@
|
|||||||
image: Visual Studio 2017
|
|
||||||
|
|
||||||
install:
|
|
||||||
- cmd: git submodule update --init --recursive
|
|
||||||
|
|
||||||
before_build:
|
|
||||||
- cmd: mkdir tmp
|
|
||||||
- cmd: cd tmp
|
|
||||||
- cmd: cmake -G "Visual Studio 15 Win64" ..
|
|
||||||
|
|
||||||
build:
|
|
||||||
project: $(APPVEYOR_BUILD_FOLDER)\tmp\$(APPVEYOR_PROJECT_NAME).sln
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- cmd: ctest -VV -C "Debug"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# This project is licensed under the MIT license. For more information see the
|
|
||||||
# LICENSE file.
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
|
||||||
|
|
||||||
set(LIBS_INCLUDE_DIRS
|
|
||||||
# -- googletest / -mock --------------------------------------------------------
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gtest/googletest/include
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/gtest/googlemock/include
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
PARENT_SCOPE)
|
|
||||||
|
|
||||||
set(LIBS_SRC_FILES
|
|
||||||
PARENT_SCOPE)
|
|
||||||
Submodule libs/gtest deleted from 703bd9caab
28
tests/CMakeLists.txt
Normal file
28
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# This project is licensed under the MIT license. For more information see the
|
||||||
|
# LICENSE file.
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
googletest
|
||||||
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
|
GIT_TAG b796f7d44681514f58a683a3a71ff17c94edb0c1 # v1.13.0
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(googletest)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
file(GLOB_RECURSE MADDY_TESTS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/maddy/*.cpp)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
add_executable(
|
||||||
|
MaddyTests
|
||||||
|
${MADDY_TESTS_FILES}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||||
|
)
|
||||||
|
target_include_directories(MaddyTests PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
target_link_libraries(MaddyTests maddy gmock_main)
|
||||||
|
add_test(MaddyTests MaddyTests)
|
||||||
Reference in New Issue
Block a user