Skip to content

Commit a360983

Browse files
authored
Merge pull request #352 from apache/count-min-cpp
Count min cpp
2 parents f5741c9 + 0a797bf commit a360983

6 files changed

Lines changed: 1144 additions & 20 deletions

File tree

CMakeLists.txt

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ include(CMakeDependentOption)
3434
### Require out-of-source builds
3535
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
3636
if(EXISTS "${LOC_PATH}")
37-
message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
37+
message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
3838
endif()
3939

4040
# Ensure builds on Windows export all symbols
@@ -69,7 +69,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
6969
###### OPTIONS ######
7070
# Enable testing
7171
option(BUILD_TESTS "Build unit tests" ON)
72-
if (BUILD_TESTS)
72+
if (BUILD_TESTS)
7373
enable_testing()
7474
endif()
7575

@@ -93,10 +93,10 @@ set(default_build_type "Release")
9393
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
9494
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
9595
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
96-
STRING "Choose the type of build." FORCE)
96+
STRING "Choose the type of build." FORCE)
9797
# Set the possible values of build type for cmake-gui
9898
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
99-
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
99+
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
100100
endif()
101101

102102
###### TARGETS ######
@@ -115,47 +115,48 @@ add_subdirectory(sampling)
115115
add_subdirectory(tuple)
116116
add_subdirectory(req)
117117
add_subdirectory(quantiles)
118+
add_subdirectory(count)
118119

119120
if (WITH_PYTHON)
120121
add_subdirectory(python)
121122
endif()
122123

123-
target_link_libraries(datasketches INTERFACE hll cpc kll fi theta sampling req quantiles)
124+
target_link_libraries(datasketches INTERFACE hll cpc kll fi theta sampling req quantiles count)
124125

125126
if (COVERAGE)
126127
find_program(LCOV_PATH NAMES "lcov")
127128
find_program(GENHTML_PATH NAMES "genhtml")
128129
if (NOT LCOV_PATH-NOTFOUND AND NOT GENHTML_PATH-NOTFOUND)
129130
add_custom_target(coverage_report
130-
COMMAND ${LCOV_PATH} --capture --exclude '*/test/*' --exclude '/Library/*' --exclude '/usr/include/*' --directory . --output-file lcov.info
131-
COMMAND ${GENHTML_PATH} --legend lcov.info --output-directory coverage --demangle-cpp)
132-
endif()
131+
COMMAND ${LCOV_PATH} --capture --exclude '*/test/*' --exclude '/Library/*' --exclude '/usr/include/*' --directory . --output-file lcov.info
132+
COMMAND ${GENHTML_PATH} --legend lcov.info --output-directory coverage --demangle-cpp)
133+
endif()
133134
endif()
134135

135136

136137
# # Installation
137138
install(TARGETS datasketches
138-
EXPORT ${PROJECT_NAME}
139-
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/DataSketches
140-
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/DataSketches
141-
)
139+
EXPORT ${PROJECT_NAME}
140+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/DataSketches
141+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/DataSketches
142+
)
142143

143144
# Packaging
144145
include(CMakePackageConfigHelpers)
145146
write_basic_package_version_file(
146-
"${CMAKE_CURRENT_BINARY_DIR}/DataSketchesConfigVersion.cmake"
147-
VERSION ${PROJECT_VERSION}
148-
COMPATIBILITY SameMajorVersion
147+
"${CMAKE_CURRENT_BINARY_DIR}/DataSketchesConfigVersion.cmake"
148+
VERSION ${PROJECT_VERSION}
149+
COMPATIBILITY SameMajorVersion
149150
)
150151
configure_package_config_file(
151-
cmake/DataSketchesConfig.cmake.in
152-
"${CMAKE_CURRENT_BINARY_DIR}/DataSketchesConfig.cmake"
153-
INSTALL_DESTINATION lib/DataSketches/cmake
154-
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
152+
cmake/DataSketchesConfig.cmake.in
153+
"${CMAKE_CURRENT_BINARY_DIR}/DataSketchesConfig.cmake"
154+
INSTALL_DESTINATION lib/DataSketches/cmake
155+
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
155156
)
156157
install(EXPORT ${PROJECT_NAME} DESTINATION lib/DataSketches/cmake)
157158
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DataSketchesConfigVersion.cmake"
158-
"${CMAKE_CURRENT_BINARY_DIR}/DataSketchesConfig.cmake"
159+
"${CMAKE_CURRENT_BINARY_DIR}/DataSketchesConfig.cmake"
159160
DESTINATION lib/DataSketches/cmake)
160161

161162

count/CMakeLists.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
add_library(count INTERFACE)
19+
20+
add_library(${PROJECT_NAME}::COUNT ALIAS count)
21+
22+
if (BUILD_TESTS)
23+
add_subdirectory(test)
24+
endif()
25+
26+
target_include_directories(count
27+
INTERFACE
28+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
29+
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
30+
)
31+
32+
target_link_libraries(count INTERFACE common)
33+
target_compile_features(count INTERFACE cxx_std_11)
34+
35+
install(TARGETS count
36+
EXPORT ${PROJECT_NAME}
37+
)
38+
39+
install(FILES
40+
include/count_min.hpp
41+
include/count_min_impl.hpp
42+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/DataSketches")

0 commit comments

Comments
 (0)