2019-12-17 18:45:31 +08:00
|
|
|
|
include_directories(include source)
|
2022-05-26 20:30:43 +08:00
|
|
|
|
include(GenerateExportHeader)
|
2020-02-05 23:34:51 +08:00
|
|
|
|
file(GLOB api_src_list include/*.h source/*.cpp source/*.h source/*.c)
|
2020-04-08 15:42:52 +08:00
|
|
|
|
|
2020-02-05 23:34:51 +08:00
|
|
|
|
if (IOS)
|
|
|
|
|
add_library(mk_api STATIC ${api_src_list})
|
2022-04-16 15:57:02 +08:00
|
|
|
|
target_link_libraries(mk_api ${LINK_LIB_LIST} jsoncpp)
|
2022-05-27 17:03:49 +08:00
|
|
|
|
return()
|
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
if (ENABLE_API_STATIC_LIB)
|
|
|
|
|
add_definitions(-DMediaKitApi_STATIC)
|
|
|
|
|
add_library(mk_api STATIC ${api_src_list})
|
2020-02-05 23:34:51 +08:00
|
|
|
|
else ()
|
2022-05-27 17:03:49 +08:00
|
|
|
|
add_library(mk_api SHARED ${api_src_list})
|
|
|
|
|
endif ()
|
2022-05-26 20:30:43 +08:00
|
|
|
|
|
2022-05-27 17:03:49 +08:00
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
|
target_link_libraries(mk_api -Wl,--start-group jsoncpp ${LINK_LIB_LIST} -Wl,--end-group)
|
|
|
|
|
else ()
|
|
|
|
|
target_link_libraries(mk_api jsoncpp ${LINK_LIB_LIST})
|
2022-05-26 20:30:43 +08:00
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
add_definitions(-DGENERATE_EXPORT)
|
|
|
|
|
include_directories(${CMAKE_BINARY_DIR})
|
|
|
|
|
generate_export_header(mk_api
|
|
|
|
|
EXPORT_MACRO_NAME API_EXPORT
|
|
|
|
|
BASE_NAME MK_API
|
|
|
|
|
STATIC_DEFINE MediaKitApi_STATIC
|
|
|
|
|
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/mk_export.h"
|
|
|
|
|
)
|
2019-12-17 18:45:31 +08:00
|
|
|
|
|
2022-05-27 17:03:49 +08:00
|
|
|
|
add_subdirectory(tests)
|
|
|
|
|
|
|
|
|
|
file(GLOB api_header_list include/*.h ${CMAKE_BINARY_DIR}/*.h)
|
|
|
|
|
install(FILES ${api_header_list} DESTINATION ${INSTALL_PATH_INCLUDE})
|
|
|
|
|
install(TARGETS mk_api ARCHIVE DESTINATION ${INSTALL_PATH_LIB} LIBRARY DESTINATION ${INSTALL_PATH_LIB})
|