Merge pull request #389 [meson] add missing compile options from ninjaoflight/meson-fixes

This commit is contained in:
Sébastien Rombauts 2022-12-12 09:06:19 +01:00 committed by GitHub
commit a5c783db99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 4 deletions

View File

@ -20,10 +20,14 @@ unix_like_code = '''
'''
unix_like = cxx.compiles(unix_like_code, name : 'unix like environment')
## 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
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
@ -130,6 +134,29 @@ if get_option('SQLITE_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_PROTECTOR')
## if is on MinGW-W64 give a warning that is not supported
if mingw_64_env
warning('SQLiteCpp does not support stack protection on MinGW-W64')
warming('this could lead to a crash on the application')
warming('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('SQLITECPP_OMIT_LOAD_EXTENSION')
sqlitecpp_args += ['-DSQLITE_OMIT_LOAD_EXTENSION']
endif
if unix_like
sqlitecpp_args += [
'-DfPIC',

View File

@ -9,8 +9,12 @@ option('SQLITE_ENABLE_ASSERT_HANDLER', type: 'boolean', value: false, descriptio
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_OMMIT_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++