2013-09-28 17:59:50 +08:00
|
|
|
# CMakeLists.txt for the ZoneMinder binaries
|
|
|
|
|
|
|
|
# Create files from the .in files
|
2021-04-07 05:21:47 +08:00
|
|
|
configure_file(zm_config_data.h.in "${CMAKE_BINARY_DIR}/zm_config_data.h" @ONLY)
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2017-12-01 04:19:31 +08:00
|
|
|
# Group together all the source files that are used by all the binaries (zmc, zmu, zms etc)
|
2018-05-11 05:46:46 +08:00
|
|
|
set(ZM_BIN_SRC_FILES
|
|
|
|
zm_analysis_thread.cpp
|
2022-01-05 01:58:19 +08:00
|
|
|
zm_poll_thread.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm_buffer.cpp
|
|
|
|
zm_camera.cpp
|
|
|
|
zm_comms.cpp
|
|
|
|
zm_config.cpp
|
|
|
|
zm_curl_camera.cpp
|
2019-08-23 00:57:00 +08:00
|
|
|
zm_crypt.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm.cpp
|
|
|
|
zm_db.cpp
|
2021-03-16 03:08:43 +08:00
|
|
|
zm_decoder_thread.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm_logger.cpp
|
|
|
|
zm_event.cpp
|
|
|
|
zm_eventstream.cpp
|
|
|
|
zm_exception.cpp
|
2019-08-23 00:57:00 +08:00
|
|
|
zm_fifo.cpp
|
2021-03-02 02:49:17 +08:00
|
|
|
zm_fifo_debug.cpp
|
|
|
|
zm_fifo_stream.cpp
|
2020-12-08 05:26:26 +08:00
|
|
|
zm_file_camera.cpp
|
|
|
|
zm_font.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm_frame.cpp
|
|
|
|
zm_group.cpp
|
|
|
|
zm_image.cpp
|
|
|
|
zm_jpeg.cpp
|
|
|
|
zm_libvlc_camera.cpp
|
2020-07-22 05:38:32 +08:00
|
|
|
zm_libvnc_camera.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm_local_camera.cpp
|
|
|
|
zm_monitor.cpp
|
|
|
|
zm_monitorstream.cpp
|
|
|
|
zm_ffmpeg.cpp
|
2020-12-08 05:26:26 +08:00
|
|
|
zm_ffmpeg_camera.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm_ffmpeg_input.cpp
|
|
|
|
zm_mpeg.cpp
|
|
|
|
zm_packet.cpp
|
|
|
|
zm_packetqueue.cpp
|
|
|
|
zm_poly.cpp
|
|
|
|
zm_regexp.cpp
|
|
|
|
zm_remote_camera.cpp
|
|
|
|
zm_remote_camera_http.cpp
|
|
|
|
zm_remote_camera_nvsocket.cpp
|
|
|
|
zm_remote_camera_rtsp.cpp
|
|
|
|
zm_rtp.cpp
|
|
|
|
zm_rtp_ctrl.cpp
|
|
|
|
zm_rtp_data.cpp
|
|
|
|
zm_rtp_source.cpp
|
|
|
|
zm_rtsp.cpp
|
|
|
|
zm_rtsp_auth.cpp
|
2021-02-28 01:26:37 +08:00
|
|
|
zm_rtsp_server_fifo_source.cpp
|
2021-03-11 00:01:04 +08:00
|
|
|
zm_rtsp_server_fifo_adts_source.cpp
|
|
|
|
zm_rtsp_server_fifo_h264_source.cpp
|
2021-03-02 05:46:29 +08:00
|
|
|
zm_rtsp_server_fifo_audio_source.cpp
|
2021-02-28 01:26:37 +08:00
|
|
|
zm_rtsp_server_fifo_video_source.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm_sdp.cpp
|
|
|
|
zm_signal.cpp
|
|
|
|
zm_stream.cpp
|
|
|
|
zm_swscale.cpp
|
2021-12-17 05:30:26 +08:00
|
|
|
zm_time.cpp
|
2018-12-27 01:02:00 +08:00
|
|
|
zm_user.cpp
|
|
|
|
zm_utils.cpp
|
|
|
|
zm_videostore.cpp
|
|
|
|
zm_zone.cpp
|
|
|
|
zm_storage.cpp)
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2022-01-05 01:58:19 +08:00
|
|
|
if(GSOAP_FOUND)
|
|
|
|
set(ZM_BIN_SRC_FILES
|
|
|
|
${ZM_BIN_SRC_FILES}
|
|
|
|
${CMAKE_BINARY_DIR}/generated/soapPullPointSubscriptionBindingProxy.cpp
|
|
|
|
${CMAKE_BINARY_DIR}/generated/soapC.cpp
|
|
|
|
${GSOAP_PLUGIN_DIR}/smdevp.c
|
|
|
|
${GSOAP_PLUGIN_DIR}/mecevp.c
|
|
|
|
${GSOAP_PLUGIN_DIR}/wsaapi.c
|
|
|
|
${GSOAP_PLUGIN_DIR}/wsseapi.c
|
|
|
|
${GSOAP_PLUGIN_DIR}/../custom/struct_timeval.c
|
|
|
|
)
|
|
|
|
|
|
|
|
SET(GCC_COMPILE_FLAGS "-DWITH_OPENSSL -DWITH_DOM")
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMPILE_FLAGS}")
|
|
|
|
|
|
|
|
#Create the directory that will host files generated by GSOAP
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
|
|
|
|
|
|
|
|
#some files are generated by gsoap
|
|
|
|
set_source_files_properties( ${CMAKE_BINARY_DIR}/generated/soapClientLib.c PROPERTIES GENERATED TRUE )
|
|
|
|
set_source_files_properties( ${CMAKE_BINARY_DIR}/generated/soapC.c PROPERTIES GENERATED TRUE )
|
|
|
|
set_source_files_properties( ${CMAKE_BINARY_DIR}/generated/soapPullPointSubscriptionBindingProxy.cpp PROPERTIES GENERATED TRUE )
|
|
|
|
set_source_files_properties( ${GSOAP_PLUGIN_DIR}/smdevp.c PROPERTIES LANGUAGE CXX)
|
|
|
|
set_source_files_properties( ${GSOAP_PLUGIN_DIR}/mecevp.c PROPERTIES LANGUAGE CXX)
|
|
|
|
set_source_files_properties( ${GSOAP_PLUGIN_DIR}/wsaapi.c PROPERTIES LANGUAGE CXX)
|
|
|
|
set_source_files_properties( ${GSOAP_PLUGIN_DIR}/wsseapi.c PROPERTIES LANGUAGE CXX)
|
|
|
|
set_source_files_properties( ${GSOAP_PLUGIN_DIR}/../custom/struct_timeval.c PROPERTIES LANGUAGE CXX)
|
|
|
|
|
|
|
|
#Create a cmake target that generate gsoap files
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/generated/soapC.cpp
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/generated/soapPullPointSubscriptionBindingProxy.cpp
|
|
|
|
COMMAND ${GSOAP_WSDL2H} -d -P -O2 -o ${CMAKE_BINARY_DIR}/generated/bindings.h http://www.onvif.org/onvif/ver10/events/wsdl/event.wsdl
|
|
|
|
COMMAND echo '\#import \"wsse.h\"' >> ${CMAKE_BINARY_DIR}/generated/bindings.h
|
|
|
|
COMMAND echo '\#import \"struct_timeval.h\"' >> ${CMAKE_BINARY_DIR}/generated/bindings.h
|
|
|
|
COMMAND ${GSOAP_SOAPCPP2} -n -2 -C -I ${GSOAP_PLUGIN_DIR}/.. -I ${GSOAP_PLUGIN_DIR}/../import/ -I ${GSOAP_PLUGIN_DIR}/../custom/ -d ${CMAKE_BINARY_DIR}/generated -j -x ${CMAKE_BINARY_DIR}/generated/bindings.h
|
|
|
|
COMMENT "CREATING STUBS AND GLUE CODE"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(GSOAP_GENERATION_TARGET
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/generated/soapC.cpp
|
|
|
|
DEPENDS ${CMAKE_BINARY_DIR}/generated/soapPullPointSubscriptionBindingProxy.cpp
|
|
|
|
DEPENDS ${GSOAP_PLUGIN_DIR}/smdevp.c
|
|
|
|
DEPENDS ${GSOAP_PLUGIN_DIR}/mecevp.c
|
|
|
|
DEPENDS ${GSOAP_PLUGIN_DIR}/wsaapi.c
|
|
|
|
DEPENDS ${GSOAP_PLUGIN_DIR}/wsseapi.c
|
|
|
|
DEPENDS ${GSOAP_PLUGIN_DIR}/../custom/struct_timeval.c
|
|
|
|
)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
# A fix for cmake recompiling the source files for every target.
|
|
|
|
add_library(zm STATIC ${ZM_BIN_SRC_FILES})
|
2021-02-03 05:57:50 +08:00
|
|
|
|
|
|
|
target_include_directories(zm
|
|
|
|
PUBLIC
|
2021-04-07 05:21:47 +08:00
|
|
|
${CMAKE_BINARY_DIR}
|
2021-02-03 05:57:50 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
2022-01-05 01:58:19 +08:00
|
|
|
if(GSOAP_FOUND)
|
|
|
|
target_include_directories(zm
|
|
|
|
PUBLIC
|
|
|
|
${CMAKE_BINARY_DIR}/generated
|
|
|
|
${GSOAP_PLUGIN_DIR}/..
|
|
|
|
${GSOAP_INCLUDE_DIR})
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2021-02-09 05:36:34 +08:00
|
|
|
target_link_libraries(zm
|
2021-02-28 01:18:35 +08:00
|
|
|
PUBLIC
|
2021-06-05 20:00:21 +08:00
|
|
|
FFMPEG::avcodec
|
2021-06-05 19:54:46 +08:00
|
|
|
FFMPEG::avformat
|
2021-06-05 17:58:44 +08:00
|
|
|
FFMPEG::avutil
|
2021-06-05 20:19:32 +08:00
|
|
|
FFMPEG::swresample
|
2021-06-05 20:12:20 +08:00
|
|
|
FFMPEG::swscale
|
2021-02-28 02:06:08 +08:00
|
|
|
libbcrypt::bcrypt
|
2021-03-11 00:01:04 +08:00
|
|
|
RtspServer::RtspServer
|
2021-04-12 15:26:48 +08:00
|
|
|
martinmoene::span-lite
|
2021-06-05 02:44:55 +08:00
|
|
|
${ZM_BIN_LIBS}
|
2021-02-09 05:36:34 +08:00
|
|
|
PRIVATE
|
|
|
|
zm-core-interface)
|
|
|
|
|
2022-01-05 01:58:19 +08:00
|
|
|
if(GSOAP_FOUND)
|
|
|
|
target_link_libraries(zm
|
|
|
|
PUBLIC
|
|
|
|
${GSOAP_CXX_LIBRARIES}
|
|
|
|
${GSOAP_SSL_CXX_LIBRARIES}
|
|
|
|
${OPENSSL_SSL_LIBRARY}
|
|
|
|
${OPENSSL_CRYPTO_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2021-05-24 21:34:59 +08:00
|
|
|
if(${ZM_JWT_BACKEND} STREQUAL "jwt_cpp")
|
|
|
|
target_link_libraries(zm
|
|
|
|
PUBLIC
|
|
|
|
jwt-cpp::jwt-cpp)
|
|
|
|
elseif(${ZM_JWT_BACKEND} STREQUAL "libjwt")
|
|
|
|
target_link_libraries(zm
|
|
|
|
PUBLIC
|
|
|
|
JWT::libjwt)
|
|
|
|
endif()
|
|
|
|
|
2021-09-08 05:15:40 +08:00
|
|
|
if(TARGET V4L2::videodev2)
|
|
|
|
target_link_libraries(zm
|
|
|
|
PRIVATE
|
|
|
|
V4L2::videodev2)
|
|
|
|
endif()
|
|
|
|
|
2013-09-28 17:59:50 +08:00
|
|
|
add_executable(zmc zmc.cpp)
|
|
|
|
add_executable(zms zms.cpp)
|
2021-02-28 01:26:37 +08:00
|
|
|
add_executable(zmu zmu.cpp)
|
2021-10-12 03:44:58 +08:00
|
|
|
add_executable(zmbenchmark zmbenchmark.cpp)
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2022-01-05 01:58:19 +08:00
|
|
|
if(GSOAP_FOUND)
|
|
|
|
#Make sure that the client is compiled only after gsoap has been processed
|
|
|
|
add_dependencies(zmc GSOAP_GENERATION_TARGET)
|
|
|
|
endif()
|
|
|
|
|
2021-02-09 05:36:34 +08:00
|
|
|
target_link_libraries(zmc
|
|
|
|
PRIVATE
|
|
|
|
zm-core-interface
|
|
|
|
zm
|
|
|
|
${ZM_EXTRA_LIBS}
|
|
|
|
${CMAKE_DL_LIBS})
|
|
|
|
|
|
|
|
target_link_libraries(zms
|
|
|
|
PRIVATE
|
|
|
|
zm-core-interface
|
|
|
|
zm
|
|
|
|
${ZM_EXTRA_LIBS}
|
2021-02-28 02:06:08 +08:00
|
|
|
${CMAKE_DL_LIBS})
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2021-02-28 01:26:37 +08:00
|
|
|
target_link_libraries(zmu
|
|
|
|
PRIVATE
|
|
|
|
zm-core-interface
|
|
|
|
zm
|
|
|
|
${ZM_EXTRA_LIBS}
|
2021-06-05 02:44:55 +08:00
|
|
|
${CMAKE_DL_LIBS})
|
2021-02-28 01:26:37 +08:00
|
|
|
|
2021-10-12 03:44:58 +08:00
|
|
|
target_link_libraries(zmbenchmark
|
|
|
|
PRIVATE
|
|
|
|
zm-core-interface
|
|
|
|
zm
|
|
|
|
${ZM_EXTRA_LIBS}
|
|
|
|
${CMAKE_DL_LIBS})
|
|
|
|
|
2015-06-21 06:33:13 +08:00
|
|
|
# Generate man files for the binaries destined for the bin folder
|
2021-02-04 04:22:28 +08:00
|
|
|
if(BUILD_MAN)
|
|
|
|
foreach(CBINARY zmc zmu)
|
2020-08-07 13:54:58 +08:00
|
|
|
POD2MAN(${CMAKE_CURRENT_SOURCE_DIR}/${CBINARY}.cpp ${CBINARY} 8 ${ZM_MANPAGE_DEST_PREFIX})
|
2021-02-04 04:22:28 +08:00
|
|
|
endforeach(CBINARY zmc zmu)
|
|
|
|
endif()
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2021-02-28 01:39:24 +08:00
|
|
|
install(TARGETS zmc zmu RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
2015-04-13 00:47:28 +08:00
|
|
|
install(TARGETS zms RUNTIME DESTINATION "${ZM_CGIDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
2015-10-25 08:07:42 +08:00
|
|
|
install(CODE "execute_process(COMMAND ln -sf zms nph-zms WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/nph-zms DESTINATION "${ZM_CGIDIR}")
|
2013-09-28 17:59:50 +08:00
|
|
|
|
2021-02-28 01:39:24 +08:00
|
|
|
if(HAVE_RTSP_SERVER)
|
|
|
|
add_executable(zm_rtsp_server zm_rtsp_server.cpp)
|
|
|
|
target_link_libraries(zm_rtsp_server
|
|
|
|
PRIVATE
|
|
|
|
zm-core-interface
|
|
|
|
zm
|
|
|
|
${ZM_EXTRA_LIBS}
|
2021-06-05 02:44:55 +08:00
|
|
|
${CMAKE_DL_LIBS})
|
2021-02-28 01:39:24 +08:00
|
|
|
install(TARGETS zm_rtsp_server RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
|
|
|
endif()
|