mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
优化CMakeList, 完善iOS下编译配置 (#2578)
1、调整 json 的源码引入,外部可以引入 json/json.h 使用; 2、针对 iOS 工程调整 cmake 配置,解决 iOS 环境下mk_util.h 找不到问题;同时在 iOS 工程中引入 MediaServer 静态库;
This commit is contained in:
parent
6cd9e15cb8
commit
c530f281c3
@ -24,7 +24,11 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# jsoncpp
|
# jsoncpp
|
||||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/src/lib_json JSONCPP_SRC_LIST)
|
file(GLOB JSONCPP_SRC_LIST
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/include/json/*.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/src/lib_json/*.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/src/lib_json/*.h)
|
||||||
|
|
||||||
add_library(jsoncpp STATIC ${JSONCPP_SRC_LIST})
|
add_library(jsoncpp STATIC ${JSONCPP_SRC_LIST})
|
||||||
target_compile_options(jsoncpp
|
target_compile_options(jsoncpp
|
||||||
PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
||||||
|
@ -449,11 +449,6 @@ if(ENABLE_API)
|
|||||||
add_subdirectory(api)
|
add_subdirectory(api)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# IOS 不编译可执行程序
|
|
||||||
if(IOS)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
if(ENABLE_PLAYER AND ENABLE_FFMPEG)
|
if(ENABLE_PLAYER AND ENABLE_FFMPEG)
|
||||||
@ -470,6 +465,11 @@ if(ENABLE_SERVER_LIB)
|
|||||||
set(MK_LINK_LIBRARIES ${MK_LINK_LIBRARIES} PARENT_SCOPE)
|
set(MK_LINK_LIBRARIES ${MK_LINK_LIBRARIES} PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# IOS 不编译可执行程序
|
||||||
|
if(IOS)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
#cpp测试demo程序
|
#cpp测试demo程序
|
||||||
if (ENABLE_TESTS)
|
if (ENABLE_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
@ -30,13 +30,6 @@ file(GLOB API_SRC_LIST
|
|||||||
|
|
||||||
set(LINK_LIBRARIES ${MK_LINK_LIBRARIES})
|
set(LINK_LIBRARIES ${MK_LINK_LIBRARIES})
|
||||||
|
|
||||||
if(IOS)
|
|
||||||
add_library(mk_api STATIC ${API_SRC_LIST})
|
|
||||||
target_link_libraries(mk_api
|
|
||||||
PRIVATE ${LINK_LIBRARIES})
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(COMPILE_DEFINITIONS ${MK_COMPILE_DEFINITIONS})
|
set(COMPILE_DEFINITIONS ${MK_COMPILE_DEFINITIONS})
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
@ -46,6 +39,8 @@ endif ()
|
|||||||
if(ENABLE_API_STATIC_LIB)
|
if(ENABLE_API_STATIC_LIB)
|
||||||
add_library(mk_api STATIC ${API_SRC_LIST})
|
add_library(mk_api STATIC ${API_SRC_LIST})
|
||||||
list(APPEND COMPILE_DEFINITIONS MediaKitApi_STATIC)
|
list(APPEND COMPILE_DEFINITIONS MediaKitApi_STATIC)
|
||||||
|
elseif(IOS)
|
||||||
|
add_library(mk_api STATIC ${API_SRC_LIST})
|
||||||
else()
|
else()
|
||||||
add_library(mk_api SHARED ${API_SRC_LIST})
|
add_library(mk_api SHARED ${API_SRC_LIST})
|
||||||
endif()
|
endif()
|
||||||
@ -82,6 +77,11 @@ install(TARGETS mk_api
|
|||||||
LIBRARY DESTINATION ${INSTALL_PATH_LIB}
|
LIBRARY DESTINATION ${INSTALL_PATH_LIB}
|
||||||
RUNTIME DESTINATION ${INSTALL_PATH_RUNTIME})
|
RUNTIME DESTINATION ${INSTALL_PATH_RUNTIME})
|
||||||
|
|
||||||
|
# IOS 跳过测试代码
|
||||||
|
if(IOS)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
if (ENABLE_TESTS)
|
if (ENABLE_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
@ -38,7 +38,13 @@ if(ENABLE_SERVER_LIB)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(MediaServer ${MediaServer_SRC_LIST})
|
# IOS 不编译可执行程序,只做依赖库
|
||||||
|
if(IOS)
|
||||||
|
add_library(MediaServer STATIC ${MediaServer_SRC_LIST})
|
||||||
|
else()
|
||||||
|
add_executable(MediaServer ${MediaServer_SRC_LIST})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(MediaServer
|
target_compile_definitions(MediaServer
|
||||||
PRIVATE ${COMPILE_DEFINITIONS})
|
PRIVATE ${COMPILE_DEFINITIONS})
|
||||||
target_compile_options(MediaServer
|
target_compile_options(MediaServer
|
||||||
|
Loading…
Reference in New Issue
Block a user