blob: 85fb71a8430720bce7f157179c98628a03244f4b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt
index 0fed2d2..c426b94 100644
--- a/library/src/CMakeLists.txt
+++ b/library/src/CMakeLists.txt
@@ -138,27 +138,42 @@ set( rocfft_source
# for cache serialization. We also want to use a static SQLite,
# and distro static libraries aren't typically built
# position-independent.
-include( FetchContent )
-# embed SQLite
-FetchContent_Declare(sqlite_local
- URL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip
- URL_HASH SHA256=999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729
-)
-FetchContent_MakeAvailable(sqlite_local)
-add_library( sqlite3 STATIC ${sqlite_local_SOURCE_DIR}/sqlite3.c )
-set_target_properties( sqlite3 PROPERTIES
- C_VISIBILITY_PRESET "hidden"
- VISIBILITY_INLINES_HIDDEN ON
- POSITION_INDEPENDENT_CODE ON
+option( SQLITE_USE_SYSTEM_PACKAGE "Use SQLite3 from find_package" OFF )
+if( SQLITE_USE_SYSTEM_PACKAGE )
+ find_package(SQLite3 3.36 REQUIRED)
+ set(ROCFFT_SQLITE_LIB SQLite::SQLite3)
+else()
+ include( FetchContent )
+ if(DEFINED ENV{SQLITE_SRC_URL})
+ set(SQLITE_SRC_URL_INIT $ENV{SQLITE_SRC_URL})
+ else()
+ set(SQLITE_SRC_URL_INIT https://sqlite.org/2021/sqlite-amalgamation-3360000.zip)
+ endif()
+ set(SQLITE_SRC_URL ${SQLITE_SRC_URL_INIT} CACHE STRING "Location of SQLite source code")
+ set(SQLITE_SRC_SHA256 999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729 CACHE STRING "SHA256 hash of SQLite source code")
+
+ # embed SQLite
+ FetchContent_Declare(sqlite_local
+ URL ${SQLITE_SRC_URL}
+ URL_HASH SHA256=${SQLITE_SRC_SHA256}
)
-
-# we don't need extensions, and omitting them from SQLite removes the
-# need for dlopen/dlclose from within rocFFT
-target_compile_options(
- sqlite3
- PRIVATE -DSQLITE_OMIT_LOAD_EXTENSION
-)
+ FetchContent_MakeAvailable(sqlite_local)
+ add_library( sqlite3 OBJECT ${sqlite_local_SOURCE_DIR}/sqlite3.c )
+ set_target_properties( sqlite3 PROPERTIES
+ C_VISIBILITY_PRESET "hidden"
+ VISIBILITY_INLINES_HIDDEN ON
+ POSITION_INDEPENDENT_CODE ON
+ )
+
+ # we don't need extensions, and omitting them from SQLite removes the
+ # need for dlopen/dlclose from within rocFFT
+ target_compile_options(
+ sqlite3
+ PRIVATE -DSQLITE_OMIT_LOAD_EXTENSION
+ )
+ set(ROCFFT_SQLITE_LIB sqlite3)
+endif()
set_property(
SOURCE rtc.cpp
@@ -169,8 +184,8 @@ prepend_path( ".." rocfft_headers_public relative_rocfft_headers_public )
add_library( rocfft ${rocfft_source} ${relative_rocfft_headers_public} )
add_library( roc::rocfft ALIAS rocfft )
+target_link_libraries( rocfft PRIVATE ${ROCFFT_SQLITE_LIB} )
-target_link_libraries( rocfft PRIVATE stockham_gen sqlite3 )
if( NOT WIN32 )
target_link_libraries( rocfft PRIVATE -lstdc++fs )
endif()
|