Skip to content

Commit 5edb375

Browse files
authored
[FEATURE-3] Replace cppkafka with librdkafka, and removing everything using boost. (#6)
Signed-off-by: Tao He <[email protected]>
1 parent 53b1f4f commit 5edb375

13 files changed

+232
-168
lines changed

.github/workflows/build-doc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install Dependencies
1616
run: |
1717
sudo apt update -y
18-
sudo apt install -y libmpich-dev libgoogle-glog-dev libgflags-dev libboost-dev librdkafka-dev doxygen
18+
sudo apt install -y libmpich-dev libgoogle-glog-dev libgflags-dev librdkafka-dev doxygen
1919
- name: Build Doc
2020
run: |
2121
mkdir build

.github/workflows/c-cpp.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
if: runner.os == 'Linux'
2424
run: |
2525
sudo apt update -y
26-
sudo apt install -y libmpich-dev libgoogle-glog-dev libgflags-dev libboost-dev librdkafka-dev
26+
sudo apt install -y libmpich-dev libgoogle-glog-dev libgflags-dev librdkafka-dev
2727
- name: Install Dependencies for macOS
2828
if: runner.os == 'macOS'
2929
run: |
3030
sudo scutil --set HostName my_computer.local
3131
echo '127.0.0.1 my_computer.local' | sudo tee -a /etc/hosts
32-
brew install mpich glog gflags boost librdkafka
32+
brew install mpich glog gflags librdkafka
3333
- name: Build
3434
run: |
3535
mkdir build

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "examples/gnn_sampler/thirdparty/cppkafka"]
2-
path = examples/gnn_sampler/thirdparty/cppkafka
3-
url = https://github.com/mfontanini/cppkafka.git

CMakeLists.txt

+13-15
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,13 @@ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -g")
5757
# ------------------------------------------------------------------------------
5858
find_package(MPI REQUIRED)
5959
include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
60-
find_package(Boost REQUIRED)
61-
include_directories(${Boost_INCLUDE_DIRS})
6260

6361
# find Threads------------------------------------------------------------------
6462
set(CMAKE_THREAD_PREFER_PTHREAD ON)
6563
find_package(Threads REQUIRED)
6664

6765
# find glog---------------------------------------------------------------------
6866
include("cmake/FindGlog.cmake")
69-
7067
if (NOT GLOG_FOUND)
7168
message(FATAL_ERROR "glog not found, please install the glog library")
7269
else ()
@@ -92,6 +89,12 @@ if (USE_JEMALLOC)
9289
endif ()
9390
endif ()
9491

92+
# find rdkafka---------------------------------------------------------------------
93+
include("cmake/FindRdkafka.cmake")
94+
if (NOT RDKAFKA_FOUND)
95+
message(STATUS "rdkafka not found, build without rdkafka")
96+
endif ()
97+
9598
# ------------------------------------------------------------------------------
9699
# generete libgrape-lite
97100
# ------------------------------------------------------------------------------
@@ -107,7 +110,7 @@ if (JEMALLOC_FOUND)
107110
endif ()
108111

109112
if (NOT GFLAGS_FOUND)
110-
message(WARNING "Disable examples because gflags not found")
113+
message(WARNING "Disable analytical_apps because gflags not found")
111114
else ()
112115
add_executable(analytical_apps examples/analytical_apps/flags.cc
113116
examples/analytical_apps/run_app.cc)
@@ -118,24 +121,19 @@ else ()
118121
${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES} ${CMAKE_DL_LIBS})
119122
endif ()
120123

121-
if (NOT (EXISTS ${CMAKE_SOURCE_DIR}/examples/gnn_sampler/thirdparty/cppkafka/CMakeLists.txt))
122-
message(WARNING "Disable gnn_sampler because submodule cppkafka isn't checkout not")
123-
elseif (NOT GFLAGS_FOUND)
124-
message(WARNING "Disable examples because gflags not found")
124+
if (NOT GFLAGS_FOUND)
125+
message(WARNING "Disable gnn_sampler because gflags not found")
126+
elseif (NOT RDKAFKA_FOUND)
127+
message(WARNING "Disable gnn_sampler because rdkafka not found")
125128
else ()
126-
set(CPPKAFKA_DISABLE_TESTS ON CACHE BOOL "Disable cppkafka tests")
127-
set(CPPKAFKA_DISABLE_EXAMPLES ON CACHE BOOL "Disable cppkafka examples")
128-
add_subdirectory(examples/gnn_sampler/thirdparty/cppkafka)
129-
130129
add_executable(gnn_sampler examples/gnn_sampler/run_sampler.cc)
131130
set_target_properties(gnn_sampler PROPERTIES OUTPUT_NAME run_sampler)
132131
target_include_directories(gnn_sampler PRIVATE
133132
examples/gnn_sampler
134133
examples/gnn_sampler/thirdparty
135-
exampler/gnn_sampler/thirdparty/cppkafka/include
136134
${RDKAFKA_INCLUDE_DIR})
137-
target_link_libraries(gnn_sampler grape-lite cppkafka ${MPI_CXX_LIBRARIES}
138-
${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES} ${CMAKE_DL_LIBS} ${Boost_LIBRARIES})
135+
target_link_libraries(gnn_sampler grape-lite ${MPI_CXX_LIBRARIES}
136+
${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES} ${CMAKE_DL_LIBS} ${RDKAFKA_LIBRARIES})
139137
endif ()
140138

141139
# ------------------------------------------------------------------------------

LICENSE

+1-31
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ DEALINGS IN THE SOFTWARE.
248248

249249
-------------------------------------------------------------------------------
250250

