Commit c0a7a4ab by tbago Committed by GitHub

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

- enable_server cmake选项生效;
- enable_tests 选项在api目录下的test同样生效;
- 增加stdio.h 防止编译失败;
parent 24104199
...@@ -461,7 +461,9 @@ if(ENABLE_PLAYER AND ENABLE_FFMPEG) ...@@ -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)
......
...@@ -74,8 +74,6 @@ generate_export_header(mk_api ...@@ -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 ...@@ -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()
...@@ -43,15 +43,3 @@ foreach(TEST_SRC ${TEST_SRC_LIST}) ...@@ -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()
...@@ -9,6 +9,7 @@ ...@@ -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 {
......
...@@ -9,6 +9,7 @@ ...@@ -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
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论