Browse Source

Fixed AST viewer to compile on Linux.

pull/1162/merge
Joao Matos 6 years ago
parent
commit
68db2a8e39
  1. 3
      build/Helpers.lua
  2. 2
      src/ASTViewer/AstReader.h
  3. 5
      src/ASTViewer/CommandLineSplitter.cpp
  4. 2
      src/ASTViewer/Highlighter.cpp
  5. 22
      src/ASTViewer/premake5.lua

3
build/Helpers.lua

@ -118,7 +118,8 @@ function SetupNativeProject() @@ -118,7 +118,8 @@ function SetupNativeProject()
links { "c++" }
filter { "system:not windows", "language:C++" }
buildoptions { "-fpermissive -std=c++11" }
cppdialect "C++11"
buildoptions { "-fpermissive" }
-- OS-specific options

2
src/ASTViewer/AstReader.h

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/CommandLine.h"
#include "clang/basic/SourceLocation.h"
#include "clang/Basic/SourceLocation.h"
#pragma warning(pop)
#include <string>
#include <variant>

5
src/ASTViewer/CommandLineSplitter.cpp

@ -22,12 +22,12 @@ std::vector<std::string> splitCommandLine(std::string const &cmdline) @@ -22,12 +22,12 @@ std::vector<std::string> splitCommandLine(std::string const &cmdline)
// Note! This expands shell variables.
if (wordexp(cmdline.c_str(), &p, 0))
{
return NULL;
return result;
}
argc = p.we_wordc;
if (!(argv = calloc(argc, sizeof(char *))))
if (!(argv = (char**) calloc(argc, sizeof(char *))))
{
goto fail;
}
@ -42,6 +42,7 @@ std::vector<std::string> splitCommandLine(std::string const &cmdline) @@ -42,6 +42,7 @@ std::vector<std::string> splitCommandLine(std::string const &cmdline)
return result;
fail:
wordfree(&p);
return result;
}
#else // WIN32
{

2
src/ASTViewer/Highlighter.cpp

@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
**
****************************************************************************/
#include "highlighter.h"
#include "Highlighter.h"
//! [0]
Highlighter::Highlighter(QTextDocument *parent)

22
src/ASTViewer/premake5.lua

@ -1,7 +1,4 @@ @@ -1,7 +1,4 @@
require("premake-qt/qt")
-- this line is optional, but it avoids writting premake.extensions.qt to
-- call the plugin's methods.
local qt = premake.extensions.qt
project "CppSharp.ASTViewer"
@ -9,12 +6,27 @@ project "CppSharp.ASTViewer" @@ -9,12 +6,27 @@ project "CppSharp.ASTViewer"
kind "ConsoleApp"
systemversion("latest")
cppdialect "C++17"
qt.enable()
qtpath "C:\\Qt\\5.12.0\\msvc2017"
filter { "system:linux" }
buildoptions { "-fPIC" }
links { "pthread" }
qtincludepath "/usr/include/x86_64-linux-gnu/qt5"
qtlibpath "/usr/lib/x86_64-linux-gnu"
qtbinpath "/usr/lib/qt5/bin"
filter { "system:windows" }
qtpath "C:\\Qt\\5.12.0\\msvc2017"
filter {}
qtmodules { "core", "gui", "widgets" }
qtprefix "Qt5"
files { "**.h", "**.cpp", "**.ui", "**.qrc" }
SetupLLVMIncludes()
SetupLLVMLibs()
filter { "action:vs*" }
buildoptions { "/wd4141", "/wd4146", "/wd4996" }
buildoptions { "/wd4141", "/wd4146", "/wd4996" }

Loading…
Cancel
Save