Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use conan and github actions #3

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: green_tiget workflow
on:
pull_request:
push:
branches: master

jobs:
ubuntu:
strategy:
matrix:
image: [gcc9, clang9]
build_type: [Debug, Release]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2-beta
- name: run docker
run: docker run --rm -v $GITHUB_WORKSPACE:/home/conan/repo conanio/${{ matrix.image }} cmake -DBUILD_TYPE=${{ matrix.build_type }} -P /home/conan/repo/ci/build.cmake

windows-docker:
strategy:
matrix:
image: ['dvirtz/msvc_16:lstc2019']
build_type: [Debug, Release]
runs-on: windows-2019
steps:
- uses: actions/checkout@v2-beta
- name: run docker
run: docker run --rm --mount type=bind,source=$env:GITHUB_WORKSPACE,destination=C:\Users\ContainerAdministrator\repo ${{ matrix.image }} cmake -DBUILD_TYPE=${{ matrix.build_type }} -P C:\Users\ContainerAdministrator\repo\ci\build.cmake
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

# VS Code
.vscode/
.history/

# build folders
_*/
build

# pyenv
.python-version
97 changes: 0 additions & 97 deletions .travis.yml

This file was deleted.

61 changes: 44 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,59 @@ cmake_minimum_required(VERSION 3.3)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

include(HunterGate)
project(GreenTiger)

include(CompilerWarnings)

# Download automatically, you can also just copy the conan.cmake file
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)

if(WIN32)
find_program(CONAN conan.bat)
endif()

conan_check()

HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.66.tar.gz"
SHA1 "c599029cf00b124c624702739741fead5d4e605d"
conan_add_remote(
NAME manu343726
URL https://api.bintray.com/conan/manu343726/conan-packages)


set(DEPENDENCIES
boost/1.71.0@_/_
range-v3/0.9.0@ericniebler/stable
Catch2/2.9.2@catchorg/stable
gsl_microsoft/2.0.0@bincrafters/stable
type_safe/0.3@Manu343726/testing
)

project(GreenTiger)
conan_cmake_run(REQUIRES ${DEPENDENCIES}
CONAN_COMMAND ${CONAN}
GENERATORS cmake_paths
BUILD missing)

set(BOOST_COMPONENTS system filesystem)
hunter_add_package(Boost COMPONENTS ${BOOST_COMPONENTS})
find_package(Boost CONFIG REQUIRED ${BOOST_COMPONENTS})
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)

hunter_add_package(Catch)
find_package(Catch2 CONFIG REQUIRED)
set(Boost_USE_STATIC_LIBS ON)

hunter_add_package(range-v3)
find_package(range-v3 CONFIG REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem)

