ZLM CXX添加exprt文件,ext-codec引用zlm中宏定义,完善install相关文件安装

This commit is contained in:
baiyfcu 2024-07-26 09:55:33 +08:00
parent e389d16379
commit 0eca329dba
6 changed files with 72 additions and 31 deletions

View File

@ -237,9 +237,14 @@ endif()
# 使 # 使
if(ENABLE_CXX_API) if(ENABLE_CXX_API)
# #
#install(DIRECTORY ${ToolKit_ROOT}/ install(DIRECTORY ${ToolKit_ROOT}/src/
# DESTINATION ${INSTALL_PATH_INCLUDE}/ZLToolKit DESTINATION ${INSTALL_PATH_INCLUDE}/ZLToolKit
# REGEX "(.*[.](md|cpp)|win32)$" EXCLUDE) REGEX "(.*[.](md|cpp)|win32)$" EXCLUDE)
#install(TARGETS zltoolkit if(ENABLE_CXX_API)
# DESTINATION ${INSTALL_PATH_LIB}) install(TARGETS zltoolkit
DESTINATION ${INSTALL_PATH_BIN})
else()
install(TARGETS zltoolkit
DESTINATION ${INSTALL_PATH_LIB})
endif()
endif() endif()

@ -1 +1 @@
Subproject commit 9c5292f4f5c7fe36794c9b33d24c4b95e932f114 Subproject commit fdd3450fc6bee60f8fb16ac4fd272c54d6b27238

View File

@ -30,7 +30,7 @@
#if defined(_WIN32) && defined(_MSC_VER) #if defined(_WIN32) && defined(_MSC_VER)
# if !defined(GENERATE_EXPORT) # if !defined(GENERATE_EXPORT)
# if defined(MediaKitApi_EXPORTS) # if defined(mk_api_EXPORTS)
# define API_EXPORT __declspec(dllexport) # define API_EXPORT __declspec(dllexport)
# else # else
# define API_EXPORT __declspec(dllimport) # define API_EXPORT __declspec(dllimport)

View File

