HDFS-11971: libhdfs++: [Fix] a few portability issues. Contributed by Anatoli Schein

This commit is contained in:
James Clampffer 2017-06-20 15:17:58 -04:00
parent 1c9b174663
commit c5e7a69523
9 changed files with 40 additions and 76 deletions

View File

@ -176,6 +176,7 @@ include_directories( SYSTEM
third_party/uriparser2 third_party/uriparser2
${OPENSSL_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}
${SASL_INCLUDE_DIR} ${SASL_INCLUDE_DIR}
${PROTOBUF_INCLUDE_DIRS}
) )
@ -206,6 +207,7 @@ if (HADOOP_BUILD)
${PROTOBUF_LIBRARY} ${PROTOBUF_LIBRARY}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${SASL_LIBRARIES} ${SASL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
) )
else (HADOOP_BUILD) else (HADOOP_BUILD)
add_library(hdfspp_static STATIC ${EMPTY_FILE_CC} ${LIBHDFSPP_ALL_OBJECTS}) add_library(hdfspp_static STATIC ${EMPTY_FILE_CC} ${LIBHDFSPP_ALL_OBJECTS})
@ -214,6 +216,7 @@ else (HADOOP_BUILD)
${PROTOBUF_LIBRARY} ${PROTOBUF_LIBRARY}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${SASL_LIBRARIES} ${SASL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
) )
add_library(hdfspp SHARED ${EMPTY_FILE_CC} ${LIBHDFSPP_ALL_OBJECTS}) add_library(hdfspp SHARED ${EMPTY_FILE_CC} ${LIBHDFSPP_ALL_OBJECTS})
target_link_libraries(hdfspp_static target_link_libraries(hdfspp_static
@ -221,6 +224,7 @@ else (HADOOP_BUILD)
${PROTOBUF_LIBRARY} ${PROTOBUF_LIBRARY}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${SASL_LIBRARIES} ${SASL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
) )
endif (HADOOP_BUILD) endif (HADOOP_BUILD)
set(LIBHDFSPP_VERSION "0.1.0") set(LIBHDFSPP_VERSION "0.1.0")
@ -231,11 +235,11 @@ set_target_properties(hdfspp PROPERTIES
# Can be installed to a particular location via "make DESTDIR=... install" # Can be installed to a particular location via "make DESTDIR=... install"
file(GLOB_RECURSE LIBHDFSPP_HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/include/*.h*") file(GLOB_RECURSE LIBHDFSPP_HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/include/*.h*")
file(GLOB_RECURSE LIBHDFS_HEADER_FILES "${HADOOP_IMPORT_DIR}/include/*.h*") file(GLOB_RECURSE LIBHDFS_HEADER_FILES "${HADOOP_IMPORT_DIR}/include/*.h*")
install(FILES ${LIBHDFSPP_HEADER_FILES} DESTINATION /include/hdfspp) install(FILES ${LIBHDFSPP_HEADER_FILES} DESTINATION include/hdfspp)
install(FILES ${LIBHDFS_HEADER_FILES} DESTINATION /include/hdfs) install(FILES ${LIBHDFS_HEADER_FILES} DESTINATION include/hdfs)
install(TARGETS hdfspp_static ARCHIVE DESTINATION /lib) install(TARGETS hdfspp_static ARCHIVE DESTINATION lib)
install(TARGETS hdfspp LIBRARY DESTINATION /lib) install(TARGETS hdfspp LIBRARY DESTINATION lib)
add_custom_target( add_custom_target(
InstallToBuildDirectory InstallToBuildDirectory

View File

@ -24,12 +24,4 @@ include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib ) link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(cat_c cat.c) add_executable(cat_c cat.c)
target_link_libraries(cat_c hdfspp uriparser2) target_link_libraries(cat_c hdfspp_static uriparser2)
# Several examples in different languages need to produce executables with
# same names. To allow executables with same names we keep their CMake
# names different, but specify their executable names as follows:
set_target_properties( cat_c
PROPERTIES
OUTPUT_NAME "cat"
)

View File

@ -24,12 +24,4 @@ include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib ) link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(connect_cancel_c connect_cancel.c) add_executable(connect_cancel_c connect_cancel.c)
target_link_libraries(connect_cancel_c hdfspp uriparser2) target_link_libraries(connect_cancel_c hdfspp_static uriparser2)
# Several examples in different languages need to produce executables with
# same names. To allow executables with same names we keep their CMake
# names different, but specify their executable names as follows:
set_target_properties( connect_cancel_c
PROPERTIES
OUTPUT_NAME "connect_cancel_c"
)

View File

@ -23,13 +23,5 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
include_directories( ${LIBHDFSPP_DIR}/include ) include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib ) link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(cat_cc cat.cc) add_executable(cat cat.cc)
target_link_libraries(cat_cc hdfspp) target_link_libraries(cat hdfspp_static)
# Several examples in different languages need to produce executables with
# same names. To allow executables with same names we keep their CMake
# names different, but specify their executable names as follows:
set_target_properties( cat_cc
PROPERTIES
OUTPUT_NAME "cat"
)

View File

@ -24,4 +24,4 @@ include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib ) link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(connect_cancel connect_cancel.cc) add_executable(connect_cancel connect_cancel.cc)
target_link_libraries(connect_cancel hdfspp) target_link_libraries(connect_cancel hdfspp_static)

View File

@ -23,13 +23,5 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
include_directories( ${LIBHDFSPP_DIR}/include ) include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib ) link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(find_cc find.cc) add_executable(find find.cc)
target_link_libraries(find_cc hdfspp) target_link_libraries(find hdfspp_static)
# Several examples in different languages need to produce executables with
# same names. To allow executables with same names we keep their CMake
# names different, but specify their executable names as follows:
set_target_properties( find_cc
PROPERTIES
OUTPUT_NAME "find"
)

View File

@ -23,13 +23,5 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
include_directories( ${LIBHDFSPP_DIR}/include ) include_directories( ${LIBHDFSPP_DIR}/include )
link_directories( ${LIBHDFSPP_DIR}/lib ) link_directories( ${LIBHDFSPP_DIR}/lib )
add_executable(gendirs_cc gendirs.cc) add_executable(gendirs gendirs.cc)
target_link_libraries(gendirs_cc hdfspp) target_link_libraries(gendirs hdfspp_static)
# Several examples in different languages need to produce executables with
# same names. To allow executables with same names we keep their CMake
# names different, but specify their executable names as follows:
set_target_properties( gendirs_cc
PROPERTIES
OUTPUT_NAME "gendirs"
)

View File

@ -98,7 +98,7 @@ protected:
static std::string fixCase(const std::string &in) { static std::string fixCase(const std::string &in) {
std::string result(in); std::string result(in);
for (auto & c: result) c = toupper(c); for (auto & c: result) c = (char) toupper(c);
return result; return result;
} }
}; };

View File

@ -27,67 +27,67 @@ add_library(tools_common_obj OBJECT tools_common.cc)
add_library(tools_common $<TARGET_OBJECTS:tools_common_obj>) add_library(tools_common $<TARGET_OBJECTS:tools_common_obj>)
add_executable(hdfs_cat hdfs_cat.cc) add_executable(hdfs_cat hdfs_cat.cc)
target_link_libraries(hdfs_cat tools_common hdfspp) target_link_libraries(hdfs_cat tools_common hdfspp_static)
add_executable(hdfs_chgrp hdfs_chgrp.cc) add_executable(hdfs_chgrp hdfs_chgrp.cc)
target_link_libraries(hdfs_chgrp tools_common hdfspp) target_link_libraries(hdfs_chgrp tools_common hdfspp_static)
add_executable(hdfs_chown hdfs_chown.cc) add_executable(hdfs_chown hdfs_chown.cc)
target_link_libraries(hdfs_chown tools_common hdfspp) target_link_libraries(hdfs_chown tools_common hdfspp_static)
add_executable(hdfs_chmod hdfs_chmod.cc) add_executable(hdfs_chmod hdfs_chmod.cc)
target_link_libraries(hdfs_chmod tools_common hdfspp) target_link_libraries(hdfs_chmod tools_common hdfspp_static)
add_executable(hdfs_find hdfs_find.cc) add_executable(hdfs_find hdfs_find.cc)
target_link_libraries(hdfs_find tools_common hdfspp) target_link_libraries(hdfs_find tools_common hdfspp_static)
add_executable(hdfs_mkdir hdfs_mkdir.cc) add_executable(hdfs_mkdir hdfs_mkdir.cc)
target_link_libraries(hdfs_mkdir tools_common hdfspp) target_link_libraries(hdfs_mkdir tools_common hdfspp_static)
add_executable(hdfs_rm hdfs_rm.cc) add_executable(hdfs_rm hdfs_rm.cc)
target_link_libraries(hdfs_rm tools_common hdfspp) target_link_libraries(hdfs_rm tools_common hdfspp_static)
add_executable(hdfs_ls hdfs_ls.cc) add_executable(hdfs_ls hdfs_ls.cc)
target_link_libraries(hdfs_ls tools_common hdfspp) target_link_libraries(hdfs_ls tools_common hdfspp_static)
add_executable(hdfs_stat hdfs_stat.cc) add_executable(hdfs_stat hdfs_stat.cc)
target_link_libraries(hdfs_stat tools_common hdfspp) target_link_libraries(hdfs_stat tools_common hdfspp_static)
add_executable(hdfs_count hdfs_count.cc) add_executable(hdfs_count hdfs_count.cc)
target_link_libraries(hdfs_count tools_common hdfspp) target_link_libraries(hdfs_count tools_common hdfspp_static)
add_executable(hdfs_df hdfs_df.cc) add_executable(hdfs_df hdfs_df.cc)
target_link_libraries(hdfs_df tools_common hdfspp) target_link_libraries(hdfs_df tools_common hdfspp_static)
add_executable(hdfs_du hdfs_du.cc) add_executable(hdfs_du hdfs_du.cc)
target_link_libraries(hdfs_du tools_common hdfspp) target_link_libraries(hdfs_du tools_common hdfspp_static)
add_executable(hdfs_get hdfs_get.cc) add_executable(hdfs_get hdfs_get.cc)
target_link_libraries(hdfs_get tools_common hdfspp) target_link_libraries(hdfs_get tools_common hdfspp_static)
add_executable(hdfs_copyToLocal hdfs_copyToLocal.cc) add_executable(hdfs_copyToLocal hdfs_copyToLocal.cc)
target_link_libraries(hdfs_copyToLocal tools_common hdfspp) target_link_libraries(hdfs_copyToLocal tools_common hdfspp_static)
add_executable(hdfs_moveToLocal hdfs_moveToLocal.cc) add_executable(hdfs_moveToLocal hdfs_moveToLocal.cc)
target_link_libraries(hdfs_moveToLocal tools_common hdfspp) target_link_libraries(hdfs_moveToLocal tools_common hdfspp_static)
add_executable(hdfs_setrep hdfs_setrep.cc) add_executable(hdfs_setrep hdfs_setrep.cc)
target_link_libraries(hdfs_setrep tools_common hdfspp) target_link_libraries(hdfs_setrep tools_common hdfspp_static)
add_executable(hdfs_allowSnapshot hdfs_allowSnapshot.cc) add_executable(hdfs_allowSnapshot hdfs_allowSnapshot.cc)
target_link_libraries(hdfs_allowSnapshot tools_common hdfspp) target_link_libraries(hdfs_allowSnapshot tools_common hdfspp_static)
add_executable(hdfs_disallowSnapshot hdfs_disallowSnapshot.cc) add_executable(hdfs_disallowSnapshot hdfs_disallowSnapshot.cc)
target_link_libraries(hdfs_disallowSnapshot tools_common hdfspp) target_link_libraries(hdfs_disallowSnapshot tools_common hdfspp_static)
add_executable(hdfs_createSnapshot hdfs_createSnapshot.cc) add_executable(hdfs_createSnapshot hdfs_createSnapshot.cc)
target_link_libraries(hdfs_createSnapshot tools_common hdfspp) target_link_libraries(hdfs_createSnapshot tools_common hdfspp_static)
add_executable(hdfs_renameSnapshot hdfs_renameSnapshot.cc) add_executable(hdfs_renameSnapshot hdfs_renameSnapshot.cc)
target_link_libraries(hdfs_renameSnapshot tools_common hdfspp) target_link_libraries(hdfs_renameSnapshot tools_common hdfspp_static)
add_executable(hdfs_deleteSnapshot hdfs_deleteSnapshot.cc) add_executable(hdfs_deleteSnapshot hdfs_deleteSnapshot.cc)
target_link_libraries(hdfs_deleteSnapshot tools_common hdfspp) target_link_libraries(hdfs_deleteSnapshot tools_common hdfspp_static)
add_executable(hdfs_tail hdfs_tail.cc) add_executable(hdfs_tail hdfs_tail.cc)
target_link_libraries(hdfs_tail tools_common hdfspp) target_link_libraries(hdfs_tail tools_common hdfspp_static)