Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sandstorm-io/capnproto in…
Browse files Browse the repository at this point in the history
…to async-cocoa
  • Loading branch information
jjwchoy committed Feb 27, 2015
2 parents f6ea7d2 + db26888 commit cec428e
Show file tree
Hide file tree
Showing 277 changed files with 33,707 additions and 15,330 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -25,9 +25,6 @@
# setup-ekam.sh
/c++/.ekam

# setup-autotools.sh
/c++/gtest

# Jekyll-generated site
/doc/_site

Expand Down
9 changes: 7 additions & 2 deletions CONTRIBUTORS
@@ -1,10 +1,15 @@
The following people have made large code contributions to this repository.
Those contributions are copyright the respective authors and licensed by them
under the same BSD license terms as the rest of the library.
under the same MIT license terms as the rest of the library.

Kenton Varda <temporal@gmail.com>: Primary Author
Kenton Varda <kenton@sandstorm.io>: Primary Author
Jason Choy <jjwchoy@gmail.com>: kj/threadlocal.h and other iOS tweaks, `name` annotation in C++ code generator
Remy Blank <rblank@google.com> (contributions copyright Google Inc.): KJ Timers
Joshua Warner <joshuawarner32@gmail.com>: cmake build, AnyStruct/AnyList, other stuff
Scott Purdy <scott@fer.io>: kj/std iostream interface
Bryan Borham <bjboreham@gmail.com>: Initial MSVC support
Philip Quinn <p@partylemon.com>: cmake build and other assorted bits
Brian Taylor <el.wubo@gmail.com>: emacs syntax highlighting

This file does not list people who maintain their own Cap'n Proto
implementations as separate projects. Those people are awesome too! :)
36 changes: 17 additions & 19 deletions LICENSE
@@ -1,23 +1,21 @@
Copyright (c) 2013-2014 Kenton Varda <temporal@gmail.com> and contributors
All rights reserved.
Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
Licensed under the MIT License:

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

114 changes: 114 additions & 0 deletions c++/CMakeLists.txt
@@ -0,0 +1,114 @@
project("Cap'n Proto" CXX)
cmake_minimum_required(VERSION 2.8)
set(VERSION 0.6-dev)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(CheckIncludeFileCXX)
if(MSVC)
check_include_file_cxx(initializer_list HAS_CXX11)
else()
check_include_file_cxx(initializer_list HAS_CXX11 "-std=gnu++0x")
endif()
if(NOT HAS_CXX11)
message(SEND_ERROR "Requires a C++11 compiler and standard library.")
endif()

# Set installation paths; these can be overridden in the cache.
set(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
CACHE PATH "Base installation path for executables."
)
set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin"
CACHE PATH "Installation directory for binaries (default: prefix/bin)."
)
set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib"
CACHE PATH "Installation directory for libraries (default: prefix/lib)."
)
set(INCLUDE_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/include"
CACHE PATH "Installation directory for header files (default: prefix/include)."
)

# Options ======================================================================

option(BUILD_TOOLS "Build command-line tools and compiler." ON)
option(BUILD_TESTING "Build unit tests and enable CTest 'check' target." ON)
option(EXTERNAL_CAPNP "Use the system capnp binary, or the one specified in $CAPNP, instead of using the compiled one." OFF)
option(CAPNP_LITE "Compile Cap'n Proto in 'lite mode', in which all reflection APIs (schema.h, dynamic.h, etc.) are not included. Produces a smaller library at the cost of features. All programs built against the library must be compiled with -DCAPNP_LITE. Requires EXTERNAL_CAPNP to build the tests." OFF)

# Check for invalid combinations of build options
if(NOT BUILD_TOOLS AND BUILD_TESTING AND NOT EXTERNAL_CAPNP)
# Not *all* of the tests require the capnp compiler, and those that do could be excluded
# when not building the tools, but it's easier to just have a blanket rule.
message(SEND_ERROR "Tests (BUILD_TESTING) cannot be build without either BUILD_TOOLS or EXTERNAL_CAPNP.")
endif()

if(CAPNP_LITE AND BUILD_TESTING AND NOT EXTERNAL_CAPNP)
# As above, we could exclude only the tests that depend on the compiler.
message(SEND_ERROR "CAPNP_LITE with BUILD_TESTING requires EXTERNAL_CAPNP.")
endif()

if(CAPNP_LITE AND BUILD_TOOLS)
message(WARNING "Command-line tools will not be built with CAPNP_LITE.")
endif()

if(MSVC AND NOT CAPNP_LITE)
message(SEND_ERROR "Building with MSVC is only supported with CAPNP_LITE.")
endif()

if(CAPNP_LITE)
set(CAPNP_LITE_FLAG "-DCAPNP_LITE")
else()
set(CAPNP_LITE_FLAG)
endif()

if(MSVC)
# TODO(cleanup): Enable higher warning level in MSVC, but make sure to test
# build with that warning level and clean out false positives.
set(CMAKE_CXX_FLAGS "${CAPNP_LITE_FLAG} ${CMAKE_CXX_FLAGS}")
else()
# Note that it's important to add new CXXFLAGS before ones specified by the
# user, so that the user's flags override them. This is particularly
# important if -Werror was enabled and then certain warnings need to be
# disabled, as is done in super-test.sh.
#
# We enable a lot of warnings, but then disable some:
# * strict-aliasing: We use type-punning in known-safe ways that GCC doesn't
# recognize as safe.
# * sign-compare: Low S/N ratio.
# * unused-parameter: Low S/N ratio.
#
# We have to use -std=gnu++0x isntead of -std=c++11 because otherwise we lose
# GNU extensions that we need.
set(CMAKE_CXX_FLAGS "-std=gnu++0x -Wall -Wextra -Wno-strict-aliasing -Wno-sign-compare -Wno-unused-parameter -pthread ${CAPNP_LITE_FLAG} ${CMAKE_CXX_FLAGS}")
endif()

# Source =======================================================================

add_subdirectory(src)

# Install ======================================================================

if(NOT MSVC) # Don't install pkg-config files when building with MSVC
# Variables for pkg-config files
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${EXEC_INSTALL_PREFIX}")
set(libdir "${LIB_INSTALL_DIR}")
set(includedir "${INCLUDE_INSTALL_DIR}")
set(PTHREAD_CFLAGS "-pthread")
set(STDLIB_FLAG) # TODO: Unsupported

configure_file(capnp.pc.in "${CMAKE_CURRENT_BINARY_DIR}/capnp.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capnp.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")

if(NOT CAPNP_LITE)
configure_file(capnp-rpc.pc.in "${CMAKE_CURRENT_BINARY_DIR}/capnp-rpc.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capnp-rpc.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
endif()

unset(STDLIB_FLAG)
unset(PTHREAD_CFLAGS)
unset(includedir)
unset(libdir)
unset(exec_prefix)
unset(prefix)
endif()

0 comments on commit cec428e

Please sign in to comment.