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