Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sqlitecpp 3.2.1-1 #816

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ci_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@
"windows": false
}
},
"sqlitecpp":{
"build_options": [
"sqlitecpp:SQLITECPP_BUILD_TESTS=true",
"sqlitecpp:SQLITECPP_BUILD_EXAMPLES=true"
]
},
"tinyfsm": {
"build_options": [
"tinyfsm:build_examples=true"
Expand Down
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,14 @@
"3.34.1-1"
]
},
"sqlitecpp": {
"dependency_names": [
"sqlitecpp"
],
"versions": [
"3.2.1-1"
]
},
"tabulate": {
"dependency_names": [
"tabulate"
Expand Down
293 changes: 293 additions & 0 deletions subprojects/packagefiles/sqlitecpp/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
project(
'SQLiteCpp', 'cpp',
# SQLiteCpp requires C++11 support
default_options: ['cpp_std=c++11'],
license: 'MIT',
version: '3.2.1',
)

cxx = meson.get_compiler('cpp')

## at best we might try to test if this code compiles
## testing for compilers or platforms is not reliable enough
## example: native clang on windows or mingw in windows
unix_like_code = '''
#if defined(unix) || defined(__unix__) || defined(__unix)
// do nothing
#else
# error "Non Unix-like OS"
#endif
'''
unix_like = cxx.compiles(unix_like_code, name : 'unix like environment')

mingw_64_env_code = '''
#if defined(__MINGW64__)
// do nothing
#else
# error "Non MinGW-W64 environment"
#endif
'''
mingw_64_env = cxx.compiles(mingw_64_env_code, name : 'MinGW-W64 environment')

thread_dep = dependency('threads')
# sqlite3 support
sqlite3_dep = dependency(
'sqlite3',
fallback: ['sqlite3', 'sqlite3_dep']
)

sqlitecpp_incl = [
include_directories('include')
]
sqlitecpp_srcs = files(
'src/Backup.cpp',
'src/Column.cpp',
'src/Database.cpp',
'src/Exception.cpp',
'src/Savepoint.cpp',
'src/Statement.cpp',
'src/Transaction.cpp',
)
sqlitecpp_args = cxx.get_supported_arguments(
# included in meson by default
# -Wall
'-Wextra',
'-Wpedantic',
'-Wswitch-enum',
'-Wshadow',
'-Wno-long-long',
)
sqlitecpp_link = []
sqlitecpp_deps = [
sqlite3_dep,
thread_dep,
]
## used to override the default sqlitecpp options like cpp standard
sqlitecpp_opts = []

## tests

sqlitecpp_test_srcs = files(
'tests/Column_test.cpp',
'tests/Database_test.cpp',
'tests/Savepoint_test.cpp',
'tests/Statement_test.cpp',
'tests/Backup_test.cpp',
'tests/Transaction_test.cpp',
'tests/VariadicBind_test.cpp',
'tests/Exception_test.cpp',
'tests/ExecuteMany_test.cpp',
)
sqlitecpp_test_args = []

## samples

sqlitecpp_sample1_srcs = files(
'examples/example1/main.cpp',
)
sqlitecpp_sample2_srcs = files(
'examples/example2/src/main.cpp',
)

## 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',
]
# check that we are not trying to build as dynamic library
if get_option('default_library') != 'shared'
message('warning: SQLiteCpp does not support shared library on Windows, the library will be built as static')
endif

endif
# Options relative to SQLite and SQLiteC++ functions

if get_option('SQLITE_ENABLE_COLUMN_METADATA')
sqlitecpp_args += [
'-DSQLITE_ENABLE_COLUMN_METADATA',
]
endif

if get_option('SQLITE_ENABLE_ASSERT_HANDLER')
sqlitecpp_args += [
'-DSQLITE_ENABLE_ASSERT_HANDLER',
]
endif

if get_option('SQLITE_HAS_CODEC')
sqlitecpp_args += [
'SQLITE_HAS_CODEC',
]
endif

if get_option('SQLITE_USE_LEGACY_STRUCT')
sqlitecpp_args += [
'-DSQLITE_USE_LEGACY_STRUCT',
]
endif

## C++17 disable the support for std::filesystem (by default off)
if get_option('SQLITECPP_DISABLE_STD_FILESYSTEM')
sqlitecpp_cxx_flags += ['-DSQLITECPP_DISABLE_STD_FILESYSTEM']
endif

## stack protection hardening
if get_option('SQLITECPP_USE_STACK_PROTECTION')
## if is on MinGW-W64 give a warning that is not supported
if mingw_64_env
message('warning: SQLiteCpp does not support stack protection on MinGW-W64')
message('warning: this could lead to a crash on the application')
message('warning: you can disable this warning by setting SQLITECPP_USE_STACK_PROTECTOR to false')
else
sqlitecpp_args += ['-fstack-protector']
endif
endif

## enable ommit load extension
if get_option('SQLITE_OMIT_LOAD_EXTENSION')
sqlitecpp_args += ['-DSQLITE_OMIT_LOAD_EXTENSION']
## check if running on OSX
elif host_machine.system() == 'darwin' and sqlite3_dep.found()
sqlite3_load_extension_support = cxx.links(
'''
#include <sqlite3.h>
int main() {
sqlite3_enable_load_extension(0, 0);
return 0;
}
''',
name: 'sqlite3_load_extension',
dependencies: [sqlite3_dep])
if not sqlite3_load_extension_support
message('warning: Detected bundled SQLite3 in OSX, but it does not support load extension')
message('warning: SQLiteCpp will be built without load extension support')
message('warning: You can disable this warning by setting SQLITE_OMIT_LOAD_EXTENSION to false')
sqlitecpp_args += ['-DSQLITE_OMIT_LOAD_EXTENSION']
endif
endif



if unix_like
sqlitecpp_args += [
# -fPIC is included by default in meson
# 'fPIC',
]
# add dl dependency
libdl_dep = cxx.find_library('dl')
sqlitecpp_deps += [
libdl_dep,
]
endif

if get_option('b_coverage')
# Prevent the compiler from removing the unused inline functions so that they get tracked as "non-covered"
sqlitecpp_args += [
'-fkeep-inline-functions',
'-fkeep-static-functions',
]
endif

## Workarround for windows: if building on windows we will build the library as static
if host_machine.system() == 'windows'
libsqlitecpp = static_library(
'sqlitecpp',
sqlitecpp_srcs,
include_directories: sqlitecpp_incl,
cpp_args: sqlitecpp_args,
dependencies: sqlitecpp_deps,
# override the default options
override_options: sqlitecpp_opts,)
else
libsqlitecpp = library(
'sqlitecpp',
sqlitecpp_srcs,
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',)
endif

if get_option('SQLITECPP_BUILD_TESTS')
# for the unit tests we need to link against a static version of SQLiteCpp
if host_machine.system() == 'windows' or get_option('default_library') == 'static'
# we do not need to recomplile the library
libsqlitecpp_static = libsqlitecpp
else
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,)
endif
endif

install_subdir(
'include/SQliteCpp',
install_dir: get_option('includedir'))

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(
'gtest',
main : true,
fallback: ['gtest', 'gtest_main_dep'])
sqlitecpp_test_dependencies = [
gtest_dep,
sqlitecpp_static_dep,
sqlite3_dep,
]

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

test_args = []

test('sqlitecpp unit tests', testexe, args: test_args)
endif
if get_option('SQLITECPP_BUILD_EXAMPLES')
## demo 1 executable
sqlitecpp_demo1_exe = executable('SQLITECPP_sample_demo1',
sqlitecpp_sample1_srcs,
dependencies: sqlitecpp_dep,
# override the default options
override_options: sqlitecpp_opts,)
## demo 2 executable
sqlitecpp_demo1_exe = executable('SQLITECPP_sample_demo2',
sqlitecpp_sample2_srcs,
dependencies: sqlitecpp_dep,
# override the default options
override_options: sqlitecpp_opts,)

endif

pkgconfig = import('pkgconfig')
pkgconfig.generate(
libsqlitecpp,
description: 'a smart and easy to use C++ SQLite3 wrapper.',
version: meson.project_version(),
)
21 changes: 21 additions & 0 deletions subprojects/packagefiles/sqlitecpp/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Options relative to SQLite and SQLiteC++ functions
## Enable the use of SQLite column metadata and Column::getColumnOriginName() method,
## Require that the sqlite3 library is also compiled with this flag (default under Debian/Ubuntu, but not on Mac OS X).
option('SQLITE_ENABLE_COLUMN_METADATA', type: 'boolean', value: false, description: 'Enable Column::getColumnOriginName(). Require support from sqlite3 library.')
## Enable the user definition of a assertion_failed() handler (default to false, easier to handler for beginners).
option('SQLITE_ENABLE_ASSERT_HANDLER', type: 'boolean', value: false, description: 'Enable the user definition of a assertion_failed() handler.')
## Enable database encryption API. Requires implementations of sqlite3_key & sqlite3_key_v2.
## Eg. SQLCipher (libsqlcipher-dev) is an SQLite extension that provides 256 bit AES encryption of database files.
option('SQLITE_HAS_CODEC', type: 'boolean', value: false, description: 'Enable database encryption API. Not available in the public release of SQLite.')
## Force forward declaration of legacy struct sqlite3_value (pre SQLite 3.19)
option('SQLITE_USE_LEGACY_STRUCT', type: 'boolean', value: false, description: 'Fallback to forward declaration of legacy struct sqlite3_value (pre SQLite 3.19)')
## Enable ommit load extension
option('SQLITE_OMIT_LOAD_EXTENSION', type: 'boolean', value: false, description: 'Enable ommit load extension.')
## Disable the support for std::filesystem (C++17)
option('SQLITECPP_DISABLE_STD_FILESYSTEM', type: 'boolean', value: false, description: 'Disable the support for std::filesystem (C++17)')
## Stack protection is not supported on MinGW-W64 on Windows, allow this flag to be turned off.
option('SQLITECPP_USE_STACK_PROTECTION', type: 'boolean', value: true, description: 'Enable stack protection for MySQL.')
## Enable build for the tests of SQLiteC++
option('SQLITECPP_BUILD_TESTS', type: 'boolean', value: false, description: 'Build SQLiteC++ unit tests.')
## Build the examples of SQLiteC++
option('SQLITECPP_BUILD_EXAMPLES', type: 'boolean', value: false, description: 'Build SQLiteC++ examples.')
Loading