Parcourir la source

HDFS-9737: libhdfs++: Create examples of consuming libhdfs++. Contributed by Bob Hansen

Bob Hansen il y a 9 ans
Parent
commit
b931869b9f

+ 7 - 0
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)

+ 5 - 0
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