251-
cmake/{FindGFlags.cmake,FindGlog.cmake,FindJemalloc.cmake} is based on code
251+
cmake/{FindGFlags.cmake,FindGlog.cmake,FindJemalloc.cmake,FindRdkafka.cmake} is based on code
252252
from BVLC/Caffe, has the following license:
253253

254254
COPYRIGHT
@@ -665,36 +665,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
665665

666666
-------------------------------------------------------------------------------
667667

668-
examples/gnn_sampler/thirdparty/cppkafka: BSD 2-Clause License
669-
670-
Copyright (c) 2016-2017, Matias Fontanini
671-
All rights reserved.
672-
673-
Redistribution and use in source and binary forms, with or without
674-
modification, are permitted provided that the following conditions are
675-
met:
676-
677-
* Redistributions of source code must retain the above copyright
678-
notice, this list of conditions and the following disclaimer.
679-
* Redistributions in binary form must reproduce the above
680-
copyright notice, this list of conditions and the following disclaimer
681-
in the documentation and/or other materials provided with the
682-
distribution.
683-
684-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
685-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
686-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
687-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
688-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
689-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
690-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
691-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
692-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
693-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
694-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
695-
696-
-------------------------------------------------------------------------------
697-
698668
examples/gnn_sampler/thirdparty/xoroshiro: The MIT License (MIT)
699669

700670
The MIT License (MIT)

NOTICE.txt

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ This product includes software from the Caffe project (BSD, 2-clause)
1919
This product includes software from the libcxx project (Apache License v2.0 with LLVM Exceptions)
2020
* https://github.com/llvm-mirror/libcxx
2121

22-
This product includes software from the cppkafka project (BSD, 2-Clause)
23-
* Copyright (c) 2016-2017, Matias Fontanini
24-
* https://github.com/mfontanini/cppkafka
25-
2622
This product includes software from the xoroshiro project (MIT)
2723
* Copyright (c) 2017-19 Melissa E. O'Neill
2824
* http://prng.di.unimi.it/

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ Here are the dependencies for optional features:
3030

3131
Extra dependencies are required by examples:
3232
- [gflags](https://github.com/gflags/gflags) (>= 2.2.0);
33-
- [boost](https://www.boost.org/) (>= 1.58);
3433
- [Apache Kafka](https://github.com/apache/kafka) (>= 2.3.0);
35-
- [librdkafka](https://github.com/edenhill/librdkafka)(>1.4.0) as the dependency for [cppkafka](https://github.com/mfontanini/cppkafka) (included as a submodule).
34+
- [librdkafka](https://github.com/edenhill/librdkafka)(>= 0.11.3);
3635

3736

3837
### Building libgrape-lite and examples
@@ -107,7 +106,6 @@ The latest version of online documentation can be found at [https://alibaba.gith
107106

108107
- [flat_hash_map](https://github.com/skarupke/flat_hash_map), an efficient hashmap implementation;
109108
- [granula](https://github.com/atlarge-research/granula), a tool for gathering performance information for LDBC Benchmark;
110-
- [cppkafka](https://github.com/mfontanini/cppkafka), a C++ wrapper of librdkafka;
111109
- [xoroshiro](http://prng.di.unimi.it/), a pseudo-random number generator.
112110

113111

cmake/FindRdkafka.cmake

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This file is used to find librdkafka library in CMake script, modifeid from the
2+
# code from
3+
#
4+
# https://github.com/BVLC/caffe/blob/master/cmake/Modules/FindGlog.cmake
5+
#
6+
# which is licensed under the 2-Clause BSD License.
7+
#
8+
# - Try to find librdkafka
9+
#
10+
# The following variables are optionally searched for defaults
11+
# RDKAFKA_ROOT_DIR: Base directory where all RDKAFKA components are found
12+
#
13+
# The following are set after configuration is done:
14+
# RDKAFKA_FOUND
15+
# RDKAFKA_INCLUDE_DIRS
16+
# RDKAFKA_LIBRARIES
17+
# RDKAFKA_LIBRARY_DIRS
18+
19+
include(FindPackageHandleStandardArgs)
20+
21+
set(RDKAFKA_ROOT_DIR "" CACHE PATH "Folder contains librdkafka")
22+
23+
# We are testing only a couple of files in the include directories
24+
find_path(RDKAFKA_INCLUDE_DIR librdkafka PATHS ${RDKAFKA_ROOT_DIR}/include)
25+
26+
find_library(RDKAFKA_LIBRARY rdkafka PATHS ${RDKAFKA_ROOT_DIR}/lib)
27+
find_library(RDKAFKA++_LIBRARY rdkafka++ PATHS ${RDKAFKA_ROOT_DIR}/lib)
28+
29+
find_package_handle_standard_args(RDKAFKA DEFAULT_MSG RDKAFKA_INCLUDE_DIR RDKAFKA_LIBRARY)
30+
31+
32+
if(RDKAFKA_FOUND)
33+
set(RDKAFKA_INCLUDE_DIRS ${RDKAFKA_INCLUDE_DIR})
34+
# The RDKAFKA_LIBRARY comes later, since it is depended by the former.
35+
set(RDKAFKA_LIBRARIES ${RDKAFKA++_LIBRARY} ${RDKAFKA_LIBRARY})
36+
message(STATUS "Found rdkafka (include: ${RDKAFKA_INCLUDE_DIRS}, library: ${RDKAFKA_LIBRARIES})")
37+
mark_as_advanced(RDKAFKA_LIBRARY_DEBUG RDKAFKA_LIBRARY_RELEASE
38+
RDKAFKA_LIBRARY RDKAFKA_INCLUDE_DIR RDKAFKA_ROOT_DIR)
39+
endif()

0 commit comments

Comments
 (0)