2012-06-19 19:40:44 +00:00
|
|
|
#
|
|
|
|
# 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
|
2015-06-29 19:01:17 +00:00
|
|
|
#
|
2012-06-19 19:40:44 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2017-07-20 00:51:14 +00:00
|
|
|
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
2012-06-19 19:40:44 +00:00
|
|
|
|
2015-06-29 19:01:17 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../hadoop-common-project/hadoop-common)
|
|
|
|
include(HadoopCommon)
|
2012-06-19 19:40:44 +00:00
|
|
|
|
2015-06-29 19:01:17 +00:00
|
|
|
find_package(OpenSSL REQUIRED)
|
2020-02-10 03:55:04 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
pkg_check_modules(LIBTIRPC libtirpc)
|
|
|
|
|
|
|
|
find_path(RPC_INCLUDE_DIRS NAMES rpc/rpc.h)
|
|
|
|
|
|
|
|
if (NOT RPC_INCLUDE_DIRS)
|
|
|
|
find_path(TIRPC_INCLUDE_DIRS
|
|
|
|
NAMES netconfig.h
|
|
|
|
PATH_SUFFIXES tirpc
|
|
|
|
HINTS ${LIBTIRPC_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
find_library(TIRPC_LIBRARIES
|
|
|
|
NAMES tirpc
|
|
|
|
HINTS ${LIBTIRPC_LIBRARY_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(${TIRPC_INCLUDE_DIRS})
|
|
|
|
endif()
|
2012-06-19 19:40:44 +00:00
|
|
|
|
|
|
|
include_directories(
|
|
|
|
main/native/utils/api
|
|
|
|
main/native/pipes/api
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${OPENSSL_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
# Example programs
|
|
|
|
add_executable(wordcount-simple main/native/examples/impl/wordcount-simple.cc)
|
|
|
|
target_link_libraries(wordcount-simple hadooppipes hadooputils)
|
2015-06-29 19:01:17 +00:00
|
|
|
hadoop_output_directory(wordcount-simple examples)
|
2012-06-19 19:40:44 +00:00
|
|
|
|
|
|
|
add_executable(wordcount-part main/native/examples/impl/wordcount-part.cc)
|
|
|
|
target_link_libraries(wordcount-part hadooppipes hadooputils)
|
2015-06-29 19:01:17 +00:00
|
|
|
hadoop_output_directory(wordcount-part examples)
|
2012-06-19 19:40:44 +00:00
|
|
|
|
|
|
|
add_executable(wordcount-nopipe main/native/examples/impl/wordcount-nopipe.cc)
|
|
|
|
target_link_libraries(wordcount-nopipe hadooppipes hadooputils)
|
2015-06-29 19:01:17 +00:00
|
|
|
hadoop_output_directory(wordcount-nopipe examples)
|
2012-06-19 19:40:44 +00:00
|
|
|
|
|
|
|
add_executable(pipes-sort main/native/examples/impl/sort.cc)
|
|
|
|
target_link_libraries(pipes-sort hadooppipes hadooputils)
|
2015-06-29 19:01:17 +00:00
|
|
|
hadoop_output_directory(pipes-sort examples)
|
2012-06-19 19:40:44 +00:00
|
|
|
|
|
|
|
add_library(hadooputils STATIC
|
|
|
|
main/native/utils/impl/StringUtils.cc
|
|
|
|
main/native/utils/impl/SerialUtils.cc
|
|
|
|
)
|
2020-02-10 03:55:04 +00:00
|
|
|
if (NOT RPC_INCLUDE_DIRS AND LIBTIRPC_FOUND)
|
|
|
|
target_link_libraries(hadooputils tirpc)
|
|
|
|
endif()
|
2012-06-19 19:40:44 +00:00
|
|
|
|
|
|
|
add_library(hadooppipes STATIC
|
|
|
|
main/native/pipes/impl/HadoopPipes.cc
|
|
|
|
)
|
2015-05-22 19:51:03 +00:00
|
|
|
|
2015-06-29 19:01:17 +00:00
|
|
|
include(CheckLibraryExists)
|
|
|
|
check_library_exists(dl dlopen "" NEED_LINK_DL)
|
|
|
|
|
|
|
|
if(NEED_LINK_DL)
|
|
|
|
set(LIB_DL "dl")
|
|
|
|
endif()
|
2015-05-22 19:51:03 +00:00
|
|
|
|
2015-06-29 19:01:17 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
|
|
|
exec_program("uname" ARGS "-r" OUTPUT_VARIABLE OS_VERSION)
|
|
|
|
if(OS_VERSION VERSION_LESS "5.12")
|
|
|
|
set(LIB_NET "socket" "nsl")
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-05-22 19:51:03 +00:00
|
|
|
|
2012-06-19 19:40:44 +00:00
|
|
|
target_link_libraries(hadooppipes
|
|
|
|
${OPENSSL_LIBRARIES}
|
2015-05-22 19:51:03 +00:00
|
|
|
${LIB_DL}
|
2015-06-29 19:01:17 +00:00
|
|
|
${LIB_NET}
|
2012-06-19 19:40:44 +00:00
|
|
|
)
|