Skip to content

Commit

Permalink
Merge branch 'master' into row
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperos155 committed Jul 24, 2022
2 parents 81d0fe5 + b611b5c commit a8fe606
Show file tree
Hide file tree
Showing 6 changed files with 10,321 additions and 5,783 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Version 3.1.1 - August 19 2020
- #293 Remove FindSQLiteCpp.cmake from sum01

Version 3.x - 2022
- #300 #316 Updated SQLite3 from 3.32.3 to 3.37.2 (2022-01-06)
- #300 #316 #362 Updated SQLite3 from 3.32.3 to 3.39.2 (2022-07-21)
- #236 Disable explicit setting of MSVC runtime from BioDataAnalysis/emmenlau
- #308 Fix build warning due to string truncation from stauffer-garmin
- #311 Add Database::tryExec() from kcowolf
Expand All @@ -208,3 +208,7 @@ Version 3.x - 2022
- #341 Install the package.xml file from ardabbour/patch-1
- #352 add basic meson support from ninjaoflight/meson-support
- #349 Refactoring of Statement and Column classes from Kacperos155/refactoring-Statement&Column
- #359 Fix compilation issues earlier than iOS 13
- #354 Windows improved support (meson) from ninjaoflight/windows-migration
- #361 Fix Statement unit test using long from SRombauts/fix-statement-unit-tests-long-long-type
- #346 Add compatible definition for std::experimental::filesystem from guoh27/master
15 changes: 13 additions & 2 deletions include/SQLiteCpp/Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
// c++17: MinGW GCC version > 8
// c++17: Visual Studio 2017 version 15.7
// c++17: macOS unless targetting compatibility with macOS < 10.15
#ifndef SQLITECPP_HAVE_STD_EXPERIMENTAL_FILESYSTEM
#if __cplusplus >= 201703L
#if defined(__MINGW32__) || defined(__MINGW64__)
#if __GNUC__ > 8 // MinGW requires GCC version > 8 for std::filesystem
#define SQLITECPP_HAVE_STD_FILESYSTEM
#endif
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
// macOS clang won't let us touch std::filesystem if we're targetting earlier than 10.15
// macOS clang won't let us touch std::filesystem if we're targetting earlier than 10.15
#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && defined(__IPHONE_13_0) && \
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_13_0
// build for iOS clang won't let us touch std::filesystem if we're targetting earlier than iOS 13
// build for iOS clang won't let us touch std::filesystem if we're targetting earlier than iOS 13
#else
#define SQLITECPP_HAVE_STD_FILESYSTEM
#endif
Expand All @@ -36,6 +37,16 @@ __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_13_0
#include <filesystem>
#endif // c++17 and a suitable compiler

#else // SQLITECPP_HAVE_STD_EXPERIMENTAL_FILESYSTEM

#define SQLITECPP_HAVE_STD_FILESYSTEM
#include <experimental/filesystem>
namespace std {
namespace filesystem = experimental::filesystem;
}

#endif // SQLITECPP_HAVE_STD_EXPERIMENTAL_FILESYSTEM

#include <memory>
#include <string.h>

Expand Down
52 changes: 45 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ sqlitecpp_deps = [
sqlite3_dep,
thread_dep,
]
## used to override the default sqlitecpp options like cpp standard
sqlitecpp_opts = []

## tests

Expand All @@ -59,6 +61,10 @@ sqlitecpp_test_srcs = [
'tests/Exception_test.cpp',
'tests/ExecuteMany_test.cpp',
]
sqlitecpp_test_args = [
# do not use ambiguous overloads by default
'-DNON_AMBIGOUS_OVERLOAD'
]

## samples

Expand All @@ -78,7 +84,14 @@ if not (host_machine.system() == 'windows' and cxx.get_id() == 'msvc')
'-Wno-long-long',
]
endif

## using MSVC headers requires c++14, if not will show an error on xstddef as:
## 'auto' return without trailing return type; deduced return types are a C++14 extension
if host_machine.system() == 'windows'
message('[WINDOWS] using c++14 standard')
sqlitecpp_opts += [
'cpp_std=c++14',
]
endif
# Options relative to SQLite and SQLiteC++ functions

if get_option('SQLITE_ENABLE_COLUMN_METADATA')
Expand Down Expand Up @@ -131,10 +144,23 @@ libsqlitecpp = library(
include_directories: sqlitecpp_incl,
cpp_args: sqlitecpp_args,
dependencies: sqlitecpp_deps,
# override the default options
override_options: sqlitecpp_opts,
# install: true,
# API version for SQLiteCpp shared library.
version: '0',
)
version: '0',)
if get_option('SQLITECPP_BUILD_TESTS')
# for the unit tests we need to link against a static version of SQLiteCpp
libsqlitecpp_static = static_library(
'sqlitecpp_static',
sqlitecpp_srcs,
include_directories: sqlitecpp_incl,
cpp_args: sqlitecpp_args,
dependencies: sqlitecpp_deps,
# override the default options
override_options: sqlitecpp_opts,)
# static libraries do not have a version
endif

install_headers(
'include/SQLiteCpp/SQLiteCpp.h',
Expand All @@ -153,6 +179,14 @@ sqlitecpp_dep = declare_dependency(
include_directories: sqlitecpp_incl,
link_with: libsqlitecpp,
)
if get_option('SQLITECPP_BUILD_TESTS')
## make the dependency static so the unit tests can link against it
## (mainly for windows as the symbols are not exported by default)
sqlitecpp_static_dep = declare_dependency(
include_directories: sqlitecpp_incl,
link_with: libsqlitecpp_static,
)
endif

if get_option('SQLITECPP_BUILD_TESTS')
gtest_dep = dependency(
Expand All @@ -161,13 +195,15 @@ if get_option('SQLITECPP_BUILD_TESTS')
fallback: ['gtest', 'gtest_dep'])
sqlitecpp_test_dependencies = [
gtest_dep,
sqlitecpp_dep,
sqlitecpp_static_dep,
sqlite3_dep,
]
sqlitecpp_test_args = []

testexe = executable('testexe', sqlitecpp_test_srcs,
dependencies: sqlitecpp_test_dependencies)
dependencies: sqlitecpp_test_dependencies,
cpp_args: sqlitecpp_test_args,
# override the default options
override_options: sqlitecpp_opts,)

test_args = []

Expand All @@ -177,7 +213,9 @@ if get_option('SQLITECPP_BUILD_EXAMPLES')
## demo executable
sqlitecpp_demo_exe = executable('SQLITECPP_sample_demo',
sqlitecpp_sample_srcs,
dependencies: sqlitecpp_dep)
dependencies: sqlitecpp_dep,
# override the default options
override_options: sqlitecpp_opts,)
endif

pkgconfig = import('pkgconfig')
Expand Down
Loading

0 comments on commit a8fe606

Please sign in to comment.