Skip to content

Commit 93edea5

Browse files
committed
updated, last on linux
1 parent a0027cd commit 93edea5

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

cmake/FindLlvm.cmake

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,29 @@ function(replace_compiler_option var old new)
1616
set( ${var} "${${var}}" PARENT_SCOPE )
1717
endfunction()
1818

19+
macro (setup_package_version_variables _packageName)
20+
if (DEFINED ${_packageName}_VERSION)
21+
string (REGEX MATCHALL "[0-9]+" _versionComponents "${${_packageName}_VERSION}")
22+
list (LENGTH _versionComponents _len)
23+
if (${_len} GREATER 0)
24+
list(GET _versionComponents 0 ${_packageName}_VERSION_MAJOR)
25+
endif()
26+
if (${_len} GREATER 1)
27+
list(GET _versionComponents 1 ${_packageName}_VERSION_MINOR)
28+
endif()
29+
if (${_len} GREATER 2)
30+
list(GET _versionComponents 2 ${_packageName}_VERSION_PATCH)
31+
endif()
32+
if (${_len} GREATER 3)
33+
list(GET _versionComponents 3 ${_packageName}_VERSION_TWEAK)
34+
endif()
35+
set (${_packageName}_VERSION_COUNT ${_len})
36+
else()
37+
set (${_packageName}_VERSION_COUNT 0)
38+
set (${_packageName}_VERSION "")
39+
endif()
40+
endmacro()
41+
1942
find_program(LLVM_CONFIG_EXECUTABLE llvm-config${LLVM_SUFFIX})
2043

2144
execute_process(
@@ -81,7 +104,12 @@ execute_process(
81104
COMMAND ${LLVM_CONFIG_EXECUTABLE} --system-libs
82105
OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
83106
OUTPUT_STRIP_TRAILING_WHITESPACE
107+
ERROR_QUIET
84108
)
109+
string(COMPARE EQUAL "${LLVM_SYSTEM_LIBS}" "" SYSTEM_LIBS_UNDEFINED)
110+
if(SYSTEM_LIBS_UNDEFINED)
111+
set(LLVM_SYSTEM_LIBS "-lz -lpthread -ltinfo -ldl -lm")
112+
endif()
85113

86114
execute_process(
87115
COMMAND ${LLVM_CONFIG_EXECUTABLE} --bindir

tooling/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set(CLANG_LIBS
1212
-lclangSema
1313
-lclangEdit
1414
-lclangASTMatchers
15-
-lclangRewrite
15+
# -lclangRewrite
1616
-lclangRewriteFrontend
1717
-lclangStaticAnalyzerFrontend
1818
-lclangStaticAnalyzerCheckers
@@ -23,16 +23,16 @@ set(CLANG_LIBS
2323
)
2424

2525
set(CLANG_TOOLS
26-
ast
27-
complex
28-
clang_check
26+
# ast
27+
# complex
28+
# clang_check
2929
cfe
30-
rewrite1
31-
rewrite2
32-
rewrite3
33-
tokens
34-
toplevel_decls
35-
try_matcher
30+
# rewrite1
31+
# rewrite2
32+
# rewrite3
33+
# tokens
34+
# toplevel_decls
35+
# try_matcher
3636
)
3737
foreach(TOOL ${CLANG_TOOLS})
3838
add_subdirectory(${TOOL})

tooling/cfe/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int main(int argc, char **argv) {
4646
return 1;
4747
}
4848
CI.getSourceManager().createMainFileID(pFile);
49-
CI.getDiagnosticsClient().BeginSourceFile(CI.getLangOpts(), 0);
49+
CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), 0);
5050
ParseAST(CI.getSema());
5151
// Print AST statistics
5252
CI.getASTContext().PrintStats();

tooling/tokens/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int main(int argc, char **argv) {
1010
cl::ParseCommandLineOptions(argc, argv, "My tokenizer\n");
1111
CXIndex index = clang_createIndex(0, 0);
1212
const char *args[] = {"-I/usr/include", "-I."};
13-
CXTranslationUnit translationUnit = clang_ parseTranslationUnit(
13+
CXTranslationUnit translationUnit = clang_parseTranslationUnit(
1414
index, FileName.c_str(), 2, NULL, 0, CXTranslationUnit_None);
1515
CXFile file = clang_getFile(translationUnit, FileName.c_str());
1616
CXSourceLocation loc_start =

0 commit comments

Comments
 (0)