1import("//third-party/unittest/unittest.gni") 2 3# FIXME: If we add -Wl,-z,nodelete to the global ldflags, we need to remove 4# it again for these tests (cf CMake). 5 6template("dynlib_add_module") { 7 not_needed(invoker, "*") 8 9 loadable_module(target_name) { 10 # Put plugin next to the unit test executable. 11 # This assumes that unittest() puts tests in target_out_dir. 12 output_dir = target_out_dir 13 14 sources = [ "PipSqueak.cpp" ] 15 16 if (host_os != "mac" && host_os != "win") { 17 # The GN build currently doesn't globally pass -fPIC, but that's 18 # needed for building .so files on ELF. Just pass it manually 19 # for loadable_modules for now. 20 cflags = [ "-fPIC" ] 21 } 22 } 23} 24 25dynlib_add_module("PipSqueak") { 26} 27 28dynlib_add_module("SecondLib") { 29} 30 31unittest("DynamicLibraryTests") { 32 deps = [ 33 ":PipSqueak", 34 ":SecondLib", 35 "//llvm/include/llvm/Config:config", 36 "//llvm/lib/Support", 37 ] 38 sources = [ 39 "DynamicLibraryTest.cpp", 40 "ExportedFuncs.cpp", 41 ] 42 43 if (host_os != "mac" && host_os != "win") { 44 # Corresponds to export_executable_symbols() in cmake. 45 ldflags = [ "-rdynamic" ] 46 } 47} 48