Skip to content

Commit 89e4a8b

Browse files
authored
Merge pull request #1516 from su2code/su2_hdf5_cross_compile
Use correct target_machine check for hdf5 cross compilation
2 parents 1791e3c + 5ab1645 commit 89e4a8b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

externals/cgns/hdf5/meson.build

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if build_machine.system() == 'windows' or meson.get_compiler('c').get_id() == 'intel'
1+
if target_machine.system() == 'windows' or meson.get_compiler('c').get_id() == 'intel'
22
hdf5_default_warnings = []
33
else
44
hdf5_default_warnings = ['-Wno-unused-result',
@@ -46,7 +46,7 @@ if opt_szip.found()
4646
endif
4747

4848

49-
if build_machine.system() == 'windows'
49+
if target_machine.system() == 'windows'
5050
hdf5_conf_data.set('H5_HAVE_WINDOWS', 1)
5151
hdf5_conf_data.set('H5_HAVE_WINDOW_PATH', 1)
5252
hdf5_conf_data.set('H5_HAVE_MINGW', 1)
@@ -66,21 +66,25 @@ if build_machine.system() == 'windows'
6666
hdf5_conf_data.set('H5_HAVE_LIBWSOCK32', 1)
6767
endif
6868

69-
if build_machine.system() != 'windows'
70-
if build_machine.endian() == 'big'
69+
if target_machine.system() != 'windows'
70+
if target_machine.endian() == 'big'
7171
hdf5_conf_data.set('H5_WORDS_BIGENDIAN', 1)
7272
else
7373
hdf5_conf_data.set('H5_WORDS_BIGENDIAN', 0)
7474
endif
7575
endif
7676

7777

78-
if build_machine.system() == 'windows'
78+
if target_machine.system() == 'windows'
7979
hdf5_conf_data.set('H5_DEFAULT_PLUGINDIR', '%ALLUSERSPROFILE%\\\\hdf5\\\\lib\\\\plugin')
8080
else
8181
hdf5_conf_data.set('H5_DEFAULT_PLUGINDIR', '/usr/local/hdf5/lib/plugin')
8282
endif
8383

84+
if target_machine.system()=='darwin'
85+
hdf5_conf_data.set('H5_HAVE_DARWIN', 1)
86+
endif
87+
8488
#if cc.has_function('difftime', prefix : '#include <time.h>')
8589
# # function exists, do whatever is required.
8690
#endif
@@ -143,7 +147,7 @@ if cc.has_header('io.h')
143147
hdf5_conf_data.set('H5_HAVE_IO_H', 1)
144148
endif
145149

146-
if build_machine.system() != 'windows'
150+
if target_machine.system() != 'windows'
147151
hdf5_conf_data.set('H5_HAVE_WINSOCK2_H', cc.has_header('winsock2.h'))
148152
endif
149153

@@ -253,15 +257,16 @@ else
253257
hdf5_conf_data.set('H5_HAVE_LIBUCB', 1)
254258
endif
255259

256-
257-
defs = [
258-
'-D_FILE_OFFSET_BITS=64',
259-
'-D_LARGEFILE64_SOURCE',
260-
'-D_LARGEFILE_SOURCE',
261-
]
262-
260+
defs = []
263261
#if not windows or mingw
264-
defs += ['-D_POSIX_C_SOURCE=200809L', '-D_GNU_SOURCE',]
262+
if target_machine.system()!='darwin'
263+
defs += [
264+
'-D_FILE_OFFSET_BITS=64',
265+
'-D_LARGEFILE64_SOURCE',
266+
'-D_LARGEFILE_SOURCE',]
267+
268+
defs += ['-D_POSIX_C_SOURCE=200809L', '-D_GNU_SOURCE',]
269+
endif
265270
#endif
266271

267272
if not(cc.has_function('lseek64', prefix: '''#include <sys/types.h>
@@ -305,7 +310,7 @@ hdf5_conf_data.set('H5_SIZEOF_INT', cc.sizeof('int'))
305310
hdf5_conf_data.set('H5_SIZEOF_UNSIGNED', cc.sizeof('unsigned'))
306311

307312

308-
if build_machine.system() != 'darwin'
313+
if target_machine.system() != 'darwin'
309314
hdf5_conf_data.set('H5_SIZEOF_LONG', cc.sizeof('long'))
310315
endif
311316

@@ -347,7 +352,7 @@ hdf5_conf_data.set('H5_SIZEOF_INT_LEAST64_T', cc.sizeof ('int_least64_t', pre
347352
hdf5_conf_data.set('H5_SIZEOF_UINT_LEAST64_T', cc.sizeof ('uint_least64_t', prefix:'#include <stdint.h>'))
348353
hdf5_conf_data.set('H5_SIZEOF_INT_FAST64_T', cc.sizeof ('int_fast64_t', prefix:'#include <stdint.h>'))
349354
hdf5_conf_data.set('H5_SIZEOF_UINT_FAST64_T', cc.sizeof ('uint_fast64_t', prefix:'#include <stdint.h>'))
350-
if build_machine.system() != 'darwin'
355+
if target_machine.system() != 'darwin'
351356
hdf5_conf_data.set('H5_SIZEOF_SIZE_T', cc.sizeof('size_t'))
352357
hdf5_conf_data.set('H5_SIZEOF_SSIZE_T', cc.sizeof('ssize_t'))
353358
if hdf5_conf_data.get('H5_SIZEOF_SSIZE_T') < 1
@@ -467,7 +472,7 @@ hdf5_conf_data.set('H5_GETTIMEOFDAY_GIVE_TZ', cc.compiles(code_gettimeofday_give
467472
hdf5_conf_data.set('H5_HAVE_TM_ZONE', 1)
468473
hdf5_conf_data.set('H5_HAVE_STRUCT_TM_TM_ZONE', 1)
469474

470-
if build_machine.system() != 'windows'
475+
if target_machine.system() != 'windows'
471476
hdf5_conf_data.set('H5_HAVE_TIMEZONE', 1)
472477
endif
473478

@@ -559,7 +564,7 @@ hdf5_conf_data.set('H5_HAVE_SOCKLEN_T', 1)
559564
#
560565

561566
# Check IOEO
562-
if build_machine.system() == 'windows'
567+
if target_machine.system() == 'windows'
563568
code_ioeo='''
564569
#include <windows.h>
565570
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
@@ -614,11 +619,6 @@ hdf5_conf_data.set('H5_USE_FILE_LOCKING', 1)
614619
hdf5_conf_data.set('H5_IGNORE_DISABLED_FILE_LOCKS', 1)
615620
hdf5_conf_data.set('H5_HAVE_LARGE_HSIZET', 1)
616621

617-
if build_machine.system() == 'darwin'
618-
hdf5_conf_data.set('H5_HAVE_DARWIN', 1)
619-
endif
620-
621-
622622
if mpi
623623
hdf5_conf_data.set('H5_HAVE_PARALLEL', 1)
624624
ext_deps += mpi_dep

0 commit comments

Comments
 (0)