diff --git a/CMakeLists.txt b/CMakeLists.txt index 40c4b8d..bd4798d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,10 @@ execute_process( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/antlr ) +SET(WITH_LIBCXX OFF CACHE BOOL "") +add_subdirectory(${CMAKE_SOURCE_DIR}/tools/antlr/antlr4/runtime/Cpp/ EXCLUDE_FROM_ALL) +include_directories(${CMAKE_SOURCE_DIR}/tools/antlr/antlr4/runtime/Cpp/runtime/src) + # Function # ANTLR() # @@ -78,16 +82,6 @@ function(target_set_common target) endif() endfunction() -# Build the ANTLR runtime. -set(CMAKE_CXX_STANDARD 17) -add_subdirectory( - ${CMAKE_SOURCE_DIR}/tools/antlr/cpp_runtime/ - ${CMAKE_CURRENT_BINARY_DIR}/antlr - EXCLUDE_FROM_ALL -) -set_property(TARGET antlr4_static PROPERTY CXX_STANDARD 17) -include_directories(${CMAKE_SOURCE_DIR}/tools/antlr/cpp_runtime/runtime/src) - #------------------------------------------------------------------------------- add_subdirectory(src) diff --git a/tools/antlr/CMakeLists.txt.patch b/tools/antlr/CMakeLists.txt.patch deleted file mode 100644 index a8c772f..0000000 --- a/tools/antlr/CMakeLists.txt.patch +++ /dev/null @@ -1,28 +0,0 @@ -97,123d96 -< # Compiler-specific C++11 activation. -< if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel") -< execute_process( -< COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) -< # Just g++-5.0 and greater contain header. (test in ubuntu) -< if (NOT (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0)) -< message(FATAL_ERROR "${PROJECT_NAME} requires g++ 5.0 or greater.") -< endif () -< elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND APPLE) -< set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") -< elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND CMAKE_SYSTEM_NAME MATCHES "Linux") -< execute_process( -< COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CLANG_VERSION) -< if (NOT (CLANG_VERSION VERSION_GREATER 4.2.1 OR CLANG_VERSION VERSION_EQUAL 4.2.1)) -< message(FATAL_ERROR "${PROJECT_NAME} requires clang 4.2.1 or greater.") -< endif () -< # You can use libc++ to compile this project when g++ is NOT greater than or equal to 5.0. -< if (WITH_LIBCXX) -< set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") -< endif() -< elseif ( MSVC_VERSION GREATER 1800 OR MSVC_VERSION EQUAL 1800 ) -< # Visual Studio 2012+ supports c++11 features -< else () -< message(FATAL_ERROR "Your C++ compiler does not support C++11.") -< endif () -< -< diff --git a/tools/antlr/download_and_patch.sh b/tools/antlr/download_and_patch.sh index a46a9ef..ae96b24 100755 --- a/tools/antlr/download_and_patch.sh +++ b/tools/antlr/download_and_patch.sh @@ -6,15 +6,10 @@ then exit fi -mkdir cpp_runtime +mkdir -p cpp_runtime -## Download ANTLR and the CPP runtime -curl http://www.antlr.org/download/antlr-4.7.1-complete.jar -Lo antlr.jar -curl http://www.antlr.org/download/antlr4-cpp-runtime-4.7.1-source.zip -Lo cpp_runtime/archive.zip +## Download the ANTLR executable. +curl http://www.antlr.org/download/antlr-4.8-complete.jar -L -o antlr.jar -## Unzip cpp runtime -cd cpp_runtime -unzip *.zip - -## Patch the cpp runtime CMakeLists.txt. -patch CMakeLists.txt < ../CMakeLists.txt.patch +## Download the C++ runtime. +git clone --depth 1 https://github.com/antlr/antlr4 -b 4.8