Skip to content

Commit

Permalink
[C++] Restore Plasma source tree after 0.5.0 release
Browse files Browse the repository at this point in the history
This reverts commit 62ef2cd.
  • Loading branch information
wesm committed Jul 23, 2017
1 parent 9b26ed8 commit 2c81015
Show file tree
Hide file tree
Showing 41 changed files with 14,261 additions and 0 deletions.
113 changes: 113 additions & 0 deletions cpp/src/plasma/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

cmake_minimum_required(VERSION 2.8)

project(plasma)

find_package(PythonLibsNew REQUIRED)
find_package(Threads)

option(PLASMA_PYTHON
"Build the Plasma Python extensions"
OFF)

if(APPLE)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
endif(APPLE)

include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS})
include_directories("${FLATBUFFERS_INCLUDE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/" "${CMAKE_CURRENT_LIST_DIR}/thirdparty/" "${CMAKE_CURRENT_LIST_DIR}/../")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-conversion")

# Compile flatbuffers

set(PLASMA_FBS_SRC "${CMAKE_CURRENT_LIST_DIR}/format/plasma.fbs" "${CMAKE_CURRENT_LIST_DIR}/format/common.fbs")
set(OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/format/)

set(PLASMA_FBS_OUTPUT_FILES
"${OUTPUT_DIR}/common_generated.h"
"${OUTPUT_DIR}/plasma_generated.h")

add_custom_target(gen_plasma_fbs DEPENDS ${PLASMA_FBS_OUTPUT_FILES})

if(FLATBUFFERS_VENDORED)
add_dependencies(gen_plasma_fbs flatbuffers_ep)
endif()

add_custom_command(
OUTPUT ${PLASMA_FBS_OUTPUT_FILES}
# The --gen-object-api flag generates a C++ class MessageT for each
# flatbuffers message Message, which can be used to store deserialized
# messages in data structures. This is currently used for ObjectInfo for
# example.
COMMAND ${FLATBUFFERS_COMPILER} -c -o ${OUTPUT_DIR} ${PLASMA_FBS_SRC} --gen-object-api
DEPENDS ${PLASMA_FBS_SRC}
COMMENT "Running flatc compiler on ${PLASMA_FBS_SRC}"
VERBATIM)

if(UNIX AND NOT APPLE)
link_libraries(rt)
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

set_source_files_properties(extension.cc PROPERTIES COMPILE_FLAGS -Wno-strict-aliasing)

set(PLASMA_SRCS
client.cc
common.cc
eviction_policy.cc
events.cc
fling.cc
io.cc
malloc.cc
plasma.cc
protocol.cc
thirdparty/ae/ae.c
thirdparty/xxhash.cc)

ADD_ARROW_LIB(plasma
SOURCES ${PLASMA_SRCS}
DEPENDENCIES gen_plasma_fbs
SHARED_LINK_LIBS ${FLATBUFFERS_STATIC_LIB} ${CMAKE_THREAD_LIBS_INIT} arrow_static
STATIC_LINK_LIBS ${FLATBUFFERS_STATIC_LIB} ${CMAKE_THREAD_LIBS_INIT} arrow_static)

# The optimization flag -O3 is suggested by dlmalloc.c, which is #included in
# malloc.cc; we set it here regardless of whether we do a debug or release build.
set_source_files_properties(malloc.cc PROPERTIES COMPILE_FLAGS "-Wno-error -O3")

add_executable(plasma_store store.cc)
target_link_libraries(plasma_store plasma_static)

ADD_ARROW_TEST(test/serialization_tests)
ARROW_TEST_LINK_LIBRARIES(test/serialization_tests plasma_static)
ADD_ARROW_TEST(test/client_tests)
ARROW_TEST_LINK_LIBRARIES(test/client_tests plasma_static)

if(PLASMA_PYTHON)
add_library(plasma_extension SHARED extension.cc)

if(APPLE)
target_link_libraries(plasma_extension plasma_static "-undefined dynamic_lookup")
else(APPLE)
target_link_libraries(plasma_extension plasma_static -Wl,--whole-archive ${FLATBUFFERS_STATIC_LIB} -Wl,--no-whole-archive)
endif(APPLE)
endif()
Loading

0 comments on commit 2c81015

Please sign in to comment.