Skip to content

Commit a8fe606

Browse files
authored
Merge branch 'master' into row
2 parents 81d0fe5 + b611b5c commit a8fe606

File tree

6 files changed

+10321
-5783
lines changed

6 files changed

+10321
-5783
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Version 3.1.1 - August 19 2020
188188
- #293 Remove FindSQLiteCpp.cmake from sum01
189189

190190
Version 3.x - 2022
191-
- #300 #316 Updated SQLite3 from 3.32.3 to 3.37.2 (2022-01-06)
191+
- #300 #316 #362 Updated SQLite3 from 3.32.3 to 3.39.2 (2022-07-21)
192192
- #236 Disable explicit setting of MSVC runtime from BioDataAnalysis/emmenlau
193193
- #308 Fix build warning due to string truncation from stauffer-garmin
194194
- #311 Add Database::tryExec() from kcowolf
@@ -208,3 +208,7 @@ Version 3.x - 2022
208208
- #341 Install the package.xml file from ardabbour/patch-1
209209
- #352 add basic meson support from ninjaoflight/meson-support
210210
- #349 Refactoring of Statement and Column classes from Kacperos155/refactoring-Statement&Column
211+
- #359 Fix compilation issues earlier than iOS 13
212+
- #354 Windows improved support (meson) from ninjaoflight/windows-migration
213+
- #361 Fix Statement unit test using long from SRombauts/fix-statement-unit-tests-long-long-type
214+
- #346 Add compatible definition for std::experimental::filesystem from guoh27/master

include/SQLiteCpp/Database.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
// c++17: MinGW GCC version > 8
1616
// c++17: Visual Studio 2017 version 15.7
1717
// c++17: macOS unless targetting compatibility with macOS < 10.15
18+
#ifndef SQLITECPP_HAVE_STD_EXPERIMENTAL_FILESYSTEM
1819
#if __cplusplus >= 201703L
1920
#if defined(__MINGW32__) || defined(__MINGW64__)
2021
#if __GNUC__ > 8 // MinGW requires GCC version > 8 for std::filesystem
2122
#define SQLITECPP_HAVE_STD_FILESYSTEM
2223
#endif
2324
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
24-
// macOS clang won't let us touch std::filesystem if we're targetting earlier than 10.15
25+
// macOS clang won't let us touch std::filesystem if we're targetting earlier than 10.15
2526
#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && defined(__IPHONE_13_0) && \
2627
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_13_0
27-
// build for iOS clang won't let us touch std::filesystem if we're targetting earlier than iOS 13
28+
// build for iOS clang won't let us touch std::filesystem if we're targetting earlier than iOS 13
2829
#else
2930
#define SQLITECPP_HAVE_STD_FILESYSTEM
3031
#endif
@@ -36,6 +37,16 @@ __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_13_0
3637
#include <filesystem>
3738
#endif // c++17 and a suitable compiler
3839

40+
#else // SQLITECPP_HAVE_STD_EXPERIMENTAL_FILESYSTEM
41+
42+
#define SQLITECPP_HAVE_STD_FILESYSTEM
43+
#include <experimental/filesystem>
44+
namespace std {
45+
namespace filesystem = experimental::filesystem;
46+
}
47+
48+
#endif // SQLITECPP_HAVE_STD_EXPERIMENTAL_FILESYSTEM
49+
3950
#include <memory>
4051
#include <string.h>
4152

meson.build

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ sqlitecpp_deps = [
4646
sqlite3_dep,
4747
thread_dep,
4848
]
49+
## used to override the default sqlitecpp options like cpp standard
50+
sqlitecpp_opts = []
4951

5052
## tests
5153

@@ -59,6 +61,10 @@ sqlitecpp_test_srcs = [
5961
'tests/Exception_test.cpp',
6062
'tests/ExecuteMany_test.cpp',
6163
]
64+
sqlitecpp_test_args = [
65+
# do not use ambiguous overloads by default
66+
'-DNON_AMBIGOUS_OVERLOAD'
67+
]
6268

