aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2021-11-29 10:09:43 +0800
committerKunoiSayami <[email protected]>2021-11-29 10:09:43 +0800
commit8126602f094fa6644ee109d7f8b49fa0a02b5451 (patch)
treec6d67ce671bb10f89f9e4ba9681731500584f86a /CMakeLists.txt
parent0e18a4800b0737dc8f1d3720bc79bf000529ddef (diff)
dump: 20211129
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt52
1 files changed, 48 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b6fac1..b9a4ca1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -180,8 +180,6 @@ target_sources(leveldb
"table/two_level_iterator.h"
"util/arena.cu"
"util/arena.cuh"
- "util/arena.cc"
- "util/arena.h"
"util/bloom.cc"
"util/cache.cc"
"util/coding.cc"
@@ -300,7 +298,7 @@ add_executable(leveldbutil
"db/leveldbutil.cc"
)
target_link_libraries(leveldbutil leveldb)
-set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Ldb")
+#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_70,code=[compute_70,lto_70]")
if(LEVELDB_BUILD_TESTS)
enable_testing()
@@ -355,6 +353,52 @@ if(LEVELDB_BUILD_TESTS)
add_test(NAME "${test_target_name}" COMMAND "${test_target_name}")
endfunction(leveldb_test)
+ function(leveldb_test_arena test_file)
+ get_filename_component(test_target_name "${test_file}" NAME_WE)
+
+ cuda_add_library(arena_cuda "")
+ target_sources(arena_cuda
+ PRIVATE
+ "util/arena.cu"
+ )
+ set_target_properties(arena_cuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
+ target_compile_options(arena_cuda PRIVATE
+ $<$<COMPILE_LANGUAGE:CUDA>: -dc>)
+
+#[[ add_library(arena_cuda_link "")
+ target_sources(arena_cuda_link
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/libs/arena.o
+ )
+ target_compile_options(arena_cuda_link PRIVATE
+ $<$<COMPILE_LANGUAGE:CUDA>: -dlink>)]]
+
+ add_executable("${test_target_name}" "")
+ target_sources("${test_target_name}"
+ PRIVATE
+ "${PROJECT_BINARY_DIR}/${LEVELDB_PORT_CONFIG_DIR}/port_config.h"
+ "util/testutil.cc"
+ "util/testutil.h"
+
+ "${test_file}"
+ )
+ set_target_properties(arena_cuda PROPERTIES CUDA_ARCHITECTURES "75")
+ target_link_libraries("${test_target_name}" leveldb gmock gtest benchmark)
+ target_compile_definitions("${test_target_name}"
+ PRIVATE
+ ${LEVELDB_PLATFORM_NAME}=1
+ )
+ if (NOT HAVE_CXX17_HAS_INCLUDE)
+ target_compile_definitions("${test_target_name}"
+ PRIVATE
+ LEVELDB_HAS_PORT_CONFIG_H=1
+ )
+ endif(NOT HAVE_CXX17_HAS_INCLUDE)
+ set_target_properties("${test_target_name}" PROPERTIES CUDA_ARCHITECTURES "75")
+
+ add_test(NAME "${test_target_name}" COMMAND "${test_target_name}")
+ endfunction(leveldb_test_arena)
+
leveldb_test("db/c_test.c")
leveldb_test("db/fault_injection_test.cc")
@@ -374,7 +418,7 @@ if(LEVELDB_BUILD_TESTS)
leveldb_test("db/filename_test.cc")
leveldb_test("db/log_test.cc")
leveldb_test("db/recovery_test.cc")
- leveldb_test("db/skiplist_test.cu")
+ leveldb_test_arena("db/skiplist_test.cu")
leveldb_test("db/version_edit_test.cc")
leveldb_test("db/version_set_test.cc")
leveldb_test("db/write_batch_test.cc")