Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: tools/clang/plugins/CMakeLists.txt

Issue 1072203002: Build the Clang plugin on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isInSystemHeader Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/clang/plugins/ChromeClassTester.cpp » ('j') | tools/clang/plugins/ChromeClassTester.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/plugins/CMakeLists.txt
diff --git a/tools/clang/plugins/CMakeLists.txt b/tools/clang/plugins/CMakeLists.txt
index d17de19fcd09d79a5a41860469a9dd97a557f29a..2e2420aab94bedfe7126748eac7dce9a7114503d 100644
--- a/tools/clang/plugins/CMakeLists.txt
+++ b/tools/clang/plugins/CMakeLists.txt
@@ -1,15 +1,32 @@
-add_llvm_loadable_module(libFindBadConstructs
- ChromeClassTester.cpp
- FindBadConstructsAction.cpp
- FindBadConstructsConsumer.cpp
- )
+set(plugin_sources
+ ChromeClassTester.cpp
+ FindBadConstructsAction.cpp
+ FindBadConstructsConsumer.cpp)
-add_dependencies(libFindBadConstructs clang)
+if(WIN32)
+ # Clang doesn't support loadable modules on Windows. Unfortunately, building
+ # the plugin as a static library and linking clang against it doesn't work.
+ # Since clang doesn't reference any symbols in our static library, the linker
+ # strips it out completely.
+ # Instead, we rely on the fact that the SOURCES property of a target is no
+ # read-only after CMake 3.1 and use it to compile the plugin directly into
+ # clang...
+ cmake_minimum_required(VERSION 3.1)
+ # Paths must be absolute, since we're modifying a target in another directory.
+ set(absolute_sources "")
+ foreach(source ${plugin_sources})
+ list(APPEND absolute_sources ${CMAKE_CURRENT_SOURCE_DIR}/${source})
+ endforeach()
+ set_property(TARGET clang APPEND PROPERTY SOURCES ${absolute_sources})
+else()
+ add_llvm_loadable_module(libFindBadConstructs ${plugin_sources})
+ add_dependencies(libFindBadConstructs clang)
-cr_install(TARGETS libFindBadConstructs LIBRARY DESTINATION lib)
+ cr_install(TARGETS libFindBadConstructs LIBRARY DESTINATION lib)
-cr_add_test(plugins_test
- ${CMAKE_CURRENT_SOURCE_DIR}/tests/test.sh
- ${CMAKE_BINARY_DIR}/bin/clang
- $<TARGET_FILE:libFindBadConstructs>
- )
+ cr_add_test(plugins_test
Nico 2015/04/12 04:19:14 Should this get a "TODO: port script to python, ru
dcheng 2015/04/12 06:29:30 Done.
+ ${CMAKE_CURRENT_SOURCE_DIR}/tests/test.sh
+ ${CMAKE_BINARY_DIR}/bin/clang
+ $<TARGET_FILE:libFindBadConstructs>
+ )
+endif()
« no previous file with comments | « no previous file | tools/clang/plugins/ChromeClassTester.cpp » ('j') | tools/clang/plugins/ChromeClassTester.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698