Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LLVM, ANTLR. Fix runtime build. #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions cmake/get_antlr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/get_antlr_manual.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmake/get_llvm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
4 changes: 2 additions & 2 deletions scripts/configureLLVM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")