mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-09 12:16:05 -04:00
meson code review
change version to 3.2.1 change file sources array to files() comment default flags check for sqlite3_load_extension support change warning() to message('warning:
This commit is contained in:
parent
403839d910
commit
e8b812e1e1
76
meson.build
76
meson.build
@ -3,7 +3,7 @@ project(
|
|||||||
# SQLiteCpp requires C++11 support
|
# SQLiteCpp requires C++11 support
|
||||||
default_options: ['cpp_std=c++11'],
|
default_options: ['cpp_std=c++11'],
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
version: '3.2.0',
|
version: '3.2.1',
|
||||||
)
|
)
|
||||||
|
|
||||||
cxx = meson.get_compiler('cpp')
|
cxx = meson.get_compiler('cpp')
|
||||||
@ -39,7 +39,7 @@ sqlite3_dep = dependency(
|
|||||||
sqlitecpp_incl = [
|
sqlitecpp_incl = [
|
||||||
include_directories('include')
|
include_directories('include')
|
||||||
]
|
]
|
||||||
sqlitecpp_srcs = [
|
sqlitecpp_srcs = files(
|
||||||
'src/Backup.cpp',
|
'src/Backup.cpp',
|
||||||
'src/Column.cpp',
|
'src/Column.cpp',
|
||||||
'src/Database.cpp',
|
'src/Database.cpp',
|
||||||
@ -47,10 +47,16 @@ sqlitecpp_srcs = [
|
|||||||
'src/Savepoint.cpp',
|
'src/Savepoint.cpp',
|
||||||
'src/Statement.cpp',
|
'src/Statement.cpp',
|
||||||
'src/Transaction.cpp',
|
'src/Transaction.cpp',
|
||||||
]
|
)
|
||||||
sqlitecpp_args = [
|
sqlitecpp_args = cxx.get_supported_arguments(
|
||||||
'-Wall',
|
# included in meson by default
|
||||||
]
|
# -Wall
|
||||||
|
'-Wextra',
|
||||||
|
'-Wpedantic',
|
||||||
|
'-Wswitch-enum',
|
||||||
|
'-Wshadow',
|
||||||
|
'-Wno-long-long',
|
||||||
|
)
|
||||||
sqlitecpp_link = []
|
sqlitecpp_link = []
|
||||||
sqlitecpp_deps = [
|
sqlitecpp_deps = [
|
||||||
sqlite3_dep,
|
sqlite3_dep,
|
||||||
@ -61,7 +67,7 @@ sqlitecpp_opts = []
|
|||||||
|
|
||||||
## tests
|
## tests
|
||||||
|
|
||||||
sqlitecpp_test_srcs = [
|
sqlitecpp_test_srcs = files(
|
||||||
'tests/Column_test.cpp',
|
'tests/Column_test.cpp',
|
||||||
'tests/Database_test.cpp',
|
'tests/Database_test.cpp',
|
||||||
'tests/Savepoint_test.cpp',
|
'tests/Savepoint_test.cpp',
|
||||||
@ -71,30 +77,18 @@ sqlitecpp_test_srcs = [
|
|||||||
'tests/VariadicBind_test.cpp',
|
'tests/VariadicBind_test.cpp',
|
||||||
'tests/Exception_test.cpp',
|
'tests/Exception_test.cpp',
|
||||||
'tests/ExecuteMany_test.cpp',
|
'tests/ExecuteMany_test.cpp',
|
||||||
]
|
)
|
||||||
sqlitecpp_test_args = []
|
sqlitecpp_test_args = []
|
||||||
|
|
||||||
## samples
|
## samples
|
||||||
|
|
||||||
sqlitecpp_sample1_srcs = [
|
sqlitecpp_sample1_srcs = files(
|
||||||
'examples/example1/main.cpp',
|
'examples/example1/main.cpp',
|
||||||
]
|
)
|
||||||
sqlitecpp_sample2_srcs = [
|
sqlitecpp_sample2_srcs = files(
|
||||||
'examples/example2/src/main.cpp',
|
'examples/example2/src/main.cpp',
|
||||||
]
|
)
|
||||||
|
|
||||||
# if not using MSVC we need to add this compiler arguments
|
|
||||||
# for a list of MSVC supported arguments please check:
|
|
||||||
# https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically?view=msvc-170
|
|
||||||
if not (host_machine.system() == 'windows' and cxx.get_id() == 'msvc')
|
|
||||||
sqlitecpp_args += [
|
|
||||||
'-Wextra',
|
|
||||||
'-Wpedantic',
|
|
||||||
'-Wswitch-enum',
|
|
||||||
'-Wshadow',
|
|
||||||
'-Wno-long-long',
|
|
||||||
]
|
|
||||||
endif
|
|
||||||
## using MSVC headers requires c++14, if not will show an error on xstddef as:
|
## 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
|
## 'auto' return without trailing return type; deduced return types are a C++14 extension
|
||||||
if host_machine.system() == 'windows'
|
if host_machine.system() == 'windows'
|
||||||
@ -104,7 +98,7 @@ if host_machine.system() == 'windows'
|
|||||||
]
|
]
|
||||||
# check that we are not trying to build as dynamic library
|
# check that we are not trying to build as dynamic library
|
||||||
if get_option('default_library') != 'shared'
|
if get_option('default_library') != 'shared'
|
||||||
warming('SQLiteCpp does not support shared library on Windows, the library will be built as static')
|
message('warning: SQLiteCpp does not support shared library on Windows, the library will be built as static')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
@ -140,26 +134,46 @@ if get_option('SQLITECPP_DISABLE_STD_FILESYSTEM')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
## stack protection hardening
|
## stack protection hardening
|
||||||
if get_option('SQLITECPP_USE_STACK_PROTECTOR')
|
if get_option('SQLITECPP_USE_STACK_PROTECTION')
|
||||||
## if is on MinGW-W64 give a warning that is not supported
|
## if is on MinGW-W64 give a warning that is not supported
|
||||||
if mingw_64_env
|
if mingw_64_env
|
||||||
warning('SQLiteCpp does not support stack protection on MinGW-W64')
|
message('warning: SQLiteCpp does not support stack protection on MinGW-W64')
|
||||||
warming('this could lead to a crash on the application')
|
message('warning: this could lead to a crash on the application')
|
||||||
warming('you can disable this warning by setting SQLITECPP_USE_STACK_PROTECTOR to false')
|
message('warning: you can disable this warning by setting SQLITECPP_USE_STACK_PROTECTOR to false')
|
||||||
else
|
else
|
||||||
sqlitecpp_args += ['-fstack-protector']
|
sqlitecpp_args += ['-fstack-protector']
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
## enable ommit load extension
|
## enable ommit load extension
|
||||||
if get_option('SQLITECPP_OMIT_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']
|
sqlitecpp_args += ['-DSQLITE_OMIT_LOAD_EXTENSION']
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if unix_like
|
if unix_like
|
||||||
sqlitecpp_args += [
|
sqlitecpp_args += [
|
||||||
'-DfPIC',
|
# -fPIC is included by default in meson
|
||||||
|
# 'fPIC',
|
||||||
]
|
]
|
||||||
# add dl dependency
|
# add dl dependency
|
||||||
libdl_dep = cxx.find_library('dl')
|
libdl_dep = cxx.find_library('dl')
|
||||||
|
@ -10,7 +10,7 @@ option('SQLITE_HAS_CODEC', type: 'boolean', value: false, description: 'Enable d
|
|||||||
## Force forward declaration of legacy struct sqlite3_value (pre SQLite 3.19)
|
## 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)')
|
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
|
## Enable ommit load extension
|
||||||
option('SQLITE_OMMIT_LOAD_EXTENSION', type: 'boolean', value: false, description: '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)
|
## 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)')
|
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.
|
## Stack protection is not supported on MinGW-W64 on Windows, allow this flag to be turned off.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user