Skip to content

Commit

Permalink
HBASE-18901 [C++] Remove white space lines and clean up CMAKE
Browse files Browse the repository at this point in the history
  • Loading branch information
phrocker committed Oct 12, 2017
1 parent f795983 commit b36e896
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 84 deletions.
31 changes: 0 additions & 31 deletions hbase-native-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# specific language governing permissions and limitations
# under the License.
#

cmake_minimum_required(VERSION 3.0)
PROJECT(hbaseclient CXX)
set(PROJECT_NAME "hbaseclient")
Expand All @@ -26,29 +25,24 @@ set(PROJECT_VERSION_PATCH 0)
set(BUILD_SHARED_LIBS ON)
## set our cmake module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

## include the Protobuf generation code
include(ProtobufGen)
if(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
endif()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(HBASE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase")
set(HBASE_PROTO_GEN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase/if")
set(HBASE_PROTO_GEN_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/hbase/if")

# Set the right openssl root path
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl/")
else()
set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu")
endif()

# Include OpenSSL
find_package (OpenSSL REQUIRED)
if (OPENSSL_FOUND)
Expand All @@ -70,24 +64,18 @@ find_package(Java REQUIRED)
find_package(JNI REQUIRED)
find_package(Zookeeper REQUIRED)
find_package(Protobuf REQUIRED)


if (NOT FOLLY_FOUND)
message(FATAL_ERROR "-- Folly not found")
endif()

if (NOT WANGLE_FOUND)
message(FATAL_ERROR "-- Wangle not found")
endif()

if (NOT PROTOBUF_FOUND)
message(FATAL_ERROR "-- Protocol buffer include directory not found ${PROTOBUF_INCLUDE_DIRS}")
endif()

if (NOT JNI_FOUND)
message(FATAL_ERROR "-- JAVA include directory not found")
endif()

### provide the include directories, starting at the base
### and including those from our
include_directories(include)
Expand All @@ -102,10 +90,6 @@ include_directories(${FOLLY_INCLUDE_DIRS})
### the protocol buffer source/headers without polluting our tree.
set(CMAKE_BINARY_DIR_GEN "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/hbase/if/")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR_GEN})




## build a recursive list of sources
file(GLOB_RECURSE CONNECTION_SRC "${HBASE_SRC_DIR}/connection/*.cc" )
file(GLOB_RECURSE EXCEPTION_SRC "${HBASE_SRC_DIR}/exceptions/*.cc" )
Expand All @@ -118,9 +102,7 @@ file(GLOB_RECURSE TEST_UTIL "${HBASE_SRC_DIR}/test-util/*.cc" )
include_directories(${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY})
include_directories(${SASL_INCLUDE_DIRS})
include_directories(${GFLAGS_INCLUDE_DIR})

file(GLOB_RECURSE PROTO_FILES "${HBASE_SRC_DIR}/if/*.proto" )

### generate the protocol buffers.
generate_protobuf_src(PROTO_SOURCES PROTO_HEADERS ${PROTO_FILES})

Expand All @@ -138,7 +120,6 @@ target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES})
target_link_libraries(hbaseclient-static ${WANGLE_LIBRARIES})
target_link_libraries(hbaseclient-static ${Zookeeper_LIBRARIES})
target_link_libraries(hbaseclient-static ${OPENSSL_LIBRARIES})

add_library(hbaseclient-shared SHARED ${PROTO_SOURCES} ${CLIENT_SRC} ${CONNECTION_SRC} ${EXCEPTION_SRC} ${PROTO_SRC} ${SECURITY_SRC} ${SRDE_SRC} ${UTILS_SRC})
set_target_properties(hbaseclient-shared PROPERTIES LINKER_LANGUAGE CXX)
SET_TARGET_PROPERTIES(hbaseclient-shared PROPERTIES COMPILE_FLAGS " -fPIC")
Expand All @@ -152,7 +133,6 @@ target_link_libraries(hbaseclient-shared ${GFLAGS_SHARED_LIB})
target_link_libraries(hbaseclient-shared ${KRB5_LIBRARIES})
target_link_libraries(hbaseclient-shared ${WANGLE_LIBRARIES})
target_link_libraries(hbaseclient-shared ${Zookeeper_LIBRARIES})

add_executable(simple-client "${HBASE_SRC_DIR}/examples/simple-client.cc")
SET_TARGET_PROPERTIES(simple-client PROPERTIES COMPILE_FLAGS " ")
target_link_libraries(simple-client ${PROTOBUF_LIBRARY})
Expand All @@ -162,7 +142,6 @@ target_link_libraries(simple-client ${GFLAGS_SHARED_LIB})
target_link_libraries(simple-client ${KRB5_LIBRARIES})
target_link_libraries(simple-client ${Zookeeper_LIBRARIES})
target_link_libraries(simple-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT})

