HADOOP-12104. Migrate Hadoop Pipes native build to new CMake framework (Alan Burlison via Colin P. McCabe)
(cherry picked from commit 5a27c3fd76
)
This commit is contained in:
parent
ada7f66e12
commit
df58fdaf21
|
@ -187,6 +187,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-11885. hadoop-dist dist-layout-stitching.sh does not work with dash.
|
HADOOP-11885. hadoop-dist dist-layout-stitching.sh does not work with dash.
|
||||||
(wang)
|
(wang)
|
||||||
|
|
||||||
|
HADOOP-12104. Migrate Hadoop Pipes native build to new CMake framework
|
||||||
|
(alanburlison via cmccabe)
|
||||||
|
|
||||||
HADOOP-12036. Consolidate all of the cmake extensions in one directory
|
HADOOP-12036. Consolidate all of the cmake extensions in one directory
|
||||||
(alanburlison via cmccabe)
|
(alanburlison via cmccabe)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# to you under the Apache License, Version 2.0 (the
|
# to you under the Apache License, Version 2.0 (the
|
||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
@ -17,26 +17,12 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../hadoop-common-project/hadoop-common)
|
||||||
|
include(HadoopCommon)
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE, Release)
|
|
||||||
|
|
||||||
set(PIPES_FLAGS "-g -Wall -O2 -D_REENTRANT -D_GNU_SOURCE")
|
|
||||||
set(PIPES_FLAGS "${PIPES_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIPES_FLAGS}")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIPES_FLAGS}")
|
|
||||||
|
|
||||||
include(../../../hadoop-common-project/hadoop-common/src/JNIFlags.cmake NO_POLICY_SCOPE)
|
|
||||||
|
|
||||||
function(output_directory TGT DIR)
|
|
||||||
SET_TARGET_PROPERTIES(${TGT} PROPERTIES
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
|
|
||||||
SET_TARGET_PROPERTIES(${TGT} PROPERTIES
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
|
|
||||||
SET_TARGET_PROPERTIES(${TGT} PROPERTIES
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
|
|
||||||
endfunction(output_directory TGT DIR)
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
main/native/utils/api
|
main/native/utils/api
|
||||||
main/native/pipes/api
|
main/native/pipes/api
|
||||||
|
@ -47,19 +33,19 @@ include_directories(
|
||||||
# Example programs
|
# Example programs
|
||||||
add_executable(wordcount-simple main/native/examples/impl/wordcount-simple.cc)
|
add_executable(wordcount-simple main/native/examples/impl/wordcount-simple.cc)
|
||||||
target_link_libraries(wordcount-simple hadooppipes hadooputils)
|
target_link_libraries(wordcount-simple hadooppipes hadooputils)
|
||||||
output_directory(wordcount-simple examples)
|
hadoop_output_directory(wordcount-simple examples)
|
||||||
|
|
||||||
add_executable(wordcount-part main/native/examples/impl/wordcount-part.cc)
|
add_executable(wordcount-part main/native/examples/impl/wordcount-part.cc)
|
||||||
target_link_libraries(wordcount-part hadooppipes hadooputils)
|
target_link_libraries(wordcount-part hadooppipes hadooputils)
|
||||||
output_directory(wordcount-part examples)
|
hadoop_output_directory(wordcount-part examples)
|
||||||
|
|
||||||
add_executable(wordcount-nopipe main/native/examples/impl/wordcount-nopipe.cc)
|
add_executable(wordcount-nopipe main/native/examples/impl/wordcount-nopipe.cc)
|
||||||
target_link_libraries(wordcount-nopipe hadooppipes hadooputils)
|
target_link_libraries(wordcount-nopipe hadooppipes hadooputils)
|
||||||
output_directory(wordcount-nopipe examples)
|
hadoop_output_directory(wordcount-nopipe examples)
|
||||||
|
|
||||||
add_executable(pipes-sort main/native/examples/impl/sort.cc)
|
add_executable(pipes-sort main/native/examples/impl/sort.cc)
|
||||||
target_link_libraries(pipes-sort hadooppipes hadooputils)
|
target_link_libraries(pipes-sort hadooppipes hadooputils)
|
||||||
output_directory(pipes-sort examples)
|
hadoop_output_directory(pipes-sort examples)
|
||||||
|
|
||||||
add_library(hadooputils STATIC
|
add_library(hadooputils STATIC
|
||||||
main/native/utils/impl/StringUtils.cc
|
main/native/utils/impl/StringUtils.cc
|
||||||
|
@ -70,15 +56,22 @@ add_library(hadooppipes STATIC
|
||||||
main/native/pipes/impl/HadoopPipes.cc
|
main/native/pipes/impl/HadoopPipes.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
CHECK_LIBRARY_EXISTS(dl dlopen "" NEED_LINK_DL)
|
check_library_exists(dl dlopen "" NEED_LINK_DL)
|
||||||
|
|
||||||
if (NEED_LINK_DL)
|
if(NEED_LINK_DL)
|
||||||
set(LIB_DL dl)
|
set(LIB_DL "dl")
|
||||||
endif (NEED_LINK_DL)
|
endif()
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
target_link_libraries(hadooppipes
|
target_link_libraries(hadooppipes
|
||||||
${OPENSSL_LIBRARIES}
|
${OPENSSL_LIBRARIES}
|
||||||
${LIB_DL}
|
${LIB_DL}
|
||||||
pthread
|
${LIB_NET}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue