IMPALA-4966: Add flatbuffers to build FlatBuffers version 1.6.0 is already included in the toolchain. This commit adds it to the build system.
Change-Id: I2ca255ddf08ac846b454bfa1470ed67b1338d2b0 Reviewed-on: http://gerrit.cloudera.org:8080/6180 Reviewed-by: Dimitris Tsirogiannis <[email protected]> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/60c1c6e8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/60c1c6e8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/60c1c6e8 Branch: refs/heads/master Commit: 60c1c6e81b8705f493c6f9844e4c9a0aeb813721 Parents: 71eb569 Author: Dimitris Tsirogiannis <[email protected]> Authored: Tue Feb 28 13:33:11 2017 -0800 Committer: Impala Public Jenkins <[email protected]> Committed: Thu Mar 2 09:43:03 2017 +0000 ---------------------------------------------------------------------- CMakeLists.txt | 9 +++++++ bin/bootstrap_toolchain.py | 8 +++--- bin/impala-config.sh | 1 + cmake_modules/FindFlatBuffers.cmake | 43 ++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/60c1c6e8/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 207fac4..cc21604 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,7 @@ set_dep_root(BOOST) set_dep_root(BREAKPAD) set_dep_root(BZIP2) set_dep_root(CRCUTIL) +set_dep_root(FLATBUFFERS) set_dep_root(GCC) set_dep_root(GFLAGS) set_dep_root(GLOG) @@ -244,6 +245,14 @@ message(STATUS "Thrift library path: ${THRIFT_LIBS}") message(STATUS "Thrift static library: ${THRIFT_STATIC_LIB}") message(STATUS "Thrift compiler: ${THRIFT_COMPILER}") +# find flatbuffers headers, lib and compiler +find_package(FlatBuffers REQUIRED) +include_directories(${FLATBUFFERS_INCLUDE_DIR}) +set(LIBS ${LIBS} ${FLATBUFFERS_LIBS}) +message(STATUS "FlatBuffers include dir: ${FLATBUFFERS_INCLUDE_DIR}") +message(STATUS "FlatBuffers library path: ${FLATBUFFERS_LIBS}") +message(STATUS "FlatBuffers compiler: ${FLATBUFFERS_COMPILER}") + # find Snappy headers and libs find_package(Snappy REQUIRED) include_directories(${SNAPPY_INCLUDE_DIR}) http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/60c1c6e8/bin/bootstrap_toolchain.py ---------------------------------------------------------------------- diff --git a/bin/bootstrap_toolchain.py b/bin/bootstrap_toolchain.py index 349cd60..72d4041 100755 --- a/bin/bootstrap_toolchain.py +++ b/bin/bootstrap_toolchain.py @@ -349,10 +349,10 @@ if __name__ == "__main__": if not os.path.exists(toolchain_root): os.makedirs(toolchain_root) - packages = ["avro", "binutils", "boost", "breakpad", "bzip2", "cmake", "crcutil", "gcc", - "gflags", "glog", "gperftools", "gtest", "kudu", "libev", "llvm", - ("llvm", "3.8.0-asserts-p1"), "lz4", "openldap", "protobuf", "rapidjson", "re2", - "snappy", "thrift", "tpc-h", "tpc-ds", "zlib"] + packages = ["avro", "binutils", "boost", "breakpad", "bzip2", "cmake", "crcutil", + "flatbuffers", "gcc", "gflags", "glog", "gperftools", "gtest", "kudu", "libev", + "llvm", ("llvm", "3.8.0-asserts-p1"), "lz4", "openldap", "protobuf", "rapidjson", + "re2", "snappy", "thrift", "tpc-h", "tpc-ds", "zlib"] bootstrap(toolchain_root, packages) # Download the CDH components if necessary. http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/60c1c6e8/bin/impala-config.sh ---------------------------------------------------------------------- diff --git a/bin/impala-config.sh b/bin/impala-config.sh index 3b16013..69a368a 100755 --- a/bin/impala-config.sh +++ b/bin/impala-config.sh @@ -84,6 +84,7 @@ export IMPALA_BZIP2_VERSION=1.0.6-p2 export IMPALA_CMAKE_VERSION=3.2.3-p1 export IMPALA_CRCUTIL_VERSION=440ba7babeff77ffad992df3a10c767f184e946e export IMPALA_CYRUS_SASL_VERSION=2.1.23 +export IMPALA_FLATBUFFERS_VERSION=1.6.0 export IMPALA_GCC_VERSION=4.9.2 export IMPALA_GFLAGS_VERSION=2.0 export IMPALA_GLOG_VERSION=0.3.2-p2 http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/60c1c6e8/cmake_modules/FindFlatBuffers.cmake ---------------------------------------------------------------------- diff --git a/cmake_modules/FindFlatBuffers.cmake b/cmake_modules/FindFlatBuffers.cmake new file mode 100644 index 0000000..d61a640 --- /dev/null +++ b/cmake_modules/FindFlatBuffers.cmake @@ -0,0 +1,43 @@ +############################################################################## +# 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. +############################################################################## + +# Find FLATBUFFERS (flatbuffers/include, libflatbuffers.a, flatc) +# This module defines: +# FLATBUFFERS_INCLUDE_DIR, directory containing headers +# FLATBUFFERS_LIBS, path to flatbuffers's static library +# FLATBUFFERS_COMPILER, path to flatc compiler + +find_path(FLATBUFFERS_INCLUDE_DIR flatbuffers/flatbuffers.h + PATHS ${FLATBUFFERS_ROOT}/include + NO_CMAKE_SYSTEM_PATH + NO_SYSTEM_ENVIRONMENT_PATH) + +find_library(FLATBUFFERS_LIBS libflatbuffers.a + PATHS ${FLATBUFFERS_ROOT}/lib + NO_CMAKE_SYSTEM_PATH + NO_SYSTEM_ENVIRONMENT_PATH) + +find_program(FLATBUFFERS_COMPILER flatc + PATHS ${FLATBUFFERS_ROOT}/bin + NO_CMAKE_SYSTEM_PATH + NO_SYSTEM_ENVIRONMENT_PATH) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FLATBUFFERS REQUIRED_VARS + FLATBUFFERS_INCLUDE_DIR FLATBUFERS_LIBS FLATBUFFERS_COMPILER)
