From ea2b4fb4935627e4dea48f193eeb0019155a3abe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 10 May 2022 09:48:08 +0200 Subject: Use our own implementation of C++14 threads on MinGW --- libbutl/buildfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'libbutl/buildfile') diff --git a/libbutl/buildfile b/libbutl/buildfile index b2dc8f7..499800c 100644 --- a/libbutl/buildfile +++ b/libbutl/buildfile @@ -3,6 +3,7 @@ lib{butl}: {hxx ixx txx cxx}{** -uuid-* +uuid-io \ -win32-utility \ + -mingw-* \ -version \ -builtin-options} \ {hxx}{version} {hxx ixx cxx}{builtin-options} @@ -12,9 +13,15 @@ tsys = $cxx.target.system windows = ($tclass == 'windows') -# Exclude these from compilation on non-Windows targets. +# Whether to use our own implementation of C++14 threads on MinGW (note: +# requires Windows 7 or later). +# +mingw_stdthread = ($tsys == 'mingw32') + +# Exclude these from compilation on targets where does not apply. # lib{butl}: {hxx ixx cxx}{win32-utility}: include = $windows +lib{butl}: hxx{mingw-*}: include = $mingw_stdthread # Our C-files are always included into C++-files that wrap the corresponding # API so treat them as files exclude from the compilation. @@ -72,6 +79,9 @@ hxx{version}: # cxx.poptions =+ "-I$out_root" "-I$src_root" +if $mingw_stdthread + cxx.poptions += -D_WIN32_WINNT=0x0601 -DLIBBUTL_MINGW_STDTHREAD + obja{*} bmia{*}: cxx.poptions += -DLIBBUTL_STATIC_BUILD objs{*} bmis{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD @@ -79,6 +89,9 @@ objs{*} bmis{*}: cxx.poptions += -DLIBBUTL_SHARED_BUILD # lib{butl}: cxx.export.poptions = "-I$out_root" "-I$src_root" +if $mingw_stdthread + lib{butl}: cxx.export.poptions += -D_WIN32_WINNT=0x0601 -DLIBBUTL_MINGW_STDTHREAD + liba{butl}: cxx.export.poptions += -DLIBBUTL_STATIC libs{butl}: cxx.export.poptions += -DLIBBUTL_SHARED -- cgit v1.1