mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-09 19:06:15 +01:00
Meson: add 'force_posix_threads' option
This allows building with posix threads on Windows. It is generally better to use win32 threads implementation on Windows, but this option can be used in case it causes issues, or for performance comparison for example. https://bugzilla.gnome.org/show_bug.cgi?id=784995
This commit is contained in:
parent
4b82738f0a
commit
2477c7b05f
@ -204,15 +204,15 @@ if host_system == 'windows'
|
||||
)
|
||||
glib_win_res = windows.compile_resources(glib_win_rc)
|
||||
glib_sources += [glib_win_res]
|
||||
glib_sources += files('gthread-win32.c')
|
||||
glib_sources += files('gwin32.c', 'gspawn-win32.c', 'giowin32.c')
|
||||
platform_deps = [winsock2, cc.find_library('winmm')]
|
||||
else
|
||||
glib_sources += files('gthread-posix.c')
|
||||
glib_sources += files('glib-unix.c', 'gspawn.c', 'giounix.c')
|
||||
platform_deps = []
|
||||
endif
|
||||
|
||||
glib_sources += files('gthread-@0@.c'.format(threads_implementation))
|
||||
|
||||
if enable_dtrace
|
||||
glib_dtrace_obj = dtrace_obj_gen.process('glib_probes.d')
|
||||
glib_dtrace_hdr = dtrace_hdr_gen.process('glib_probes.d')
|
||||
|
11
meson.build
11
meson.build
@ -1476,15 +1476,16 @@ endif
|
||||
|
||||
# === Threads ===
|
||||
|
||||
# Let meson figure out all this business and whether -pthread or whatnot is needed
|
||||
# FIXME: probably needs more tweaking in meson for things like -D_REENTRANT etc.
|
||||
thread_dep = dependency('threads')
|
||||
|
||||
# Determination of thread implementation
|
||||
if host_system == 'windows'
|
||||
if host_system == 'windows' and not get_option('force_posix_threads')
|
||||
thread_dep = []
|
||||
threads_implementation = 'win32'
|
||||
glibconfig_conf.set('g_threads_impl_def', 'WIN32')
|
||||
glib_conf.set('THREADS_WIN32', 1)
|
||||
else
|
||||
# FIXME: probably needs more tweaking in meson for things like -D_REENTRANT etc.
|
||||
thread_dep = dependency('threads')
|
||||
threads_implementation = 'posix'
|
||||
pthread_prefix = '''
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
|
@ -68,3 +68,8 @@ option('bsymbolic_functions',
|
||||
type : 'boolean',
|
||||
value : true,
|
||||
description : 'link with -Bsymbolic-functions if supported')
|
||||
|
||||
option('force_posix_threads',
|
||||
type : 'boolean',
|
||||
value : false,
|
||||
description : 'Also use posix threads in case the platform defaults to another implementation (on Windows for example)')
|
||||
|
Loading…
Reference in New Issue
Block a user