diff options
Diffstat (limited to 'libbutl/buildfile')
-rw-r--r-- | libbutl/buildfile | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/libbutl/buildfile b/libbutl/buildfile index 6526900..ba4ad96 100644 --- a/libbutl/buildfile +++ b/libbutl/buildfile @@ -1,37 +1,37 @@ # file : libbutl/buildfile # license : MIT; see accompanying LICENSE file -# This library was modularized using the Modules TS semantics (with support -# for dual, module/header consumption) which was subsequently partially -# dismantled. We, however, kept some of the changes in anticipation that they -# would be useful when attempting to modularize using the merged modules -# semantics. Specifically, there are currently headers with both .mxx and .hxx -# extensions and the code is littered with the `#if __cpp_[lib_]modules_ts` -# blocks. Note that it's important for the auto-generated header support -# that the default extension for hxx{} is .hxx. -# -# @@ If/when going back to using mxx{}, make sure to cleanup explicit .mxx. -# -lib{butl}: {hxx ixx txx cxx}{** -uuid-* +uuid-io \ - -win32-utility \ - -version \ - -builtin-options} \ - hxx{**.mxx} {hxx}{version} {hxx ixx cxx}{builtin-options} +lib{butl}: {hxx ixx txx cxx}{** -uuid-* +uuid-io \ + -win32-utility \ + -mingw-* \ + -version \ + -builtin-options} \ + {hxx}{version} {hxx ixx cxx}{builtin-options} tclass = $cxx.target.class 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 included into sha256.cxx (sha256c.c) and timestamp.cxx -# (strptime.c timelocal.h timelocal.c), so treat them as files exclude from -# the compilation. +# Our C-files are always included into C++-files that wrap the corresponding +# 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. # @@ -39,6 +39,13 @@ 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. +# +if ($cxx.id == 'gcc' && $cxx.version.major < 6) + cc.coptions += -Wno-unused-function # Additional system libraries. # @@ -58,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 @@ -78,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 @@ -85,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 |