- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2
feat: Add CLP connector #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fb10f2c
              7b1d318
              cf4aad2
              0414c5a
              bb93043
              fe6bace
              4738ad4
              6b5998c
              8080d84
              5907d11
              b742bb0
              e7112be
              7fe8838
              b27d95a
              580e411
              bf76ccc
              55c43e0
              3f6d60c
              4999b18
              72b7b98
              e1b0c3a
              7ae6504
              98bf4f4
              3c248ee
              529c2fa
              ef9e272
              527f6fe
              fd4c435
              4c259b7
              2dd5e0e
              52cd74f
              6bda409
              4f36e5e
              b6aed4f
              ea33a7a
              a222eaf
              d1eaabd
              62048e8
              80fcd9d
              dcbf0d9
              695d5f3
              f1c6cfe
              2f9356c
              27c4b7d
              efa6ec9
              b8cf3ed
              9c44db1
              ee126d4
              73e845e
              c6f1e05
              e5e2b66
              a8c48f8
              7955a92
              4300210
              aa9390c
              b00d340
              b6ba69b
              730aabf
              eff493b
              ffe2760
              92f9fc0
              c466884
              6410857
              ec28c71
              0cd9943
              f26ba13
              9834a69
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,175 @@ | ||||||||||||||||||||||||||||||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||
| # You may obtain a copy of the License at | ||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||
| # limitations under the License. | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| # NOTE: ExternalAntlr4Cpp.cmake taken from | ||||||||||||||||||||||||||||||
| # https://github.com/antlr/antlr4/blob/4.13.1/runtime/Cpp/cmake/ExternalAntlr4Cpp.cmake | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| cmake_minimum_required(VERSION 3.7) | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| if(POLICY CMP0114) | ||||||||||||||||||||||||||||||
| cmake_policy(SET CMP0114 NEW) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| include(ExternalProject) | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| set(ANTLR4_ROOT ${CMAKE_CURRENT_BINARY_DIR}/antlr4_runtime/src/antlr4_runtime) | ||||||||||||||||||||||||||||||
| set(ANTLR4_INCLUDE_DIRS ${ANTLR4_ROOT}/runtime/Cpp/runtime/src) | ||||||||||||||||||||||||||||||
| set(ANTLR4_GIT_REPOSITORY https://github.com/antlr/antlr4.git) | ||||||||||||||||||||||||||||||
| if(NOT DEFINED ANTLR4_TAG) | ||||||||||||||||||||||||||||||
| # Set to branch name to keep library updated at the cost of needing to rebuild | ||||||||||||||||||||||||||||||
| # after 'clean' Set to commit hash to keep the build stable and does not need | ||||||||||||||||||||||||||||||
| # to rebuild after 'clean' | ||||||||||||||||||||||||||||||
| set(ANTLR4_TAG master) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| # Ensure that the include dir already exists at configure time (to avoid cmake | ||||||||||||||||||||||||||||||
| # erroring on non-existent include dirs) | ||||||||||||||||||||||||||||||
| file(MAKE_DIRECTORY "${ANTLR4_INCLUDE_DIRS}") | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") | ||||||||||||||||||||||||||||||
| set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist/$(Configuration)) | ||||||||||||||||||||||||||||||
| elseif(${CMAKE_GENERATOR} MATCHES "Xcode.*") | ||||||||||||||||||||||||||||||
| set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist/$(CONFIGURATION)) | ||||||||||||||||||||||||||||||
| else() | ||||||||||||||||||||||||||||||
| set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| 
      Comment on lines
    
      +40
     to 
      +46
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Quote generator variable in  When  -if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
+if("${CMAKE_GENERATOR}" MATCHES "Visual Studio.*")Apply the same pattern to the other generator checks below (lines 40-46, 42-44, 68-80). 📝 Committable suggestion
 
        Suggested change
       
 | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| if(MSVC) | ||||||||||||||||||||||||||||||
