2019-09-26 11:33:58 +00:00
|
|
|
link_libraries(${PROJECT_NAME})
|
2019-08-08 07:17:09 +00:00
|
|
|
|
|
|
|
file(GLOB SCP_LIST ${CMAKE_CURRENT_SOURCE_DIR}/simple_example/*.csp)
|
|
|
|
foreach(cspFile ${SCP_LIST})
|
2019-08-31 00:27:57 +00:00
|
|
|
message(STATUS "cspFile:" ${cspFile})
|
2020-01-25 03:58:20 +00:00
|
|
|
get_filename_component(classname ${cspFile} NAME_WE)
|
2019-08-31 00:27:57 +00:00
|
|
|
message(STATUS "view classname:" ${classname})
|
|
|
|
add_custom_command(OUTPUT ${classname}.h ${classname}.cc
|
|
|
|
COMMAND drogon_ctl
|
|
|
|
ARGS
|
|
|
|
create
|
|
|
|
view
|
|
|
|
${cspFile}
|
|
|
|
DEPENDS ${cspFile}
|
|
|
|
VERBATIM)
|
|
|
|
set(VIEWSRC ${VIEWSRC} ${classname}.cc)
|
2019-08-08 07:17:09 +00:00
|
|
|
endforeach()
|
2018-05-30 05:23:59 +00:00
|
|
|
|
2019-08-31 00:27:57 +00:00
|
|
|
set(simple_example_sources
|
|
|
|
simple_example/CustomCtrl.cc
|
|
|
|
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
|
2020-06-07 06:43:05 +00:00
|
|
|
simple_example/DigestAuthFilter.cc
|
2019-08-31 00:27:57 +00:00
|
|
|
simple_example/main.cc)
|
2018-05-30 05:23:59 +00:00
|
|
|
|
2019-08-08 07:17:09 +00:00
|
|
|
add_executable(webapp ${simple_example_sources} ${VIEWSRC})
|
|
|
|
add_dependencies(webapp drogon_ctl)
|
2018-05-30 05:23:59 +00:00
|
|
|
|
2019-08-08 07:17:09 +00:00
|
|
|
set(client_example_sources client_example/main.cc)
|
2019-08-31 00:27:57 +00:00
|
|
|
set(benchmark_sources benchmark/BenchmarkCtrl.cc benchmark/JsonCtrl.cc
|
|
|
|
benchmark/main.cc)
|
|
|
|
# AUX_SOURCE_DIRECTORY(simple_example_test DIR_TEST)
|
2018-07-24 09:24:23 +00:00
|
|
|
|
2019-08-08 07:17:09 +00: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 09:53:02 +00:00
|
|
|
add_executable(multiple_ws_test simple_example_test/MultipleWsTest.cc)
|
2019-01-19 14:57:07 +00:00
|
|
|
|
2019-08-31 00:27:57 +00:00
|
|
|
add_custom_command(
|
|
|
|
TARGET webapp POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-E
|
|
|
|
copy_if_different
|
|
|
|
${PROJECT_SOURCE_DIR}/config.example.json
|
|
|
|
${PROJECT_SOURCE_DIR}/drogon.jpg
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/simple_example/index.html
|
2020-02-29 07:46:08 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/simple_example/index.html.gz
|
2019-08-31 00:27:57 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.pem
|
|
|
|
$<TARGET_FILE_DIR:webapp>)
|
2019-07-26 14:22:12 +00:00
|
|
|
|
2019-08-31 00:27:57 +00:00
|
|
|
set(example_targets
|
|
|
|
webapp
|
|
|
|
webapp_test
|
|
|
|
client
|
|
|
|
benchmark
|
|
|
|
pipelining_test
|
|
|
|
websocket_test
|
|
|
|
multiple_ws_test)
|
2019-07-26 14:22:12 +00:00
|
|
|
|
2019-08-31 00:27:57 +00:00
|
|
|
set_property(TARGET ${example_targets}
|
|
|
|
PROPERTY CXX_STANDARD ${DROGON_CXX_STANDARD})
|
2019-08-08 07:17:09 +00:00
|
|
|
set_property(TARGET ${example_targets} PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
|
|
set_property(TARGET ${example_targets} PROPERTY CXX_EXTENSIONS OFF)
|
2020-03-05 14:03:41 +00:00
|
|
|
set_property(TARGET webapp PROPERTY ENABLE_EXPORTS ON)
|