Skip to content

Commit

Permalink
Merge pull request #40 from qchateau/modernize
Browse files Browse the repository at this point in the history
Modernize
  • Loading branch information
qchateau authored Nov 13, 2020
2 parents 62e0e68 + ad2ee49 commit fa94d67
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
13 changes: 8 additions & 5 deletions .github/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_linux():
builder.add(compiler=CLANG, compiler_version="10", cppstd="20")

# Test supported boost versions
# NOTE: boost 1.72.0 is not compatible with C++20
# NOTE: boost 1.72.0 and before are not compatible with C++20
builder.add(compiler=GCC, compiler_version="10", cppstd="17", options={"boost": "1.70.0"})
builder.add(compiler=GCC, compiler_version="10", cppstd="17", options={"boost": "1.71.0"})
builder.add(compiler=GCC, compiler_version="10", cppstd="17", options={"boost": "1.72.0"})
Expand All @@ -115,24 +115,27 @@ def test_linux():
builder.add(compiler=GCC, compiler_version="10", cppstd="20", options={"asio": "1.17.0", "packio:standalone_asio": True})

# Test logs
builder.add(compiler=GCC, compiler_version="10", cppstd="20", options={"loglevel": "trace"}, build_type="Debug")
builder.add(compiler=GCC, compiler_version="10", cppstd="20", options={"loglevel": "trace"})

builder.run()


def test_mac():
builder = Packager()
builder.add(compiler=APPLE_CLANG, compiler_version="11.0", cppstd="17")
builder.add(compiler=APPLE_CLANG, compiler_version="11.0", cppstd="20")
builder.add(compiler=APPLE_CLANG, compiler_version="11.0", cppstd="20", build_type="Debug")
builder.add(compiler=APPLE_CLANG, compiler_version="11.0", cppstd="20")
builder.add(compiler=APPLE_CLANG, compiler_version="11.0", cppstd="17", build_type="Debug")
builder.add(compiler=APPLE_CLANG, compiler_version="11.0", cppstd="17")
builder.run()


def test_windows():
builder = Packager()
builder.add(compiler=MSVC, compiler_version="16", cppstd="17")
builder.add(compiler=MSVC, compiler_version="16", cppstd="20")
builder.add(compiler=MSVC, compiler_version="16", cppstd="20", build_type="Debug")
builder.add(compiler=MSVC, compiler_version="16", cppstd="20")
builder.add(compiler=MSVC, compiler_version="16", cppstd="17", build_type="Debug")
builder.add(compiler=MSVC, compiler_version="16", cppstd="17")
builder.run()


Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ jobs:
strategy:
fail-fast: false
matrix:
conan-total-pages: [4]
conan-current-page: [1, 2, 3, 4]
conan-total-pages: [4]
os: [ubuntu-20.04]
include:
- os: windows-2019
conan-total-pages: 1
conan-current-page: 1
- os: macos-11.0
conan-total-pages: 1
- os: macos-11.0
conan-current-page: 1
conan-total-pages: 1
runs-on: ${{ matrix.os }}
env:
UNITY_BATCH: 10
Expand All @@ -27,6 +27,14 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1

- name: Cache conan data
uses: actions/cache@v2
with:
path: ~/.conan
key: ${{ matrix.os }}-build-${{ matrix.conan-current-page }}-${{ matrix.conan-total-pages }}-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/build.py') }}
restore-keys: |
${{ matrix.os }}-build-${{ matrix.conan-current-page }}-${{ matrix.conan-total-pages }}
- name: Install dependencies
run: python -m pip install -U conan conan_package_tools

Expand Down
22 changes: 11 additions & 11 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,47 @@ set(SOURCES
tests/incremental_buffers.cpp
)

add_definitions(-DASIO_NO_DEPRECATED=1)
add_definitions(-DBOOST_ASIO_NO_DEPRECATED=1)
add_compile_definitions(ASIO_NO_DEPRECATED=1)
add_compile_definitions(BOOST_ASIO_NO_DEPRECATED=1)

if (UNIX)
add_compile_options(-Wall -Wextra -Werror)
else ()
add_compile_options(/W4 /WX /Zc:__cplusplus /bigobj)
# C4715 is raised in nlohmann::json
# C4499 is raised in boost 1.74 with coroutines
# C4702 is raised for now reason in nl_json_rpc/rpc.h
add_compile_options(/wd4715 /wd4499 /wd4702)
add_compile_options(/wd4715)
# C4702 is raised for no reason in nl_json_rpc/rpc.h
add_compile_options(/wd4702)
add_compile_definitions(_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1)
add_compile_definitions(_WIN32_WINNT=0x0A00) # win10
endif ()

if (PACKIO_LOGGING)
string(TOUPPER "${PACKIO_LOGGING}" LOGLEVEL)
add_definitions(-DPACKIO_LOGGING=1)
add_definitions(-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${LOGLEVEL})
add_compile_definitions(PACKIO_LOGGING=1)
add_compile_definitions(SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${LOGLEVEL})
message(STATUS "Building with logs: ${LOGLEVEL}")
endif ()

if (PACKIO_COROUTINES)
message(STATUS "Building with coroutines")

set(BUILD_SAMPLES ON)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-fcoroutines-ts)
elseif (MSVC)
add_compile_options(/await)
endif ()

message(STATUS "Building with coroutines")
endif ()

add_executable(tests ${SOURCES})
target_link_libraries(tests ${CONAN_LIBS})

if (BUILD_SAMPLES)
message(STATUS "Building samples")

add_executable(basic samples/basic.cpp)
target_link_libraries(basic ${CONAN_LIBS})

add_executable(fibonacci samples/fibonacci.cpp)
target_link_libraries(fibonacci ${CONAN_LIBS})
endif ()

0 comments on commit fa94d67

Please sign in to comment.