add_executable(load-client "${HBASE_SRC_DIR}/examples/load-client.cc")
SET_TARGET_PROPERTIES(load-client PROPERTIES COMPILE_FLAGS " ")
target_link_libraries(load-client ${PROTOBUF_LIBRARY})
Expand All @@ -172,26 +151,19 @@ target_link_libraries(load-client ${GFLAGS_SHARED_LIB})
target_link_libraries(load-client ${KRB5_LIBRARIES})
target_link_libraries(load-client ${Zookeeper_LIBRARIES})
target_link_libraries(load-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT})


if (JNI_FOUND)
message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
endif()

if (NOT SKIP_TESTS)
include(BuildTests)
endif()

## Create a custom target for our linter

add_custom_target(
linter
COMMAND ${CMAKE_SOURCE_DIR}/bin/cpplint.sh)


# Install library headers

include(GNUInstallDirs)
file(GLOB RECURSE HEADERS include/*.h)
set_target_properties(hbaseclient-static PROPERTIES PUBLIC_HEADER "${HEADERS}")
Expand All @@ -200,18 +172,15 @@ install(TARGETS hbaseclient-static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include/
COMPONENT LIBRARY )

install(TARGETS hbaseclient-shared
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include/
COMPONENT LIBRARY )

INSTALL (
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION include/
FILES_MATCHING PATTERN "*.h*")

# Install pb-generated headers too
INSTALL (
DIRECTORY "${CMAKE_BINARY_DIR_GEN}"
Expand Down
12 changes: 0 additions & 12 deletions hbase-native-client/cmake/BuildTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


### test functions

MACRO(GETSOURCEFILES result curdir)
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
SET(dirlist "")
Expand All @@ -29,7 +26,6 @@ MACRO(GETSOURCEFILES result curdir)
ENDFOREACH()
SET(${result} ${dirlist})
ENDMACRO()

find_package(GMock REQUIRED)
add_library(testutil STATIC ${TEST_UTIL})
target_include_directories(testutil PRIVATE BEFORE "include")
Expand All @@ -43,7 +39,6 @@ target_include_directories(testutil PRIVATE BEFORE${KRB5_INCLUDE_DIRS})
target_include_directories(testutil PRIVATE BEFORE${Java_INCLUDE_DIRS})
target_include_directories(testutil PRIVATE BEFORE${FOLLY_INCLUDE_DIRS})
target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${KRB5_LIBRARIES} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES})

function(createTests testName)
message ("-- Including Test: ${testName}")
target_include_directories(${testName} PRIVATE BEFORE "include")
Expand Down Expand Up @@ -71,14 +66,9 @@ function(createTests testName)
${FOLLY_LIBRARIES}
${GLOG_SHARED_LIB})
endfunction()


enable_testing(test)

SET(TEST_DIR ${CMAKE_SOURCE_DIR}/src/test)

GETSOURCEFILES(UNIT_TESTS "${TEST_DIR}")

SET(UNIT_TEST_COUNT 0)
FOREACH(testfile ${UNIT_TESTS})
get_filename_component(testfilename "${testfile}" NAME_WE)
Expand All @@ -88,5 +78,3 @@ FOREACH(testfile ${UNIT_TESTS})
add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
ENDFOREACH()
message("-- Finished building ${UNIT_TEST_COUNT} unit test file(s)...")


7 changes: 0 additions & 7 deletions hbase-native-client/cmake/FindFolly.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,32 @@
# specific language governing permissions and limitations
# under the License.
#

find_path(FOLLY_ROOT_DIR
NAMES include/folly/AtomicHashMap.h
)

find_library(FOLLY_LIBRARIES
NAMES folly
HINTS ${FOLLY_ROOT_DIR}/lib /usr/lib/ /usr/local/lib/ /usr/lib/x86_64-linux-gnu/
)

find_library(FOLLY_BENCHMARK_LIBRARIES
NAMES follybenchmark
HINTS ${FOLLY_ROOT_DIR}/lib
)

find_path(FOLLY_INCLUDE_DIR
NAMES folly/AtomicHashMap.h
HINTS ${FOLLY_ROOT_DIR}/include
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Folly DEFAULT_MSG
FOLLY_LIBRARIES
FOLLY_INCLUDE_DIR
)

mark_as_advanced(
FOLLY_ROOT_DIR
FOLLY_LIBRARIES
FOLLY_BENCHMARK_LIBRARIES
FOLLY_INCLUDE_DIR
)

if (FOLLY_LIBRARIES)
set(FOLLY_FOUND "true")
message("-- Folly found, ${FOLLY_LIBRARIES}")
Expand Down
2 changes: 0 additions & 2 deletions hbase-native-client/cmake/FindGMock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

find_path(GMOCK_INCLUDE_DIR gmock/gmock.h)
# make sure we don't accidentally pick up a different version
find_library(GMOCK_SHARED_LIB gmock)
find_library(GMOCK_STATIC_LIB libgmock.a)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GMOCK REQUIRED_VARS
GMOCK_SHARED_LIB GMOCK_STATIC_LIB GMOCK_INCLUDE_DIR)
2 changes: 0 additions & 2 deletions hbase-native-client/cmake/FindGflags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h)
# make sure we don't accidentally pick up a different version
find_library(GFLAGS_SHARED_LIB gflags)
find_library(GFLAGS_STATIC_LIB libgflags.a)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GFLAGS REQUIRED_VARS
GFLAGS_SHARED_LIB GFLAGS_STATIC_LIB GFLAGS_INCLUDE_DIR)
2 changes: 0 additions & 2 deletions hbase-native-client/cmake/FindGlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

find_path(GLOG_INCLUDE_DIR glog/logging.h)
# make sure we don't accidentally pick up a different version
find_library(GLOG_SHARED_LIB glog)
find_library(GLOG_STATIC_LIB libglog.a)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLOG REQUIRED_VARS
GLOG_SHARED_LIB GLOG_STATIC_LIB GLOG_INCLUDE_DIR)
6 changes: 0 additions & 6 deletions hbase-native-client/cmake/FindKrb5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,23 @@
find_path(KRB5_ROOT_DIR
NAMES include/krb5/krb5.h
)

find_library(KRB5_LIBRARIES
NAMES krb5
HINTS ${KRB5_ROOT_DIR}/lib
)


find_path(KRB5_INCLUDE_DIR
NAMES krb5/krb5.h
HINTS ${KRB5_ROOT_DIR}/include
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(krb5 DEFAULT_MSG
KRB5_LIBRARIES
KRB5_INCLUDE_DIR
)

if (KRB5_LIBRARIES)
set(KRB5_FOUND "true")
message("-- KRB5 Libs Found, ${KRB5_LIBRARIES}")
endif()

mark_as_advanced(
KRB5_ROOT_DIR
KRB5_LIBRARIES
Expand Down
3 changes: 0 additions & 3 deletions hbase-native-client/cmake/FindSasl2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
# under the License.
#
include(CheckSymbolExists)

find_path (
SASL_INCLUDE_DIRS NAMES sasl/sasl.h
PATHS /include /usr/include /usr/local/include /usr/share/include)

find_library(
SASL_LIBS NAMES sasl2
PATHS /usr/lib /lib /usr/local/lib /usr/lib/x86_64-linux-gnu/)

if (SASL_INCLUDE_DIRS AND SASL_LIBS)
set (SASL_FOUND 1)
message("-- LibSASL found, ${SASL_LIBS}")
Expand Down
6 changes: 0 additions & 6 deletions hbase-native-client/cmake/FindWangle.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,27 @@
# specific language governing permissions and limitations
# under the License.
#

find_path(WANGLE_ROOT_DIR
NAMES include/wangle/acceptor/Acceptor.h
)

find_library(WANGLE_LIBRARIES
NAMES wangle
HINTS ${WANGLE_ROOT_DIR}/lib /usr/lib/ /usr/local/lib/
)

find_path(WANGLE_INCLUDE_DIR
NAMES wangle/acceptor/Acceptor.h
HINTS ${WANGLE_ROOT_DIR}/include /usr/local/include/
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(WANGLE DEFAULT_MSG
WANGLE_LIBRARIES
WANGLE_INCLUDE_DIR
)

mark_as_advanced(
WANGLE_ROOT_DIR
WANGLE_LIBRARIES
WANGLE_INCLUDE_DIR
)

if (WANGLE_LIBRARIES)
set(WANGLE_FOUND "true")
message("-- Wangle found, ${WANGLE_LIBRARIES}")
Expand Down
8 changes: 0 additions & 8 deletions hbase-native-client/cmake/FindZookeeper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ if (MSVC)
else()
FILE(TO_CMAKE_PATH ${ZOOKEEPER_HOME} Zookeeper_HomePath)
set(Zookeeper_LIB_PATHS ${Zookeeper_HomePath}/src/c/${ZK_BuildOutputDir})

find_path(ZK_INCLUDE_DIR zookeeper.h ${Zookeeper_HomePath}/src/c/include)
find_path(ZK_INCLUDE_DIR_GEN zookeeper.jute.h ${Zookeeper_HomePath}/src/c/generated)
set(Zookeeper_INCLUDE_DIR zookeeper.h ${ZK_INCLUDE_DIR} ${ZK_INCLUDE_DIR_GEN} )
Expand All @@ -39,21 +38,14 @@ else()
find_path(Zookeeper_INCLUDE_DIR zookeeper/zookeeper.h /usr/local/include)
find_library(Zookeeper_LIBRARY NAMES libzookeeper_mt.a PATHS ${Zookeeper_LIB_PATHS})
endif()


set(Zookeeper_LIBRARIES ${Zookeeper_LIBRARY} )
set(Zookeeper_INCLUDE_DIRS ${Zookeeper_INCLUDE_DIR} )

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set Zookeeper_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Zookeeper DEFAULT_MSG
Zookeeper_LIBRARY Zookeeper_INCLUDE_DIR)

if (Zookeeper_LIBRARY)
message("-- Zookeeper found, ${Zookeeper_LIBRARY}")
endif()

mark_as_advanced(Zookeeper_INCLUDE_DIR Zookeeper_LIBRARY )


Loading

0 comments on commit b36e896

Please sign in to comment.