59 lines
1.8 KiB
CMake
59 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(crpc)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
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
|
|
)
|
|
|
|
FILE(GLOB_RECURSE SRC_LIST ${PROJECT_SOURCE_DIR}/src/*.cpp)
|
|
add_executable(crpc
|
|
${SRC_LIST}
|
|
main.cpp
|
|
src/item.cpp
|
|
src/message.cpp
|
|
src/rpc.cpp
|
|
src/service.cpp
|
|
src/plugins/c/c_message_plugin.cpp
|
|
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
|
|
${antlr4cpp_src_files_tqcq}
|
|
)
|
|
target_include_directories(crpc PRIVATE src/grammar/ src/)
|
|
target_include_directories(crpc PRIVATE
|
|
${antlr4cpp_include_dirs_tqcq}
|
|
)
|
|
target_link_libraries(crpc PRIVATE
|
|
antlr4_static
|
|
)
|
|
|
|
add_dependencies(crpc antlr4cpp_generation_tqcq)
|
|
|
|
INSTALL(TARGETS crpc DESTINATION bin)
|
|
|
|
#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
|
|
#)
|
|
|