xref: /llvm-project/llvm/utils/gn/secondary/compiler-rt/lib/profile/BUILD.gn (revision ff2298ef1a4cd26ec19f2d35efd8787e16fd7d9e)
1import("//compiler-rt/target.gni")
2
3static_library("profile") {
4  output_dir = crt_current_out_dir
5  if (current_os == "mac") {
6    output_name = "clang_rt.profile_osx"
7  } else {
8    output_name = "clang_rt.profile$crt_current_target_suffix"
9  }
10
11  complete_static_lib = true
12  configs -= [ "//llvm/utils/gn/build:thin_archive" ]
13
14  cflags = []
15  if (current_os != "win") {
16    cflags = [
17      "-fPIC",
18      "-Wno-pedantic",
19    ]
20  } else {
21    # This appears to be a C-only warning banning the use of locals in
22    # aggregate initializers. All other compilers accept this, though.
23    #     nonstandard extension used : 'identifier' :
24    #     cannot be initialized using address of automatic variable
25    cflags += [ "/wd4221" ]
26  }
27
28  include_dirs = [ "../../include" ]
29
30  sources = [
31    "GCDAProfiling.c",
32    "InstrProfiling.c",
33    "InstrProfiling.h",
34    "InstrProfilingBuffer.c",
35    "InstrProfilingFile.c",
36    "InstrProfilingInternal.c",
37    "InstrProfilingInternal.h",
38    "InstrProfilingMerge.c",
39    "InstrProfilingMergeFile.c",
40    "InstrProfilingNameVar.c",
41    "InstrProfilingPlatformAIX.c",
42    "InstrProfilingPlatformDarwin.c",
43    "InstrProfilingPlatformFuchsia.c",
44    "InstrProfilingPlatformLinux.c",
45    "InstrProfilingPlatformOther.c",
46    "InstrProfilingPlatformWindows.c",
47    "InstrProfilingPort.h",
48    "InstrProfilingRuntime.cpp",
49    "InstrProfilingUtil.c",
50    "InstrProfilingUtil.h",
51    "InstrProfilingValue.c",
52    "InstrProfilingVersionVar.c",
53    "InstrProfilingWriter.c",
54  ]
55  if (current_os == "win") {
56    sources += [
57      "WindowsMMap.c",
58      "WindowsMMap.h",
59    ]
60  }
61
62  if (current_os != "win") {
63    defines = [
64      "COMPILER_RT_HAS_UNAME",
65      "COMPILER_RT_HAS_ATOMICS",
66      "COMPILER_RT_HAS_FCNTL_LCK",
67    ]
68  }
69}
70