[gn build] (manually) port f617ab1044 (DoublerPlugin)

This commit is contained in:
Nico Weber 2021-06-30 14:49:00 -04:00
parent f0693bc0ae
commit 51c3e3f80c
1 changed files with 20 additions and 15 deletions

View File

@ -3,23 +3,25 @@ import("//llvm/utils/unittest/unittest.gni")
# Keyed off LLVM_ENABLE_PLUGINS in the CMake build, which is usually false # Keyed off LLVM_ENABLE_PLUGINS in the CMake build, which is usually false
# on Windows and true elsewhere. # on Windows and true elsewhere.
if (host_os != "win") { if (host_os != "win") {
loadable_module("TestPlugin") { foreach(plugin, ["TestPlugin", "DoublerPlugin"]) {
# Put plugin next to the unit test executable. loadable_module(plugin) {
output_dir = target_out_dir # Put plugin next to the unit test executable.
output_dir = target_out_dir
sources = [ "TestPlugin.cpp" ] sources = [ "$plugin.cpp" ]
deps = [ deps = [
# TestPlugin doesn't want to link in any LLVM code, it just needs its # TestPlugin doesn't want to link in any LLVM code, it just needs its
# headers. # headers.
"//llvm/include/llvm/IR:public_tablegen", "//llvm/include/llvm/IR:public_tablegen",
] ]
if (host_os != "mac" && host_os != "win") { if (host_os != "mac" && host_os != "win") {
# The GN build currently doesn't globally pass -fPIC, but that's # The GN build currently doesn't globally pass -fPIC, but that's
# needed for building .so files on ELF. Just pass it manually # needed for building .so files on ELF. Just pass it manually
# for loadable_modules for now. # for loadable_modules for now.
cflags = [ "-fPIC" ] cflags = [ "-fPIC" ]
}
} }
} }
} }
@ -38,7 +40,10 @@ unittest("PluginsTests") {
# Otherwise, reconfiguring with plugins disabled will leave behind a stale # Otherwise, reconfiguring with plugins disabled will leave behind a stale
# executable. # executable.
if (host_os != "win") { if (host_os != "win") {
deps += [ ":TestPlugin" ] deps += [
":DoublerPlugin",
":TestPlugin",
]
defines = [ "LLVM_ENABLE_PLUGINS" ] defines = [ "LLVM_ENABLE_PLUGINS" ]
} }