Skip to content

Commit

Permalink
vendor cereal
Browse files Browse the repository at this point in the history
  • Loading branch information
iceboy233 committed Sep 22, 2019
1 parent 5522e45 commit 4ac5b45
Show file tree
Hide file tree
Showing 205 changed files with 47,178 additions and 6 deletions.
2 changes: 1 addition & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")",
".",
"node_modules/cereal/include"
"vendor/cereal/include"
],
"dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"],
"defines": ["NAPI_DISABLE_CPP_EXCEPTIONS"],
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"main": "build/Release/sandbox.node",
"dependencies": {
"cereal": "https://github.com/USCiLab/cereal.git",
"node-addon-api": "^1.7.1"
},
"gypfile": true
Expand Down
49 changes: 49 additions & 0 deletions vendor/cereal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Compiled Object files
*.slo
*.lo
*.o

# Compiled Dynamic libraries
*.so
*.dylib

# Compiled Static libraries
*.lai
*.la
*.a

# Visual studio cruft
*.opensdf
*.sdf
*.suo
*.user
*/x64
*/Debug*
*/Release*
*.log
*.tlog*
*.obj
*.VC.db
*.VC.VC.opendb
*.pdb

# misc files mostly used for testing
out.txt
ptr.txt
test.txt
boost_serialize
arr.txt
performance
include_renamed
.ycm_extra_conf.py*
doc/html
rtti.txt
doc/latex
portability64
portability32
file.json
out.xml
cereal_version.out
xml_ordering.out
build
/out/
39 changes: 39 additions & 0 deletions vendor/cereal/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
language: cpp
dist: trusty
sudo: false
group: beta

addons:
apt:
sources:
- 'ubuntu-toolchain-r-test'
- 'boost-latest'
packages:
- 'g++-multilib'
- 'libboost-serialization-dev'
# - 'libboost-test-dev'

compiler:
- gcc

matrix:
include:
- os: linux
compiler: clang
env: CMAKE_OPTIONS="-DSKIP_PORTABILITY_TEST=ON"

# TODO: Add an entry for valgrind
# after_script: make valgrind

- os: osx
osx_image: xcode8
compiler: clang

script:
- mkdir build && cd build
- cmake ${CMAKE_OPTIONS} .. && make -j4
- ctest . --output-on-failure

branches:
only:
- develop
66 changes: 66 additions & 0 deletions vendor/cereal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
cmake_minimum_required (VERSION 2.6.2)
project (cereal)

option(SKIP_PORTABILITY_TEST "Skip portability (32 bit) tests" OFF)
if(NOT CMAKE_VERSION VERSION_LESS 3.0) # installing cereal requires INTERFACE lib
option(JUST_INSTALL_CEREAL "Don't do anything besides installing the library" OFF)
endif()

option(THREAD_SAFE "Use mutexes to ensure thread safety" OFF)
if(THREAD_SAFE)
add_definitions(-DCEREAL_THREAD_SAFE=1)
set(CEREAL_THREAD_LIBS "pthread")
else()
set(CEREAL_THREAD_LIBS "")
endif()

if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /W3 /WX")
else()
set(CMAKE_CXX_FLAGS "-Wall -g -Wextra -Wshadow -pedantic -Wold-style-cast ${CMAKE_CXX_FLAGS}")
option(WITH_WERROR "Compile with '-Werror' C++ compiler flag" ON)
if(WITH_WERROR)
set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
endif(WITH_WERROR)
if(CMAKE_VERSION VERSION_LESS 3.1)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
else()
if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD STREQUAL "98")
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
endif()

if(NOT CMAKE_VERSION VERSION_LESS 3.0)
add_library(cereal INTERFACE)
target_include_directories(cereal INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
install(TARGETS cereal EXPORT cereal
DESTINATION lib) # ignored
install(EXPORT cereal FILE cereal-config.cmake
DESTINATION share/cmake/cereal)
install(DIRECTORY include/cereal DESTINATION include)
endif()

if(JUST_INSTALL_CEREAL)
return()
endif()

include_directories(./include)

# Boost serialization for performance sandbox
find_package(Boost COMPONENTS serialization)

if(Boost_FOUND)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)

