forked from jasder/antlr
try appveyor with tweak to cmake config.
This commit is contained in:
parent
5cc106562f
commit
8af4c38991
|
@ -19,11 +19,11 @@
|
|||
#
|
||||
# next make a build folder e.g. ~/buildfolder/
|
||||
# from the buildfolder, run cmake ~/srcfolder; make
|
||||
#
|
||||
#
|
||||
###############################################################
|
||||
# # minimum required CMAKE version
|
||||
# CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.2 FATAL_ERROR)
|
||||
#
|
||||
#
|
||||
# LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
|
||||
#
|
||||
# # compiler must be 11 or 14
|
||||
|
@ -49,7 +49,7 @@
|
|||
# add_executable(demo main.cpp ${antlr4cpp_src_files_antlrcpptest})
|
||||
# add_dependencies(demo antlr4cpp antlr4cpp_generation_antlrcpptest)
|
||||
# target_link_libraries(demo antlr4-runtime)
|
||||
#
|
||||
#
|
||||
###############################################################
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.2)
|
||||
|
@ -66,7 +66,7 @@ set(ANTLR4CPP_EXTERNAL_ROOT ${CMAKE_BINARY_DIR}/externals/antlr4cpp)
|
|||
# external repository
|
||||
# GIT_REPOSITORY https://github.com/antlr/antlr4.git
|
||||
set(ANTLR4CPP_EXTERNAL_REPO "https://github.com/antlr/antlr4.git")
|
||||
set(ANTLR4CPP_EXTERNAL_TAG "4.6")
|
||||
set(ANTLR4CPP_EXTERNAL_TAG "4.6-rc1")
|
||||
|
||||
if(NOT EXISTS "${ANTLR4CPP_JAR_LOCATION}")
|
||||
message(FATAL_ERROR "Unable to find antlr tool. ANTLR4CPP_JAR_LOCATION:${ANTLR4CPP_JAR_LOCATION}")
|
||||
|
@ -81,13 +81,13 @@ endif()
|
|||
# set(ANTLR4CPP_JAR_LOCATION ${ANTLR4CPP_EXTERNAL_ROOT}/${ANTLR4CPP_JAR_NAME})
|
||||
#
|
||||
# !TODO! Ensure Antlr tool available - copy from internet
|
||||
#
|
||||
#
|
||||
# # !TODO! this shold be calculated based on the tags
|
||||
# if (NOT ANTLR4CPP_JAR_NAME)
|
||||
# # default location to find antlr Java binary
|
||||
# set(ANTLR4CPP_JAR_NAME antlr4-4.5.4-SNAPSHOT.jar)
|
||||
# endif()
|
||||
#
|
||||
#
|
||||
# if(NOT EXISTS "${ANTLR4CPP_JAR_LOCATION}")
|
||||
# # download Java tool if not installed
|
||||
# ExternalProject_ADD(
|
||||
|
@ -162,20 +162,20 @@ endforeach(src_path)
|
|||
|
||||
set(ANTLR4CPP_LIBS "${INSTALL_DIR}/lib")
|
||||
|
||||
# antlr4_shared ${INSTALL_DIR}/lib/libantlr4-runtime.so
|
||||
# antlr4_static ${INSTALL_DIR}/lib/libantlr4-runtime.a
|
||||
# antlr4_shared ${INSTALL_DIR}/lib/libantlr4-runtime.so
|
||||
# antlr4_static ${INSTALL_DIR}/lib/libantlr4-runtime.a
|
||||
|
||||
############ Generate runtime #################
|
||||
# macro to add dependencies to target
|
||||
#
|
||||
# Param 1 project name
|
||||
# Param 1 project name
|
||||
# Param 1 namespace (postfix for dependencies)
|
||||
# Param 2 Lexer file (full path)
|
||||
# Param 3 Parser File (full path)
|
||||
#
|
||||
# output
|
||||
#
|
||||
# antlr4cpp_src_files_{namespace} - src files for add_executable
|
||||
# antlr4cpp_src_files_{namespace} - src files for add_executable
|
||||
# antlr4cpp_include_dirs_{namespace} - include dir for generated headers
|
||||
# antlr4cpp_generation_{namespace} - for add_dependencies tracking
|
||||
|
||||
|
@ -184,18 +184,18 @@ macro(antlr4cpp_process_grammar
|
|||
antlr4cpp_project_namespace
|
||||
antlr4cpp_grammar_lexer
|
||||
antlr4cpp_grammar_parser)
|
||||
|
||||
|
||||
if(EXISTS "${ANTLR4CPP_JAR_LOCATION}")
|
||||
message(STATUS "Found antlr tool: ${ANTLR4CPP_JAR_LOCATION}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find antlr tool. ANTLR4CPP_JAR_LOCATION:${ANTLR4CPP_JAR_LOCATION}")
|
||||
endif()
|
||||
|
||||
|
||||
add_custom_target("antlr4cpp_generation_${antlr4cpp_project_namespace}"
|
||||
COMMAND
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E make_directory ${ANTLR4CPP_GENERATED_SRC_DIR}
|
||||
COMMAND
|
||||
"${Java_JAVA_EXECUTABLE}" -jar "${ANTLR4CPP_JAR_LOCATION}" -Werror -Dlanguage=Cpp -listener -visitor -o "${ANTLR4CPP_GENERATED_SRC_DIR}/${antlr4cpp_project_namespace}" -package ${antlr4cpp_project_namespace} "${antlr4cpp_grammar_lexer}" "${antlr4cpp_grammar_parser}"
|
||||
"${Java_JAVA_EXECUTABLE}" -jar "${ANTLR4CPP_JAR_LOCATION}" -Werror -Dlanguage=Cpp -listener -visitor -o "${ANTLR4CPP_GENERATED_SRC_DIR}/${antlr4cpp_project_namespace}" -package ${antlr4cpp_project_namespace} "${antlr4cpp_grammar_lexer}" "${antlr4cpp_grammar_parser}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
DEPENDS "${antlr4cpp_grammar_lexer}" "${antlr4cpp_grammar_parser}"
|
||||
)
|
||||
|
@ -213,9 +213,9 @@ macro(antlr4cpp_process_grammar
|
|||
)
|
||||
endforeach(generated_file)
|
||||
message(STATUS "Antlr4Cpp ${antlr4cpp_project_namespace} Generated: ${generated_files}")
|
||||
|
||||
|
||||
# export generated include directory
|
||||
set(antlr4cpp_include_dirs_${antlr4cpp_project_namespace} ${ANTLR4CPP_GENERATED_SRC_DIR}/${antlr4cpp_project_namespace})
|
||||
message(STATUS "Antlr4Cpp ${antlr4cpp_project_namespace} include: ${ANTLR4CPP_GENERATED_SRC_DIR}/${antlr4cpp_project_namespace}")
|
||||
|
||||
|
||||
endmacro()
|
||||
|
|
Loading…
Reference in New Issue