| set(ANTLR4_STATIC_LIBRARIES ${ANTLR4_OUTPUT_DIR}/antlr4-runtime-static.lib) | ||||||||||||||||||||||||||||||
| set(ANTLR4_SHARED_LIBRARIES ${ANTLR4_OUTPUT_DIR}/antlr4-runtime.lib) | ||||||||||||||||||||||||||||||
| set(ANTLR4_RUNTIME_LIBRARIES ${ANTLR4_OUTPUT_DIR}/antlr4-runtime.dll) | ||||||||||||||||||||||||||||||
| else() | ||||||||||||||||||||||||||||||
| set(ANTLR4_STATIC_LIBRARIES ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.a) | ||||||||||||||||||||||||||||||
| if(MINGW) | ||||||||||||||||||||||||||||||
| set(ANTLR4_SHARED_LIBRARIES ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll.a) | ||||||||||||||||||||||||||||||
| set(ANTLR4_RUNTIME_LIBRARIES ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll) | ||||||||||||||||||||||||||||||
| elseif(CYGWIN) | ||||||||||||||||||||||||||||||
| set(ANTLR4_SHARED_LIBRARIES ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dll.a) | ||||||||||||||||||||||||||||||
| set(ANTLR4_RUNTIME_LIBRARIES | ||||||||||||||||||||||||||||||
| ${ANTLR4_OUTPUT_DIR}/cygantlr4-runtime-${ANTLR4_TAG}.dll) | ||||||||||||||||||||||||||||||
| elseif(APPLE) | ||||||||||||||||||||||||||||||
| set(ANTLR4_RUNTIME_LIBRARIES ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.dylib) | ||||||||||||||||||||||||||||||
| else() | ||||||||||||||||||||||||||||||
| set(ANTLR4_RUNTIME_LIBRARIES ${ANTLR4_OUTPUT_DIR}/libantlr4-runtime.so) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| if(${CMAKE_GENERATOR} MATCHES ".* Makefiles") | ||||||||||||||||||||||||||||||
| # This avoids 'warning: jobserver unavailable: using -j1. Add '+' to parent | ||||||||||||||||||||||||||||||
| # make rule.' | ||||||||||||||||||||||||||||||
| set(ANTLR4_BUILD_COMMAND $(MAKE)) | ||||||||||||||||||||||||||||||
| elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") | ||||||||||||||||||||||||||||||
| set(ANTLR4_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $(Configuration) | ||||||||||||||||||||||||||||||
| --target) | ||||||||||||||||||||||||||||||
| elseif(${CMAKE_GENERATOR} MATCHES "Xcode.*") | ||||||||||||||||||||||||||||||
| set(ANTLR4_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $(CONFIGURATION) | ||||||||||||||||||||||||||||||
| --target) | ||||||||||||||||||||||||||||||
| else() | ||||||||||||||||||||||||||||||
| set(ANTLR4_BUILD_COMMAND ${CMAKE_COMMAND} --build . --target) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| if(NOT DEFINED ANTLR4_WITH_STATIC_CRT) | ||||||||||||||||||||||||||||||
| set(ANTLR4_WITH_STATIC_CRT ON) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| if(ANTLR4_ZIP_REPOSITORY) | ||||||||||||||||||||||||||||||
| ExternalProject_Add( | ||||||||||||||||||||||||||||||
| antlr4_runtime | ||||||||||||||||||||||||||||||
| PREFIX antlr4_runtime | ||||||||||||||||||||||||||||||
| URL ${ANTLR4_ZIP_REPOSITORY} | ||||||||||||||||||||||||||||||
| DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} | ||||||||||||||||||||||||||||||
| BUILD_COMMAND "" | ||||||||||||||||||||||||||||||
| BUILD_IN_SOURCE 1 | ||||||||||||||||||||||||||||||
| SOURCE_DIR ${ANTLR4_ROOT} | ||||||||||||||||||||||||||||||
| SOURCE_SUBDIR runtime/Cpp | ||||||||||||||||||||||||||||||
| CMAKE_CACHE_ARGS | ||||||||||||||||||||||||||||||
| -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||||||||||||||||||||||||||||||
| -DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT} | ||||||||||||||||||||||||||||||
| -DDISABLE_WARNINGS:BOOL=ON | ||||||||||||||||||||||||||||||
| # -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a | ||||||||||||||||||||||||||||||
| # different C++ standard -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} | ||||||||||||||||||||||||||||||
| # alternatively, compile the runtime with the same C++ standard as the | ||||||||||||||||||||||||||||||
| # outer project | ||||||||||||||||||||||||||||||
| INSTALL_COMMAND "" | ||||||||||||||||||||||||||||||
| EXCLUDE_FROM_ALL 1) | ||||||||||||||||||||||||||||||
| else() | ||||||||||||||||||||||||||||||
| ExternalProject_Add( | ||||||||||||||||||||||||||||||
| antlr4_runtime | ||||||||||||||||||||||||||||||
| PREFIX antlr4_runtime | ||||||||||||||||||||||||||||||
| GIT_REPOSITORY ${ANTLR4_GIT_REPOSITORY} | ||||||||||||||||||||||||||||||
| GIT_TAG ${ANTLR4_TAG} | ||||||||||||||||||||||||||||||
| DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} | ||||||||||||||||||||||||||||||
| BUILD_COMMAND "" | ||||||||||||||||||||||||||||||
| BUILD_IN_SOURCE 1 | ||||||||||||||||||||||||||||||
| SOURCE_DIR ${ANTLR4_ROOT} | ||||||||||||||||||||||||||||||
| SOURCE_SUBDIR runtime/Cpp | ||||||||||||||||||||||||||||||
| CMAKE_CACHE_ARGS | ||||||||||||||||||||||||||||||
| -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||||||||||||||||||||||||||||||
| -DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT} | ||||||||||||||||||||||||||||||
| -DDISABLE_WARNINGS:BOOL=ON | ||||||||||||||||||||||||||||||
| # -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a | ||||||||||||||||||||||||||||||
| # different C++ standard -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} | ||||||||||||||||||||||||||||||
| # alternatively, compile the runtime with the same C++ standard as the | ||||||||||||||||||||||||||||||
| # outer project | ||||||||||||||||||||||||||||||
| INSTALL_COMMAND "" | ||||||||||||||||||||||||||||||
| EXCLUDE_FROM_ALL 1) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| # Separate build step as rarely people want both | ||||||||||||||||||||||||||||||
| set(ANTLR4_BUILD_DIR ${ANTLR4_ROOT}) | ||||||||||||||||||||||||||||||
| if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0") | ||||||||||||||||||||||||||||||
| # CMake 3.14 builds in above's SOURCE_SUBDIR when BUILD_IN_SOURCE is true | ||||||||||||||||||||||||||||||
| set(ANTLR4_BUILD_DIR ${ANTLR4_ROOT}/runtime/Cpp) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| ExternalProject_Add_Step( | ||||||||||||||||||||||||||||||
| antlr4_runtime build_static | ||||||||||||||||||||||||||||||
| COMMAND ${ANTLR4_BUILD_COMMAND} antlr4_static | ||||||||||||||||||||||||||||||
| # Depend on target instead of step (a custom command) to avoid running | ||||||||||||||||||||||||||||||
| # dependent steps concurrently | ||||||||||||||||||||||||||||||
| DEPENDS antlr4_runtime | ||||||||||||||||||||||||||||||
| BYPRODUCTS ${ANTLR4_STATIC_LIBRARIES} | ||||||||||||||||||||||||||||||
| EXCLUDE_FROM_MAIN 1 | ||||||||||||||||||||||||||||||
| WORKING_DIRECTORY ${ANTLR4_BUILD_DIR}) | ||||||||||||||||||||||||||||||
| ExternalProject_Add_StepTargets(antlr4_runtime build_static) | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| add_library(antlr4_static STATIC IMPORTED) | ||||||||||||||||||||||||||||||
| add_dependencies(antlr4_static antlr4_runtime-build_static) | ||||||||||||||||||||||||||||||
| set_target_properties( | ||||||||||||||||||||||||||||||
| antlr4_static | ||||||||||||||||||||||||||||||
| PROPERTIES IMPORTED_LOCATION ${ANTLR4_STATIC_LIBRARIES}) | ||||||||||||||||||||||||||||||
| target_include_directories(antlr4_static INTERFACE ${ANTLR4_INCLUDE_DIRS}) | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| ExternalProject_Add_Step( | ||||||||||||||||||||||||||||||
| antlr4_runtime build_shared | ||||||||||||||||||||||||||||||
| COMMAND ${ANTLR4_BUILD_COMMAND} antlr4_shared | ||||||||||||||||||||||||||||||
| # Depend on target instead of step (a custom command) to avoid running | ||||||||||||||||||||||||||||||
| # dependent steps concurrently | ||||||||||||||||||||||||||||||
| DEPENDS antlr4_runtime | ||||||||||||||||||||||||||||||
| BYPRODUCTS ${ANTLR4_SHARED_LIBRARIES} ${ANTLR4_RUNTIME_LIBRARIES} | ||||||||||||||||||||||||||||||
| EXCLUDE_FROM_MAIN 1 | ||||||||||||||||||||||||||||||
| WORKING_DIRECTORY ${ANTLR4_BUILD_DIR}) | ||||||||||||||||||||||||||||||
| ExternalProject_Add_StepTargets(antlr4_runtime build_shared) | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| add_library(antlr4_shared SHARED IMPORTED) | ||||||||||||||||||||||||||||||
| add_dependencies(antlr4_shared antlr4_runtime-build_shared) | ||||||||||||||||||||||||||||||
| set_target_properties( | ||||||||||||||||||||||||||||||
| antlr4_shared | ||||||||||||||||||||||||||||||
| PROPERTIES IMPORTED_LOCATION ${ANTLR4_RUNTIME_LIBRARIES}) | ||||||||||||||||||||||||||||||
| target_include_directories(antlr4_shared INTERFACE ${ANTLR4_INCLUDE_DIRS}) | ||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||
| if(ANTLR4_SHARED_LIBRARIES) | ||||||||||||||||||||||||||||||
| set_target_properties(antlr4_shared PROPERTIES IMPORTED_IMPLIB | ||||||||||||||||||||||||||||||
| ${ANTLR4_SHARED_LIBRARIES}) | ||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||
|         
                  coderabbitai[bot] marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|  | ||
