Skip to content

Commit 279fc51

Browse files
committed
HDFS-14244 Additional patch to hook up the examples. I promoted enough of the
header files from common to include so that the examples didn't need to use files that we aren't installing.
1 parent 60b31af commit 279fc51

36 files changed

+82
-74
lines changed

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ if (HADOOP_BUILD AND NOT HDFSPP_LIBRARY_ONLY)
143143
endif ()
144144

145145
if (NOT HDFSPP_LIBRARY_ONLY)
146+
ExternalProject_Add(hdfspp_examples
147+
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples
148+
CMAKE_ARGS ${HDFSPP_CMAKE_ARGS}
149+
INSTALL_DIR ${STAGING_DIR}
150+
LIST_SEPARATOR |
151+
DEPENDS hdfspp
152+
)
146153
ExternalProject_Add(hdfspp_tools
147154
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools
148155
CMAKE_ARGS ${HDFSPP_CMAKE_ARGS}

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,27 @@
1616
# limitations under the License.
1717
#
1818

19+
cmake_minimum_required(VERSION 2.8.12)
20+
if (POLICY CMP0042)
21+
cmake_policy(SET CMP0042 NEW) # suppress warning about mac rpath
22+
endif ()
23+
24+
project (HDFSPP_EXAMPLES)
25+
26+
include(DecideSasl)
27+
28+
find_package(ASIO REQUIRED)
29+
find_package(HDFSPP REQUIRED)
30+
find_package(Protobuf REQUIRED)
31+
32+
include(HdfsppCompilerOptions)
33+
34+
include_directories(
35+
${HDFSPP_INCLUDE_DIR}
36+
${ASIO_INCLUDE_DIR}
37+
)
38+
1939
add_subdirectory(c)
2040
add_subdirectory(cc)
41+
42+
install(TARGETS)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/c/cat/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,5 @@
1616
# limitations under the License.
1717
#
1818

19-
# Default LIBHDFSPP_DIR to the default install location. You can override
20-
# it by add -DLIBHDFSPP_DIR=... to your cmake invocation
21-
set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
22-
23-
include_directories( ${LIBHDFSPP_DIR}/include )
24-
link_directories( ${LIBHDFSPP_DIR}/lib )
25-
2619
add_executable(cat_c cat.c)
27-
target_link_libraries(cat_c hdfspp_static uriparser2)
20+
target_link_libraries(cat_c hdfspp)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/c/cat/cat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include <stdlib.h>
2727
#include <string.h>
2828
#include "hdfspp/hdfs_ext.h"
29-
#include "uriparser2/uriparser2.h"
30-
#include "common/util_c.h"
29+
#include "hdfspp/uriparser2.h"
30+
#include "hdfspp/util_c.h"
3131

3232
#define SCHEME "hdfs"
3333
#define BUF_SIZE 1048576 //1 MB

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/c/connect_cancel/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,5 @@
1616
# limitations under the License.
1717
#
1818

19-
# Default LIBHDFSPP_DIR to the default install location. You can override
20-
# it by add -DLIBHDFSPP_DIR=... to your cmake invocation
21-
set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
22-
23-
include_directories( ${LIBHDFSPP_DIR}/include )
24-
link_directories( ${LIBHDFSPP_DIR}/lib )
25-
2619
add_executable(connect_cancel_c connect_cancel.c)
27-
target_link_libraries(connect_cancel_c hdfspp_static uriparser2)
20+
target_link_libraries(connect_cancel_c hdfspp)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/c/connect_cancel/connect_cancel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <unistd.h>
3030

3131
#include "hdfspp/hdfs_ext.h"
32-
#include "common/util_c.h"
32+
#include "hdfspp/util_c.h"
3333

3434
#define ERROR_BUFFER_SIZE 1024
3535

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/cc/cat/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
# limitations under the License.
1717
#
1818

19-
# Default LIBHDFSPP_DIR to the default install location. You can override
20-
# it by add -DLIBHDFSPP_DIR=... to your cmake invocation
21-
set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
22-
23-
include_directories( ${LIBHDFSPP_DIR}/include )
24-
link_directories( ${LIBHDFSPP_DIR}/lib )
25-
26-
add_executable(cat cat.cc)
27-
target_link_libraries(cat tools_common hdfspp_static)
19+
add_executable(cat cat.cc
20+
${CMAKE_SOURCE_DIR}/../tools/tools_common.cc)
21+
target_link_libraries(cat hdfspp protobuf)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/cc/connect_cancel/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ include_directories( ${LIBHDFSPP_DIR}/include )
2424
link_directories( ${LIBHDFSPP_DIR}/lib )
2525

2626
add_executable(connect_cancel connect_cancel.cc)
27-
target_link_libraries(connect_cancel hdfspp_static)
27+
target_link_libraries(connect_cancel hdfspp protobuf)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/cc/connect_cancel/connect_cancel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020

2121
#include "hdfspp/hdfspp.h"
22-
#include "common/hdfs_configuration.h"
23-
#include "common/configuration_loader.h"
22+
#include "hdfspp/hdfs_configuration.h"
23+
#include "hdfspp/configuration_loader.h"
2424

2525
#include <google/protobuf/stubs/common.h>
2626

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/examples/cc/find/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
2323
include_directories( ${LIBHDFSPP_DIR}/include )
2424
link_directories( ${LIBHDFSPP_DIR}/lib )
2525

26-
add_executable(find find.cc)
27-
target_link_libraries(find tools_common hdfspp_static)
26+
add_executable(find find.cc
27+
${CMAKE_SOURCE_DIR}/../tools/tools_common.cc)
28+
target_link_libraries(find hdfspp protobuf)

0 commit comments

Comments
 (0)