From 9e30f3f2654074906a44f2fe40ce688fdb9853ee Mon Sep 17 00:00:00 2001 From: Mike Lischke Date: Mon, 23 May 2016 09:40:48 +0200 Subject: [PATCH] A few minor changes related to building via cmake. --- runtime/Cpp/CMakeLists.txt | 19 +++++++++++-------- runtime/Cpp/README.md | 4 +++- runtime/Cpp/demo/README.md | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/runtime/Cpp/CMakeLists.txt b/runtime/Cpp/CMakeLists.txt index a3ade217d..2fabd12cc 100644 --- a/runtime/Cpp/CMakeLists.txt +++ b/runtime/Cpp/CMakeLists.txt @@ -40,16 +40,19 @@ find_package(Java REQUIRED) file(STRINGS "VERSION" ANTLR_VERSION) -if (NOT ANTLR_JAR_LOCATION) - message(FATAL_ERROR "Missing antlr4.jar location. You can specify it's path using: -DANTLR_JAR_LOCATION=") -else() - 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}") +if (WITH_DEMO) + if (NOT ANTLR_JAR_LOCATION) + message(FATAL_ERROR "Missing antlr4.jar location. You can specify it's path using: -DANTLR_JAR_LOCATION=") 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(WITH_DEMO) + set(MY_CXX_WARNING_FLAGS " -Wall -pedantic -W") # Initialize CXXFLAGS. diff --git a/runtime/Cpp/README.md b/runtime/Cpp/README.md index 1f0c4590f..c62a8c6d8 100644 --- a/runtime/Cpp/README.md +++ b/runtime/Cpp/README.md @@ -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. #### Compiling on Linux -- cd /runtime/Cpp +- cd /runtime/Cpp (this is where this readme is located) - mkdir build && mkdir run && cd build - cmake ..-DANTLR_JAR_LOCATION=full/path/to/antlr4-4.5.4-SNAPSHOT.jar -DWITH_DEMO=True - make - DESTDIR=/runtime/Cpp/run make install +If you don't want to build the demo then simply run cmake without parameters. + diff --git a/runtime/Cpp/demo/README.md b/runtime/Cpp/demo/README.md index ca412d8d4..e2db8fffc 100644 --- a/runtime/Cpp/demo/README.md +++ b/runtime/Cpp/demo/README.md @@ -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. - Open the project in the folder that matches your system. - Compile and run. + +Compilation is done as described in the runtime/cpp/readme.md file.