@@ -2,70 +2,71 @@ set(LLVM_LINK_COMPONENTS
22 AllTargetsAsmParsers
33 AllTargetsDescs
44 AllTargetsInfos
5+ FrontendOpenMP
6+ TargetParser
57 support
68 )
79
8- add_clang_executable(O2codecheck
10+ # Needed by LLVM's CMake checks because this file defines multiple targets.
11+ set (LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp)
12+
13+ add_clang_library(clangTidyMainO2 STATIC
914 ClangTidyMain.cpp
15+
16+ LINK_LIBS
17+ clangTidy
18+ ${ALL_CLANG_TIDY_CHECKS}
19+
20+ DEPENDS
21+ omp_gen
1022 )
1123
12- target_link_libraries (O2codecheck
24+ target_include_directories (clangTidyMainO2
25+ PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} >
26+ )
27+ target_link_libraries (clangTidyMainO2
1328 PRIVATE
1429 clangAST
1530 clangASTMatchers
1631 clangBasic
17- clangTidy
18-
19- # link our own checks
20- clangTidyAliceO2Module
21- clangTidyReportingModule
22-
23- # include checkers available from main clang-tidy
24- clangTidyAlteraModule
25- clangTidyAndroidModule
26- clangTidyAbseilModule
27- clangTidyBoostModule
28- clangTidyBugproneModule
29- clangTidyCERTModule
30- clangTidyConcurrencyModule
31- clangTidyCppCoreGuidelinesModule
32- clangTidyDarwinModule
33- clangTidyFuchsiaModule
34- clangTidyGoogleModule
35- clangTidyHICPPModule
36- clangTidyLinuxKernelModule
37- clangTidyLLVMModule
38- clangTidyLLVMLibcModule
39- clangTidyMiscModule
40- clangTidyModernizeModule
41- clangTidyMPIModule
42- clangTidyObjCModule
43- clangTidyOpenMPModule
44- clangTidyPerformanceModule
45- clangTidyPortabilityModule
46- clangTidyReadabilityModule
47- clangTidyZirconModule
4832 clangTooling
4933 clangToolingCore
5034 )
5135
52- install (TARGETS O2codecheck
53- RUNTIME DESTINATION bin)
36+ # Support plugins.
37+ if (CLANG_PLUGIN_SUPPORT)
38+ set (support_plugins SUPPORT_PLUGINS)
39+ endif ()
5440
55- #install(PROGRAMS clang-tidy-diff.py DESTINATION share/clang)
56- install (PROGRAMS run_O2CodeChecker.py DESTINATION bin)
41+ add_clang_tool(o2-clang-tidy
42+ ClangTidyToolMain.cpp
43+
44+ DEPENDS
45+ ${support_plugins}
46+ )
47+ target_link_libraries (o2-clang-tidy
48+ PRIVATE
49+ clangAST
50+ clangASTMatchers
51+ clangBasic
52+ clangTooling
53+ clangToolingCore
54+ )
55+ target_link_libraries (o2-clang-tidy
56+ PRIVATE
57+ clangTidyO2
58+ clangTidyMainO2
59+ ${ALL_CLANG_TIDY_CHECKS}
60+ )
5761
58- # we need to install the builtin headers in a path which is searched by the tool
59- # FIXME: a soft link would be better
60- string (REPLACE "." ";" LLVM_PACKAGE_VERSION_LIST ${LLVM_PACKAGE_VERSION} )
61- list (GET LLVM_PACKAGE_VERSION_LIST 0 LLVM_PACKAGE_VERSION_MAJOR)
62- install (DIRECTORY ${LLVM_LIBRARY_DIR} /clang/${LLVM_PACKAGE_VERSION_MAJOR} /include DESTINATION lib/clang/${LLVM_PACKAGE_VERSION_MAJOR} )
62+ if (CLANG_PLUGIN_SUPPORT)
63+ export_executable_symbols_for_plugins(o2-clang-tidy)
64+ endif ()
6365
64- IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
65- # On MacOS we need to do the same with C++ headers since they are in a non-standard location
66- # (alternative would be to set the CPATH environment variable)
67- INSTALL (CODE "execute_process(COMMAND mkdir ${CMAKE_INSTALL_PREFIX} /include)" )
68- INSTALL (CODE "execute_process(COMMAND ln -sf \
69- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++ \
70- ${CMAKE_INSTALL_PREFIX} /include/c++)" )
71- ENDIF ()
66+ install (PROGRAMS clang-tidy-diff.py
67+ DESTINATION "${CMAKE_INSTALL_DATADIR} /clang"
68+ COMPONENT o2-clang-tidy)
69+ install (PROGRAMS run-clang-tidy.py
70+ DESTINATION "${CMAKE_INSTALL_BINDIR} "
71+ COMPONENT o2-clang-tidy
72+ RENAME run-clang-tidy)
0 commit comments