Skip to content

Commit 68db2a8

Browse files
committed
Fixed AST viewer to compile on Linux.
1 parent f340e3b commit 68db2a8

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

build/Helpers.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ function SetupNativeProject()
118118
links { "c++" }
119119

120120
filter { "system:not windows", "language:C++" }
121-
buildoptions { "-fpermissive -std=c++11" }
121+
cppdialect "C++11"
122+
buildoptions { "-fpermissive" }
122123

123124
-- OS-specific options
124125

src/ASTViewer/AstReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "clang/Tooling/CommonOptionsParser.h"
77
#include "clang/Tooling/Tooling.h"
88
#include "llvm/Support/CommandLine.h"
9-
#include "clang/basic/SourceLocation.h"
9+
#include "clang/Basic/SourceLocation.h"
1010
#pragma warning(pop)
1111
#include <string>
1212
#include <variant>

src/ASTViewer/CommandLineSplitter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ std::vector<std::string> splitCommandLine(std::string const &cmdline)
2222
// Note! This expands shell variables.
2323
if (wordexp(cmdline.c_str(), &p, 0))
2424
{
25-
return NULL;
25+
return result;
2626
}
2727

2828
argc = p.we_wordc;
2929

30-
if (!(argv = calloc(argc, sizeof(char *))))
30+
if (!(argv = (char**) calloc(argc, sizeof(char *))))
3131
{
3232
goto fail;
3333
}
@@ -42,6 +42,7 @@ std::vector<std::string> splitCommandLine(std::string const &cmdline)
4242
return result;
4343
fail:
4444
wordfree(&p);
45+
return result;
4546
}
4647
#else // WIN32
4748
{

src/ASTViewer/Highlighter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
**
3939
****************************************************************************/
4040

41-
#include "highlighter.h"
41+
#include "Highlighter.h"
4242

4343
//! [0]
4444
Highlighter::Highlighter(QTextDocument *parent)

src/ASTViewer/premake5.lua

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
require("premake-qt/qt")
2-
3-
-- this line is optional, but it avoids writting premake.extensions.qt to
4-
-- call the plugin's methods.
52
local qt = premake.extensions.qt
63

74
project "CppSharp.ASTViewer"
85
SetupNativeProject()
96
kind "ConsoleApp"
107
systemversion("latest")
118
cppdialect "C++17"
9+
1210
qt.enable()
13-
qtpath "C:\\Qt\\5.12.0\\msvc2017"
11+
12+
filter { "system:linux" }
13+
buildoptions { "-fPIC" }
14+
links { "pthread" }
15+
qtincludepath "/usr/include/x86_64-linux-gnu/qt5"
16+
qtlibpath "/usr/lib/x86_64-linux-gnu"
17+
qtbinpath "/usr/lib/qt5/bin"
18+
19+
filter { "system:windows" }
20+
qtpath "C:\\Qt\\5.12.0\\msvc2017"
21+
22+
filter {}
23+
1424
qtmodules { "core", "gui", "widgets" }
1525
qtprefix "Qt5"
1626
files { "**.h", "**.cpp", "**.ui", "**.qrc" }
27+
1728
SetupLLVMIncludes()
1829
SetupLLVMLibs()
30+
1931
filter { "action:vs*" }
20-
buildoptions { "/wd4141", "/wd4146", "/wd4996" }
32+
buildoptions { "/wd4141", "/wd4146", "/wd4996" }

0 commit comments

Comments
 (0)