From a106dfdaf60ea450f0ca67015fc999aa65a94068 Mon Sep 17 00:00:00 2001 From: Deric Cheung Date: Tue, 23 Jun 2020 14:25:35 -0600 Subject: [PATCH 1/5] Fix target include directories in runtime --- runtime/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt index 3e27495..0b905c2 100644 --- a/runtime/src/CMakeLists.txt +++ b/runtime/src/CMakeLists.txt @@ -6,7 +6,7 @@ set( # Build our executable from the source files. add_library(gazrt SHARED ${gazprea_rt_files}) -target_include_directories(gazc PUBLIC ${RUNTIME_INCLUDE}) +target_include_directories(gazrt PUBLIC ${RUNTIME_INCLUDE}) # Symbolic link our library to the base directory so we don't have to go searching for it. symlink_to_bin("gazrt") From d459565931311c381b3f17471528c5462fd66795 Mon Sep 17 00:00:00 2001 From: Deric Cheung Date: Tue, 23 Jun 2020 14:30:08 -0600 Subject: [PATCH 2/5] Upgrade to LLVM 10.0.0 and C++17 --- CMakeLists.txt | 2 +- cmake/get_llvm.cmake | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 113a306..dbcdaa3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ find_package(Java COMPONENTS Runtime REQUIRED) # Need java to run ANTLR, but onl include("${CMAKE_SOURCE_DIR}/cmake/get_llvm.cmake") # Set C++ standards. -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) # Add CXX flags. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") diff --git a/cmake/get_llvm.cmake b/cmake/get_llvm.cmake index 52ef53b..838f308 100644 --- a/cmake/get_llvm.cmake +++ b/cmake/get_llvm.cmake @@ -6,11 +6,11 @@ find_package(LLVM REQUIRED CONFIG) message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") -# Ensure we found our own specified version at 6.0.0. We don't want Ohaton's 3.x.x or another local +# Ensure we found our own specified version at 10.0.0. We don't want Ohaton's 3.x.x or another local # build we don't know. -if(NOT ("${LLVM_VERSION_MAJOR}" EQUAL 6 AND +if(NOT ("${LLVM_VERSION_MAJOR}" EQUAL 10 AND "${LLVM_VERSION_MINOR}" EQUAL 0 AND - "${LLVM_VERSION_PATCH}" EQUAL 1)) + "${LLVM_VERSION_PATCH}" EQUAL 0)) message(FATAL_ERROR "LLVM version incompatible.") endif() From 5fbe9296aff6a9e7b3697fb77e7460dffc12df64 Mon Sep 17 00:00:00 2001 From: Deric Cheung Date: Tue, 23 Jun 2020 14:30:33 -0600 Subject: [PATCH 3/5] Add LLVM link libraries --- src/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be083de..eb3a05e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,8 +11,12 @@ target_include_directories(gazc PUBLIC ${ANTLR_GEN_DIR}) # Ensure that the antlr4-runtime is available. add_dependencies(gazc antlr) -# Add the antlr runtime and parser as libraries to link. -target_link_libraries(gazc parser antlr4-runtime) +# Find the libraries that correspond to the LLVM components +# that we wish to use +llvm_map_components_to_libnames(llvm_libs core) + +# Add the LLVM, antlr runtime and parser as libraries to link. +target_link_libraries(gazc parser antlr4-runtime ${llvm_libs}) # Symbolic link our executable to the base directory so we don't have to go searching for it. symlink_to_bin("gazc") From 55fb6509bea832747e05acd30b2b2de5a800b7a2 Mon Sep 17 00:00:00 2001 From: Deric Cheung Date: Tue, 23 Jun 2020 14:31:52 -0600 Subject: [PATCH 4/5] Fix LLVM options not being read properly --- scripts/configureLLVM.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/configureLLVM.sh b/scripts/configureLLVM.sh index 27e2b70..a92e6f2 100755 --- a/scripts/configureLLVM.sh +++ b/scripts/configureLLVM.sh @@ -32,7 +32,7 @@ # hanging, linking is probably the issue). # LLVM_ENABLE_DOXYGEN: # Enables local docs building. Requires doxygen? -LLVM_OPTIONS="-DLLVM_BUILD_TOOLS=OFF -DLLVM_BUILD_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_OPTIMIZED_TABLEGEN=ON" +LLVM_OPTIONS="-DLLVM_BUILD_TOOLS=ON -DLLVM_BUILD_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_OPTIMIZED_TABLEGEN=ON" # ------------------------- # STEP 1: CHOOSE PATHS. @@ -102,4 +102,4 @@ if [[ "$unamestr" == 'Linux' ]]; then USE_GOLD="-DLLVM_USE_LINKER=gold" fi -cmake "$SRC_DIR" -DCMAKE_BUILD_TYPE="$BUILD" -DLLVM_TARGETS_TO_BUILD=X86 $USE_GOLD $USE_INSTALL "$LLVM_OPTIONS" +cmake "$SRC_DIR" -DCMAKE_BUILD_TYPE="$BUILD" -DLLVM_TARGETS_TO_BUILD=X86 $USE_GOLD $USE_INSTALL $LLVM_OPTIONS From b4b971c5b44cc8bd44db15cd4bb9b488ef69a141 Mon Sep 17 00:00:00 2001 From: Deric Cheung Date: Tue, 23 Jun 2020 14:39:03 -0600 Subject: [PATCH 5/5] Upgrade to ANTLR 4.8 --- cmake/get_antlr.cmake | 4 ++-- cmake/get_antlr_manual.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/get_antlr.cmake b/cmake/get_antlr.cmake index b7377d2..ba9edc9 100644 --- a/cmake/get_antlr.cmake +++ b/cmake/get_antlr.cmake @@ -20,12 +20,12 @@ file(TO_CMAKE_PATH "${_ANTLR_DIR}/bin" BIN_DIR) # Join dir. set(BIN_DIR ${BIN_DIR} CACHE PATH "ANTLR jar directory.") # Set for internal use. # Download ANTLR executable, saves us from ensuring people have java build tools (e.g. Maven)... -file(TO_CMAKE_PATH "${BIN_DIR}/antlr-4.7.1-complete.jar" ANTLR_JAR) +file(TO_CMAKE_PATH "${BIN_DIR}/antlr-4.8-complete.jar" ANTLR_JAR) if (NOT EXISTS "${ANTLR_JAR}") message(STATUS "Downloading ANTLR generator...") file( DOWNLOAD - http://www.antlr.org/download/antlr-4.7.1-complete.jar + http://www.antlr.org/download/antlr-4.8-complete.jar "${ANTLR_JAR}" SHOW_PROGRESS ) diff --git a/cmake/get_antlr_manual.cmake b/cmake/get_antlr_manual.cmake index 5614bab..20b2c99 100644 --- a/cmake/get_antlr_manual.cmake +++ b/cmake/get_antlr_manual.cmake @@ -18,7 +18,7 @@ if (NOT EXISTS "${ANTLR_JAR}") message(STATUS "Downloading ANTLR generator...") file( DOWNLOAD - http://www.antlr.org/download/antlr-4.7.1-complete.jar + http://www.antlr.org/download/antlr-4.8-complete.jar "${ANTLR_JAR}" SHOW_PROGRESS ) @@ -42,7 +42,7 @@ ExternalProject_Add( # ANTLR repository and tag. GIT_REPOSITORY https://github.com/antlr/antlr4.git - GIT_TAG "4.7.1" + GIT_TAG "4.8" UPDATE_COMMAND "" PATCH_COMMAND "" TIMEOUT 10