• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  # TODO(https://crbug.com/675879): Clean up after the Blink rename.
34  cr_add_test(blink_gc_plugin_legacy_test
35    python tests/legacy_naming/test.py
36    ${CMAKE_BINARY_DIR}/bin/clang
37    )
38  cr_add_test(blink_gc_plugin_test
39    python tests/test.py
40    ${CMAKE_BINARY_DIR}/bin/clang
41    )
42else()
43  add_llvm_loadable_module("lib${LIBRARYNAME}" ${plugin_sources})
44  add_dependencies("lib${LIBRARYNAME}" clang)
45
46  cr_install(TARGETS "lib${LIBRARYNAME}" LIBRARY DESTINATION lib)
47
48  # TODO(https://crbug.com/675879): Clean up after the Blink rename.
49  cr_add_test(blink_gc_plugin_legacy_test
50    python tests/legacy_naming/test.py
51    ${CMAKE_BINARY_DIR}/bin/clang
52    $<TARGET_FILE:lib${LIBRARYNAME}>
53    )
54  cr_add_test(blink_gc_plugin_test
55    python tests/test.py
56    ${CMAKE_BINARY_DIR}/bin/clang
57    $<TARGET_FILE:lib${LIBRARYNAME}>
58    )
59endif()
60