From 71b4f2ea25cd2c2327f21f92a86653139219ef39 Mon Sep 17 00:00:00 2001 From: Bob Hansen Date: Wed, 3 Feb 2016 16:38:25 -0500 Subject: [PATCH] HDFS-9737: libhdfs++: Create examples of consuming libhdfs++. Contributed by Bob Hansen --- .../src/main/native/libhdfspp/CMakeLists.txt | 7 +++++++ .../src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt index 847500082f..834da71a14 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt @@ -124,6 +124,7 @@ include_directories( SYSTEM add_subdirectory(third_party/gmock-1.7.0) add_subdirectory(lib) add_subdirectory(tests) +add_subdirectory(examples) # create an empty file; hadoop_add_dual_library wraps add_library which # requires at least one file as an argument @@ -170,3 +171,9 @@ install(FILES ${LIBHDFS_HEADER_FILES} DESTINATION /include/hdfs) install(TARGETS hdfspp_static ARCHIVE DESTINATION /lib) install(TARGETS hdfspp LIBRARY DESTINATION /lib) + +add_custom_target( + InstallToBuildDirectory + COMMAND "${CMAKE_MAKE_PROGRAM}" install DESTDIR=${PROJECT_BINARY_DIR}/output +) +set(LIBHDFSPP_DIR ${PROJECT_BINARY_DIR}/output) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h index 3017fe1ffa..1ddeba14e2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/hdfs_ext.h @@ -50,7 +50,9 @@ * Keep C bindings that are libhdfs++ specific in here. **/ +#ifdef __cplusplus extern "C" { +#endif /** * Reads the last error, if any, that happened in this thread * into the user supplied buffer. @@ -108,5 +110,8 @@ int hdfsBuilderConfGetStr(struct hdfsBuilder *bld, const char *key, */ int hdfsBuilderConfGetInt(struct hdfsBuilder *bld, const char *key, int32_t *val); +#ifdef __cplusplus } /* end extern "C" */ #endif + +#endif