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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
From: =?utf-8?q?Timo_R=C3=B6hling?= <timo@gaussglocke.de>
Date: Thu, 3 Dec 2020 11:42:18 +0100
Subject: Use system sqlite3
Forwarded: not-needed
---
CMakeLists.txt | 1 +
cmake/modules/Findsqlite3.cmake | 6 ++++++
src/cpp/CMakeLists.txt | 5 ++++-
src/cpp/rtps/persistence/SQLite3PersistenceService.cpp | 2 +-
src/cpp/rtps/persistence/SQLite3PersistenceService.h | 2 +-
test/unittest/dds/publisher/CMakeLists.txt | 2 +-
test/unittest/rtps/persistence/CMakeLists.txt | 2 +-
test/unittest/rtps/persistence/PersistenceTests.cpp | 2 +-
test/unittest/rtps/reader/CMakeLists.txt | 2 +-
test/unittest/statistics/dds/CMakeLists.txt | 4 ++--
10 files changed, 19 insertions(+), 9 deletions(-)
create mode 100644 cmake/modules/Findsqlite3.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ced953..b9769a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -261,6 +261,7 @@ eprosima_find_thirdparty(TinyXML2 tinyxml2)
find_package(foonathan_memory REQUIRED)
message(STATUS "Found foonathan_memory: ${foonathan_memory_DIR}")
find_package(ThirdpartyBoost REQUIRED)
+find_package(sqlite3 REQUIRED)
if(ANDROID)
if((ANDROID_PLATFORM LESS_EQUAL 23) OR (ANDROID_NATIVE_API_LEVEL LESS_EQUAL 23))
diff --git a/cmake/modules/Findsqlite3.cmake b/cmake/modules/Findsqlite3.cmake
new file mode 100644
index 0000000..2471bdb
--- /dev/null
+++ b/cmake/modules/Findsqlite3.cmake
@@ -0,0 +1,6 @@
+include(FindPackageHandleStandardArgs)
+
+find_file(sqlite3_INCLUDE_DIRS sqlite3.h)
+find_library(sqlite3_LIBRARIES sqlite3)
+
+find_package_handle_standard_args(sqlite3 DEFAULT_MSG sqlite3_INCLUDE_DIRS sqlite3_LIBRARIES)
diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
index 871851a..f546693 100644
--- a/src/cpp/CMakeLists.txt
+++ b/src/cpp/CMakeLists.txt
@@ -342,7 +342,6 @@ endif()
#SQLITE3 persistence service sources
set(${PROJECT_NAME}_sqlite3_source_files
rtps/persistence/SQLite3PersistenceService.cpp
- rtps/persistence/sqlite3.c
)
if(SQLITE3_SUPPORT)
@@ -526,6 +525,10 @@ if (APPLE)
)
endif()
+if(SQLITE3_SUPPORT)
+ target_link_libraries(${PROJECT_NAME} PRIVATE ${sqlite3_LIBRARIES})
+endif()
+
if(MSVC OR MSVC_IDE)
# On installed binaries use manifest to specify dependencies
if(INSTALLER_PLATFORM AND OPENSSL_FOUND)
diff --git a/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp b/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
index dc83202..e49b8ef 100644
--- a/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
+++ b/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
@@ -22,7 +22,7 @@
#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/history/WriterHistory.hpp>
-#include <rtps/persistence/sqlite3.h>
+#include <sqlite3.h>
#include <sstream>
diff --git a/src/cpp/rtps/persistence/SQLite3PersistenceService.h b/src/cpp/rtps/persistence/SQLite3PersistenceService.h
index be617c5..8590298 100644
--- a/src/cpp/rtps/persistence/SQLite3PersistenceService.h
+++ b/src/cpp/rtps/persistence/SQLite3PersistenceService.h
@@ -20,7 +20,7 @@
#define SQLITE3PERSISTENCESERVICE_H_
#include <rtps/persistence/PersistenceService.h>
-#include <rtps/persistence/sqlite3.h>
+#include <sqlite3.h>
namespace eprosima {
namespace fastdds {
diff --git a/test/unittest/dds/publisher/CMakeLists.txt b/test/unittest/dds/publisher/CMakeLists.txt
index 9b21f6a..a6ad0ee 100644
--- a/test/unittest/dds/publisher/CMakeLists.txt
+++ b/test/unittest/dds/publisher/CMakeLists.txt
@@ -26,7 +26,6 @@ file(GLOB DDSSQLFILTER_SOURCES ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/topic/DDSSQ
#SQLITE3 persistence service sources
set(sqlite3_source_files
- ${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/sqlite3.c
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
)
@@ -375,6 +374,7 @@ target_link_libraries(DataWriterTests
GTest::gmock
${CMAKE_DL_LIBS}
${TINYXML2_LIBRARY}
+ $<$<BOOL:${SQLITE3_SUPPORT}>:${sqlite3_LIBRARIES}>
$<$<BOOL:${LINK_SSL}>:OpenSSL::SSL$<SEMICOLON>OpenSSL::Crypto>
$<$<BOOL:${WIN32}>:iphlpapi$<SEMICOLON>Shlwapi>
${THIRDPARTY_BOOST_LINK_LIBS}
diff --git a/test/unittest/rtps/persistence/CMakeLists.txt b/test/unittest/rtps/persistence/CMakeLists.txt
index 879f919..3c58239 100644
--- a/test/unittest/rtps/persistence/CMakeLists.txt
+++ b/test/unittest/rtps/persistence/CMakeLists.txt
@@ -27,7 +27,6 @@ if(SQLITE3_SUPPORT)
${PROJECT_SOURCE_DIR}/src/cpp/rtps/network/utils/netmask_filter.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/network/utils/network.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/PersistenceFactory.cpp
- ${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/sqlite3.c
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetmaskFilterKind.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/network/NetworkInterface.cpp
@@ -55,6 +54,7 @@ if(SQLITE3_SUPPORT)
fastdds::log
foonathan_memory
GTest::gmock
+ ${sqlite3_LIBRARIES}
${CMAKE_DL_LIBS}
)
if(MSVC OR MSVC_IDE)
diff --git a/test/unittest/rtps/persistence/PersistenceTests.cpp b/test/unittest/rtps/persistence/PersistenceTests.cpp
index 0cc57ed..2894ed7 100644
--- a/test/unittest/rtps/persistence/PersistenceTests.cpp
+++ b/test/unittest/rtps/persistence/PersistenceTests.cpp
@@ -23,7 +23,7 @@
#include <rtps/common/GuidUtils.hpp>
#include <rtps/history/CacheChangePool.h>
#include <rtps/persistence/PersistenceService.h>
-#include <rtps/persistence/sqlite3.h>
+#include <sqlite3.h>
#include <rtps/persistence/SQLite3PersistenceServiceStatements.h>
#include <utils/SystemInfo.hpp>
diff --git a/test/unittest/rtps/reader/CMakeLists.txt b/test/unittest/rtps/reader/CMakeLists.txt
index 935b9ea..eeee9e3 100644
--- a/test/unittest/rtps/reader/CMakeLists.txt
+++ b/test/unittest/rtps/reader/CMakeLists.txt
@@ -249,7 +249,6 @@ set(STATEFUL_READER_TESTS_SOURCE StatefulReaderTests.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/participant/RTPSParticipant.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/participant/RTPSParticipantImpl.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/PersistenceFactory.cpp
- ${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/sqlite3.c
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/reader/BaseReader.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/reader/reader_utils.cpp
@@ -430,6 +429,7 @@ target_link_libraries(StatefulReaderTests
GTest::gmock
${CMAKE_DL_LIBS}
${TINYXML2_LIBRARY}
+ ${sqlite3_LIBRARIES}
$<$<BOOL:${LINK_SSL}>:OpenSSL::SSL$<SEMICOLON>OpenSSL::Crypto>
$<$<BOOL:${WIN32}>:iphlpapi$<SEMICOLON>Shlwapi>
${THIRDPARTY_BOOST_LINK_LIBS}
diff --git a/test/unittest/statistics/dds/CMakeLists.txt b/test/unittest/statistics/dds/CMakeLists.txt
index 040b3b2..a473f21 100644
--- a/test/unittest/statistics/dds/CMakeLists.txt
+++ b/test/unittest/statistics/dds/CMakeLists.txt
@@ -248,7 +248,6 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX)
${PROJECT_SOURCE_DIR}/src/cpp/rtps/participant/RTPSParticipant.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/participant/RTPSParticipantImpl.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/PersistenceFactory.cpp
- ${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/sqlite3.c
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/reader/BaseReader.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/reader/reader_utils.cpp
@@ -435,7 +434,6 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX)
${PROJECT_SOURCE_DIR}/src/cpp/rtps/participant/RTPSParticipant.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/participant/RTPSParticipantImpl.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/PersistenceFactory.cpp
- ${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/sqlite3.c
${PROJECT_SOURCE_DIR}/src/cpp/rtps/persistence/SQLite3PersistenceService.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/reader/BaseReader.cpp
${PROJECT_SOURCE_DIR}/src/cpp/rtps/reader/reader_utils.cpp
@@ -600,6 +598,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX)
GTest::gmock
${CMAKE_DL_LIBS}
${TINYXML2_LIBRARY}
+ ${sqlite3_LIBRARIES}
$<$<BOOL:${LINK_SSL}>:OpenSSL::SSL$<SEMICOLON>OpenSSL::Crypto>
$<$<BOOL:${WIN32}>:iphlpapi$<SEMICOLON>Shlwapi>
${THIRDPARTY_BOOST_LINK_LIBS}
@@ -653,6 +652,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX)
GTest::gmock
${CMAKE_DL_LIBS}
${TINYXML2_LIBRARY}
+ ${sqlite3_LIBRARIES}
$<$<BOOL:${LINK_SSL}>:OpenSSL::SSL$<SEMICOLON>OpenSSL::Crypto>
$<$<BOOL:${WIN32}>:iphlpapi$<SEMICOLON>Shlwapi>
${THIRDPARTY_BOOST_LINK_LIBS}
|