Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1372 from lscheinkman/NUP-2481
Browse files Browse the repository at this point in the history
NUP-2481: Update capnp to 0.6.1
  • Loading branch information
lscheinkman authored Oct 4, 2017
2 parents d5f161a + 88056a0 commit ec8674b
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 7 deletions.
5 changes: 3 additions & 2 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
# http://numenta.org/licenses/
# -----------------------------------------------------------------------------

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.3)
project(nupic_core_main CXX)

set(CMAKE_VERBOSE_MAKEFILE OFF)
include(GNUInstallDirs)

set_directory_properties(PROPERTIES EP_BASE "${EP_BASE}")

# Shorter aliases for static library prefix and suffix.
set(STATIC_PRE ${CMAKE_STATIC_LIBRARY_PREFIX})
set(STATIC_SUF ${CMAKE_STATIC_LIBRARY_SUFFIX})
# This is the library prefix path.
set(LIB_PRE ${EP_BASE}/Install/lib)
set(LIB_PRE ${EP_BASE}/Install/${CMAKE_INSTALL_LIBDIR})
# This is the include path.
set(INCLUDE_PRE ${EP_BASE}/Install/include)
# The full prefix path for binaries.
Expand Down
11 changes: 8 additions & 3 deletions external/CapnProto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ include(../src/NupicLibraryUtils) # for MERGE_STATIC_LIBRARIES
set(CAPNP_STATIC_LIB_TARGET capnp-bundle)

set(capnp_lib_url
"${REPOSITORY_DIR}/external/common/share/capnproto/capnproto-c++-0.5.3.tar.gz")
"${REPOSITORY_DIR}/external/common/share/capnproto/capnproto-c++-0.6.1.tar.gz")
set(capnp_win32_tools_url
"${REPOSITORY_DIR}/external/common/share/capnproto/capnproto-c++-win32-0.5.3.zip")
"${REPOSITORY_DIR}/external/common/share/capnproto/capnproto-c++-win32-0.6.1.zip")

set(capnp_lib_kj ${LIB_PRE}/${STATIC_PRE}kj${STATIC_SUF})
set(capnp_lib_capnp ${LIB_PRE}/${STATIC_PRE}capnp${STATIC_SUF})
Expand All @@ -67,10 +67,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# NOTE nupic.core's swig wraps depend on the macro CAPNP_LITE to have a value
set(CAPNP_COMPILER_DEFINITIONS ${CAPNP_COMPILER_DEFINITIONS} -DCAPNP_LITE=1)
set(capnp_link_libraries ${capnp_lib_capnp} ${capnp_lib_kj})
set(capn_patch_file "${REPOSITORY_DIR}/external/common/share/capnproto/capnproto-0.6.1.patch")
set(capnp_patch_command patch -p2 -i ${capn_patch_file})
else()
set(CAPNP_CMAKE_DEFINITIONS -DCAPNP_LITE=0)
set(capnp_link_libraries ${capnp_lib_capnpc} ${capnp_lib_capnp} ${capnp_lib_kj})
endif()
message(STATUS "CapnProto capnp_patch_command=${capnp_patch_command}")


# NOTE Capnproto link fails with segfault on Travis and Ubuntu when using
Expand All @@ -88,6 +91,8 @@ ExternalProject_Add(CapnProto

UPDATE_COMMAND ""

PATCH_COMMAND ${capnp_patch_command}

CMAKE_GENERATOR ${CMAKE_GENERATOR}

CMAKE_ARGS
Expand Down Expand Up @@ -119,7 +124,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
${CMAKE_COMMAND} -E make_directory ${BIN_PRE}
INSTALL_COMMAND
${CMAKE_COMMAND} -E copy_directory
"<SOURCE_DIR>/capnproto-tools-win32-0.5.3"
"<SOURCE_DIR>/capnproto-tools-win32-0.6.1"
${BIN_PRE}
)
endif()
Expand Down
10 changes: 8 additions & 2 deletions external/common/share/capnproto/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
capnproto-c++-0.5.3.tar.gz: from https://capnproto.org/capnproto-c++-0.5.3.tar.gz
capnproto-c++-win32-0.5.3.zip: from https://capnproto.org/capnproto-c++-win32-0.5.3.zip
capnproto-c++-0.6.1.tar.gz: from https://capnproto.org/capnproto-c++-0.6.1.tar.gz
capnproto-c++-win32-0.6.1.zip: from https://capnproto.org/capnproto-c++-win32-0.6.1.zip

Capnp added a dependency to `kj::ThrowOverflow` function in `capnp/common.h`
implementing the function in `units.c++`. However `units.c++` is only compiled
when `CAPNP_LITE=0` causing a link error when `CAPNP_LITE=1`. See
https://github.com/capnproto/capnproto/pull/437
We patch capnp 0.6.1 adding `units.c++` to `CAPNP_LITE=1` build.
15 changes: 15 additions & 0 deletions external/common/share/capnproto/capnproto-0.6.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/c++/src/kj/CMakeLists.txt b/c++/src/kj/CMakeLists.txt
index 2b7da310..e882a151 100644
--- a/c++/src/kj/CMakeLists.txt
+++ b/c++/src/kj/CMakeLists.txt
@@ -14,9 +14,9 @@ set(kj_sources_lite
main.c++
arena.c++
test-helpers.c++
+ units.c++
)
set(kj_sources_heavy
- units.c++
refcount.c++
string-tree.c++
parse/char.c++
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit ec8674b

Please sign in to comment.