Skip to content

Commit

Permalink
feat: download msgpack (#2885)
Browse files Browse the repository at this point in the history
Downloads msgpack-c with same content using commit hash, from
https://github.com/AztecProtocol/msgpack-c. As this is not our code (a
few small patches to error-handling aside) and it's somewhat large at
7mb of code, itself bundling dependencies., so it's cleaner to not have
it in tree.
  • Loading branch information
ludamad authored Oct 17, 2023
1 parent d7b7fb1 commit 8ac8beb
Show file tree
Hide file tree
Showing 863 changed files with 73 additions and 119,623 deletions.
1 change: 1 addition & 0 deletions barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ include(cmake/threading.cmake)
include(cmake/gtest.cmake)
include(cmake/benchmark.cmake)
include(cmake/module.cmake)
include(cmake/msgpack.cmake)
add_subdirectory(src)
if (ENABLE_ASAN AND NOT(FUZZING))
find_program(LLVM_SYMBOLIZER_PATH NAMES llvm-symbolizer-16)
Expand Down
10 changes: 10 additions & 0 deletions barretenberg/cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function(barretenberg_module MODULE_NAME)
${ARGN}
${TBB_IMPORTED_TARGETS}
)

# enable msgpack downloading via dependency (solves race condition)
add_dependencies(${MODULE_NAME} msgpack-c)
add_dependencies(${MODULE_NAME}_objects msgpack-c)
list(APPEND lib_targets ${MODULE_NAME})

set(MODULE_LINK_NAME ${MODULE_NAME})
Expand Down Expand Up @@ -117,6 +121,9 @@ function(barretenberg_module MODULE_NAME)
${TBB_IMPORTED_TARGETS}
)

# enable msgpack downloading via dependency (solves race condition)
add_dependencies(${MODULE_NAME}_test_objects msgpack-c)
add_dependencies(${MODULE_NAME}_tests msgpack-c)
if(NOT WASM AND NOT CI)
# If collecting coverage data, set profile
# For some reason processor affinity doesn't work, so the developer has to set it manually anyway
Expand Down Expand Up @@ -219,6 +226,9 @@ function(barretenberg_module MODULE_NAME)
${TBB_IMPORTED_TARGETS}
)

# enable msgpack downloading via dependency (solves race condition)
add_dependencies(${MODULE_NAME}_bench_objects msgpack-c)
add_dependencies(${MODULE_NAME}_bench msgpack-c)
add_custom_target(
run_${MODULE_NAME}_bench
COMMAND ${MODULE_NAME}_bench
Expand Down
16 changes: 16 additions & 0 deletions barretenberg/cpp/cmake/msgpack.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include(ExternalProject)

# External project: Download msgpack-c from GitHu
set(MSGPACK_PREFIX "${CMAKE_BINARY_DIR}/_deps/msgpack-c")
set(MSGPACK_INCLUDE "${MSGPACK_PREFIX}/src/msgpack-c/include")

ExternalProject_Add(
msgpack-c
PREFIX ${MSGPACK_PREFIX}
GIT_REPOSITORY "https://github.com/AztecProtocol/msgpack-c.git"
GIT_TAG af447c28f0bafe761290a72754212436e530941b
CONFIGURE_COMMAND "" # No configure step
BUILD_COMMAND "" # No build step
INSTALL_COMMAND "" # No install step
UPDATE_COMMAND "" # No update step
)
5 changes: 2 additions & 3 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ if(WASM)
add_link_options(-Wl,--export-memory,--import-memory,--stack-first,-z,stack-size=1048576,--max-memory=4294967296)
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/msgpack-c/include)

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${MSGPACK_INCLUDE})

# I feel this should be limited to ecc, however it's currently used in headers that go across libraries,
# and there currently isn't an easy way to inherit the DDISABLE_SHENANIGANS parameter.
if(DISABLE_ASM)
message(STATUS "Using fallback non-assembly methods for field multiplications.")
message("Using fallback non-assembly methods for field multiplications.")
add_definitions(-DDISABLE_SHENANIGANS=1)
else()
message(STATUS "Using optimized assembly for field arithmetic.")
Expand Down
72 changes: 0 additions & 72 deletions barretenberg/cpp/src/msgpack-c/.github/depends/boost.sh

This file was deleted.

51 changes: 0 additions & 51 deletions barretenberg/cpp/src/msgpack-c/.github/depends/zlib.sh

This file was deleted.

74 changes: 0 additions & 74 deletions barretenberg/cpp/src/msgpack-c/.github/workflows/coverage.yml

This file was deleted.

Loading

0 comments on commit 8ac8beb

Please sign in to comment.