mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-21 01:13:37 +08:00
parent
304c898a3a
commit
af08b58d29
@ -80,6 +80,37 @@ option(ENABLE_WEBRTC "Enable WebRTC" true)
|
||||
option(ENABLE_PLAYER "Enable Player" true)
|
||||
option(ENABLE_MSVC_MT "Enable MSVC Mt/Mtd lib" true)
|
||||
option(ENABLE_API_STATIC_LIB "Enable mk_api static lib" false)
|
||||
option(USE_SOLUTION_FOLDERS "Enable solution dir supported" ON)
|
||||
# ----------------------------------------------------------------------------
|
||||
# Solution folders:
|
||||
# ----------------------------------------------------------------------------
|
||||
if(USE_SOLUTION_FOLDERS)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
|
||||
endif()
|
||||
|
||||
function(set_file_group prefix)
|
||||
message(STATUS "set_file_group " ${prefix} " " ${ARGC})
|
||||
foreach(FILE IN LISTS ARGN 1)
|
||||
# Get the directory of the source file
|
||||
get_filename_component(PARENT_DIR "${FILE}" DIRECTORY)
|
||||
|
||||
# Remove common directory prefix to make the group
|
||||
string(REPLACE "${prefix}" "" GROUP "${PARENT_DIR}")
|
||||
|
||||
# Make sure we are using windows slashes
|
||||
string(REPLACE "/" "\\" GROUP "${GROUP}")
|
||||
|
||||
# Group into "Source Files" and "Header Files"
|
||||
#if ("${FILE}" MATCHES ".*\\.cpp")
|
||||
# set(GROUP "Source Files${GROUP}")
|
||||
#elseif("${FILE}" MATCHES ".*\\.h")
|
||||
# set(GROUP "Header Files${GROUP}")
|
||||
#endif()
|
||||
#message(STATUS ${GROUP} " : " ${FILE})
|
||||
source_group("${GROUP}" FILES "${FILE}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
if (MSVC AND ENABLE_MSVC_MT)
|
||||
set(CompilerFlags
|
||||
@ -264,6 +295,11 @@ else ()
|
||||
add_definitions(-DWIN32_LEAN_AND_MEAN -DMP4V2_NO_STDINT_DEFS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
endif ()
|
||||
|
||||
if (USE_SOLUTION_FOLDERS AND (NOT GROUP_BY_EXPLORER)) # 在 IDE 中对文件进行分组,源文件和头文件分开
|
||||
set_file_group(${ToolKit_Root} ${ToolKit_src_list})
|
||||
set_file_group("${CMAKE_CURRENT_SOURCE_DIR}/src" ${MediaKit_src_list})
|
||||
endif()
|
||||
|
||||
#添加库
|
||||
add_library(zltoolkit STATIC ${ToolKit_src_list})
|
||||
add_library(zlmediakit STATIC ${MediaKit_src_list})
|
||||
|
@ -4,6 +4,9 @@ foreach(TEST_SRC ${TEST_SRC_LIST})
|
||||
message(STATUS "add c api tester:${TEST_EXE_NAME}")
|
||||
set(exe_name api_tester_${TEST_EXE_NAME})
|
||||
add_executable(${exe_name} ${TEST_SRC})
|
||||
if(USE_SOLUTION_FOLDERS)
|
||||
SET_PROPERTY(TARGET ${exe_name} PROPERTY FOLDER "api_test")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(${exe_name} PROPERTIES COMPILE_FLAGS ${VS_FALGS} )
|
||||
|
@ -14,6 +14,10 @@ foreach (TEST_SRC ${TEST_SRC_LIST})
|
||||
message(STATUS "add test:${TEST_EXE_NAME}")
|
||||
add_executable(${TEST_EXE_NAME} ${TEST_SRC})
|
||||
|
||||
if(USE_SOLUTION_FOLDERS)
|
||||
SET_PROPERTY(TARGET ${TEST_EXE_NAME} PROPERTY FOLDER "test")
|
||||
endif ()
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(${TEST_EXE_NAME} PROPERTIES COMPILE_FLAGS ${VS_FALGS})
|
||||
endif ()
|
||||
|
Loading…
Reference in New Issue
Block a user