1set(LIBRARYNAME BlinkGCPlugin) 2 3set(plugin_sources 4 BlinkGCPlugin.cpp 5 BlinkGCPluginConsumer.cpp 6 CheckDispatchVisitor.cpp 7 CheckFieldsVisitor.cpp 8 CheckFinalizerVisitor.cpp 9 CheckGCRootsVisitor.cpp 10 CheckTraceVisitor.cpp 11 CollectVisitor.cpp 12 Config.cpp 13 DiagnosticsReporter.cpp 14 Edge.cpp 15 RecordInfo.cpp) 16 17if(WIN32) 18 # Clang doesn't support loadable modules on Windows. Unfortunately, building 19 # the plugin as a static library and linking clang against it doesn't work. 20 # Since clang doesn't reference any symbols in our static library, the linker 21 # strips it out completely. 22 # Instead, we rely on the fact that the SOURCES property of a target is no 23 # read-only after CMake 3.1 and use it to compile the plugin directly into 24 # clang... 25 cmake_minimum_required(VERSION 3.1) 26 # Paths must be absolute, since we're modifying a target in another directory. 27 set(absolute_sources "") 28 foreach(source ${plugin_sources}) 29 list(APPEND absolute_sources ${CMAKE_CURRENT_SOURCE_DIR}/${source}) 30 endforeach() 31 set_property(TARGET clang APPEND PROPERTY SOURCES ${absolute_sources}) 32 33 cr_add_test(blink_gc_plugin_test 34 python tests/test.py 35 ${CMAKE_BINARY_DIR}/bin/clang 36 ) 37else() 38 add_llvm_loadable_module("lib${LIBRARYNAME}" ${plugin_sources}) 39 add_dependencies("lib${LIBRARYNAME}" clang) 40 41 cr_install(TARGETS "lib${LIBRARYNAME}" LIBRARY DESTINATION lib) 42 43 cr_add_test(blink_gc_plugin_test 44 python tests/test.py 45 ${CMAKE_BINARY_DIR}/bin/clang 46 $<TARGET_FILE:lib${LIBRARYNAME}> 47 ) 48endif() 49