1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
diff -r e99ac8ce1ce7 genie.lua
--- a/genie.lua Sat May 09 22:42:09 2020 +0200
+++ b/genie.lua Tue May 12 16:01:56 2020 +0200
@@ -88,6 +88,10 @@
.. " engine passes option objcarcopts coverage support lto coroutines"
.. " webassembly")
local LLVM_INCLUDEDIR = pkg_config(LLVM_CONFIG .. " --includedir")
+local CLANG_INCLUDEDIR = pkg_config(LLVM_CONFIG .. " --prefix")[1]
+ .. "/lib/clang/"
+ .. pkg_config(LLVM_CONFIG .. " --version")[1]
+ .. "/include"
if not os.is("windows") then
premake.gcc.cxx = CLANG_CXX
@@ -204,7 +208,6 @@
includedirs {
"external/linenoise-ng/include",
"external",
- "SPIRV-Tools/include",
"include",
"."
}
@@ -218,6 +221,7 @@
targetdir "bin"
defines {
"SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS",
+ "CLANG_INCLUDE_DIR=\"" .. CLANG_INCLUDEDIR .. "\"",
"SCOPESRT_IMPL"
}
@@ -229,7 +233,7 @@
}
buildoptions_cpp {
- "-std=c++11",
+ "-std=c++14",
"-fno-rtti",
"-fno-exceptions",
"-ferror-limit=1",
@@ -278,23 +282,12 @@
--"-Wl,--export-dynamic",
--"-rdynamic",
- THISDIR .. "/SPIRV-Tools/build/source/opt/libSPIRV-Tools-opt.a",
- THISDIR .. "/SPIRV-Tools/build/source/libSPIRV-Tools.a"
+ "-lSPIRV-Tools-opt",
+ "-lSPIRV-Tools"
}
linkoptions(LLVM_LDFLAGS)
linkoptions {
- "-lclangCodeGen",
- "-lclangFrontend",
- "-lclangDriver",
- "-lclangSerialization",
- "-lclangParse",
- "-lclangSema",
- "-lclangAnalysis",
- "-lclangEdit",
- "-lclangASTMatchers",
- "-lclangAST",
- "-lclangLex",
- "-lclangBasic"
+ "-lclang-cpp"
}
--linkoptions { "-Wl,--whole-archive" }
linkoptions(LLVM_LIBS)
@@ -370,23 +363,12 @@
"-Wl,--stack,8388608"
}
linkoptions {
- THISDIR .. "/SPIRV-Tools/build/source/opt/libSPIRV-Tools-opt.a",
- THISDIR .. "/SPIRV-Tools/build/source/libSPIRV-Tools.a"
+ "-lSPIRV-Tools-opt",
+ "-lSPIRV-Tools"
}
linkoptions(LLVM_LDFLAGS)
linkoptions {
- "-lclangCodeGen",
- "-lclangFrontend",
- "-lclangDriver",
- "-lclangSerialization",
- "-lclangParse",
- "-lclangSema",
- "-lclangAnalysis",
- "-lclangEdit",
- "-lclangASTMatchers",
- "-lclangAST",
- "-lclangLex",
- "-lclangBasic"
+ "-lclang-cpp"
}
linkoptions(LLVM_LIBS)
@@ -441,25 +423,14 @@
}
linkoptions {
- THISDIR .. "/SPIRV-Tools/build/source/opt/libSPIRV-Tools-opt.a",
- THISDIR .. "/SPIRV-Tools/build/source/libSPIRV-Tools.a"
+ "-lSPIRV-Tools-opt",
+ "-lSPIRV-Tools"
}
linkoptions(LLVM_LDFLAGS)
linkoptions {
- "-lclangFrontend",
- "-lclangDriver",
- "-lclangSerialization",
- "-lclangCodeGen",
- "-lclangParse",
- "-lclangSema",
- "-lclangAnalysis",
- "-lclangEdit",
- "-lclangASTMatchers",
- "-lclangAST",
- "-lclangLex",
- "-lclangBasic"
+ "-lclang-cpp"
}
linkoptions(LLVM_LIBS)
diff -r e99ac8ce1ce7 src/boot.cpp
--- a/src/boot.cpp Sat May 09 22:42:09 2020 +0200
+++ b/src/boot.cpp Tue May 12 16:01:56 2020 +0200
@@ -227,7 +227,11 @@
char *path_copy = strdup(scopes_compiler_path);
scopes_compiler_dir = format("%s/..", dirname(path_copy))->data;
free(path_copy);
+#ifdef CLANG_INCLUDE_DIR
+ scopes_clang_include_dir = CLANG_INCLUDE_DIR;
+#else
scopes_clang_include_dir = format("%s/lib/clang/include", scopes_compiler_dir)->data;
+#endif
scopes_include_dir = format("%s/include", scopes_compiler_dir)->data;
}
diff -r e99ac8ce1ce7 src/c_import.cpp
--- a/src/c_import.cpp Sat May 09 22:42:09 2020 +0200
+++ b/src/c_import.cpp Tue May 12 16:01:56 2020 +0200
@@ -831,8 +831,8 @@
std::vector< std::unique_ptr<clang::ASTConsumer> > consumers;
consumers.push_back(clang::EmitLLVMOnlyAction::CreateASTConsumer(CI, InFile));
- consumers.push_back(llvm::make_unique<CodeGenProxy>(*this));
- return llvm::make_unique<clang::MultiplexConsumer>(std::move(consumers));
+ consumers.push_back(std::make_unique<CodeGenProxy>(*this));
+ return std::make_unique<clang::MultiplexConsumer>(std::move(consumers));
}
static std::vector<LLVMModuleRef> llvm_c_modules;
|