2023-12-03 08:34:17 +08:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2023-12-02 00:32:54 +08:00
|
|
|
project(crpc)
|
|
|
|
|
2023-12-03 11:57:23 +08:00
|
|
|
find_program(Java_JAVA_EXECUTABLE NAMES java)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|
|
|
set(ANTLR4_GIT_REPOSITORY https://code.uocat.com/3party/antlr4.git)
|
|
|
|
set(ANTLR4_TAG 4.13.1)
|
|
|
|
include( ExternalAntlr4Cpp )
|
|
|
|
# find_package(antlr4-runtime CONFIG REQUIRED)
|
|
|
|
set(ANTLR4CPP_JAR_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/3party/anltr/antlr-4.13.1-complete.jar)
|
|
|
|
set(ANTLR4CPP_GENERATED_SRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/grammar)
|
|
|
|
antlr4cpp_process_grammar(proto
|
|
|
|
tqcq
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/grammar/ProtoLexer.g4
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/grammar/ProtoParser.g4
|
|
|
|
)
|
2023-12-02 00:32:54 +08:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
|
|
|
FILE(GLOB_RECURSE SRC_LIST ${PROJECT_SOURCE_DIR}/src/*.cpp)
|
|
|
|
add_executable(crpc
|
2023-12-02 08:45:42 +08:00
|
|
|
${SRC_LIST}
|
2023-12-02 00:32:54 +08:00
|
|
|
main.cpp
|
|
|
|
src/item.cpp
|
|
|
|
src/message.cpp
|
|
|
|
src/rpc.cpp
|
|
|
|
src/service.cpp
|
|
|
|
src/plugins/c/c_message_plugin.cpp
|
2023-12-02 08:45:42 +08:00
|
|
|
src/plugins/c/items/c_item.cpp
|
|
|
|
src/plugins/service_plugin.cpp
|
|
|
|
src/plugins/plugin.cpp
|
|
|
|
src/plugins/c/c_service_server_plugin.cpp
|
|
|
|
src/plugins/c/rpcs/crpc_client.cpp
|
|
|
|
src/plugins/c/rpcs/crpc.cpp
|
|
|
|
src/plugins/c/c_service_plugin.cpp
|
2023-12-03 11:57:23 +08:00
|
|
|
${antlr4cpp_src_files_tqcq}
|
2023-12-02 00:32:54 +08:00
|
|
|
)
|
2023-12-03 08:04:44 +08:00
|
|
|
target_include_directories(crpc PRIVATE src/grammar/ src/)
|
2023-12-03 11:57:23 +08:00
|
|
|
target_include_directories(crpc PRIVATE
|
|
|
|
${antlr4cpp_include_dirs_tqcq}
|
|
|
|
)
|
|
|
|
target_link_libraries(crpc PRIVATE
|
|
|
|
antlr4_static
|
|
|
|
)
|
2023-12-02 00:32:54 +08:00
|
|
|
|
2023-12-03 11:57:23 +08:00
|
|
|
add_dependencies(crpc antlr4cpp_generation_tqcq)
|
|
|
|
|
2023-12-03 08:09:34 +08:00
|
|
|
INSTALL(TARGETS crpc DESTINATION bin)
|
2023-12-03 11:59:46 +08:00
|
|
|
|
|
|
|
#FILE(GLOB_RECURSE TEST_SRC_LIST ${CMAKE_CURRENT_BINARY_DIR}/grammar/*.c)
|
|
|
|
#add_executable(test ${TEST_SRC_LIST}
|
|
|
|
# test/test.c
|
|
|
|
#)
|
|
|
|
#
|
|
|
|
#target_include_directories(test PRIVATE
|
|
|
|
# ${CMAKE_CURRENT_SOURCE_DIR}/3party/tpl
|
|
|
|
#)
|
|
|
|
|