2019-08-08 15:17:09 +08:00
|
|
|
link_libraries(drogon trantor pthread dl)
|
|
|
|
|
|
|
|
file(GLOB SCP_LIST ${CMAKE_CURRENT_SOURCE_DIR}/simple_example/*.csp)
|
|
|
|
foreach(cspFile ${SCP_LIST})
|
|
|
|
message(STATUS "cspFile:" ${cspFile})
|
|
|
|
exec_program(basename ARGS "${cspFile} .csp" OUTPUT_VARIABLE classname)
|
|
|
|
message(STATUS "view classname:" ${classname})
|
|
|
|
add_custom_command(OUTPUT ${classname}.h ${classname}.cc
|
2018-05-30 13:23:59 +08:00
|
|
|
COMMAND drogon_ctl
|
|
|
|
ARGS create view ${cspFile}
|
|
|
|
DEPENDS ${cspFile}
|
|
|
|
VERBATIM )
|
2019-08-08 15:17:09 +08:00
|
|
|
set(VIEWSRC ${VIEWSRC} ${classname}.cc)
|
|
|
|
endforeach()
|
2018-05-30 13:23:59 +08:00
|
|
|
|
|
|
|
|
2019-08-08 15:17:09 +08:00
|
|
|
set(simple_example_sources simple_example/CustomCtrl.cc
|
2019-07-26 22:22:12 +08:00
|
|
|
simple_example/CustomHeaderFilter.cc
|
|
|
|
simple_example/DoNothingPlugin.cc
|
|
|
|
simple_example/ForwardCtrl.cc
|
|
|
|
simple_example/JsonTestController.cc
|
|
|
|
simple_example/ListParaCtl.cc
|
|
|
|
simple_example/PipeliningTest.cc
|
|
|
|
simple_example/TestController.cc
|
|
|
|
simple_example/TestPlugin.cc
|
|
|
|
simple_example/TestViewCtl.cc
|
|
|
|
simple_example/WebSocketTest.cc
|
|
|
|
simple_example/api_Attachment.cc
|
|
|
|
simple_example/api_v1_ApiTest.cc
|
|
|
|
simple_example/TimeFilter.cc
|
|
|
|
simple_example/main.cc)
|
2018-05-30 13:23:59 +08:00
|
|
|
|
2019-08-08 15:17:09 +08:00
|
|
|
add_executable(webapp ${simple_example_sources} ${VIEWSRC})
|
|
|
|
add_dependencies(webapp drogon_ctl)
|
2018-05-30 13:23:59 +08:00
|
|
|
|
2019-08-08 15:17:09 +08:00
|
|
|
set(client_example_sources client_example/main.cc)
|
|
|
|
set(benchmark_sources benchmark/BenchmarkCtrl.cc
|
2019-07-26 22:22:12 +08:00
|
|
|
benchmark/JsonCtrl.cc
|
|
|
|
benchmark/main.cc)
|
2019-03-12 18:21:35 +08:00
|
|
|
#AUX_SOURCE_DIRECTORY(simple_example_test DIR_TEST)
|
2018-07-24 17:24:23 +08:00
|
|
|
|
2019-08-08 15:17:09 +08:00
|
|
|
add_executable(client ${client_example_sources})
|
|
|
|
add_executable(benchmark ${benchmark_sources})
|
|
|
|
add_executable(webapp_test simple_example_test/main.cc)
|
|
|
|
add_executable(pipelining_test simple_example_test/HttpPipeliningTest.cc)
|
|
|
|
add_executable(websocket_test simple_example_test/WebSocketTest.cc)
|
2019-08-26 17:53:02 +08:00
|
|
|
add_executable(multiple_ws_test simple_example_test/MultipleWsTest.cc)
|
2019-01-19 22:57:07 +08:00
|
|
|
|
2019-08-08 15:17:09 +08:00
|
|
|
add_custom_command(TARGET webapp POST_BUILD
|
2019-05-03 14:44:20 +08:00
|
|
|
COMMAND gzip
|
|
|
|
ARGS -c ${CMAKE_CURRENT_SOURCE_DIR}/simple_example/index.html > ${CMAKE_CURRENT_BINARY_DIR}/index.html.gz
|
|
|
|
VERBATIM)
|
2019-08-08 15:17:09 +08:00
|
|
|
add_custom_command(TARGET webapp POST_BUILD
|
2019-01-19 22:57:07 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
2019-03-27 19:32:09 +08:00
|
|
|
${PROJECT_SOURCE_DIR}/config.example.json ${PROJECT_SOURCE_DIR}/drogon.jpg
|
2019-05-03 14:44:20 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/simple_example/index.html
|
2019-07-26 22:22:12 +08:00
|
|
|
${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.pem $<TARGET_FILE_DIR:webapp>)
|
|
|
|
|
2019-08-26 17:53:02 +08:00
|
|
|
set(example_targets webapp webapp_test client benchmark pipelining_test websocket_test multiple_ws_test)
|
2019-07-26 22:22:12 +08:00
|
|
|
|
2019-08-08 15:17:09 +08:00
|
|
|
set_property(TARGET ${example_targets} PROPERTY CXX_STANDARD ${DROGON_CXX_STANDARD})
|
|
|
|
set_property(TARGET ${example_targets} PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
|
|
set_property(TARGET ${example_targets} PROPERTY CXX_EXTENSIONS OFF)
|