From c1365684c34442021b50810b025878124e8ee6d6 Mon Sep 17 00:00:00 2001 From: ChaseOxide Date: Wed, 28 Feb 2018 16:36:33 -0600 Subject: [PATCH] Added support for OSX --- runtime/Cpp/cmake/ExternalAntlr4Cpp.cmake | 3 +++ runtime/Cpp/cmake/README.md | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/Cpp/cmake/ExternalAntlr4Cpp.cmake b/runtime/Cpp/cmake/ExternalAntlr4Cpp.cmake index 47800305c..cf57d659b 100644 --- a/runtime/Cpp/cmake/ExternalAntlr4Cpp.cmake +++ b/runtime/Cpp/cmake/ExternalAntlr4Cpp.cmake @@ -37,6 +37,9 @@ else() ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll.a) set(ANTLR4_RUNTIME_LIBRARIES ${ANTLR4_OUTPUT_DIR}/cygantlr4-runtime-4.7.1.dll) + elseif(APPLE) + set(ANTLR4_RUNTIME_LIBRARIES + ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dylib) else() set(ANTLR4_RUNTIME_LIBRARIES ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.so) diff --git a/runtime/Cpp/cmake/README.md b/runtime/Cpp/cmake/README.md index 0aa6df507..3e2fb62df 100644 --- a/runtime/Cpp/cmake/README.md +++ b/runtime/Cpp/cmake/README.md @@ -85,7 +85,7 @@ ANTLR_${name}_OUTPUT_DIR - the output directory for ANTLR The options are: * `PACKAGE` - defines a namespace for the generated C++ files -* `OUTPUT_DIRECTORY` - the output directory for the generated files. By default it uses ${CMAKE_CURRENT_BINARY_DIR} +* `OUTPUT_DIRECTORY` - the output directory for the generated files. By default it uses `${CMAKE_CURRENT_BINARY_DIR}` * `DEPENDS_ANTLR` - the dependent target generated from antlr_target for the current call * `COMPILE_FLAGS` - additional compile flags for ANTLR tool * `DEPENDS` - specify the files on which the command depends. It works the same way `DEPENDS` in [add_custom_command()](https://cmake.org/cmake/help/v3.11/command/add_custom_command.html) @@ -109,7 +109,7 @@ Including ExternalAntlr4Cpp will add `antlr4_static` and `antlr4_shared` as an o ANTLR4_INCLUDE_DIRS - the include directory that should be included when compiling C++ source file ANTLR4_STATIC_LIBRARIES - path to antlr4 static library ANTLR4_SHARED_LIBRARIES - path to antlr4 shared library -ANTLR4_RUNTIME_LIBRARIES - path to antlr4 shared runtime library (such as DLL and SO file) +ANTLR4_RUNTIME_LIBRARIES - path to antlr4 shared runtime library (such as DLL, DYLIB and SO file) ANTLR4_TAG - branch/tag used for building antlr4 library ``` `ANTLR4_TAG` is set to master branch by default to keep antlr4 updated. However, it will be required to rebuild after every `clean` is called. Set `ANTLR4_TAG` to a desired commit hash value to avoid rebuilding after every `clean` and keep the build stable, at the cost of not automatically update to latest commit. @@ -125,7 +125,7 @@ add_executable(output main.cpp) target_link_libraries(output antlr4_static) ``` -It may also be a good idea to copy the runtime libraries (DLL or SO file) to the executable for it to run properly after build. i.e. To build and link antlr4 shared library to a target one may call: +It may also be a good idea to copy the runtime libraries (DLL, DYLIB or SO file) to the executable for it to run properly after build. i.e. To build and link antlr4 shared library to a target one may call: ```cmake include(ExternalAntlr4Cpp) include_directories(${ANTLR4_INCLUDE_DIRS})