mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-27 19:05:12 +00:00
Add an ability to replace some source files before building.
This commit is contained in:
parent
d667dab439
commit
0e08c8388a
3 changed files with 16 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.9)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING INTERNAL FORCE)
|
||||
|
||||
|
|
@ -35,6 +35,11 @@ if (MSVC)
|
|||
patch_file(${WEBRTC_SOURCE_DIR}/build/config/win/BUILD.gn ":static_crt" ":dynamic_crt")
|
||||
endif ()
|
||||
|
||||
# Copy all files from 'patches' directory to 'webrtc/src'
|
||||
# For example, 'patches/api/foo.h' will be copied to 'webrtc/src/api/foo.h'
|
||||
include(PatchSources)
|
||||
patch_sources("${CMAKE_CURRENT_SOURCE_DIR}/patches" "${CMAKE_CURRENT_SOURCE_DIR}/webrtc/src")
|
||||
|
||||
include(AddWebRTCTarget)
|
||||
add_webrtc_target(${WEBRTC_SOURCE_DIR} ${WEBRTC_BUILD_DIR})
|
||||
|
||||
|
|
|
|||
10
cmake/PatchSources.cmake
Normal file
10
cmake/PatchSources.cmake
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function(patch_sources PATCH_DIR SOURCE_DIR)
|
||||
file(GLOB_RECURSE PATCHED_SOURCES RELATIVE ${PATCH_DIR} ${PATCH_DIR}/*)
|
||||
list(REMOVE_ITEM PATCHED_SOURCES ".gitkeep")
|
||||
foreach (file ${PATCHED_SOURCES})
|
||||
message(STATUS "Patching ${file}...")
|
||||
set(destination "${SOURCE_DIR}/${file}")
|
||||
cmake_path(GET destination PARENT_PATH dest_dir)
|
||||
file(COPY ${PATCH_DIR}/${file} DESTINATION ${dest_dir})
|
||||
endforeach ()
|
||||
endfunction()
|
||||
0
patches/.gitkeep
Normal file
0
patches/.gitkeep
Normal file
Loading…
Add table
Reference in a new issue