优化cmake配置文件, 添加必要头文件 (#2558)

- enable_server cmake选项生效;
- enable_tests 选项在api目录下的test同样生效;
- 增加stdio.h 防止编译失败;
This commit is contained in:
tbago 2023-06-17 10:24:17 +08:00 committed by GitHub
parent 2410419911
commit c0a7a4ab70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 15 deletions

View File

@ -461,7 +461,9 @@ if(ENABLE_PLAYER AND ENABLE_FFMPEG)
endif() endif()
#MediaServer #MediaServer
add_subdirectory(server) if(ENABLE_SERVER)
add_subdirectory(server)
endif()
# Android add_subdirectory # Android add_subdirectory
if(ENABLE_SERVER_LIB) if(ENABLE_SERVER_LIB)

View File

@ -74,8 +74,6 @@ generate_export_header(mk_api
STATIC_DEFINE MediaKitApi_STATIC STATIC_DEFINE MediaKitApi_STATIC
EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/mk_export.h") EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/mk_export.h")
add_subdirectory(tests)
file(GLOB API_HEADER_LIST include/*.h ${CMAKE_CURRENT_BINARY_DIR}/*.h) file(GLOB API_HEADER_LIST include/*.h ${CMAKE_CURRENT_BINARY_DIR}/*.h)
install(FILES ${API_HEADER_LIST} install(FILES ${API_HEADER_LIST}
DESTINATION ${INSTALL_PATH_INCLUDE}) DESTINATION ${INSTALL_PATH_INCLUDE})
@ -83,3 +81,7 @@ install(TARGETS mk_api
ARCHIVE DESTINATION ${INSTALL_PATH_LIB} ARCHIVE DESTINATION ${INSTALL_PATH_LIB}
LIBRARY DESTINATION ${INSTALL_PATH_LIB} LIBRARY DESTINATION ${INSTALL_PATH_LIB}
RUNTIME DESTINATION ${INSTALL_PATH_RUNTIME}) RUNTIME DESTINATION ${INSTALL_PATH_RUNTIME})
if (ENABLE_TESTS)
add_subdirectory(tests)
endif()

View File

@ -43,15 +43,3 @@ foreach(TEST_SRC ${TEST_SRC_LIST})
target_link_libraries(${exe_name} mk_api) target_link_libraries(${exe_name} mk_api)
target_compile_options(${exe_name} PRIVATE ${COMPILE_OPTIONS_DEFAULT}) target_compile_options(${exe_name} PRIVATE ${COMPILE_OPTIONS_DEFAULT})
endforeach() endforeach()

View File

@ -9,6 +9,7 @@
*/ */
#include <string.h> #include <string.h>
#include <stdio.h>
#include "mk_mediakit.h" #include "mk_mediakit.h"
typedef struct { typedef struct {

View File

@ -9,6 +9,7 @@
*/ */
#include <string.h> #include <string.h>
#include <stdio.h>
#include "mk_mediakit.h" #include "mk_mediakit.h"
#define LOG_LEV 4 #define LOG_LEV 4