TarsCloud_TarsCpp/servant/CMakeLists.txt

78 lines
2.4 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.2)
2018-09-05 11:26:21 +08:00
project(servant)
2021-08-23 15:35:24 +08:00
# if(TARS_OPENTRACKING)
# include_directories(${util_SOURCE_DIR}/include ${OPENTRACKING_INC})
# else()
2018-09-05 11:26:21 +08:00
include_directories(${util_SOURCE_DIR}/include)
2021-08-23 15:35:24 +08:00
# endif()
2018-09-05 11:26:21 +08:00
#调用tars2cpp, 生成tars对应的文件
2020-04-03 16:01:03 +08:00
macro(complice_tars OUT_DEPENDS_LIST HEADER INCLUDE)
2018-09-05 11:26:21 +08:00
set(DEPENDS_LIST)
2020-04-03 16:01:03 +08:00
FILE(GLOB SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/*.tars")
2018-09-05 11:26:21 +08:00
set(CLEAN_LIST)
#设置tars生成后, cpp文件因为h文件的include路径
2020-04-03 16:01:03 +08:00
set(HEADER_STRING)
if (NOT "${HEADER}" STREQUAL "")
2020-04-03 16:01:03 +08:00
set(HEADER_STRING "--header=${HEADER}")
endif ()
#设置tars文件搜索路径
set(INCLUDE_STRING "")
set(HEADER_STRING)
if (NOT "${INCLUDE}" STREQUAL "")
set(INCLUDE_STRING "--include=${INCLUDE}")
2018-09-05 11:26:21 +08:00
endif ()
foreach (FILE ${SRC_LIST})
get_filename_component(NAME_WE ${FILE} NAME_WE)
# 生成tars文件
set(TARS_IN ${FILE})
set(TARS_H ${NAME_WE}.h)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${TARS_H}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS tars2cpp ${FILE}
2021-10-15 17:45:17 +08:00
COMMAND ${TARS2CPP} --with-tars --without-trace ${HEADER_STRING} ${INCLUDE_STRING} ${TARS_IN}
COMMENT "${TARS2CPP} --with-tars --without-trace ${HEADER_STRING} ${INCLUDE_STRING} ${TARS_IN}")
2018-09-05 11:26:21 +08:00
list(APPEND DEPENDS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/${TARS_H})
#设置需要清除的文件
get_filename_component(PATH ${FILE} PATH)
list(APPEND CLEAN_LIST ${PATH}/${NAME_WE}.h)
if (EXISTS ${PATH}/${NAME_WE}.cpp)
list(APPEND CLEAN_LIST ${PATH}/${NAME_WE}.cpp)
endif (EXISTS ${PATH}/${NAME_WE}.cpp)
endforeach (FILE)
set(OUT_DEPENDS_LIST ${DEPENDS_LIST})
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEAN_LIST}")
endmacro()
add_subdirectory(protocol/servant)
2020-04-03 16:01:03 +08:00
add_subdirectory(protocol/framework)
2018-09-05 11:26:21 +08:00
add_subdirectory(tup)
add_subdirectory(libservant)
install(DIRECTORY servant DESTINATION include)
2021-09-16 18:56:19 +08:00
install(DIRECTORY promise DESTINATION include)
2018-09-05 11:26:21 +08:00
install(DIRECTORY tup DESTINATION include)
install(DIRECTORY jmem DESTINATION include)
2020-03-09 16:25:36 +08:00
install(DIRECTORY script DESTINATION .
PATTERN "*.sh"
2020-03-28 14:03:51 +08:00
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE)
2018-09-05 11:26:21 +08:00
install(DIRECTORY makefile DESTINATION .)