添加对mac的支持

This commit is contained in:
xiongziliang 2017-05-11 18:03:06 +08:00
parent 1a6840d3be
commit a4233bdeb8
5 changed files with 42 additions and 10 deletions

View File

@ -23,7 +23,7 @@ endforeach(SUB_DIR ${SUB_DIR_LIST})
#openssl #openssl
find_package(OpenSSL QUIET) find_package(OPENSSL QUIET)
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
message(STATUS "找到openssl库:\"${OPENSSL_INCLUDE_DIR}\",ENABLE_OPENSSL宏已打开") message(STATUS "找到openssl库:\"${OPENSSL_INCLUDE_DIR}\",ENABLE_OPENSSL宏已打开")
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
@ -90,6 +90,37 @@ if(NOT IOS)
add_library(${CMAKE_PROJECT_NAME}_shared SHARED ${SRC_LIST}) add_library(${CMAKE_PROJECT_NAME}_shared SHARED ${SRC_LIST})
set_target_properties(${CMAKE_PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}") set_target_properties(${CMAKE_PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}")
install(TARGETS ${CMAKE_PROJECT_NAME}_shared LIBRARY DESTINATION lib) install(TARGETS ${CMAKE_PROJECT_NAME}_shared LIBRARY DESTINATION lib)
#mp4v2
if(MP4V2_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${MP4V2_LIBRARY})
endif(MP4V2_FOUND)
#x264
if(X264_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${X264_LIBRARIES})
endif(X264_FOUND)
#faac
if(FAAC_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${FAAC_LIBRARY})
endif(FAAC_FOUND)
#ZLToolKit
if(ZLTOOLKIT_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${ZLTOOLKIT_LIBRARY})
endif(ZLTOOLKIT_FOUND)
#openssl
if(OPENSSL_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${OPENSSL_LIBRARYS})
endif(OPENSSL_FOUND)
#mysql
if(MYSQL_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${MYSQL_LIBRARYS})
endif(MYSQL_FOUND)
endif(NOT IOS) endif(NOT IOS)
# #

View File

@ -31,7 +31,7 @@ class Mp4Info
public: public:
time_t ui64StartedTime; //GMT标准时间单位秒 time_t ui64StartedTime; //GMT标准时间单位秒
time_t ui64TimeLen;//录像长度,单位秒 time_t ui64TimeLen;//录像长度,单位秒
__off_t ui64FileSize;//文件大小单位BYTE off_t ui64FileSize;//文件大小单位BYTE
string strFilePath;//文件路径 string strFilePath;//文件路径
string strFileName;//文件名称 string strFileName;//文件名称
string strFolder;//文件夹路径 string strFolder;//文件夹路径

View File

@ -39,37 +39,37 @@ target_link_libraries(${TEST_EXE_NAME} ${CMAKE_PROJECT_NAME}_shared pthread)
#mp4v2 #mp4v2
if(MP4V2_FOUND) if(MP4V2_FOUND)
target_link_libraries(${TEST_EXE_NAME} mp4v2) target_link_libraries(${TEST_EXE_NAME} ${MP4V2_LIBRARY})
endif(MP4V2_FOUND) endif(MP4V2_FOUND)
#x264 #x264
if(X264_FOUND) if(X264_FOUND)
target_link_libraries(${TEST_EXE_NAME} x264) target_link_libraries(${TEST_EXE_NAME} ${X264_LIBRARIES})
endif(X264_FOUND) endif(X264_FOUND)
#faac #faac
if(FAAC_FOUND) if(FAAC_FOUND)
target_link_libraries(${TEST_EXE_NAME} faac) target_link_libraries(${TEST_EXE_NAME} ${FAAC_LIBRARY})
endif(FAAC_FOUND) endif(FAAC_FOUND)
#ZLToolKit #ZLToolKit
if(ZLTOOLKIT_FOUND) if(ZLTOOLKIT_FOUND)
target_link_libraries(${TEST_EXE_NAME} ZLToolKit) target_link_libraries(${TEST_EXE_NAME} ${ZLTOOLKIT_LIBRARY})
endif(ZLTOOLKIT_FOUND) endif(ZLTOOLKIT_FOUND)
#openssl #openssl
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
target_link_libraries(${TEST_EXE_NAME} ssl) target_link_libraries(${TEST_EXE_NAME} ${OPENSSL_LIBRARYS})
endif(OPENSSL_FOUND) endif(OPENSSL_FOUND)
#mysql #mysql
if(MYSQL_FOUND) if(MYSQL_FOUND)
target_link_libraries(${TEST_EXE_NAME} mysqlclient) target_link_libraries(${TEST_EXE_NAME} ${MYSQL_LIBRARYS})
endif(MYSQL_FOUND) endif(MYSQL_FOUND)
#link test_player #link test_player
if(TEST_EXE_NAME STREQUAL test_player) if(TEST_EXE_NAME STREQUAL test_player)
target_link_libraries(${TEST_EXE_NAME} SDL avcodec avutil) target_link_libraries(${TEST_EXE_NAME} ${SDL_LIBRARY} ${AVCODEC_LIBRARIES} ${AVUTIL_LIBRARIES})
endif(TEST_EXE_NAME STREQUAL test_player) endif(TEST_EXE_NAME STREQUAL test_player)
endforeach(TEST_SRC ${TEST_SRC_LIST}) endforeach(TEST_SRC ${TEST_SRC_LIST})

View File

@ -30,7 +30,7 @@ class H264Decoder
public: public:
H264Decoder(void){ H264Decoder(void){
avcodec_register_all(); avcodec_register_all();
AVCodec *pCodec = avcodec_find_decoder(CODEC_ID_H264); AVCodec *pCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
if (!pCodec) { if (!pCodec) {
throw std::runtime_error("未找到H264解码器"); throw std::runtime_error("未找到H264解码器");
} }

View File

@ -42,6 +42,7 @@ void programExit(int arg) {
EventPoller::Instance().shutdown(); EventPoller::Instance().shutdown();
} }
int main(int argc,char *argv[]){ int main(int argc,char *argv[]){
setExePath(argv[0]);
signal(SIGINT, programExit); signal(SIGINT, programExit);
Logger::Instance().add(std::make_shared<ConsoleChannel>("stdout", LTrace)); Logger::Instance().add(std::make_shared<ConsoleChannel>("stdout", LTrace));
Config::loaIniConfig(); Config::loaIniConfig();