@ -23,9 +23,6 @@
set(COMPILE_DEFINITIONS) set(COMPILE_DEFINITIONS)
set(INCLUDE_DIRECTORIES) set(INCLUDE_DIRECTORIES)
# for zlm
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../3rdpart/ZLToolKit/src)
file(GLOB EXT_SRC_LIST file(GLOB EXT_SRC_LIST
${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.c
@ -38,9 +35,21 @@ add_library(ZLMediaKit::ext-codec ALIAS ext-codec)
target_compile_options(ext-codec PRIVATE ${COMPILE_OPTIONS_DEFAULT}) target_compile_options(ext-codec PRIVATE ${COMPILE_OPTIONS_DEFAULT})
target_compile_definitions(ext-codec PUBLIC ${COMPILE_DEFINITIONS}) target_compile_definitions(ext-codec PUBLIC ${COMPILE_DEFINITIONS})
target_compile_definitions(ext-codec PRIVATE ${MK_COMPILE_DEFINITIONS})
#target_link_libraries(ext-codec PRIVATE ZLMediaKit::MediaKit ZLMediaKit::ToolKit ${LINK_LIBRARIES}) #target_link_libraries(ext-codec PRIVATE ZLMediaKit::MediaKit ZLMediaKit::ToolKit ${LINK_LIBRARIES})
# for zlm
target_include_directories(ext-codec PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_SOURCE_DIR}/../3rdpart/ZLToolKit/src)
set(MediaServer_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../3rdpart/media-server")
set(MediaServer_FLV_ROOT ${MediaServer_ROOT}/libflv)
target_include_directories(ext-codec
PRIVATE
"$<BUILD_INTERFACE:${MediaServer_FLV_ROOT}/include>"
PUBLIC
"$<BUILD_INTERFACE:${MediaServer_FLV_ROOT}/include>")
target_include_directories(ext-codec target_include_directories(ext-codec
PRIVATE PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"

View File

@ -21,6 +21,8 @@
# SOFTWARE. # SOFTWARE.
# #
include(GenerateExportHeader)
file(GLOB MediaKit_SRC_LIST file(GLOB MediaKit_SRC_LIST
${CMAKE_CURRENT_SOURCE_DIR}/*/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*/*.c
${CMAKE_CURRENT_SOURCE_DIR}/*/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/*/*.cpp
@ -31,7 +33,12 @@ if(USE_SOLUTION_FOLDERS AND (NOT GROUP_BY_EXPLORER))
set_file_group("${CMAKE_CURRENT_SOURCE_DIR}" ${MediaKit_SRC_LIST}) set_file_group("${CMAKE_CURRENT_SOURCE_DIR}" ${MediaKit_SRC_LIST})
endif() endif()
if(ENABLE_CXX_API) if(NOT ENABLE_CXX_API OR IOS)
#
add_library(zlmediakit STATIC ${MediaKit_SRC_LIST})
add_library(ZLMediaKit::MediaKit ALIAS zlmediakit)
list(APPEND COMPILE_DEFINITIONS MediaKit_STATIC)
else()
# Windows # Windows
if(WIN32) if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
@ -46,10 +53,6 @@ if(ENABLE_CXX_API)
set_target_properties(zlmediakit PROPERTIES set_target_properties(zlmediakit PROPERTIES
OUTPUT_NAME zlmediakit # DLL OUTPUT_NAME zlmediakit # DLL
) )
else ()
#
add_library(zlmediakit STATIC ${MediaKit_SRC_LIST})
add_library(ZLMediaKit::MediaKit ALIAS zlmediakit)
endif () endif ()
set(LINK_LIBRARIES ${MK_LINK_LIBRARIES}) set(LINK_LIBRARIES ${MK_LINK_LIBRARIES})
@ -63,19 +66,35 @@ target_compile_options(zlmediakit
target_link_libraries(zlmediakit target_link_libraries(zlmediakit
PUBLIC ${LINK_LIBRARIES}) PUBLIC ${LINK_LIBRARIES})
target_include_directories(zlmediakit target_include_directories(zlmediakit
PRIVATE PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
)
update_cached_list(MK_LINK_LIBRARIES ZLMediaKit::MediaKit) update_cached_list(MK_LINK_LIBRARIES ZLMediaKit::MediaKit)
generate_export_header(zlmediakit
EXPORT_MACRO_NAME MK_EXPORT
BASE_NAME MK_CXX
STATIC_DEFINE MediaKit_STATIC
EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/mk_cxx_export.h")
# 使 # 使
if(ENABLE_CXX_API) if(ENABLE_CXX_API)
# #
#install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
# DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit
# REGEX ".*[.](md|cpp)$" EXCLUDE) REGEX ".*[.](md|cpp)$" EXCLUDE)
#install(TARGETS zlmediakit if(ENABLE_CXX_API)
# DESTINATION ${INSTALL_PATH_LIB}) install(TARGETS zlmediakit
DESTINATION ${INSTALL_PATH_BIN})
else()
install(TARGETS zlmediakit
DESTINATION ${INSTALL_PATH_LIB})
endif()
endif () endif ()

View File

@ -79,20 +79,28 @@ extern void Assert_Throw(int failed, const char *exp, const char *func, const ch
} }
#endif #endif
#if defined(ENABLE_CXX_API)
#if defined(GENERATE_EXPORT)
#include "mk_cxx_export.h"
#endif
#if defined(_WIN32) && defined(_MSC_VER) #if defined(_WIN32) && defined(_MSC_VER)
# if defined(MediaKit_EXPORTS) # define API_CALL __cdecl
#else
# define API_CALL
#endif
#if defined(_WIN32) && defined(_MSC_VER)
# if !defined(GENERATE_EXPORT)
# if defined(zlmediakit_EXPORTS)
# define MK_EXPORT __declspec(dllexport) # define MK_EXPORT __declspec(dllexport)
# else # else
# define MK_EXPORT __declspec(dllimport) # define MK_EXPORT __declspec(dllimport)
# endif # endif
#else # endif
#elif !defined(GENERATE_EXPORT)
# define MK_EXPORT __attribute__((visibility("default"))) # define MK_EXPORT __attribute__((visibility("default")))
#endif #endif
#else
# define MK_EXPORT
#endif
namespace mediakit { namespace mediakit {