6369
## samples
6470

@@ -78,7 +84,14 @@ if not (host_machine.system() == 'windows' and cxx.get_id() == 'msvc')
7884
'-Wno-long-long',
7985
]
8086
endif
81-
87+
## using MSVC headers requires c++14, if not will show an error on xstddef as:
88+
## 'auto' return without trailing return type; deduced return types are a C++14 extension
89+
if host_machine.system() == 'windows'
90+
message('[WINDOWS] using c++14 standard')
91+
sqlitecpp_opts += [
92+
'cpp_std=c++14',
93+
]
94+
endif
8295
# Options relative to SQLite and SQLiteC++ functions
8396

8497
if get_option('SQLITE_ENABLE_COLUMN_METADATA')
@@ -131,10 +144,23 @@ libsqlitecpp = library(
131144
include_directories: sqlitecpp_incl,
132145
cpp_args: sqlitecpp_args,
133146
dependencies: sqlitecpp_deps,
147+
# override the default options
148+
override_options: sqlitecpp_opts,
134149
# install: true,
135150
# API version for SQLiteCpp shared library.
136-
version: '0',
137-
)
151+
version: '0',)
152+
if get_option('SQLITECPP_BUILD_TESTS')
153+
# for the unit tests we need to link against a static version of SQLiteCpp
154+
libsqlitecpp_static = static_library(
155+
'sqlitecpp_static',
156+
sqlitecpp_srcs,
157+
include_directories: sqlitecpp_incl,
158+
cpp_args: sqlitecpp_args,
159+
dependencies: sqlitecpp_deps,
160+
# override the default options
161+
override_options: sqlitecpp_opts,)
162+
# static libraries do not have a version
163+
endif
138164

139165
install_headers(
140166
'include/SQLiteCpp/SQLiteCpp.h',
@@ -153,6 +179,14 @@ sqlitecpp_dep = declare_dependency(
153179
include_directories: sqlitecpp_incl,
154180
link_with: libsqlitecpp,
155181
)
182+
if get_option('SQLITECPP_BUILD_TESTS')
183+
## make the dependency static so the unit tests can link against it
184+
## (mainly for windows as the symbols are not exported by default)
185+
sqlitecpp_static_dep = declare_dependency(
186+
include_directories: sqlitecpp_incl,
187+
link_with: libsqlitecpp_static,
188+
)
189+
endif
156190

157191
if get_option('SQLITECPP_BUILD_TESTS')
158192
gtest_dep = dependency(
@@ -161,13 +195,15 @@ if get_option('SQLITECPP_BUILD_TESTS')
161195
fallback: ['gtest', 'gtest_dep'])
162196
sqlitecpp_test_dependencies = [
163197
gtest_dep,
164-
sqlitecpp_dep,
198+
sqlitecpp_static_dep,
165199
sqlite3_dep,
166200
]
167-
sqlitecpp_test_args = []
168201

169202
testexe = executable('testexe', sqlitecpp_test_srcs,
170-
dependencies: sqlitecpp_test_dependencies)
203+
dependencies: sqlitecpp_test_dependencies,
204+
cpp_args: sqlitecpp_test_args,
205+
# override the default options
206+
override_options: sqlitecpp_opts,)
171207

172208
test_args = []
173209

@@ -177,7 +213,9 @@ if get_option('SQLITECPP_BUILD_EXAMPLES')
177213
## demo executable
178214
sqlitecpp_demo_exe = executable('SQLITECPP_sample_demo',
179215
sqlitecpp_sample_srcs,
180-
dependencies: sqlitecpp_dep)
216+
dependencies: sqlitecpp_dep,
217+
# override the default options
218+
override_options: sqlitecpp_opts,)
181219
endif
182220

183221
pkgconfig = import('pkgconfig')

0 commit comments

Comments
 (0)