hunter_add_package(Microsoft.GSL)
find_package(Microsoft.GSL CONFIG REQUIRED)
set_target_properties(Boost::filesystem PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB")

hunter_add_package(type_safe)
find_package(type_safe CONFIG REQUIRED)
find_package(Catch2 CONFIG REQUIRED)

include(CompilerWarnings)
find_package(range-v3 CONFIG REQUIRED)

target_compile_options(range-v3
INTERFACE
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/wd4996;/Wv:18>)

option(BUILD_TESTS "Build tests" ON)
if(BUILD_TESTS)
Expand Down
3 changes: 1 addition & 2 deletions Chapter01/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ set(HEADERS Program.h Exercises.h)

add_executable(Chapter01 ${HEADERS} ${SOURCES})

target_compile_definitions(Chapter01 PRIVATE CATCH_CPP14_OR_GREATER)

target_link_libraries(Chapter01 PRIVATE Boost::boost Catch2::Catch includeHeaders)
target_link_libraries(Chapter01 PRIVATE Boost::boost Catch2::Catch2 includeHeaders)

parse_unit_tests(Chapter01)
2 changes: 1 addition & 1 deletion Chapter01/Test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Exercises.h"
#include "Program.h"
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include <catch2/catch.hpp>

using namespace GreenTiger;

Expand Down
3 changes: 1 addition & 2 deletions Chapter02/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ set(HEADERS Program.h)

add_executable(Chapter02 ${HEADERS} ${SOURCES})

target_compile_definitions(Chapter02 PRIVATE CATCH_CPP14_OR_GREATER)

target_link_libraries(Chapter02
PRIVATE
Boost::boost
Boost::filesystem
Boost::system
Catch2::Catch
Catch2::Catch2
includeHeaders)

parse_unit_tests(Chapter02)
3 changes: 0 additions & 3 deletions Chapter02/Program.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include "warning_suppress.h"
MSC_DIAG_OFF(4458 4457)
#include <boost/spirit/include/lex.hpp>
#include <boost/spirit/include/lex_lexertl.hpp>
MSC_DIAG_ON()
#include <boost/spirit/include/phoenix_statement.hpp>
#include <fstream>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion Chapter02/Test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Program.h"
#include "testsHelper.h"
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include <catch2/catch.hpp>

TEST_CASE("lex test files") {
namespace fs = boost::filesystem;
Expand Down
3 changes: 1 addition & 2 deletions Chapter03/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ set(HEADERS Program.h ErrorHandler.h ExpressionParser.h Skipper.h IdentifierPars

add_executable(Chapter03 ${HEADERS} ${SOURCES})

target_compile_definitions(Chapter03 PRIVATE CATCH_CPP14_OR_GREATER $<$<CONFIG:Debug>:BOOST_SPIRIT_DEBUG>)

target_link_libraries(Chapter03
PRIVATE
Boost::boost
Boost::filesystem
Boost::system
Catch2::Catch
Catch2::Catch2
includeHeaders)

parse_unit_tests(Chapter03)
5 changes: 1 addition & 4 deletions Chapter03/DeclerationParser.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#pragma once
#include "ErrorHandler.h"
#include "Skipper.h"
#include "warning_suppress.h"
MSC_DIAG_OFF(4996 4459)
#include <boost/spirit/include/qi.hpp>
MSC_DIAG_ON()
#include <boost/spirit/include/phoenix_bind.hpp>

namespace tiger {
Expand All @@ -26,7 +23,7 @@ class DeclerationParser
namespace phoenix = boost::phoenix;

using namespace std::string_literals;
using namespace qi::labels;
using namespace boost::spirit::labels;

using qi::fail;
using qi::lit;
Expand Down
5 changes: 1 addition & 4 deletions Chapter03/ExpressionParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
#include "ErrorHandler.h"
#include "IdentifierParser.h"
#include "Skipper.h"
#include "warning_suppress.h"
#include <boost/spirit/include/phoenix_bind.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_object.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
MSC_DIAG_OFF(4996 4459)
#include <boost/spirit/include/qi.hpp>
MSC_DIAG_ON()

namespace tiger {

Expand Down Expand Up @@ -41,7 +38,7 @@ class ExpressionParser
using qi::repeat;
using qi::uint_;

using namespace qi::labels;
using namespace boost::spirit::labels;

lvalue =
identifier >> *((lit('.') > identifier) | (lit('[') > expression > ']'));
Expand Down
3 changes: 0 additions & 3 deletions Chapter03/IdentifierParser.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#pragma once
#include "ErrorHandler.h"
#include "Skipper.h"
#include "warning_suppress.h"
MSC_DIAG_OFF(4996 4459)
#include <boost/spirit/include/qi.hpp>
MSC_DIAG_ON()

namespace tiger {
template <typename Iterator>
Expand Down
3 changes: 0 additions & 3 deletions Chapter03/Skipper.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#pragma once
#include "warning_suppress.h"
MSC_DIAG_OFF(4996 4459)
#include <boost/spirit/include/qi.hpp>
MSC_DIAG_ON()

namespace tiger {
template <typename Iterator>
Expand Down
2 changes: 1 addition & 1 deletion Chapter03/Test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Program.h"
#include "testsHelper.h"
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include <catch2/catch.hpp>

using namespace tiger;

Expand Down
3 changes: 1 addition & 2 deletions Chapter04/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set(HEADERS Program.h ErrorHandler.h ExpressionParser.h Skipper.h IdentifierPars

add_executable(Chapter04 ${HEADERS} ${SOURCES})

target_compile_definitions(Chapter04 PRIVATE CATCH_CPP14_OR_GREATER $<$<CONFIG:Debug>:BOOST_SPIRIT_DEBUG>)

if(MSVC)
set_source_files_properties(Program.cpp PROPERTIES COMPILE_FLAGS /bigobj)
Expand All @@ -15,7 +14,7 @@ target_link_libraries(Chapter04
Boost::boost
Boost::filesystem
Boost::system
Catch2::Catch
Catch2::Catch2
includeHeaders)

parse_unit_tests(Chapter04)
5 changes: 1 addition & 4 deletions Chapter04/DeclerationParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
#include "Annotation.h"
#include "ErrorHandler.h"
#include "Skipper.h"
#include "warning_suppress.h"
MSC_DIAG_OFF(4996 4459)
#include <boost/spirit/include/qi.hpp>
MSC_DIAG_ON()
#include <boost/spirit/include/phoenix_bind.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
Expand All @@ -29,7 +26,7 @@ class DeclerationParser
namespace phoenix = boost::phoenix;

using namespace std::string_literals;
using namespace qi::labels;
using namespace boost::spirit::labels;

using phoenix::at_c;
using phoenix::push_back;
Expand Down
Loading