TarsCloud_TarsCpp/examples/CMakeLists.txt

207 lines
10 KiB
CMake
Raw Normal View History

2020-02-01 14:24:43 +08:00
add_subdirectory(UtilDemo)
add_subdirectory(CoroutineDemo)
add_subdirectory(HttpDemo)
2020-02-08 20:10:02 +08:00
add_subdirectory(CustomDemo)
2020-02-14 14:07:16 +08:00
add_subdirectory(AuthDemo)
if(TARS_SSL)
add_subdirectory(SSLDemo)
endif()
add_subdirectory(PushDemo)
add_subdirectory(QuickStartDemo)
add_subdirectory(StressDemo)
add_subdirectory(UdpDemo)
set(WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
2020-02-27 17:16:51 +08:00
2020-02-07 13:50:04 +08:00
if(WIN32)
2020-02-19 22:24:48 +08:00
2020-02-07 13:50:04 +08:00
add_custom_target(run-quick-start
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS QuickStartDemo QuickStartDemoClient
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-quick-start.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call quick start")
2020-02-01 14:24:43 +08:00
2020-02-07 13:50:04 +08:00
add_custom_target(run-http
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS HttpServer HttpClient
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-http.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run http")
2020-02-02 15:42:56 +08:00
2020-02-14 14:07:16 +08:00
add_custom_target(run-auth
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
DEPENDS AuthServer AuthClient
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-auth.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
COMMENT "call run auth")
add_custom_target(run-udp
WORKING_DIRECTORY ${WORKING_DIRECTORY}
DEPENDS UdpServer UdpClient
USES_TERMINAL
COMMAND ../examples/scripts/run-udp.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMENT "call run udp")
2020-02-14 14:07:16 +08:00
if(TARS_HTTP2)
2020-02-19 22:24:48 +08:00
add_custom_target(run-http2
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS Http2Server Http2Client
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-http2.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run http2")
2020-02-14 14:07:16 +08:00
endif()
if(TARS_SSL)
2020-02-19 22:24:48 +08:00
add_custom_target(run-ssl
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS SSLServer SSLClient
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-ssl.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run ssl")
2020-02-14 14:07:16 +08:00
endif()
2020-02-12 10:55:00 +08:00
2020-02-07 13:50:04 +08:00
add_custom_target(run-co
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS CoroutineDemoAServer CoroutineDemoBServer CoroutineDemoClient testCoro testParallelCoro
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-co.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run co")
2020-02-08 20:10:02 +08:00
add_custom_target(run-custom
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS CustomServer CustomClient
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-custom.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run custom")
2020-02-08 20:10:02 +08:00
2020-02-07 13:50:04 +08:00
add_custom_target(run-push
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS PushServer PushClient
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-push.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run push")
2020-02-15 19:40:08 +08:00
if(TARS_SSL)
2020-02-19 22:24:48 +08:00
add_custom_target(run-all
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
DEPENDS QuickStartDemo QuickStartDemoClient HttpServer HttpClient AuthServer AuthClient SSLServer SSLClient CoroutineDemoAServer CoroutineDemoBServer CoroutineDemoClient testCoro testParallelCoro PushServer PushClient
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-quick-start.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-http.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-co.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-push.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-auth.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-ssl.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run all")
2020-02-15 19:40:08 +08:00
else()
2020-02-19 22:24:48 +08:00
add_custom_target(run-all
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:44:18 +08:00
USES_TERMINAL
2020-02-19 22:24:48 +08:00
DEPENDS QuickStartDemo QuickStartDemoClient HttpServer HttpClient AuthServer AuthClient CoroutineDemoAServer CoroutineDemoBServer CoroutineDemoClient testCoro testParallelCoro PushServer PushClient
COMMAND ../examples/scripts/run-quick-start.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-http.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-co.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-push.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND ../examples/scripts/run-auth.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-19 22:24:48 +08:00
COMMENT "call run all")
2020-02-15 19:40:08 +08:00
endif()
2020-02-07 13:50:04 +08:00
2020-02-19 22:24:48 +08:00
2020-02-14 14:07:16 +08:00
add_custom_target(run-kill
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-19 22:44:18 +08:00
USES_TERMINAL
COMMAND ../examples/scripts/run-kill.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
COMMENT "call run kill")
2020-02-07 13:50:04 +08:00
else(WIN32)
add_custom_target(run-quick-start
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-07 13:50:04 +08:00
DEPENDS QuickStartDemo QuickStartDemoClient
COMMAND sh ../examples/scripts/run-quick-start.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-07 13:50:04 +08:00
COMMENT "call quick start")
add_custom_target(run-http
WORKING_DIRECTORY ${WORKING_DIRECTORY}
DEPENDS HttpServer HttpClient
COMMAND sh ../examples/scripts/run-http.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMENT "call run http")
add_custom_target(run-udp
WORKING_DIRECTORY ${WORKING_DIRECTORY}
DEPENDS UdpServer UdpClient
COMMAND sh ../examples/scripts/run-udp.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMENT "call run udp")
2020-02-07 13:50:04 +08:00
2020-02-14 14:07:16 +08:00
add_custom_target(run-auth
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
DEPENDS AuthServer AuthClient
COMMAND sh ../examples/scripts/run-auth.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
COMMENT "call run auth")
if(TARS_HTTP2)
2020-02-12 10:55:00 +08:00
add_custom_target(run-http2
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-12 10:55:00 +08:00
DEPENDS Http2Server Http2Client
COMMAND sh ../examples/scripts/run-http2.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-12 10:55:00 +08:00
COMMENT "call run http2")
2020-02-14 14:07:16 +08:00
endif()
if(TARS_SSL)
add_custom_target(run-ssl
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
DEPENDS SSLServer SSLClient
COMMAND sh ../examples/scripts/run-ssl.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
COMMENT "call run ssl")
endif()
2020-02-12 10:55:00 +08:00
2020-02-07 13:50:04 +08:00
add_custom_target(run-co
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-07 13:50:04 +08:00
DEPENDS CoroutineDemoAServer CoroutineDemoBServer CoroutineDemoClient testCoro testParallelCoro
COMMAND sh ../examples/scripts/run-co.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-07 13:50:04 +08:00
COMMENT "call run co")
2020-02-08 20:10:02 +08:00
add_custom_target(run-custom
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-08 20:10:02 +08:00
DEPENDS CustomServer CustomClient
COMMAND sh ../examples/scripts/run-custom.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-08 20:10:02 +08:00
COMMENT "call run custom")
2020-02-07 13:50:04 +08:00
add_custom_target(run-push
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-07 13:50:04 +08:00
DEPENDS PushServer PushClient
COMMAND sh ../examples/scripts/run-push.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-07 13:50:04 +08:00
COMMENT "call run push")
2020-02-15 19:40:08 +08:00
if(TARS_SSL)
2020-02-07 13:50:04 +08:00
add_custom_target(run-all
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-15 19:40:08 +08:00
DEPENDS QuickStartDemo QuickStartDemoClient HttpServer HttpClient AuthServer AuthClient SSLServer SSLClient CoroutineDemoAServer CoroutineDemoBServer CoroutineDemoClient testCoro testParallelCoro PushServer PushClient
COMMAND sh ../examples/scripts/run-quick-start.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-http.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-co.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-push.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-auth.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-ssl.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-07 13:50:04 +08:00
COMMENT "call run all")
2020-02-15 19:40:08 +08:00
else()
add_custom_target(run-all
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
2020-02-15 19:40:08 +08:00
DEPENDS QuickStartDemo QuickStartDemoClient HttpServer HttpClient AuthServer AuthClient CoroutineDemoAServer CoroutineDemoBServer CoroutineDemoClient testCoro testParallelCoro PushServer PushClient
COMMAND sh ../examples/scripts/run-quick-start.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-http.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-co.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-push.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-auth.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-15 19:40:08 +08:00
COMMENT "call run all")
endif()
2020-02-14 14:07:16 +08:00
add_custom_target(run-kill
2020-02-27 17:16:51 +08:00
WORKING_DIRECTORY ${WORKING_DIRECTORY}
COMMAND sh ../examples/scripts/run-kill.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${WORKING_DIRECTORY}
2020-02-14 14:07:16 +08:00
COMMENT "call run kill")
2020-02-27 17:16:51 +08:00
endif(WIN32)