2012-06-11 18:34:40 +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
|
|
|
|
#
|
|
|
|
# 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.6 FATAL_ERROR)
|
|
|
|
|
2015-06-30 23:24:19 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../../../hadoop-common-project/hadoop-common)
|
|
|
|
include(HadoopCommon)
|
2012-06-11 18:34:40 +00:00
|
|
|
|
2015-06-30 23:24:19 +00:00
|
|
|
# Note: can't use -D_FILE_OFFSET_BITS=64, see MAPREDUCE-4258
|
|
|
|
string(REPLACE "-D_FILE_OFFSET_BITS=64" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
string(REPLACE "-D_FILE_OFFSET_BITS=64" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
2012-06-11 18:34:40 +00:00
|
|
|
|
2014-09-24 15:47:55 +00:00
|
|
|
include(CheckFunctionExists)
|
2016-07-30 15:26:00 +00:00
|
|
|
check_function_exists(canonicalize_file_name HAVE_CANONICALIZE_FILE_NAME)
|
2015-06-30 23:24:19 +00:00
|
|
|
check_function_exists(fcloseall HAVE_FCLOSEALL)
|
2016-07-30 15:26:00 +00:00
|
|
|
check_function_exists(fchmodat HAVE_FCHMODAT)
|
|
|
|
check_function_exists(fdopendir HAVE_FDOPENDIR)
|
|
|
|
check_function_exists(fstatat HAVE_FSTATAT)
|
|
|
|
check_function_exists(openat HAVE_OPENAT)
|
|
|
|
check_function_exists(unlinkat HAVE_UNLINKAT)
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
include_directories( /System/Library/Frameworks )
|
|
|
|
find_library(COCOA_LIBRARY Cocoa)
|
|
|
|
mark_as_advanced(COCOA_LIBRARY)
|
|
|
|
set(EXTRA_LIBS ${COCOA_LIBRARY})
|
|
|
|
endif(APPLE)
|
2014-09-24 15:47:55 +00:00
|
|
|
|
2012-06-11 18:34:40 +00:00
|
|
|
function(output_directory TGT DIR)
|
2015-06-30 23:24:19 +00:00
|
|
|
set_target_properties(${TGT} PROPERTIES
|
2012-06-11 18:34:40 +00:00
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
|
2015-06-30 23:24:19 +00:00
|
|
|
set_target_properties(${TGT} PROPERTIES
|
2012-06-11 18:34:40 +00:00
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
|
2015-06-30 23:24:19 +00:00
|
|
|
set_target_properties(${TGT} PROPERTIES
|
2012-06-11 18:34:40 +00:00
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
|
2015-06-30 23:24:19 +00:00
|
|
|
endfunction()
|
2012-06-11 18:34:40 +00:00
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
main/native/container-executor
|
|
|
|
main/native/container-executor/impl
|
|
|
|
)
|
2015-06-30 23:24:19 +00:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
|
2012-06-11 18:34:40 +00:00
|
|
|
|
|
|
|
add_library(container
|
|
|
|
main/native/container-executor/impl/configuration.c
|
|
|
|
main/native/container-executor/impl/container-executor.c
|
2016-07-30 15:26:00 +00:00
|
|
|
main/native/container-executor/impl/get_executable.c
|
2012-06-11 18:34:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(container-executor
|
|
|
|
main/native/container-executor/impl/main.c
|
|
|
|
)
|
|
|
|
target_link_libraries(container-executor
|
|
|
|
container
|
|
|
|
)
|
|
|
|
output_directory(container-executor target/usr/local/bin)
|
|
|
|
|
|
|
|
add_executable(test-container-executor
|
|
|
|
main/native/container-executor/test/test-container-executor.c
|
|
|
|
)
|
|
|
|
target_link_libraries(test-container-executor
|
2016-07-30 15:26:00 +00:00
|
|
|
container ${EXTRA_LIBS}
|
2012-06-11 18:34:40 +00:00
|
|
|
)
|
|
|
|
output_directory(test-container-executor target/usr/local/bin)
|