xref: /netbsd-src/external/apache2/llvm/dist/llvm/utils/gn/secondary/llvm/unittests/Passes/BUILD.gn (revision 82d56013d7b633d116a93943de88e08335357a7c)
1import("//llvm/utils/unittest/unittest.gni")
2
3# Keyed off LLVM_ENABLE_PLUGINS in the CMake build, which is usually false
4# on Windows and true elsewhere.
5if (host_os != "win") {
6  loadable_module("TestPlugin") {
7    # Put plugin next to the unit test executable.
8    output_dir = target_out_dir
9
10    sources = [ "TestPlugin.cpp" ]
11
12    deps = [
13      # TestPlugin doesn't want to link in any LLVM code, it just needs its
14      # headers.
15      "//llvm/include/llvm/IR:public_tablegen",
16    ]
17
18    if (host_os != "mac" && host_os != "win") {
19      # The GN build currently doesn't globally pass -fPIC, but that's
20      # needed for building .so files on ELF.  Just pass it manually
21      # for loadable_modules for now.
22      cflags = [ "-fPIC" ]
23    }
24  }
25}
26
27unittest("PluginsTests") {
28  deps = [
29    "//llvm/include/llvm/Config:config",
30    "//llvm/lib/IR",
31    "//llvm/lib/Passes",
32    "//llvm/lib/Support",
33    "//llvm/lib/Testing/Support",
34  ]
35  sources = [ "PluginsTest.cpp" ]
36
37  # If plugins are disabled, this test will disable itself at runtime.
38  # Otherwise, reconfiguring with plugins disabled will leave behind a stale
39  # executable.
40  if (host_os != "win") {
41    deps += [ ":TestPlugin" ]
42    defines = [ "LLVM_ENABLE_PLUGINS" ]
43  }
44
45  if (host_os != "mac" && host_os != "win") {
46    # Corresponds to export_executable_symbols() in cmake.
47    ldflags = [ "-rdynamic" ]
48  }
49}
50
51unittest("PassesBindingsTests") {
52  deps = [
53    "//llvm/include/llvm/Config:config",
54    "//llvm/lib/IR",
55    "//llvm/lib/Passes",
56    "//llvm/lib/Support",
57    "//llvm/lib/Target:TargetsToBuild",
58    "//llvm/lib/Testing/Support",
59  ]
60  sources = [ "PassBuilderBindingsTest.cpp" ]
61}
62