[examples] Use loadable modules instead of shared libraries for Clang plugins.

This avoids linking in extra copies of, say, LLVMSupport.

llvm-svn: 201256
This commit is contained in:
Jordan Rose 2014-02-12 21:04:23 +00:00
parent 6860c819f4
commit 68db107c81
3 changed files with 3 additions and 30 deletions

View File

@ -1,7 +1,3 @@
set( LLVM_LINK_COMPONENTS
Support
)
# If we don't need RTTI or EH, there's no reason to export anything # If we don't need RTTI or EH, there's no reason to export anything
# from the plugin. # from the plugin.
if( NOT WIN32 ) # Win32 mangles symbols differently, and if( NOT WIN32 ) # Win32 mangles symbols differently, and
@ -13,7 +9,7 @@ if( NOT WIN32 ) # Win32 mangles symbols differently, and
endif() endif()
endif() endif()
add_clang_library(PrintFunctionNames MODULE PrintFunctionNames.cpp) add_llvm_loadable_module(PrintFunctionNames PrintFunctionNames.cpp)
add_dependencies(PrintFunctionNames add_dependencies(PrintFunctionNames
ClangAttrClasses ClangAttrClasses
@ -23,14 +19,3 @@ add_dependencies(PrintFunctionNames
ClangDiagnosticCommon ClangDiagnosticCommon
ClangStmtNodes ClangStmtNodes
) )
target_link_libraries(PrintFunctionNames
clangAST
clangBasic
clangFrontend
)
set_target_properties(PrintFunctionNames
PROPERTIES
LINKER_LANGUAGE CXX
PREFIX "")

View File

@ -19,7 +19,7 @@ endif
endif endif
LINK_LIBS_IN_SHARED = 0 LINK_LIBS_IN_SHARED = 0
SHARED_LIBRARY = 1 LOADABLE_MODULE = 1
include $(CLANG_LEVEL)/Makefile include $(CLANG_LEVEL)/Makefile

View File

@ -1,8 +1,4 @@
set(LLVM_LINK_COMPONENTS add_llvm_loadable_module(SampleAnalyzerPlugin MainCallChecker.cpp)
Support
)
add_clang_library(SampleAnalyzerPlugin MODULE MainCallChecker.cpp)
add_dependencies(SampleAnalyzerPlugin add_dependencies(SampleAnalyzerPlugin
ClangAttrClasses ClangAttrClasses
@ -11,15 +7,7 @@ add_dependencies(SampleAnalyzerPlugin
ClangDeclNodes ClangDeclNodes
ClangDiagnosticCommon ClangDiagnosticCommon
ClangStmtNodes ClangStmtNodes
)
target_link_libraries(SampleAnalyzerPlugin
clangAST clangAST
clangAnalysis clangAnalysis
clangStaticAnalyzerCore clangStaticAnalyzerCore
) )
set_target_properties(SampleAnalyzerPlugin
PROPERTIES
LINKER_LANGUAGE CXX
PREFIX "")