33 # SQLiteCpp requires C++11 support
44 default_options : [' cpp_std=c++11' ],
55 license : ' MIT' ,
6- version : ' 3.1.1 ' ,
6+ version : ' 3.2.0 ' ,
77)
88
99cxx = meson .get_compiler(' cpp' )
@@ -35,6 +35,7 @@ sqlitecpp_srcs = [
3535 ' src/Column.cpp' ,
3636 ' src/Database.cpp' ,
3737 ' src/Exception.cpp' ,
38+ ' src/Savepoint.cpp' ,
3839 ' src/Statement.cpp' ,
3940 ' src/Transaction.cpp' ,
4041]
@@ -54,23 +55,24 @@ sqlitecpp_opts = []
5455sqlitecpp_test_srcs = [
5556 ' tests/Column_test.cpp' ,
5657 ' tests/Database_test.cpp' ,
58+ ' tests/Savepoint_test.cpp' ,
5759 ' tests/Statement_test.cpp' ,
5860 ' tests/Backup_test.cpp' ,
5961 ' tests/Transaction_test.cpp' ,
6062 ' tests/VariadicBind_test.cpp' ,
6163 ' tests/Exception_test.cpp' ,
6264 ' tests/ExecuteMany_test.cpp' ,
6365]
64- sqlitecpp_test_args = [
65- # do not use ambiguous overloads by default
66- ' -DNON_AMBIGOUS_OVERLOAD'
67- ]
66+ sqlitecpp_test_args = []
6867
6968## samples
7069
71- sqlitecpp_sample_srcs = [
70+ sqlitecpp_sample1_srcs = [
7271 ' examples/example1/main.cpp' ,
7372]
73+ sqlitecpp_sample2_srcs = [
74+ ' examples/example2/src/main.cpp' ,
75+ ]
7476
7577# if not using MSVC we need to add this compiler arguments
7678# for a list of MSVC supported arguments please check:
@@ -91,6 +93,11 @@ if host_machine.system() == 'windows'
9193 sqlitecpp_opts += [
9294 ' cpp_std=c++14' ,
9395 ]
96+ # check that we are not trying to build as dynamic library
97+ if get_option (' default_library' ) != ' shared'
98+ warming(' SQLiteCpp does not support shared library on Windows, the library will be built as static' )
99+ endif
100+
94101endif
95102# Options relative to SQLite and SQLiteC++ functions
96103
@@ -137,43 +144,50 @@ if get_option('b_coverage')
137144 ]
138145endif
139146
140-
141- libsqlitecpp = library (
142- ' sqlitecpp' ,
143- sqlitecpp_srcs,
144- include_directories : sqlitecpp_incl,
145- cpp_args : sqlitecpp_args,
146- dependencies : sqlitecpp_deps,
147- # override the default options
148- override_options : sqlitecpp_opts,
149- # install: true,
150- # API version for SQLiteCpp shared library.
151- version : ' 0' ,)
152- if get_option (' SQLITECPP_BUILD_TESTS' )
153- # for the unit tests we need to link against a static version of SQLiteCpp
154- libsqlitecpp_static = static_library (
155- ' sqlitecpp_static' ,
147+ ## Workarround for windows: if building on windows we will build the library as static
148+ if host_machine .system() == ' windows'
149+ libsqlitecpp = static_library (
150+ ' sqlitecpp' ,
156151 sqlitecpp_srcs,
157152 include_directories : sqlitecpp_incl,
158153 cpp_args : sqlitecpp_args,
159154 dependencies : sqlitecpp_deps,
160155 # override the default options
161156 override_options : sqlitecpp_opts,)
162- # static libraries do not have a version
157+ else
158+ libsqlitecpp = library (
159+ ' sqlitecpp' ,
160+ sqlitecpp_srcs,
161+ include_directories : sqlitecpp_incl,
162+ cpp_args : sqlitecpp_args,
163+ dependencies : sqlitecpp_deps,
164+ # override the default options
165+ override_options : sqlitecpp_opts,
166+ # install: true,
167+ # API version for SQLiteCpp shared library.
168+ version : ' 0' ,)
163169endif
164170
165- install_headers (
166- ' include/SQLiteCpp/SQLiteCpp.h' ,
167- ' include/SQLiteCpp/Assertion.h' ,
168- ' include/SQLiteCpp/Backup.h' ,
169- ' include/SQLiteCpp/Column.h' ,
170- ' include/SQLiteCpp/Database.h' ,
171- ' include/SQLiteCpp/Exception.h' ,
172- ' include/SQLiteCpp/Statement.h' ,
173- ' include/SQLiteCpp/Transaction.h' ,
174- ' include/SQLiteCpp/VariadicBind.h' ,
175- ' include/SQLiteCpp/ExecuteMany.h' ,
176- )
171+ if get_option (' SQLITECPP_BUILD_TESTS' )
172+ # for the unit tests we need to link against a static version of SQLiteCpp
173+ if host_machine .system() == ' windows' or get_option (' default_library' ) == ' static'
174+ # we do not need to recomplile the library
175+ libsqlitecpp_static = libsqlitecpp
176+ else
177+ libsqlitecpp_static = static_library (
178+ ' sqlitecpp_static' ,
179+ sqlitecpp_srcs,
180+ include_directories : sqlitecpp_incl,
181+ cpp_args : sqlitecpp_args,
182+ dependencies : sqlitecpp_deps,
183+ # override the default options
184+ override_options : sqlitecpp_opts,)
185+ endif
186+ endif
187+
188+ install_subdir (
189+ ' include/SQliteCpp' ,
190+ install_dir : get_option (' includedir' ))
177191
178192sqlitecpp_dep = declare_dependency (
179193 include_directories : sqlitecpp_incl,
@@ -192,7 +206,7 @@ if get_option('SQLITECPP_BUILD_TESTS')
192206 gtest_dep = dependency (
193207 ' gtest' ,
194208 main : true ,
195- fallback : [' gtest' , ' gtest_dep ' ])
209+ fallback : [' gtest' , ' gtest_main_dep ' ])
196210 sqlitecpp_test_dependencies = [
197211 gtest_dep,
198212 sqlitecpp_static_dep,
@@ -210,12 +224,19 @@ if get_option('SQLITECPP_BUILD_TESTS')
210224 test (' sqlitecpp unit tests' , testexe, args : test_args)
211225endif
212226if get_option (' SQLITECPP_BUILD_EXAMPLES' )
213- ## demo executable
214- sqlitecpp_demo_exe = executable (' SQLITECPP_sample_demo' ,
215- sqlitecpp_sample_srcs,
227+ ## demo 1 executable
228+ sqlitecpp_demo1_exe = executable (' SQLITECPP_sample_demo1' ,
229+ sqlitecpp_sample1_srcs,
230+ dependencies : sqlitecpp_dep,
231+ # override the default options
232+ override_options : sqlitecpp_opts,)
233+ ## demo 2 executable
234+ sqlitecpp_demo1_exe = executable (' SQLITECPP_sample_demo2' ,
235+ sqlitecpp_sample2_srcs,
216236 dependencies : sqlitecpp_dep,
217237 # override the default options
218238 override_options : sqlitecpp_opts,)
239+
219240endif
220241
221242pkgconfig = import (' pkgconfig' )
0 commit comments