mirror of
https://github.com/apache/impala.git
synced 2025-12-19 09:58:28 -05:00
This patch applies various fixes to Impala and to the copied Kudu source code in be/src/kudu/* to allow everything to compile. Some highlights of the changes made: - Various Kudu files were removed from compilation due to issues like relying on libraries that Impala does not provide. The linking of some executable is also changed for similar reasons. - The Kudu Cache implementation changed to support unique_ptr, allowing us to remove various uses of MakeScopeExitTrigger. - Some flags that have a DEFINE in both Kudu and Impala are modified to change one of the DEFINEs to a DECLARE. This patch was in part based on the patches that were applied the last time we rebased the Kudu code in IMPALA-7006, and I ensured that all changes from those commits that are still relevant were included here. I also went through all commits that have been applied to the be/src/kudu directory since the last rebase and ensured that all relevant changes from those are included here. Testing: - Passed an exhaustive DEBUG build and a core ASAN build. Change-Id: I1eb4caf927c729109426fb50a28b5e15d6ac46cb Reviewed-on: http://gerrit.cloudera.org:8080/15144 Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Reviewed-by: Joe McDonnell <joemcdonnell@cloudera.com>
143 lines
5.7 KiB
Plaintext
143 lines
5.7 KiB
Plaintext
# 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.
|
|
|
|
# This file was adapted from https://github.com/apache/kudu/blob/master/CMakeLists.txt.
|
|
# It adds two useful cmake methods (ADD_EXPORTABLE_LIBRARY and ADD_THIRDPARTY_LIB), and
|
|
# also defines a shim method (ADD_KUDU_TEST) to simplify importing Kudu's utility
|
|
# libraries.
|
|
|
|
cmake_minimum_required(VERSION 3.2.3)
|
|
include(CMakeParseArguments)
|
|
|
|
# add_library() wrapper provided for compatibility with Kudu. In the original version,
|
|
# this would add a second variant of the library, which is compiled with special
|
|
# visibility flags to hide all symbols except those that are part of the public ABI. Here
|
|
# it is a shim that simply calls add_library() to make the library available for internal
|
|
# linking.
|
|
#
|
|
# Arguments:
|
|
#
|
|
# LIB_NAME is the name of the library. It must come first. Required.
|
|
#
|
|
# SRCS is the list of source files to compile into the library. Required.
|
|
#
|
|
# DEPS is the list of targets that both library variants depend on. Required.
|
|
#
|
|
# The following arguments are all optional, and supported for compatibility, but don't
|
|
# have any effect:
|
|
#
|
|
# NONLINK_DEPS, COMPILE_FLAGS, EXPORTED_SHARED, EXPORTED_OUTPUT_NAME,
|
|
# EXPORTED_OUTPUT_DIRECTORY, EXPORTED_DEPS
|
|
function(ADD_EXPORTABLE_LIBRARY LIB_NAME)
|
|
set(options EXPORTED_SHARED)
|
|
set(one_value_args COMPILE_FLAGS EXPORTED_OUTPUT_NAME EXPORTED_OUTPUT_DIRECTORY)
|
|
set(multi_value_args SRCS DEPS EXPORTED_DEPS NONLINK_DEPS)
|
|
cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
|
|
if(ARG_UNPARSED_ARGUMENTS)
|
|
message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
|
|
endif()
|
|
|
|
add_library(${LIB_NAME} ${ARG_SRCS})
|
|
|
|
set_target_properties(${LIB_NAME} PROPERTIES
|
|
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIB_NAME}"
|
|
LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIB_NAME}"
|
|
EXECUTABLE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}/${LIB_NAME}")
|
|
|
|
if(ARG_COMPILE_FLAGS)
|
|
set_target_properties(${LIB_NAME}
|
|
PROPERTIES COMPILE_FLAGS ${ARG_COMPILE_FLAGS})
|
|
endif()
|
|
if (ARG_DEPS)
|
|
target_link_libraries(${LIB_NAME} ${ARG_DEPS})
|
|
endif()
|
|
endfunction()
|
|
|
|
############################################################
|
|
# Testing
|
|
############################################################
|
|
|
|
function(ADD_KUDU_TEST REL_TEST_NAME)
|
|
# Shim for compatibility, doesn't do anything.
|
|
endfunction()
|
|
|
|
|
|
############################################################
|
|
# Dependencies
|
|
############################################################
|
|
function(ADD_THIRDPARTY_LIB LIB_NAME)
|
|
set(options)
|
|
set(one_value_args SHARED_LIB STATIC_LIB)
|
|
set(multi_value_args DEPS)
|
|
cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
|
|
if(ARG_UNPARSED_ARGUMENTS)
|
|
message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
|
|
endif()
|
|
|
|
if(("${KUDU_LINK}" STREQUAL "s" AND ARG_STATIC_LIB) OR (NOT ARG_SHARED_LIB))
|
|
if(NOT ARG_STATIC_LIB)
|
|
message(FATAL_ERROR "No static or shared library provided for ${LIB_NAME}")
|
|
endif()
|
|
add_library(${LIB_NAME} STATIC IMPORTED)
|
|
set_target_properties(${LIB_NAME}
|
|
PROPERTIES IMPORTED_LOCATION "${ARG_STATIC_LIB}")
|
|
message(STATUS "Added static library dependency ${LIB_NAME}: ${ARG_STATIC_LIB}")
|
|
else()
|
|
add_library(${LIB_NAME} SHARED IMPORTED)
|
|
set_target_properties(${LIB_NAME}
|
|
PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}")
|
|
message(STATUS "Added shared library dependency ${LIB_NAME}: ${ARG_SHARED_LIB}")
|
|
endif()
|
|
|
|
if(ARG_DEPS)
|
|
set_target_properties(${LIB_NAME}
|
|
PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${ARG_DEPS}")
|
|
endif()
|
|
|
|
# Set up an "exported variant" for this thirdparty library (see "Visibility"
|
|
# above). It's the same as the real target, just with an "_exported" suffix.
|
|
# We prefer the static archive if it exists (as it's akin to an "internal"
|
|
# library), but we'll settle for the shared object if we must.
|
|
#
|
|
# A shared object exported variant will force any "leaf" library that
|
|
# transitively depends on it to also depend on it at runtime; this is
|
|
# desirable for some libraries (e.g. cyrus_sasl).
|
|
set(LIB_NAME_EXPORTED ${LIB_NAME}_exported)
|
|
if(ARG_STATIC_LIB)
|
|
add_library(${LIB_NAME_EXPORTED} STATIC IMPORTED)
|
|
set_target_properties(${LIB_NAME_EXPORTED}
|
|
PROPERTIES IMPORTED_LOCATION "${ARG_STATIC_LIB}")
|
|
else()
|
|
add_library(${LIB_NAME_EXPORTED} SHARED IMPORTED)
|
|
set_target_properties(${LIB_NAME_EXPORTED}
|
|
PROPERTIES IMPORTED_LOCATION "${ARG_SHARED_LIB}")
|
|
endif()
|
|
if(ARG_DEPS)
|
|
set_target_properties(${LIB_NAME_EXPORTED}
|
|
PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${ARG_DEPS}")
|
|
endif()
|
|
endfunction()
|
|
|
|
|
|
# This macro initializes KUDU_MIN_TEST_LIBS to KUDU_MIN_TEST_LIBS and
|
|
# appends the passed list of libraries to the end. This ensures that
|
|
# KUDU_MIN_TEST_LIBS is linked first.
|
|
macro(SET_KUDU_TEST_LINK_LIBS)
|
|
set(KUDU_TEST_LINK_LIBS ${KUDU_MIN_TEST_LIBS})
|
|
list(APPEND KUDU_TEST_LINK_LIBS ${ARGN})
|
|
endmacro()
|