reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
import("//llvm/utils/unittest/unittest.gni")

# FIXME: If we add -Wl,-z,nodelete to the global ldflags, we need to remove
# it again for these tests (cf CMake).

template("dynlib_add_module") {
  not_needed(invoker, "*")

  loadable_module(target_name) {
    # Put plugin next to the unit test executable.
    # This assumes that unittest() puts tests in target_out_dir.
    output_dir = target_out_dir

    sources = [
      "PipSqueak.cpp",
    ]

    if (host_os != "mac" && host_os != "win") {
      # The GN build currently doesn't globally pass -fPIC, but that's
      # needed for building .so files on ELF.  Just pass it manually
      # for loadable_modules for now.
      cflags = [ "-fPIC" ]
    }
  }
}

dynlib_add_module("PipSqueak") {
}

dynlib_add_module("SecondLib") {
}

unittest("DynamicLibraryTests") {
  deps = [
    ":PipSqueak",
    ":SecondLib",
    "//llvm/include/llvm/Config:config",
    "//llvm/lib/Support",
  ]
  sources = [
    "DynamicLibraryTest.cpp",
    "ExportedFuncs.cpp",
  ]

  if (host_os != "mac" && host_os != "win") {
    # Corresponds to export_executable_symbols() in cmake.
    ldflags = [ "-rdynamic" ]
  }
}