mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-31 00:37:39 +08:00
Merge pull request #383 from wasphin/feature/install-cxx-api
支持单独安装 C++ 库
This commit is contained in:
commit
55cc1d7391
@ -41,13 +41,17 @@ INCLUDE_DIRECTORIES(${ToolKit_Root})
|
||||
INCLUDE_DIRECTORIES(${MediaKit_Root})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/3rdpart)
|
||||
|
||||
set(ENABLE_HLS true)
|
||||
set(ENABLE_OPENSSL true)
|
||||
set(ENABLE_MYSQL false)
|
||||
set(ENABLE_FAAC false)
|
||||
set(ENABLE_X264 false)
|
||||
set(ENABLE_MP4 true)
|
||||
set(ENABLE_RTPPROXY true)
|
||||
option(ENABLE_HLS "Enable HLS" true)
|
||||
option(ENABLE_OPENSSL "Enable OpenSSL" true)
|
||||
option(ENABLE_MYSQL "Enable MySQL" false)
|
||||
option(ENABLE_FAAC "Enable FAAC" false)
|
||||
option(ENABLE_X264 "Enable x264" false)
|
||||
option(ENABLE_MP4 "Enable MP4" true)
|
||||
option(ENABLE_RTPPROXY "Enable RTPPROXY" true)
|
||||
option(ENABLE_API "Enable C API SDK" true)
|
||||
option(ENABLE_CXX_API "Enable C++ API SDK" false)
|
||||
option(ENABLE_TESTS "Enable Tests" true)
|
||||
option(ENABLE_SERVER "Enable Server" true)
|
||||
|
||||
set(LINK_LIB_LIST zlmediakit zltoolkit)
|
||||
|
||||
@ -175,6 +179,22 @@ endif ()
|
||||
add_library(zltoolkit STATIC ${ToolKit_src_list})
|
||||
add_library(zlmediakit STATIC ${MediaKit_src_list})
|
||||
|
||||
#安装目录
|
||||
if (WIN32)
|
||||
set(INSTALL_PATH_LIB $ENV{HOME}/${CMAKE_PROJECT_NAME}/lib)
|
||||
set(INSTALL_PATH_INCLUDE $ENV{HOME}/${CMAKE_PROJECT_NAME}/include)
|
||||
else ()
|
||||
set(INSTALL_PATH_LIB lib)
|
||||
set(INSTALL_PATH_INCLUDE include)
|
||||
endif ()
|
||||
|
||||
if(ENABLE_CXX_API)
|
||||
# 保留目录结构
|
||||
install(DIRECTORY ${ToolKit_Root}/ DESTINATION ${INSTALL_PATH_INCLUDE}/ZLToolKit REGEX "(.*[.](md|cpp)|win32)$" EXCLUDE)
|
||||
install(DIRECTORY ${MediaKit_Root}/ DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit REGEX ".*[.](md|cpp)$" EXCLUDE)
|
||||
install(TARGETS zltoolkit zlmediakit DESTINATION ${INSTALL_PATH_LIB})
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND LINK_LIB_LIST WS2_32 Iphlpapi shlwapi)
|
||||
set_target_properties(zltoolkit PROPERTIES COMPILE_FLAGS ${VS_FALGS} )
|
||||
@ -188,11 +208,17 @@ execute_process(COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/www ${EXECUTABLE_OUTPU
|
||||
execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/conf/config.ini ${EXECUTABLE_OUTPUT_PATH}/)
|
||||
|
||||
#添加c库
|
||||
add_subdirectory(api)
|
||||
if(ENABLE_API)
|
||||
add_subdirectory(api)
|
||||
endif()
|
||||
|
||||
if (NOT IOS)
|
||||
#测试程序
|
||||
if(ENABLE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
#主服务器
|
||||
if(ENABLE_SERVER)
|
||||
add_subdirectory(server)
|
||||
endif()
|
||||
endif ()
|
||||
|
@ -22,15 +22,6 @@ else ()
|
||||
target_link_libraries(mk_api ${LINK_LIB_LIST})
|
||||
add_subdirectory(tests)
|
||||
|
||||
#安装目录
|
||||
if (WIN32)
|
||||
set(INSTALL_PATH_LIB $ENV{HOME}/${CMAKE_PROJECT_NAME}/lib)
|
||||
set(INSTALL_PATH_INCLUDE $ENV{HOME}/${CMAKE_PROJECT_NAME}/include)
|
||||
else ()
|
||||
set(INSTALL_PATH_LIB lib)
|
||||
set(INSTALL_PATH_INCLUDE include)
|
||||
endif ()
|
||||
|
||||
file(GLOB api_header_list include/*.h)
|
||||
install(FILES ${api_header_list} DESTINATION ${INSTALL_PATH_INCLUDE})
|
||||
install(TARGETS mk_api ARCHIVE DESTINATION ${INSTALL_PATH_LIB} LIBRARY DESTINATION ${INSTALL_PATH_LIB})
|
||||
|
Loading…
Reference in New Issue
Block a user