分类: LINUX
2009-06-30 10:04:00
11,Cmake中的总工程和子工程
2 总工程
CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
PROJECT(IPCamPlatform)
##INCLUDE Paths
#libyyy
SET(libyyy_INCS
${CMAKE_SOURCE_DIR}/libyyy/include)
IF(UNIX)
SET(libyyy_INCS ${libyyy_INCS}
${CMAKE_SOURCE_DIR}/libyyy/platform/linux)
ENDIF(UNIX)
#libzzz
SET(libzzz_INCS
${CMAKE_SOURCE_DIR}/libzzz/include)
#libxxx
SET(libxxx_INCS
${CMAKE_SOURCE_DIR}/libxxx/include)
#exmp4dss
SET(exmp4dss_INCS
${CMAKE_SOURCE_DIR}/exmp4dss/include)
#other INC
SET(other_INCS
# ../${CMAKE_SOURCE_DIR}
/opt/RtspSvr
)
## Cflags
IF(UNIX)
SET(CMAKE_C_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
SET(CMAKE_CXX_FLAGS "-Wall -ggdb -pipe -march=i386 -mtune=i686")
ENDIF(UNIX)
## Defines
#SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
ADD_DEFINITIONS(-DOSIP_MT -D_DEBUG)
IF(UNIX)
ADD_DEFINITIONS(-DLINUX)
ADD_DEFINITIONS(-D_GNU_SOURCE)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
ENDIF(UNIX)
ADD_DEFINITIONS(-DPCBUILD -DCAMzzz)
ADD_DEFINITIONS(-D__COMMON_TYPE_DEF__)
ADD_SUBDIRECTORY(libyyy)
ADD_SUBDIRECTORY(libzzz)
ADD_SUBDIRECTORY(libxxx)
ADD_SUBDIRECTORY(RtspSvr)
ADD_SUBDIRECTORY(exmp4dss)
ADD_SUBDIRECTORY(exDSS)
ADD_SUBDIRECTORY(exmp4live)
3,其中一个子工程
SET(libxxx_SRCS
include/xxx2/sec_message_gen.h
include/xxx2/xxx2.h
include/xxx2/xxx_event.h
include/xxx.h
src/udp.c
src/sec_message_gen.c
src/jresponse.c
src/eXutils.c
src/xxx2.c
src/xxx_speedctl.c
src/xxx_reg.c
src/xxx_query.c
src/xxx_playback.c
src/xxx_event.c
src/xxx_disconnect.c
src/xxx_dialog.c
src/xxx_connect.c
src/xxx_callback.c
src/xxx_alarm.c
src/xxx.c
)
INCLUDE_DIRECTORIES(
${libyyy_INCS}
${libzzz_INCS}
${libxxx_INCS}
${libxxx_INCS}/xxx2
)
ADD_LIBRARY(libxxx ${libxxx_SRCS})
TARGET_LINK_LIBRARIES(libxxx libzzz libyyy)
ADD_SUBDIRECTORY(xxx_sample)
4,其中一个执行工程
SET(RtspSvr_SRCS
src/6666/include/777mon.h
#src/6666/include/Mgt.h
src/6666/include/mmAaaa.h
#src/6666/gt.cpp
src/6666/mmAaaa.cpp
src/6666/ common.h
src/6666/dolog.h
src/6666/ipcerrno.h
src/6666/Low777.h
src/6666/mempool.h
src/6666/mod_common.h
src/6666/rtp.h
src/6666/seqfifo.h
src/6666/ttttframe.h
src/6666/ttttmod_common.h
src/6666/ttttrtp.h
src/6666/ttttrtp_play.h
src/6666/ttttrtp_rec.h
src/6666/ttttutil.h
src/6666/dolog.c
src/6666/mempool.c
src/6666/seqfifo.c
src/6666/ttttframe.c
src/6666/ttttrtp_play.c
src/6666/ttttrtp_rec.c
src/6666/ttttutil.c
src/6666/Low777.cpp
src/g_common.h
src/InteractAaaa.h
#src/RtspAaaa.h
src/InteractAaaa.cpp
src/Main.cpp
)
#####################add DSS###############################
#add DSS include
SET(DSS_TOP_INCS
${other_INCS}/DarwinStreamingSrvr5.5-Source
)
SET(DSS_INCS
/usr/local/include
/usr/include
${DSS_TOP_INCS}
${DSS_TOP_INCS}/QTFileLib
${DSS_TOP_INCS}/OSMemoryLib
${DSS_TOP_INCS}/RTSPClientLib
${DSS_TOP_INCS}/APIModules
${DSS_TOP_INCS}/APICommonCode
${DSS_TOP_INCS}/APIModules/OSMemory_Modules
${DSS_TOP_INCS}/APIModules/QTSSAccessLogModule
${DSS_TOP_INCS}/APIModules/QTSSFileModule
${DSS_TOP_INCS}/APIModules/QTSSFlowControlModule
${DSS_TOP_INCS}/APIModules/QTSSReflectorModule
${DSS_TOP_INCS}/APIModules/QTSSSvrControlModule
${DSS_TOP_INCS}/APIModules/QTSSWebDebugModule
${DSS_TOP_INCS}/APIModules/QTSSWebStatsModule
${DSS_TOP_INCS}/APIModules/QTSSAuthorizeModule
${DSS_TOP_INCS}/APIModules/QTSSPOSIXFileSysModule
${DSS_TOP_INCS}/APIModules/QTSSAdminModule
${DSS_TOP_INCS}/APIModules/QTSSMP3StreamingModule
${DSS_TOP_INCS}/APIModules/QTSSRTPFileModule
${DSS_TOP_INCS}/APIModules/QTSSAccessModule
${DSS_TOP_INCS}/APIModules/QTSSHttpFileModule
${DSS_TOP_INCS}/QTFileTools/RTPFileGen.tproj
${DSS_TOP_INCS}/APIStubLib
${DSS_TOP_INCS}/CommonUtilitiesLib
${DSS_TOP_INCS}/RTCPUtilitiesLib
${DSS_TOP_INCS}/HTTPUtilitiesLib
${DSS_TOP_INCS}/RTPMetaInfoLib
${DSS_TOP_INCS}/PrefsSourceLib
${DSS_TOP_INCS}/Server.tproj
)
#add DSS library
SET(DSS_LIBS_DIR
${DSS_TOP_INCS}/
${DSS_TOP_INCS}/QTFileLib
${DSS_TOP_INCS}/CommonUtilitiesLib
)
#######################add DSS end########################
######################add mp4live#########################
#add mp4live include
SET(mp4livelib_INCS
${other_INCS}/mpeg4ip-1.6/lib/
)
SET(mp4live_INCS
${other_INCS}/mpeg4ip-1.6/server/mp4live
/usr/local/include
${mp4livelib_INCS}/ffmpeg
${mp4livelib_INCS}/mp4v2
${mp4livelib_INCS}/mp4av
${mp4livelib_INCS}/msg_queue
${mp4livelib_INCS}/rtp
${mp4livelib_INCS}/sdp
${mp4livelib_INCS}/utils
${mp4livelib_INCS}
${mp4livelib_INCS}/mpeg2ps
${mp4livelib_INCS}/srtp
${other_INCS}/mpeg4ip-1.6/include
/usr/include/SDL
)
#add mp4live library
SET(mp4live_LIBS_DIR
${other_INCS}/mpeg4ip-1.6/server/mp4live/.libs
${other_INCS}/mpeg4ip-1.6/server/mp4live/h261/.libs
${mp4livelib_INCS}/ffmpeg/.libs
${mp4livelib_INCS}/mp4v2/.libs
${mp4livelib_INCS}/mp4av/.libs
${mp4livelib_INCS}/msg_queue/.libs
${mp4livelib_INCS}/rtp/.libs
${mp4livelib_INCS}/sdp/.libs
${mp4livelib_INCS}/utils/.libs
${mp4livelib_INCS}
${mp4livelib_INCS}/mpeg2ps/.libs
${mp4livelib_INCS}/srtp/.libs
/usr/lib
/usr/local/lib
)
#####################mp4live end##########################
#######################exmp4dss############################
#add exmp4dss include
#add exmp4dss lib
#######################exmp4dss end########################
INCLUDE_DIRECTORIES(
${libutility_INCS}
${libsignal_INCS}
${libxxx_INCS}
${777AKE_SOURCE_DIR}/RtspSvr/src/6666/include
${777AKE_SOURCE_DIR}/RtspSvr/src/6666/777
${777AKE_SOURCE_DIR}/RtspSvr/include
########add DSS inc#########
${DSS_INCS}
#####add mp4live inc###########
${mp4live_INCS}
#####add exmp4dss include######
${exmp4dss_INCS}
)
LINK_DIRECTORIES(
#########add DSS lib #############
${DSS_LIBS_DIR}
#####add mp4live lib###########
${mp4live_LIBS_DIR}
#####add x264dec lib###########
${777AKE_SOURCE_DIR}/RtspSvr/lib
)
ADD_EXECUTABLE(RtspSvr ${RtspSvr_SRCS})
TARGET_LINK_LIBRARIES(RtspSvr libxxx pthread x264dec
exmp4dss DarwinStreamingServer QTFileLib QTFileExternalLib CommonUtilitiesLib pthread dl crypt
mp4live ortp mediastreamer mpeg4ip_ffmpeg msg_queue mp4v2 sdp mpeg4ip_gnu srtpif mp4av mutex utils uclmmbase avcodec SDL z avutil vorbis vorbisenc)
#-L${777AKE_SOURCE_DIR}/RtspSvr/lib -lx264dec
使用:
在源文件的同一目录下建立一个build_src,进入build_src,输入命令cmake ../src;成功后输入命令make。