diff --git a/CMakeLists.txt b/CMakeLists.txt index 2173561b..6a6fe11b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ option(ENABLE_X264 "Enable x264" false) option(ENABLE_MP4 "Enable MP4" true) option(ENABLE_RTPPROXY "Enable RTPPROXY" true) option(ENABLE_API "Enable C API SDK" true) +option(ENABLE_CXX_API "Enable C++ API SDK" false) option(ENABLE_TESTS "Enable Tests" true) option(ENABLE_SERVER "Enable Server" true) @@ -178,6 +179,22 @@ endif () add_library(zltoolkit STATIC ${ToolKit_src_list}) add_library(zlmediakit STATIC ${MediaKit_src_list}) +#安装目录 +if (WIN32) + set(INSTALL_PATH_LIB $ENV{HOME}/${CMAKE_PROJECT_NAME}/lib) + set(INSTALL_PATH_INCLUDE $ENV{HOME}/${CMAKE_PROJECT_NAME}/include) +else () + set(INSTALL_PATH_LIB lib) + set(INSTALL_PATH_INCLUDE include) +endif () + +if(ENABLE_CXX_API) + # 保留目录结构 + install(DIRECTORY ${ToolKit_Root}/ DESTINATION ${INSTALL_PATH_INCLUDE}/ZLToolKit REGEX "(.*[.](md|cpp)|win32)$" EXCLUDE) + install(DIRECTORY ${MediaKit_Root}/ DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit REGEX ".*[.](md|cpp)$" EXCLUDE) + install(TARGETS zltoolkit zlmediakit DESTINATION ${INSTALL_PATH_LIB}) +endif() + if (WIN32) list(APPEND LINK_LIB_LIST WS2_32 Iphlpapi shlwapi) set_target_properties(zltoolkit PROPERTIES COMPILE_FLAGS ${VS_FALGS} ) diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index 6169e0f5..6f460300 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -22,15 +22,6 @@ else () target_link_libraries(mk_api ${LINK_LIB_LIST}) add_subdirectory(tests) - #安装目录 - if (WIN32) - set(INSTALL_PATH_LIB $ENV{HOME}/${CMAKE_PROJECT_NAME}/lib) - set(INSTALL_PATH_INCLUDE $ENV{HOME}/${CMAKE_PROJECT_NAME}/include) - else () - set(INSTALL_PATH_LIB lib) - set(INSTALL_PATH_INCLUDE include) - endif () - file(GLOB api_header_list include/*.h) install(FILES ${api_header_list} DESTINATION ${INSTALL_PATH_INCLUDE}) install(TARGETS mk_api ARCHIVE DESTINATION ${INSTALL_PATH_LIB} LIBRARY DESTINATION ${INSTALL_PATH_LIB})