@@ -23,10 +23,10 @@ is_git_repo = run_command([isdir, '.git'], check: false).returncode() == 0
23
23
24
24
version = ' v' + meson .project_version()
25
25
if git.found() and is_git_repo
26
- git_version = run_command ([git.path (), ' describe' , ' --dirty' , ' --tags' ], check : false ).stdout().strip()
27
- branch = run_command ([git.path (), ' rev-parse' , ' --abbrev-ref' , ' HEAD' ], check : false ).stdout().strip()
26
+ git_version = run_command ([git.full_path (), ' describe' , ' --dirty' , ' --tags' ], check : false ).stdout().strip()
27
+ branch = run_command ([git.full_path (), ' rev-parse' , ' --abbrev-ref' , ' HEAD' ], check : false ).stdout().strip()
28
28
if branch == ' HEAD'
29
- branch = run_command ([git.path (), ' rev-parse' , ' HEAD' ], check : false ).stdout().strip()
29
+ branch = run_command ([git.full_path (), ' rev-parse' , ' HEAD' ], check : false ).stdout().strip()
30
30
endif
31
31
if git_version != ''
32
32
version = git_version
@@ -148,14 +148,16 @@ nanomsg = dependency('nanomsg', required: get_option('wrap_mode') == 'nofallback
148
148
if (not nanomsg.found()
149
149
or get_option (' wrap_mode' ) == ' forcefallback'
150
150
or ' nanomsg' in get_option (' force_fallback_for' ))
151
- nanomsg_proj = cmake.subproject (' nanomsg-cmake' ,
152
- cmake_options : [
153
- ' -DNN_TESTS=OFF' ,
154
- ' -DNN_TOOLS=OFF' ,
155
- ' -DNN_STATIC_LIB=ON' ,
156
- ' -DBUILD_SHARED_LIBS=OFF' ,
157
- ' -DCMAKE_POSITION_INDEPENDENT_CODE=ON' ,
158
- ])
151
+
152
+ nanomsg_opts = cmake.subproject_options()
153
+ nanomsg_opts.add_cmake_defines({
154
+ ' NN_TESTS' : false ,
155
+ ' NN_TOOLS' : false ,
156
+ ' NN_STATIC_LIB' : true ,
157
+ ' BUILD_SHARED_LIBS' : false ,
158
+ ' CMAKE_POSITION_INDEPENDENT_CODE' : true ,
159
+ })
160
+ nanomsg_proj = cmake.subproject (' nanomsg-cmake' , options : nanomsg_opts)
159
161
nanomsg = nanomsg_proj.dependency (' nanomsg' )
160
162
# nanomsg has a bad include file hierarchy when used from source
161
163
config.set(' NN_H' , ' <src/nn.h>' )
@@ -181,37 +183,41 @@ must_regenerate_pb = nanopb.found()
181
183
if (not nanopb.found()
182
184
or get_option (' wrap_mode' ) == ' forcefallback'
183
185
or ' nanopb' in get_option (' force_fallback_for' ))
184
- nanopb_proj = cmake.subproject (' nanopb-cmake' ,
185
- cmake_options : [
186
- ' -Dnanopb_BUILD_GENERATOR=OFF' ,
187
- ' -DBUILD_SHARED_LIBS=OFF' ,
188
- ' -DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1' ,
189
- ' -DCMAKE_POSITION_INDEPENDENT_CODE=ON' ,
190
- ])
186
+
187
+ nanopb_opts = cmake.subproject_options()
188
+ nanopb_opts.add_cmake_defines({
189
+ ' nanopb_BUILD_GENERATOR' : false ,
190
+ ' BUILD_SHARED_LIBS' : false ,
191
+ ' CMAKE_C_FLAGS' : ' -DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1' ,
192
+ ' CMAKE_POSITION_INDEPENDENT_CODE' : true ,
193
+ })
194
+ nanopb_proj = cmake.subproject (' nanopb-cmake' , options : nanopb_opts)
191
195
nanopb = nanopb_proj.dependency (' protobuf-nanopb-static' )
192
196
endif
193
197
194
198
libgit2 = dependency (' libgit2' , required : get_option (' wrap_mode' ) == ' nofallback' )
195
199
if ((not libgit2.found() and get_option (' diffs' ).enabled())
196
200
or get_option (' wrap_mode' ) == ' forcefallback'
197
201
or ' libgit2' in get_option (' force_fallback_for' ))
198
- libgit2_proj = cmake.subproject (' libgit2-cmake' ,
199
- cmake_options : [
200
- ' -DBUILD_SHARED_LIBS=OFF' ,
201
- ' -DBUILD_CLAR=OFF' ,
202
- ' -DUSE_ICONV=OFF' ,
203
- ' -DUSE_SSH=OFF' ,
204
- ' -DUSE_GSSAPI=OFF' ,
205
- ' -DUSE_OPENSSL=OFF' ,
206
- ' -DVALGRIND=OFF' ,
207
- ' -DCURL=OFF' ,
208
- ' -DWINHTTP=OFF' ,
209
- ' -DCMAKE_DISABLE_FIND_PACKAGE_HTTP_Parser=TRUE' ,
210
- ' -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE' ,
211
- ' -DCMAKE_DISABLE_FIND_PACKAGE_Iconv=TRUE' ,
212
- ' -DCMAKE_DISABLE_FIND_PACKAGE_Security=TRUE' ,
213
- ' -DCMAKE_POSITION_INDEPENDENT_CODE=ON' ,
214
- ])
202
+
203
+ libgit2_opts = cmake.subproject_options()
204
+ libgit2_opts.add_cmake_defines({
205
+ ' BUILD_SHARED_LIBS' : false ,
206
+ ' BUILD_CLAR' : false ,
207
+ ' USE_ICONV' : false ,
208
+ ' USE_SSH' : false ,
209
+ ' USE_GSSAPI' : false ,
210
+ ' USE_OPENSSL' : false ,
211
+ ' VALGRIND' : false ,
212
+ ' CURL' : false ,
213
+ ' WINHTTP' : false ,
214
+ ' CMAKE_DISABLE_FIND_PACKAGE_HTTP_Parser' : true ,
215
+ ' CMAKE_DISABLE_FIND_PACKAGE_ZLIB' : true ,
216
+ ' CMAKE_DISABLE_FIND_PACKAGE_Iconv' : true ,
217
+ ' CMAKE_DISABLE_FIND_PACKAGE_Security' : true ,
218
+ ' CMAKE_POSITION_INDEPENDENT_CODE' : true ,
219
+ })
220
+ libgit2_proj = cmake.subproject (' libgit2-cmake' , options : libgit2_opts)
215
221
libgit2 = libgit2_proj.dependency (' git2' )
216
222
endif
217
223
0 commit comments