|
| cmake_minimum_required (VERSION 2.6) project(MistServer) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy) include_directories($ |
|
| else () execute_process(COMMAND getconf LONG_BIT OUTPUT_VARIABLE RELEASE_RAW) set(RELEASE_RAW"Generic_$ |
|
| endif () string(STRIP $ |
|
| if (";${ARGN};"MATCHES";ts;") endif() endif() if(" |
|
| include_directories (${BINARY_DIR}) enable_testing() include(CTest) if(NOT CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX/usr) endif() if(RELEASE) set(RELEASE_RAW $ |
|
RELEASE | set (RELEASE\"${RELEASE}\" )
########################################
# Build Variables - Package Version #
########################################
#See if we have a git repo to get the version from
execute_process(COMMAND git describe --tags OUTPUT_VARIABLE PACKAGE_VERSION_RAW ERROR_QUIET)
if (NOT PACKAGE_VERSION_RAW)
execute_process(COMMAND cat VERSION OUTPUT_VARIABLE PACKAGE_VERSION_RAW ERROR_QUIET)
endif()
if (NOT PACKAGE_VERSION_RAW)
set(PACKAGE_VERSION_RAW Unknown)
endif()
#strip off the trailing spaces and newline
string(STRIP "${PACKAGE_VERSION_RAW}" PACKAGE_VERSION)
set(PACKAGE_VERSION \"${PACKAGE_VERSION}\" )
########################################
# Build Variables - Debug #
########################################
if (NOT DEBUG)
set(DEBUG 4)
endif()
########################################
# Build Variables - Shared Memory #
########################################
if (NOT DEFINED NOSHM )
add_definitions(-DSHM_ENABLED=1)
endif()
if (NOT DEFINED FILLER_DATA OR NOT DEFINED SHARED_SECRET OR NOT DEFINED SUPER_SECRET)#LTS
message(WARNING "Not all LTS variables have been set and this is an LTS build-are you sure about this?")#LTS
endif()#LTS
add_definitions(-DFILLER_DATA="${FILLER_DATA}" -DSHARED_SECRET="${SHARED_SECRET}" -DSUPER_SECRET="${SUPER_SECRET}")#LTS
if (DEFINED GEOIP )
add_definitions(-DGEOIP=1)
endif()
if (DEFINED BIGMETA )
add_definitions(-DBIGMETA=1)
endif()
if (NOT DEFINED NOUPDATE )
add_definitions(-DUPDATER=1)
endif()
if (DEFINED NOAUTH )
add_definitions(-DNOAUTH=1)
endif()
if (DEFINED KILLONEXIT )
add_definitions(-DKILLONEXIT=true)
endif()
########################################
# Build Variables - Thread Names #
########################################
if (DEFINED WITH_THREADNAMES )
add_definitions(-DWITH_THREADNAMES=1)
endif()
########################################
# Build Variables - No Crash Check #
########################################
if (DEFINED NOCRASHCHECK )
add_definitions(-DNOCRASHCHECK=1)
endif()
########################################
# Build Variables - Prepare for Build #
########################################
message("Builing release ${RELEASE}for version ${PACKAGE_VERSION}@debug level ${DEBUG}")
add_definitions(-g -funsigned-char -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG=${DEBUG} -DPACKAGE_VERSION=${PACKAGE_VERSION} -DRELEASE=${RELEASE})
########################################
# MistLib - Header Files #
########################################
set(libHeaders
${SOURCE_DIR}/lib/adts.h
${SOURCE_DIR}/lib/amf.h
${SOURCE_DIR}/lib/auth.h
${SOURCE_DIR}/lib/base64.h
${SOURCE_DIR}/lib/bitfields.h
${SOURCE_DIR}/lib/bitstream.h
${SOURCE_DIR}/lib/checksum.h
${SOURCE_DIR}/lib/config.h
${SOURCE_DIR}/lib/defines.h
${SOURCE_DIR}/lib/dtsc.h
${SOURCE_DIR}/lib/encryption.h
${SOURCE_DIR}/lib/flv_tag.h
${SOURCE_DIR}/lib/h264.h
${SOURCE_DIR}/lib/h265.h
${SOURCE_DIR}/lib/http_parser.h
${SOURCE_DIR}/lib/json.h
${SOURCE_DIR}/lib/mp4_adobe.h
${SOURCE_DIR}/lib/mp4_dash.cpp
${SOURCE_DIR}/lib/mp4_dash.h
${SOURCE_DIR}/lib/mp4_encryption.h
${SOURCE_DIR}/lib/mp4_generic.h
${SOURCE_DIR}/lib/mp4.h
${SOURCE_DIR}/lib/mp4_ms.h
${SOURCE_DIR}/lib/nal.h
${SOURCE_DIR}/lib/ogg.h
${SOURCE_DIR}/lib/procs.h
${SOURCE_DIR}/lib/rijndael.h
${SOURCE_DIR}/lib/rtmpchunks.h
${SOURCE_DIR}/lib/rtp.h
${SOURCE_DIR}/lib/shared_memory.h
${SOURCE_DIR}/lib/socket.h
${SOURCE_DIR}/lib/stream.h
${SOURCE_DIR}/lib/theora.h
${SOURCE_DIR}/lib/timing.h
${SOURCE_DIR}/lib/tinythread.h
${SOURCE_DIR}/lib/ts_packet.h
${SOURCE_DIR}/lib/ts_stream.h
${SOURCE_DIR}/lib/vorbis.h
${SOURCE_DIR}/lib/triggers.h
)
########################################
# MistLib - Source Files #
########################################
set(libSources
${SOURCE_DIR}/lib/adts.cpp
${SOURCE_DIR}/lib/amf.cpp
${SOURCE_DIR}/lib/auth.cpp
${SOURCE_DIR}/lib/base64.cpp
${SOURCE_DIR}/lib/bitfields.cpp
${SOURCE_DIR}/lib/bitstream.cpp
${SOURCE_DIR}/lib/config.cpp
${SOURCE_DIR}/lib/dtsc.cpp
${SOURCE_DIR}/lib/dtscmeta.cpp
${SOURCE_DIR}/lib/encryption.cpp
${SOURCE_DIR}/lib/flv_tag.cpp
${SOURCE_DIR}/lib/h264.cpp
${SOURCE_DIR}/lib/h265.cpp
${SOURCE_DIR}/lib/http_parser.cpp
${SOURCE_DIR}/lib/json.cpp
${SOURCE_DIR}/lib/mp4_adobe.cpp
${SOURCE_DIR}/lib/mp4.cpp
${SOURCE_DIR}/lib/mp4_dash.cpp
${SOURCE_DIR}/lib/mp4_encryption.cpp
${SOURCE_DIR}/lib/mp4_generic.cpp
${SOURCE_DIR}/lib/mp4_ms.cpp
${SOURCE_DIR}/lib/nal.cpp
${SOURCE_DIR}/lib/ogg.cpp
${SOURCE_DIR}/lib/procs.cpp
${SOURCE_DIR}/lib/rijndael.cpp
${SOURCE_DIR}/lib/rtmpchunks.cpp
${SOURCE_DIR}/lib/rtp.cpp
${SOURCE_DIR}/lib/shared_memory.cpp
${SOURCE_DIR}/lib/socket.cpp
${SOURCE_DIR}/lib/stream.cpp
${SOURCE_DIR}/lib/theora.cpp
${SOURCE_DIR}/lib/timing.cpp
${SOURCE_DIR}/lib/tinythread.cpp
${SOURCE_DIR}/lib/ts_packet.cpp
${SOURCE_DIR}/lib/ts_stream.cpp
${SOURCE_DIR}/lib/vorbis.cpp
${SOURCE_DIR}/lib/triggers.cpp
)
########################################
# MistLib - Build #
########################################
add_library (mist
${libHeaders}
${libSources}
)
if (NOT APPLE)
set (LIBRT -lrt)
endif()
target_link_libraries(mist
-lpthread
${LIBRT}
)
install(
FILES ${libHeaders}
DESTINATION include/mist
)
install(
TARGETS mist
DESTINATION lib
)
########################################
# MistLib - Local Header Install #
########################################
add_custom_command(TARGET mist
POST_BUILD
COMMAND mkdir -p ${BINARY_DIR}/mist
COMMAND cp ${libHeaders} ${BINARY_DIR}/mist
DEPENDS ${libHeaders}
)
########################################
# MistServer - Analysers ` #
########################################
macro(makeAnalyser analyserName format)
add_executable(MistAnalyser${analyserName}
src/analysers/${format}_analyser.cpp
)
target_link_libraries(MistAnalyser${analyserName}
mist
)
install(
TARGETS MistAnalyser${analyserName}
DESTINATION bin
)
endmacro()
makeAnalyser(RTMP rtmp)
makeAnalyser(FLV flv)
makeAnalyser(DTSC dtsc)
makeAnalyser(AMF amf)
makeAnalyser(MP4 mp4)
makeAnalyser(OGG ogg)
#makeAnalyser(RTP rtp) #LTS
makeAnalyser(RTSP rtsp_rtp) #LTS
makeAnalyser(TS ts) #LTS
makeAnalyser(TSStream tsstream) #LTS
makeAnalyser(Stats stats) #LTS
########################################
# MistServer - Inputs #
########################################
macro(makeInput inputName format)
if (";${ARGN};" MATCHES ";folder;")
set(mainScript src/input/mist_in_folder.cpp)
else()
set(mainScript src/input/mist_in.cpp)
endif()
add_executable(MistIn${inputName}
${mainScript}
src/input/input.cpp
src/input/input_${format}.cpp
src/io.cpp
)
#Set compile definitions
unset(my_definitions)
if (";${ARGN};" MATCHES ";nolock;")#Currently only used in TSStream
list(APPEND my_definitions "INPUT_NOLOCK")
endif()
if (";${ARGN};" MATCHES ";tslive;")
list(APPEND my_definitions "TSLIVE_INPUT")
endif()
list(APPEND my_definitions "INPUTTYPE=\"input_${format}.h\"") set_target_properties(MistIn $ |
|