aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2021-12-03 16:11:44 +0800
committerKunoiSayami <[email protected]>2021-12-03 16:19:02 +0800
commit8316f42c232a7cbfa6c77de85d0001d144d61561 (patch)
treefcd16d73c22d1475292897b8f9f5e3a75bd3f9e9 /CMakeLists.txt
parent8126602f094fa6644ee109d7f8b49fa0a02b5451 (diff)
fix(build): Fix `unresolved extern function`
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt55
1 files changed, 7 insertions, 48 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9a4ca1..29b83e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. See the AUTHORS file for names of contributors.
-cmake_minimum_required(VERSION 3.9)
+cmake_minimum_required(VERSION 3.11)
# Keep the version below in sync with the one in db.h
project(leveldb VERSION 1.23.0 LANGUAGES C CXX CUDA)
@@ -220,6 +220,8 @@ target_sources(leveldb
"${LEVELDB_PUBLIC_INCLUDE_DIR}/write_batch.h"
)
set_target_properties(leveldb PROPERTIES CUDA_ARCHITECTURES "75")
+#set_target_properties(leveldb PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
+set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
#target_link_libraries(leveldb Thrust)
if (WIN32)
@@ -298,6 +300,7 @@ add_executable(leveldbutil
"db/leveldbutil.cc"
)
target_link_libraries(leveldbutil leveldb)
+set_target_properties(leveldbutil PROPERTIES CUDA_ARCHITECTURES "75")
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_70,code=[compute_70,lto_70]")
if(LEVELDB_BUILD_TESTS)
@@ -349,56 +352,11 @@ if(LEVELDB_BUILD_TESTS)
)
endif(NOT HAVE_CXX17_HAS_INCLUDE)
set_target_properties("${test_target_name}" PROPERTIES CUDA_ARCHITECTURES "75")
+ #set_target_properties("${test_target_name}" PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
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")
@@ -418,7 +376,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_arena("db/skiplist_test.cu")
+ leveldb_test("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")
@@ -466,6 +424,7 @@ if(LEVELDB_BUILD_BENCHMARKS)
PRIVATE
${LEVELDB_PLATFORM_NAME}=1
)
+ set_target_properties("${bench_target_name}" PROPERTIES CUDA_ARCHITECTURES "75")
if (NOT HAVE_CXX17_HAS_INCLUDE)
target_compile_definitions("${bench_target_name}"
PRIVATE