enable_testing()
add_subdirectory(unittests)

add_subdirectory(sandbox)

add_subdirectory(doc)
24 changes: 24 additions & 0 deletions vendor/cereal/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2014, Randolph Voorhies, Shane Grant
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of cereal nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85 changes: 85 additions & 0 deletions vendor/cereal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
cereal - A C++11 library for serialization
==========================================

<img src="http://uscilab.github.io/cereal/assets/img/cerealboxside.png" align="right"/><p>cereal is a header-only C++11 serialization library. cereal takes arbitrary data types and reversibly turns them into different representations, such as compact binary encodings, XML, or JSON. cereal was designed to be fast, light-weight, and easy to extend - it has no external dependencies and can be easily bundled with other code or used standalone.</p>

### cereal has great documentation

Looking for more information on how cereal works and its documentation? Visit [cereal's web page](http://USCiLab.github.com/cereal) to get the latest information.

### cereal is easy to use

Installation and use of of cereal is fully documented on the [main web page](http://USCiLab.github.com/cereal), but this is a quick and dirty version:

* Download cereal and place the headers somewhere your code can see them
* Write serialization functions for your custom types or use the built in support for the standard library cereal provides
* Use the serialization archives to load and save data

```cpp
#include <cereal/types/unordered_map.hpp>
#include <cereal/types/memory.hpp>
#include <cereal/archives/binary.hpp>
#include <fstream>

struct MyRecord
{
uint8_t x, y;
float z;

template <class Archive>
void serialize( Archive & ar )
{
ar( x, y, z );
}
};

struct SomeData
{
int32_t id;
std::shared_ptr<std::unordered_map<uint32_t, MyRecord>> data;

template <class Archive>
void save( Archive & ar ) const
{
ar( data );
}

template <class Archive>
void load( Archive & ar )
{
static int32_t idGen = 0;
id = idGen++;
ar( data );
}
};

int main()
{
std::ofstream os("out.cereal", std::ios::binary);
cereal::BinaryOutputArchive archive( os );

SomeData myData;
archive( myData );

return 0;
}
```

### cereal has a mailing list

Either get in touch over <a href="mailto:cerealcpp@googlegroups.com">email</a> or [on the web](https://groups.google.com/forum/#!forum/cerealcpp).



## cereal has a permissive license

cereal is licensed under the [BSD license](http://opensource.org/licenses/BSD-3-Clause).

## cereal build status

* develop : [![Build Status](https://travis-ci.org/USCiLab/cereal.png?branch=develop)](https://travis-ci.org/USCiLab/cereal)
[![Build status](https://ci.appveyor.com/api/projects/status/91aou6smj36or0vb/branch/develop?svg=true)](https://ci.appveyor.com/project/AzothAmmo/cereal/branch/develop)

---

Were you looking for the Haskell cereal? Go <a href="https://github.com/GaloisInc/cereal">here</a>.
35 changes: 35 additions & 0 deletions vendor/cereal/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# can use variables like {build} and {branch}
version: 1.2.{build}
pull_requests:
do_not_increment_build_number: true

branches:
only:
- develop

configuration:
- Debug
- Release

environment:
matrix:
- VS_VERSION_MAJOR: 12
- VS_VERSION_MAJOR: 14
BOOST_ROOT: C:\Libraries\boost_1_59_0

platform:
- Win32
- x64

before_build: "scripts\\appveyor.bat"

build:
parallel: true
project: build/cereal.sln
verbosity: minimal

test_script: "scripts\\appveyor.bat test"

artifacts:
- path: build\Testing
- path: out
18 changes: 18 additions & 0 deletions vendor/cereal/doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
find_package(Doxygen)
if(DOXYGEN_FOUND)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doxygen.in" "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg" @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
COMMENT "Generating API documentation with Doxygen" VERBATIM
)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../scripts/updatedoc.in" "${CMAKE_CURRENT_BINARY_DIR}/updatedoc.sh" @ONLY)
add_custom_target(update-doc
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/updatedoc.sh"
DEPENDS doc
COMMENT "Copying documentation to gh-pages branch" VERBATIM
)

endif(DOXYGEN_FOUND)
Loading

0 comments on commit 4ac5b45

Please sign in to comment.