1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
import shutil
from devtools.yamaker.modules import GLOBAL, Linkable, Switch
from devtools.yamaker.project import CMakeNinjaNixProject
def post_build(self):
shutil.copy(
self.builddir + "/runtime/src/omp.h", self.dstdir
) # This file is patched during installation so we need to copy it here
def post_install(self):
with self.yamakes["."] as openmp:
openmp.NO_LTO = True
openmp.ADDINCL = [
GLOBAL(self.arcdir),
]
openmp.CFLAGS = [
"-fno-exceptions",
"-DKMP_USE_MONITOR=1", # DTCC-842
]
openmp.before(
"SRCS",
Switch({"SANITIZER_TYPE == thread": Linkable(NO_SANITIZE=True, CFLAGS=["-fPIC"])}),
)
openmp.before(
"SRCS",
Switch({"SANITIZER_TYPE == memory": Linkable(NO_SANITIZE=True, CFLAGS=["-fPIC"])}),
)
openmp.before(
"SRCS",
"""
# The KMP_DEBUG define enables OpenMP debugging support, including tracing (controlled by environment variables)
# and debug asserts. The upstream version unconditionally enables KMP_DEBUG for Debug/RelWithDebInfo builds.
# Instead, we make this opt-in via a `ymake` variable to avoid accidentally releasing a relwithdebinfo binary
# with KMP_DEBUG enabled. Note that the `ymake` variable is called OPENMP_DEBUG for clarity, since no one
# really knows what KMP is.
""",
)
openmp.before(
"SRCS",
Switch(
{
"OPENMP_DEBUG": Linkable(
CFLAGS=["-DKMP_DEBUG=1"],
)
}
),
)
llvm_openmp = CMakeNinjaNixProject(
owners=["g:cpp-contrib", "g:cpp-committee"],
arcdir="contrib/libs/cxxsupp/openmp",
nixattr="llvmPackages_13.openmp",
install_subdir="runtime/src",
ignore_commands=["perl"],
flags=[
"-DOPENMP_ENABLE_LIBOMPTARGET=OFF",
"-DOPENMP_ENABLE_LIBOMP_PROFILING=OFF",
"-DOPENMP_ENABLE_OMPT_TOOLS=OFF",
"-DLIBOMP_OMPD_SUPPORT=OFF", # Disable OMPD support as it breaks build under MSAN
"-DLIBOMP_USE_ITT_NOTIFY=OFF",
"-DLIBOMP_USE_VERSION_SYMBOLS=OFF",
],
disable_includes=[
"ittnotify.h",
"ittnotify_config.h",
"kmp_debugger.h",
"kmp_dispatch_hier.h",
"kmp_itt.inl",
"kmp_stats_timing.h",
"kmp_stub.h",
"legacy/ittnotify.h",
"llvm/Support/TimeProfiler.h",
"ompd-specific.h",
],
platform_dispatchers=["kmp_config.h"],
post_build=post_build,
post_install=post_install,
)
|