diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-08 12:50:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-08 12:50:51 +0200 |
commit | 6a2b8a263eb50c3ac09803a3fdab8fcdcbf6b904 (patch) | |
tree | 88cf8b105398fa5ac938344cbe9844c6084ba4e8 /modules/mono/build_scripts/tls_configure.py | |
parent | 3c4938d59a4af2996e53a7ee33c7e9063bb4337e (diff) | |
parent | 2873206aa6bfbcce8eb1185248c89c6fc8902d39 (diff) |
Merge pull request #26458 from neikeq/mono-build-cleanup
Mono: Add CPPPATH only to env_mono and cleanup build scripts
Diffstat (limited to 'modules/mono/build_scripts/tls_configure.py')
-rw-r--r-- | modules/mono/build_scripts/tls_configure.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/mono/build_scripts/tls_configure.py b/modules/mono/build_scripts/tls_configure.py new file mode 100644 index 0000000000..622280b00b --- /dev/null +++ b/modules/mono/build_scripts/tls_configure.py @@ -0,0 +1,36 @@ +from __future__ import print_function + +def supported(result): + return 'supported' if result else 'not supported' + + +def check_cxx11_thread_local(conf): + print('Checking for `thread_local` support...', end=" ") + result = conf.TryCompile('thread_local int foo = 0; int main() { return foo; }', '.cpp') + print(supported(result)) + return bool(result) + + +def check_declspec_thread(conf): + print('Checking for `__declspec(thread)` support...', end=" ") + result = conf.TryCompile('__declspec(thread) int foo = 0; int main() { return foo; }', '.cpp') + print(supported(result)) + return bool(result) + + +def check_gcc___thread(conf): + print('Checking for `__thread` support...', end=" ") + result = conf.TryCompile('__thread int foo = 0; int main() { return foo; }', '.cpp') + print(supported(result)) + return bool(result) + + +def configure(conf): + if check_cxx11_thread_local(conf): + conf.env.Append(CPPDEFINES=['HAVE_CXX11_THREAD_LOCAL']) + else: + if conf.env.msvc: + if check_declspec_thread(conf): + conf.env.Append(CPPDEFINES=['HAVE_DECLSPEC_THREAD']) + elif check_gcc___thread(conf): + conf.env.Append(CPPDEFINES=['HAVE_GCC___THREAD']) |