Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(dbscan) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True) | ||
|
||
set(CMAKE_CXX_FLAGS "-std=c++17 -pthread -O3 -fPIC") | ||
|
||
add_subdirectory(executable) | ||
|
||
enable_testing() | ||
add_subdirectory(test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
|
||
#pragma once | ||
|
||
#include "shared.h" | ||
#include "point.h" | ||
#include "grid.h" | ||
#include "pbbs/ndHash.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
# check whether googletest is locally installed, if not download and fetch | ||
message(STATUS "--------------- GoogleTest -------------") | ||
find_package(GTest CONFIG) | ||
if(NOT GTest_FOUND) | ||
# new way of including googletest | ||
# Download and unpack googletest at configure time | ||
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/googletest-download ) | ||
if(result) | ||
message(FATAL_ERROR "CMake step for googletest failed: ${result}") | ||
endif() | ||
execute_process(COMMAND ${CMAKE_COMMAND} --build . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test/googletest-download ) | ||
if(result) | ||
message(FATAL_ERROR "Build step for googletest failed: ${result}") | ||
endif() | ||
|
||
# Prevent overriding the parent project's compiler/linker | ||
# settings on Windows | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
|
||
# Add googletest directly to our build. This defines | ||
# the gtest and gtest_main targets. | ||
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src | ||
${CMAKE_BINARY_DIR}/googletest-build | ||
EXCLUDE_FROM_ALL) | ||
set(GTest_LIBRARIES "gtest") | ||
else() | ||
message(STATUS "using locally installed GoogleTest") | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
set(GTest_LIBRARIES GTest::gtest) | ||
endif() | ||
|
||
include(CTest) | ||
|
||
project(sourceFiles) | ||
add_library(sourceFiles INTERFACE) | ||
target_include_directories(sourceFiles INTERFACE ../src/) | ||
|
||
add_executable(grid_test grid_test.cpp) | ||
target_link_libraries(grid_test PRIVATE | ||
sourceFiles | ||
${GTest_LIBRARIES}) | ||
add_test(NAME grid_test COMMAND grid_test) | ||
|
||
# add_executable(dbscan_test dbscan_test.cpp) | ||
# target_link_libraries(dbscan_test PRIVATE | ||
# gridLib | ||
# dbscanLib | ||
# ${GTest_LIBRARIES}) | ||
# add_test(NAME dbscan_test COMMAND dbscan_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
|
||
project(googletest-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add(googletest | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG main | ||
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" | ||
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "dbscan/grid.h" | ||
#include "gtest/gtest.h" | ||
#include <iostream> | ||
#include <memory.h> | ||
|
||
int main(int argc, char **argv) { | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |