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