Skip to content
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
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: build
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
build_type: [debug,release]
sanitizer: [""]
include:
- os: macos-latest
build_type: debug
sanitizer: "-fsanitize=address"
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- name: Generating Makefiles
shell: bash
run: |
cmake . -G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_CXX_FLAGS=${{ matrix.sanitizer }} \
-DCMAKE_EXE_LINKER_FLAGS=${{ matrix.sanitizer }}
- name: Compiling
shell: bash
run: |
ninja
- name: Running Tests
shell: bash
run: |
msgpack/tests/Msgpack_tests
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
cmake_minimum_required(VERSION 3.9)
project(Msgpack LANGUAGES CXX VERSION 1.0)

option(CPPACK_TESTS "Enable cppack tests" ON)

add_subdirectory(msgpack)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/mikeloomisgg/cppack.svg?branch=master)](https://travis-ci.com/mikeloomisgg/cppack)
[![build](https://github.com/dacap/cppack/actions/workflows/build.yml/badge.svg)](https://github.com/dacap/cppack/actions/workflows/build.yml)
# cppack
A modern (c++17 required) implementation of the [msgpack spec](https://github.com/msgpack/msgpack/blob/master/spec.md).

Expand Down
5 changes: 3 additions & 2 deletions msgpack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.9)
project(Msgpack LANGUAGES CXX VERSION 1.0)

list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Expand Down Expand Up @@ -49,4 +48,6 @@ install(FILES
export(EXPORT MsgpackTargets FILE ${CMAKE_CURRENT_BINARY_DIR}/MsgpackTargets.cmake NAMESPACE Msgpack::)
export(PACKAGE Msgpack)

add_subdirectory(tests)
if(CPPACK_TESTS)
add_subdirectory(tests)
endif()
6 changes: 4 additions & 2 deletions msgpack/include/msgpack/msgpack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <chrono>
#include <cmath>
#include <bitset>
#include <unordered_map>
#include <system_error>

namespace msgpack {
enum class UnpackerError {
Expand All @@ -33,12 +35,12 @@ struct UnpackerErrCategory : public std::error_category {
return "(unrecognized error)";
}
};
};

const UnpackerErrCategory theUnpackerErrCategory{};
};

inline
std::error_code make_error_code(msgpack::UnpackerError e) {
static UnpackerErrCategory theUnpackerErrCategory;
return {static_cast<int>(e), theUnpackerErrCategory};
}
}
Expand Down
11 changes: 7 additions & 4 deletions msgpack/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
cmake_minimum_required(VERSION 3.9)

find_package(Catch2 REQUIRED)
include(FetchContent)
FetchContent_Declare(Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.1.0)
FetchContent_MakeAvailable(Catch2)

add_executable(Msgpack_tests
main.cpp
type_packing_tests.cpp
examples.cpp
error_handling.cpp
object_packing_tests.cpp
)

if (MSVC)
target_compile_options(Msgpack_tests PRIVATE /WX /Zc:__cplusplus)
target_compile_options(Msgpack_tests PRIVATE /WX /Zc:__cplusplus /EHsc)
else (MSVC)
target_compile_options(Msgpack_tests PRIVATE -Wall -Wextra -pedantic -Werror)
endif (MSVC)

target_link_libraries(Msgpack_tests
Catch2::Catch2
Catch2::Catch2WithMain
Msgpack::Msgpack)

set_target_properties(Msgpack_tests PROPERTIES CXX_STANDARD 17)
Expand Down
2 changes: 1 addition & 1 deletion msgpack/tests/error_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Created by Mike Loomis on 6/29/2019.
//

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include "msgpack/msgpack.hpp"

Expand Down
2 changes: 1 addition & 1 deletion msgpack/tests/examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Created by Mike Loomis on 6/28/2019.
//

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include "msgpack/msgpack.hpp"

Expand Down
7 changes: 0 additions & 7 deletions msgpack/tests/main.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion msgpack/tests/object_packing_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Created by Mike Loomis on 7/31/2019.
//

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <msgpack/msgpack.hpp>

Expand Down
2 changes: 1 addition & 1 deletion msgpack/tests/type_packing_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Created by Mike Loomis on 6/22/2019.
//

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <msgpack/msgpack.hpp>

Expand Down