Update the builder and CMakefile to get ready for LLVM 13

This commit is contained in:
Sameer Rahmani 2021-03-21 16:25:12 +00:00
parent 4fd85d8284
commit cd0989d060
3 changed files with 30 additions and 13 deletions

View File

@ -20,7 +20,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(BIN_DIR ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
set(CMAKE_CXX_CLANG_TIDY clang-tidy-10)
set(CMAKE_CXX_CLANG_TIDY clang-tidy)
# Let's ensure -std=c++xx instead of -std=g++xx
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_DEBUG

View File

@ -25,14 +25,32 @@
#include "serene/serene.hpp"
#include "serene/compiler.hpp"
#include <iostream>
#include <llvm/Support/CommandLine.h>
using namespace std;
using namespace serene;
int main(int argc, char *argv[]) {
UNUSED(argc);
cout << "Serene >>" << endl;
namespace cl = llvm::cl;
namespace {
enum Action { None, DumpAST }
}
static cl::opt<enum Action>
emitAction("emit", cl::desc("Select what to dump."),
cl::values(clEnumValN(DumpAST, "ast", "Output the AST only")));
int main(int argc, char *argv[]) {
cl::ParseCommandLineOptions(argc, argv, "Serene compiler \n");
switch (emitAction) {
case Action::DumpAST:
Reader r = Reader(input);
r->dump();
}
string input_file(argv[1]);
Compiler c;

17
builder
View File

@ -3,10 +3,10 @@
command=$1
export CCC_CC=clang-11
export CCC_CXX=clang++-11
export CC=clang-11
export CXX=clang++-11
export CCC_CC=clang
export CCC_CXX=clang++
export CC=clang
export CXX=clang++
ROOT_DIR=`pwd`
BUILD_DIR=$ROOT_DIR/build
@ -65,12 +65,11 @@ function tests() {
case "$command" in
# We need to fix this to have some instructions about how to build the dependencies
"deps")
sudo apt update
sudo apt install -y llvm-10 llvm-10-tools \
clang-10 clang-format-10 clang-tidy-10 \
clang-tools-10 valgrind cmake ninja-build \
doxygen
echo "You need the following dependencies"
echo "sudo apt update"
echo "sudo apt install -y llvm-10 llvm-10-tools clang-10 clang-format-10 clang-tidy-10 clang-tools-10 valgrind cmake ninja-build doxygen"
;;
"setup")
pushd ./scripts