Merge pull request #380 [Meson] fixes for meson project from ninjaoflight/windows-support

This commit is contained in:
Sébastien Rombauts 2022-12-09 09:11:03 +01:00 committed by GitHub
commit 4fc2eeecf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 44 deletions

4
.gitignore vendored
View File

@ -3,6 +3,8 @@ Release
build
*.a
# ignore clangd cache directory
.cache
.vs/
.vscode/
/SQLiteCpp.sln
@ -17,6 +19,8 @@ core
*ipch
.settings/
# do not track Visual Studio CMake settings
CMakeSettings.json
CMakeCache.txt
CMakeFiles
*.dir

View File

@ -3,7 +3,7 @@ project(
# SQLiteCpp requires C++11 support
default_options: ['cpp_std=c++11'],
license: 'MIT',
version: '3.1.1',
version: '3.2.0',
)
cxx = meson.get_compiler('cpp')
@ -35,6 +35,7 @@ sqlitecpp_srcs = [
'src/Column.cpp',
'src/Database.cpp',
'src/Exception.cpp',
'src/Savepoint.cpp',
'src/Statement.cpp',
'src/Transaction.cpp',
]
@ -54,6 +55,7 @@ sqlitecpp_opts = []
sqlitecpp_test_srcs = [
'tests/Column_test.cpp',
'tests/Database_test.cpp',
'tests/Savepoint_test.cpp',
'tests/Statement_test.cpp',
'tests/Backup_test.cpp',
'tests/Transaction_test.cpp',
@ -61,16 +63,16 @@ sqlitecpp_test_srcs = [
'tests/Exception_test.cpp',
'tests/ExecuteMany_test.cpp',
]
sqlitecpp_test_args = [
# do not use ambiguous overloads by default
'-DNON_AMBIGOUS_OVERLOAD'
]
sqlitecpp_test_args = []
## samples
sqlitecpp_sample_srcs = [
sqlitecpp_sample1_srcs = [
'examples/example1/main.cpp',
]
sqlitecpp_sample2_srcs = [
'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:
@ -91,6 +93,11 @@ if host_machine.system() == 'windows'
sqlitecpp_opts += [
'cpp_std=c++14',
]
# check that we are not trying to build as dynamic library
if get_option('default_library') != 'shared'
warming('SQLiteCpp does not support shared library on Windows, the library will be built as static')
endif
endif
# Options relative to SQLite and SQLiteC++ functions
@ -137,43 +144,50 @@ if get_option('b_coverage')
]
endif
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',)
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',
## 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,)
# static libraries do not have a version
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
install_headers(
'include/SQLiteCpp/SQLiteCpp.h',
'include/SQLiteCpp/Assertion.h',
'include/SQLiteCpp/Backup.h',
'include/SQLiteCpp/Column.h',
'include/SQLiteCpp/Database.h',
'include/SQLiteCpp/Exception.h',
'include/SQLiteCpp/Statement.h',
'include/SQLiteCpp/Transaction.h',
'include/SQLiteCpp/VariadicBind.h',
'include/SQLiteCpp/ExecuteMany.h',
)
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,
@ -192,7 +206,7 @@ if get_option('SQLITECPP_BUILD_TESTS')
gtest_dep = dependency(
'gtest',
main : true,
fallback: ['gtest', 'gtest_dep'])
fallback: ['gtest', 'gtest_main_dep'])
sqlitecpp_test_dependencies = [
gtest_dep,
sqlitecpp_static_dep,
@ -210,12 +224,19 @@ if get_option('SQLITECPP_BUILD_TESTS')
test('sqlitecpp unit tests', testexe, args: test_args)
endif
if get_option('SQLITECPP_BUILD_EXAMPLES')
## demo executable
sqlitecpp_demo_exe = executable('SQLITECPP_sample_demo',
sqlitecpp_sample_srcs,
## 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')

View File

@ -9,5 +9,7 @@ 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 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.')

View File

@ -1,9 +1,12 @@
[wrap-file]
directory = googletest-release-1.11.0
source_url = https://github.com/google/googletest/archive/release-1.11.0.tar.gz
source_filename = gtest-1.11.0.tar.gz
source_hash = b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5
patch_directory = gtest
directory = googletest-release-1.12.1
source_url = https://github.com/google/googletest/archive/release-1.12.1.tar.gz
source_filename = gtest-1.12.1.tar.gz
source_hash = 81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2
patch_filename = gtest_1.12.1-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.12.1-1/get_patch
patch_hash = 75143f11e174952bc768699fde3176511fe8e33b25dc6f6347d89e41648e99cf
wrapdb_version = 1.12.1-1
[provide]
gtest = gtest_dep