aboutsummaryrefslogtreecommitdiff
path: root/libbutl/buildfile
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl/buildfile')
-rw-r--r--libbutl/buildfile33
1 files changed, 30 insertions, 3 deletions
diff --git a/libbutl/buildfile b/libbutl/buildfile
index b2dc8f7..ba4ad96 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,14 +13,25 @@ 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).
+#
+# Note that for now we use built-in POSIX thread support during bootstrap
+# (which, as a side effect, verifies we still use MinGW GCC configured with
+# POSIX support, which we still need for TLS, exceptions, and thread-safe
+# static locals).
+#
+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.
+# API so treat them as files to exclude from the compilation.
#
-lib{butl}: file{*.c *.h}
+lib{butl}: file{**.c **.h}
# Platform-specific UUID implementations.
#
@@ -27,6 +39,7 @@ lib{butl}: cxx{uuid-linux}: include = ($tclass == 'linux')
lib{butl}: cxx{uuid-macos}: include = ($tclass == 'macos')
lib{butl}: cxx{uuid-windows}: include = $windows
lib{butl}: cxx{uuid-freebsd}: include = ($tsys == 'freebsd' || $tsys == 'netbsd')
+lib{butl}: cxx{uuid-openbsd}: include = ($tsys == 'openbsd')
# GCC prior to version 6 has flaky `#pragma GCC diagnostic` so we have to
# disable certain warnings outright.
@@ -52,6 +65,14 @@ switch $tclass, $tsys
case 'bsd', 'freebsd' | 'netbsd'
cxx.libs += -lexecinfo
+
+ case 'bsd', 'openbsd'
+ {
+ # Built-in libexecinfo is only available since OpenBSD 7.0.
+ #
+ if (([uint64] $regex.replace($cxx.target.version, '(\d+)\..+', '\1')) >= 7)
+ cxx.libs += -lexecinfo
+ }
}
if! $windows
@@ -72,6 +93,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 +103,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