| # NOTE: FindANTLR.cmake taken from | ||
| # https://github.com/antlr/antlr4/blob/4.13.1/runtime/Cpp/cmake/FindANTLR.cmake | ||
|  | ||
| # Set ANTLR version | ||
| set(ANTLR4_TAG 4.13.1) | ||
| add_definitions(-DANTLR4CPP_STATIC) | ||
|         
                  wraymo marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| # Define the JAR name and path | ||
| set(ANTLR_JAR_NAME antlr-${ANTLR4_TAG}-complete.jar) | ||
|  | ||
| # Set the download directory | ||
| set(ANTLR_DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/antlr) | ||
| file(MAKE_DIRECTORY ${ANTLR_DOWNLOAD_DIR}) | ||
|  | ||
| # Define the full path to the ANTLR JAR | ||
| set(ANTLR_EXECUTABLE ${ANTLR_DOWNLOAD_DIR}/${ANTLR_JAR_NAME}) | ||
|  | ||
| # Download the ANTLR JAR if it does not exist | ||
| if(NOT EXISTS ${ANTLR_EXECUTABLE}) | ||
| message(STATUS "ANTLR JAR not found. Downloading ANTLR ${ANTLR4_TAG}...") | ||
| file( | ||
| DOWNLOAD https://www.antlr.org/download/${ANTLR_JAR_NAME} | ||
| ${ANTLR_EXECUTABLE} | ||
| SHOW_PROGRESS | ||
| EXPECTED_HASH | ||
| SHA256=bc13a9c57a8dd7d5196888211e5ede657cb64a3ce968608697e4f668251a8487 | ||
| TLS_VERIFY ON) | ||
| endif() | ||
|  | ||
| # Include the ANTLR C++ runtime integration | ||
| include(ExternalAntlr4Cpp) | ||
|  | ||
| find_package(Java 11 REQUIRED COMPONENTS Runtime) | ||
|  | ||
| if(NOT ANTLR_EXECUTABLE) | ||
| find_program(ANTLR_EXECUTABLE NAMES antlr.jar antlr4.jar antlr-4.jar | ||
| antlr-${ANTLR4_TAG}-complete.jar) | ||
| endif() | ||
|  | ||
| if(ANTLR_EXECUTABLE AND Java_JAVA_EXECUTABLE) | ||
| execute_process( | ||
| COMMAND ${Java_JAVA_EXECUTABLE} -jar ${ANTLR_EXECUTABLE} | ||
| OUTPUT_VARIABLE ANTLR_COMMAND_OUTPUT | ||
| ERROR_VARIABLE ANTLR_COMMAND_ERROR | ||
| RESULT_VARIABLE ANTLR_COMMAND_RESULT | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|  | ||
| if(ANTLR_COMMAND_RESULT EQUAL 0) | ||
| string(REGEX MATCH "Version [0-9]+(\\.[0-9]+)*" ANTLR_VERSION | ||
| ${ANTLR_COMMAND_OUTPUT}) | ||
| string(REPLACE "Version " "" ANTLR_VERSION ${ANTLR_VERSION}) | ||
| else() | ||
| message( | ||
| SEND_ERROR "Command '${Java_JAVA_EXECUTABLE} -jar ${ANTLR_EXECUTABLE}' " | ||
| "failed with the output '${ANTLR_COMMAND_ERROR}'") | ||
| endif() | ||
|  | ||
| macro(ANTLR_TARGET Name InputFile) | ||
| set(ANTLR_OPTIONS LEXER PARSER LISTENER VISITOR) | ||
| set(ANTLR_ONE_VALUE_ARGS PACKAGE OUTPUT_DIRECTORY DEPENDS_ANTLR) | ||
| set(ANTLR_MULTI_VALUE_ARGS COMPILE_FLAGS DEPENDS) | ||
| cmake_parse_arguments( | ||
| ANTLR_TARGET | ||
| "${ANTLR_OPTIONS}" | ||
| "${ANTLR_ONE_VALUE_ARGS}" | ||
| "${ANTLR_MULTI_VALUE_ARGS}" | ||
| ${ARGN}) | ||
| set(ANTLR_${Name}_INPUT ${InputFile}) | ||
|  | ||
| get_filename_component(ANTLR_INPUT ${InputFile} NAME_WE) | ||
| get_filename_component(ANTLR_INPUT_PARENT_DIR "${InputFile}" DIRECTORY) | ||
|  | ||
| if(ANTLR_TARGET_OUTPUT_DIRECTORY) | ||
| set(ANTLR_${Name}_OUTPUT_DIR ${ANTLR_TARGET_OUTPUT_DIRECTORY}) | ||
| else() | ||
| set(ANTLR_${Name}_OUTPUT_DIR | ||
| ${CMAKE_CURRENT_BINARY_DIR}/antlr4cpp_generated_src/${ANTLR_INPUT}) | ||
| endif() | ||
|  | ||
| unset(ANTLR_${Name}_CXX_OUTPUTS) | ||
|  | ||
| if((ANTLR_TARGET_LEXER AND NOT ANTLR_TARGET_PARSER) | ||
| OR (ANTLR_TARGET_PARSER AND NOT ANTLR_TARGET_LEXER)) | ||
| list(APPEND ANTLR_${Name}_CXX_OUTPUTS | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.h | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.cpp) | ||
| set(ANTLR_${Name}_OUTPUTS | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.interp | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}.tokens) | ||
| else() | ||
| list( | ||
| APPEND | ||
| ANTLR_${Name}_CXX_OUTPUTS | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.h | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.cpp | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Parser.h | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Parser.cpp) | ||
| list(APPEND ANTLR_${Name}_OUTPUTS | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.interp | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Lexer.tokens) | ||
| endif() | ||
|  | ||
| if(ANTLR_TARGET_LISTENER) | ||
| list( | ||
| APPEND | ||
| ANTLR_${Name}_CXX_OUTPUTS | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseListener.h | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseListener.cpp | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Listener.h | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Listener.cpp) | ||
| list(APPEND ANTLR_TARGET_COMPILE_FLAGS -listener) | ||
| endif() | ||
|  | ||
| if(ANTLR_TARGET_VISITOR) | ||
| list( | ||
| APPEND | ||
| ANTLR_${Name}_CXX_OUTPUTS | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseVisitor.h | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}BaseVisitor.cpp | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Visitor.h | ||
| ${ANTLR_${Name}_OUTPUT_DIR}/${ANTLR_INPUT}Visitor.cpp) | ||
| list(APPEND ANTLR_TARGET_COMPILE_FLAGS -visitor) | ||
| endif() | ||
|  | ||
| if(ANTLR_TARGET_PACKAGE) | ||
| list(APPEND ANTLR_TARGET_COMPILE_FLAGS -package ${ANTLR_TARGET_PACKAGE}) | ||
| endif() | ||
|  | ||
| list(APPEND ANTLR_${Name}_OUTPUTS ${ANTLR_${Name}_CXX_OUTPUTS}) | ||
|  | ||
| if(ANTLR_TARGET_DEPENDS_ANTLR) | ||
| if(ANTLR_${ANTLR_TARGET_DEPENDS_ANTLR}_INPUT) | ||
| list(APPEND ANTLR_TARGET_DEPENDS | ||
| ${ANTLR_${ANTLR_TARGET_DEPENDS_ANTLR}_INPUT}) | ||
| list(APPEND ANTLR_TARGET_DEPENDS | ||
| ${ANTLR_${ANTLR_TARGET_DEPENDS_ANTLR}_OUTPUTS}) | ||
| else() | ||
| message( | ||
| SEND_ERROR "ANTLR target '${ANTLR_TARGET_DEPENDS_ANTLR}' not found") | ||
| endif() | ||
| endif() | ||
|  | ||
| add_custom_command( | ||
| OUTPUT ${ANTLR_${Name}_OUTPUTS} | ||
| COMMAND | ||
| ${Java_JAVA_EXECUTABLE} -jar ${ANTLR_EXECUTABLE} ${InputFile} -o | ||
| ${ANTLR_${Name}_OUTPUT_DIR} -no-listener -Dlanguage=Cpp | ||
| ${ANTLR_TARGET_COMPILE_FLAGS} | ||
|         
                  wraymo marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| DEPENDS ${InputFile} ${ANTLR_TARGET_DEPENDS} | ||
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
| COMMENT "Building ${Name} with ANTLR ${ANTLR_VERSION}") | ||
| endmacro(ANTLR_TARGET) | ||
|  | ||
| endif(ANTLR_EXECUTABLE AND Java_JAVA_EXECUTABLE) | ||
|  | ||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args( | ||
| ANTLR | ||
| REQUIRED_VARS ANTLR_EXECUTABLE Java_JAVA_EXECUTABLE | ||
| VERSION_VAR ANTLR_VERSION) | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| include_guard(GLOBAL) | ||
|  | ||
| FetchContent_Declare( | ||
| clp | ||
| GIT_REPOSITORY https://github.com/y-scope/clp.git | ||
| GIT_TAG 7b1b169a89abdfe44c159d6200b168391b697877 | ||
| GIT_SUBMODULES "" GIT_SUBMODULES_RECURSE TRUE) | ||
|  | ||
| FetchContent_MakeAvailable(clp) | ||
|  | ||
| if(clp_POPULATED) | ||
| message(STATUS "Updating submodules for clp...") | ||
| execute_process( | ||
| COMMAND ${CMAKE_COMMAND} -E chdir "${clp_SOURCE_DIR}" git submodule update | ||
| --init --recursive | ||
| RESULT_VARIABLE submodule_update_result | ||
| OUTPUT_VARIABLE submodule_update_output | ||
| ERROR_VARIABLE submodule_update_error) | ||
| if(NOT ${submodule_update_result} EQUAL 0) | ||
| message(ERROR | ||
| "Failed to update submodules for clp:\n${submodule_update_error}") | ||
| else() | ||
| message(STATUS "Submodules for clp updated successfully.") | ||
| endif() | ||
| endif() | 
Uh oh!
There was an error while loading. Please reload this page.