A few minor changes related to building via cmake.

This commit is contained in:
Mike Lischke 2016-05-23 09:40:48 +02:00
parent be65ccd25c
commit 9e30f3f265
3 changed files with 16 additions and 9 deletions

View File

@ -40,16 +40,19 @@ find_package(Java REQUIRED)
file(STRINGS "VERSION" ANTLR_VERSION) file(STRINGS "VERSION" ANTLR_VERSION)
if (NOT ANTLR_JAR_LOCATION) if (WITH_DEMO)
message(FATAL_ERROR "Missing antlr4.jar location. You can specify it's path using: -DANTLR_JAR_LOCATION=<path>") if (NOT ANTLR_JAR_LOCATION)
else() message(FATAL_ERROR "Missing antlr4.jar location. You can specify it's path using: -DANTLR_JAR_LOCATION=<path>")
get_filename_component(ANTLR_NAME ${ANTLR_JAR_LOCATION} NAME_WE)
if(NOT EXISTS "${ANTLR_JAR_LOCATION}")
message(FATAL_ERROR "Unable to find ${ANTLR_NAME} in ${ANTLR_JAR_LOCATION}")
else() else()
message(STATUS "Found ${ANTLR_NAME}: ${ANTLR_JAR_LOCATION}") get_filename_component(ANTLR_NAME ${ANTLR_JAR_LOCATION} NAME_WE)
if(NOT EXISTS "${ANTLR_JAR_LOCATION}")
message(FATAL_ERROR "Unable to find ${ANTLR_NAME} in ${ANTLR_JAR_LOCATION}")
else()
message(STATUS "Found ${ANTLR_NAME}: ${ANTLR_JAR_LOCATION}")
endif()
endif() endif()
endif() endif(WITH_DEMO)
set(MY_CXX_WARNING_FLAGS " -Wall -pedantic -W") set(MY_CXX_WARNING_FLAGS " -Wall -pedantic -W")
# Initialize CXXFLAGS. # Initialize CXXFLAGS.

View File

@ -44,9 +44,11 @@ Simply open the VS solution (VS 2013+) and build it.
Either open the included XCode project and build that or use the cmake compilation as described for linux. Either open the included XCode project and build that or use the cmake compilation as described for linux.
#### Compiling on Linux #### Compiling on Linux
- cd <antlr4-dir>/runtime/Cpp - cd <antlr4-dir>/runtime/Cpp (this is where this readme is located)
- mkdir build && mkdir run && cd build - mkdir build && mkdir run && cd build
- cmake ..-DANTLR_JAR_LOCATION=full/path/to/antlr4-4.5.4-SNAPSHOT.jar -DWITH_DEMO=True - cmake ..-DANTLR_JAR_LOCATION=full/path/to/antlr4-4.5.4-SNAPSHOT.jar -DWITH_DEMO=True
- make - make
- DESTDIR=<antlr4-dir>/runtime/Cpp/run make install - DESTDIR=<antlr4-dir>/runtime/Cpp/run make install
If you don't want to build the demo then simply run cmake without parameters.

View File

@ -9,3 +9,5 @@ A few steps are necessary to get this to work:
- Run the generation script. This will generate a test parser + lexer, along with listener + visitor classes in a subfolder named "generated". This is where the demo application looks for these files. - Run the generation script. This will generate a test parser + lexer, along with listener + visitor classes in a subfolder named "generated". This is where the demo application looks for these files.
- Open the project in the folder that matches your system. - Open the project in the folder that matches your system.
- Compile and run. - Compile and run.
Compilation is done as described in the runtime/cpp/readme.md file.