2019-08-31 00:27:57 +00:00
|
|
|
set(ctl_sources
|
|
|
|
cmd.cc
|
|
|
|
create.cc
|
|
|
|
create_controller.cc
|
|
|
|
create_filter.cc
|
|
|
|
create_model.cc
|
|
|
|
create_plugin.cc
|
|
|
|
create_project.cc
|
|
|
|
create_view.cc
|
|
|
|
help.cc
|
|
|
|
main.cc
|
|
|
|
press.cc
|
|
|
|
version.cc)
|
|
|
|
add_executable(_drogon_ctl
|
|
|
|
main.cc
|
|
|
|
cmd.cc
|
|
|
|
create.cc
|
|
|
|
create_view.cc)
|
2019-09-26 11:33:58 +00:00
|
|
|
target_link_libraries(_drogon_ctl ${PROJECT_NAME})
|
2022-06-29 09:29:20 +00:00
|
|
|
if (WIN32 AND BUILD_SHARED_LIBS)
|
2021-04-09 02:17:28 +00:00
|
|
|
set(DROGON_FILE $<TARGET_FILE:drogon>)
|
|
|
|
set(TRANTOR_FILE $<TARGET_FILE:trantor>)
|
|
|
|
add_custom_command(TARGET _drogon_ctl POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DCTL_FILE=${DROGON_FILE}
|
|
|
|
-DINSTALL_BIN_DIR=$<TARGET_FILE_DIR:_drogon_ctl>
|
|
|
|
-P
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CopyDlls.cmake)
|
|
|
|
add_custom_command(TARGET _drogon_ctl POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DCTL_FILE=${TRANTOR_FILE}
|
|
|
|
-DINSTALL_BIN_DIR=$<TARGET_FILE_DIR:_drogon_ctl>
|
|
|
|
-P
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CopyDlls.cmake)
|
|
|
|
endif()
|
2019-08-31 00:27:57 +00:00
|
|
|
file(GLOB SCP_LIST ${CMAKE_CURRENT_SOURCE_DIR}/templates/*.csp)
|
|
|
|
foreach(cspFile ${SCP_LIST})
|
|
|
|
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
|
2021-04-09 02:17:28 +00:00
|
|
|
COMMAND $<TARGET_FILE:_drogon_ctl>
|
2019-08-31 00:27:57 +00:00
|
|
|
ARGS
|
|
|
|
create
|
|
|
|
view
|
|
|
|
${cspFile}
|
|
|
|
DEPENDS ${cspFile}
|
|
|
|
VERBATIM)
|
|
|
|
set(TEMPL_SRC ${TEMPL_SRC} ${classname}.cc)
|
|
|
|
endforeach()
|
|
|
|
add_executable(drogon_ctl ${ctl_sources} ${TEMPL_SRC})
|
2019-09-26 11:33:58 +00:00
|
|
|
target_link_libraries(drogon_ctl PRIVATE ${PROJECT_NAME})
|
2019-08-31 00:27:57 +00:00
|
|
|
target_include_directories(drogon_ctl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
2020-05-23 02:47:24 +00:00
|
|
|
add_dependencies(drogon_ctl _drogon_ctl)
|
2020-01-25 03:58:20 +00:00
|
|
|
if(WIN32)
|
2022-05-23 06:29:04 +00:00
|
|
|
target_link_libraries(drogon_ctl PRIVATE ws2_32 Rpcrt4 iphlpapi)
|
2020-01-25 03:58:20 +00:00
|
|
|
endif(WIN32)
|
2021-07-15 15:57:12 +00:00
|
|
|
if(APPLE)
|
|
|
|
target_link_libraries(drogon_ctl PRIVATE resolv)
|
|
|
|
endif()
|
2019-08-08 07:17:09 +00:00
|
|
|
message(STATUS "bin:" ${INSTALL_BIN_DIR})
|
2019-08-31 00:27:57 +00:00
|
|
|
install(TARGETS drogon_ctl RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
2020-02-29 07:46:08 +00:00
|
|
|
if(WIN32)
|
|
|
|
set(CTL_FILE $<TARGET_FILE:drogon_ctl>)
|
|
|
|
add_custom_command(TARGET drogon_ctl POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DCTL_FILE=${CTL_FILE}
|
|
|
|
-DINSTALL_BIN_DIR=${INSTALL_BIN_DIR}
|
2021-04-09 02:17:28 +00:00
|
|
|
-DRENAME_EXE=ON
|
2020-02-29 07:46:08 +00:00
|
|
|
-P
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/CopyDlls.cmake)
|
|
|
|
else(WIN32)
|
|
|
|
install(CODE "execute_process( \
|
2019-11-12 03:34:01 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink \
|
2020-03-18 11:54:48 +00:00
|
|
|
./drogon_ctl \
|
|
|
|
./dg_ctl \
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dg_ctl"
|
|
|
|
DESTINATION ${INSTALL_BIN_DIR})
|
2020-02-29 07:46:08 +00:00
|
|
|
endif(WIN32)
|
2019-08-31 00:27:57 +00:00
|
|
|
set(ctl_targets _drogon_ctl drogon_ctl)
|
|
|
|
set_property(TARGET ${ctl_targets} PROPERTY CXX_STANDARD ${DROGON_CXX_STANDARD})
|
|
|
|
set_property(TARGET ${ctl_targets} PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
|
|
set_property(TARGET ${ctl_targets} PROPERTY CXX_EXTENSIONS OFF)
|