13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
#=============================================================================
16
- cmake_minimum_required (VERSION 3.14 FATAL_ERROR)
16
+ cmake_minimum_required (VERSION 3.18 FATAL_ERROR)
17
17
18
- project (CUDA_KAFKA VERSION 0.15.0 LANGUAGES C CXX CUDA)
19
-
20
- # TODO: Since we have no actual CUDA code in cudf_kafka this should be removed in the future
21
- # in favor of using FindCUDAToolkit to get the needed CUDA include headers
22
- if (NOT CMAKE_CUDA_COMPILER)
23
- message (SEND_ERROR "CMake cannot locate a CUDA compiler" )
24
- endif (NOT CMAKE_CUDA_COMPILER)
25
-
26
- ###################################################################################################
27
- # - build type ------------------------------------------------------------------------------------
28
-
29
- # Set a default build type if none was specified
30
- set (DEFAULT_BUILD_TYPE "Release" )
31
-
32
- if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
33
- message (STATUS "Setting build type to '${DEFAULT_BUILD_TYPE} ' since none specified." )
34
- set (CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE} " CACHE
35
- STRING "Choose the type of build." FORCE)
36
- # Set the possible values of build type for cmake-gui
37
- set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
38
- "Debug" "Release" "MinSizeRel" "RelWithDebInfo" )
39
- endif (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES )
18
+ project (CUDA_KAFKA VERSION 0.19.0 LANGUAGES CXX)
40
19
41
20
###################################################################################################
42
- # - compiler options ------------------------------------------------------------------------------
43
-
44
- set (CMAKE_CXX_STANDARD 14)
45
- set (CMAKE_CXX_STANDARD_REQUIRED ON )
21
+ # - Build options
22
+ option (BUILD_TESTS "Build tests for libcudf_kafka" ON )
46
23
47
- # To apply RUNPATH to transitive dependencies (this is a temporary solution)
48
- set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--disable-new-dtags" )
49
- set (CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags" )
50
-
51
- # Build options
52
- option (BUILD_TESTS "Configure CMake to build tests" ON )
24
+ message (VERBOSE "CUDF_KAFKA: Build gtests: ${BUILD_TESTS} " )
53
25
54
26
###################################################################################################
55
- # - cmake modules ---------------------------------------------------------------------------------
56
-
57
- message (VERBOSE "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR} " )
58
- set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake/Modules/" ${CMAKE_MODULE_PATH} )
27
+ # - Dependencies
59
28
60
- include (FeatureSummary)
61
- include (CheckIncludeFiles)
62
- include (CheckLibraryExists)
29
+ # CPM
30
+ include (../cmake/thirdparty/CUDF_GetCPM.cmake)
63
31
64
- ###################################################################################################
65
- # - conda environment -----------------------------------------------------------------------------
32
+ # libcudf
33
+ include (cmake/thirdparty/CUDF_KAFKA_GetCUDF.cmake)
66
34
67
- if ("$ENV{CONDA_BUILD} " STREQUAL "1" )
68
- set (CMAKE_SYSTEM_PREFIX_PATH "$ENV{BUILD_PREFIX} ;$ENV{PREFIX} ;${CMAKE_SYSTEM_PREFIX_PATH} " )
69
- set (CONDA_INCLUDE_DIRS "$ENV{BUILD_PREFIX} /include" "$ENV{PREFIX} /include" )
70
- set (CONDA_LINK_DIRS "$ENV{BUILD_PREFIX} /lib" "$ENV{PREFIX} /lib" )
71
- message (VERBOSE "Conda build detected, CMAKE_SYSTEM_PREFIX_PATH set to: ${CMAKE_SYSTEM_PREFIX_PATH} " )
72
- endif ()
35
+ # librdkafka
36
+ include (cmake/thirdparty/CUDF_KAFKA_GetRDKafka.cmake)
73
37
74
- ###################################################################################################
75
- # - add gtest -------------------------------------------------------------------------------------
38
+ # # GTests if enabled
39
+ if (BUILD_TESTS)
40
+ # GoogleTest
41
+ include (../cmake/thirdparty/CUDF_GetGTest.cmake)
76
42
77
- # TODO: This is currently using a nearly duplicate Google Test Module due to CMake source limitations.
78
- # this should be standardized in the future to use the same Google Test Module as cudf
79
- if (BUILD_TESTS)
43
+ # include CTest module -- automatically calls enable_testing()
80
44
include (CTest)
81
- include (ConfigureGoogleTest)
82
-
83
- if (GTEST_FOUND)
84
- message (VERBOSE "Google C++ Testing Framework (Google Test) found in ${GTEST_ROOT} " )
85
- include_directories (${GTEST_INCLUDE_DIR} )
86
- add_subdirectory (${CMAKE_SOURCE_DIR} /tests)
87
- else ()
88
- message (AUTHOR_WARNING "Google C++ Testing Framework (Google Test) not found: automated tests are disabled." )
89
- endif (GTEST_FOUND)
90
- endif (BUILD_TESTS)
91
-
92
- message (VERBOSE "CUDF_KAFKA_TEST_LIST set to: ${CUDF_KAFKA_TEST_LIST} " )
45
+ add_subdirectory (tests)
46
+ endif ()
93
47
94
48
###################################################################################################
95
49
# - include paths ---------------------------------------------------------------------------------
96
50
97
- if (CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
98
- include_directories ("${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} " )
99
- endif (CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
100
-
101
51
include_directories ("${CMAKE_BINARY_DIR} /include"
102
- "${CMAKE_BINARY_DIR} /include/jit"
103
52
"${CMAKE_SOURCE_DIR} /include"
104
53
"${CMAKE_SOURCE_DIR} /src" )
105
54
106
- if (CONDA_INCLUDE_DIRS)
107
- include_directories ("${CONDA_INCLUDE_DIRS} " )
108
- endif (CONDA_INCLUDE_DIRS)
109
-
110
55
###################################################################################################
111
56
# - library paths ---------------------------------------------------------------------------------
112
57
113
58
link_directories ("${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} " # CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES is an undocumented/unsupported variable containing the link directories for nvcc
114
59
"${CMAKE_BINARY_DIR} /lib"
115
- "${CMAKE_BINARY_DIR} "
116
- "${GTEST_LIBRARY_DIR} "
117
- "${RMM_LIBRARY} " )
118
-
119
- if (CONDA_LINK_DIRS)
120
- link_directories ("${CONDA_LINK_DIRS} " )
121
- endif (CONDA_LINK_DIRS)
60
+ "${CMAKE_BINARY_DIR} " )
122
61
123
62
###################################################################################################
124
63
# - library target --------------------------------------------------------------------------------
@@ -127,37 +66,12 @@ add_library(cudf_kafka SHARED
127
66
src/kafka_consumer.cpp
128
67
)
129
68
130
- set_target_properties (cudf_kafka PROPERTIES BUILD_RPATH "\$ ORIGIN" )
131
-
132
- # Include paths
133
- include_directories ("${CMAKE_SOURCE_DIR} /include"
134
- "${CMAKE_CURRENT_SOURCE_DIR} /include/cudf" )
135
-
136
- ###################################################################################################
137
- # cudf_kafka - librdkafka -------------------------------------------------------------------------
138
-
139
- find_path (RDKAFKA_INCLUDE "librdkafka" HINTS "$ENV{RDKAFKA_ROOT} /include" )
140
- find_library (RDKAFKA++_LIBRARY "rdkafka++" HINTS "$ENV{RDKAFKA_ROOT} /lib" "$ENV{RDKAFKA_ROOT} /build" )
141
-
142
- message (VERBOSE "RDKAFKA: RDKAFKA++_LIBRARY set to ${RDKAFKA++_LIBRARY}" )
143
- message (VERBOSE "RDKAFKA: RDKAFKA_INCLUDE set to ${RDKAFKA_INCLUDE} " )
144
-
145
- target_link_libraries (cudf_kafka ${RDKAFKA++_LIBRARY})
146
- include_directories ("${RDKAFKA_INCLUDE} " )
147
-
148
69
###################################################################################################
149
70
# - cudf_kafka Install ----------------------------------------------------------------------------
150
- target_link_libraries (cudf_kafka cudf)
71
+ target_link_libraries (cudf_kafka cudf::cudf RDKAFKA::RDKAFKA )
151
72
152
73
install (TARGETS cudf_kafka
153
74
DESTINATION lib)
154
75
155
76
install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /include
156
77
DESTINATION include )
157
-
158
- add_custom_target (build_tests_libcudf_kafka
159
- DEPENDS ${CUDF_KAFKA_TEST_LIST} )
160
-
161
- add_custom_target (test_libcudf_kafka
162
- COMMAND ctest
163
- DEPENDS build_tests_libcudf_kafka)
0 commit comments