Skip to content

Commit

Permalink
try to link with clang lld
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Jan 4, 2025
1 parent a6e4711 commit 18ae650
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project (webrtc-streamer)
set (WEBRTCROOT "${CMAKE_CURRENT_SOURCE_DIR}/../webrtc" CACHE STRING "WEBRTC root directory")
set (WEBRTCDESKTOPCAPTURE "ON" CACHE STRING "WEBRTC Desktop capture")
set (WEBRTCCHROMEBRANDED "ON" CACHE STRING "WEBRTC Chrome branded")
set (WEBRTCVERSION "b00c469cad3f8c926fcf81ded90b90b6e1e62b9c" CACHE STRING "WEBRTC version")
set (WEBRTCVERSION "549c9b717fcbdfdf5d76068b3dd37076a9ffeacb" CACHE STRING "WEBRTC version")

if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
Expand Down Expand Up @@ -82,7 +82,7 @@ if (NOT EXISTS ${WEBRTCOBJS}/${CMAKE_STATIC_LIBRARY_PREFIX}webrtc${CMAKE_STATIC_
endif()


set (WEBRTCARGS rtc_include_tests=false\nrtc_enable_protobuf=false\nrtc_build_examples=false\nrtc_build_tools=false\ntreat_warnings_as_errors=false\nenable_js_protobuf=false\nuse_glib=false\nuse_lld=false\n)
set (WEBRTCARGS rtc_include_tests=false\nrtc_enable_protobuf=false\nrtc_build_examples=false\nrtc_build_tools=false\ntreat_warnings_as_errors=false\nenable_js_protobuf=false\nuse_glib=false\n)
set (WEBRTCARGS use_custom_libcxx=false\nlibyuv_use_sme=false\n${WEBRTCARGS})
# debug/release
if(CMAKE_BUILD_TYPE STREQUAL "Release")
Expand Down Expand Up @@ -115,13 +115,17 @@ if (NOT EXISTS ${WEBRTCOBJS}/${CMAKE_STATIC_LIBRARY_PREFIX}webrtc${CMAKE_STATIC_
endif()

#patch
file(READ ${WEBRTCROOT}/src/rtc_base/ssl_stream_adapter.h filecontent)
string(REPLACE "#include <vector>" "#include <vector>\n#include <optional>" filecontent "${filecontent}")
file(WRITE ${WEBRTCROOT}/src/rtc_base/ssl_stream_adapter.h "${filecontent}")
# file(READ ${WEBRTCROOT}/src/rtc_base/ssl_stream_adapter.h filecontent)
# string(REPLACE "#include <vector>" "#include <vector>\n#include <optional>" filecontent "${filecontent}")
# file(WRITE ${WEBRTCROOT}/src/rtc_base/ssl_stream_adapter.h "${filecontent}")

file(READ ${WEBRTCROOT}/src/media/base/media_channel.h filecontent)
string(REGEX REPLACE "ost << ToStringIfSet[^;]*;" "" filecontent "${filecontent}")
file(WRITE ${WEBRTCROOT}/src/media/base/media_channel.h "${filecontent}")
file(READ ${WEBRTCROOT}/src/third_party/perfetto/include/perfetto/tracing/track.h filecontent)
string(REPLACE "#include <map>" "#include <map>\n#include <optional>" filecontent "${filecontent}")
file(WRITE ${WEBRTCROOT}/src/third_party/perfetto/include/perfetto/tracing/track.h "${filecontent}")

# file(READ ${WEBRTCROOT}/src/media/base/media_channel.h filecontent)
# string(REGEX REPLACE "ost << ToStringIfSet[^;]*;" "" filecontent "${filecontent}")
# file(WRITE ${WEBRTCROOT}/src/media/base/media_channel.h "${filecontent}")


# sound support
Expand Down Expand Up @@ -276,6 +280,9 @@ elseif (APPLE)
target_link_libraries (${CMAKE_PROJECT_NAME} ${CORE_FOUNDATION} ${APPLICATION_SERVICES} ${CORE_SERVICES}
${CORE_AUDIO} ${AUDIO_TOOLBOX} ${IO_SURFACE} ${APP_KIT})
else()
# use lld to link
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld -B${WEBRTCROOT}/src/third_party/llvm-build/Release+Asserts/bin")

# libv4l2cpp
add_definitions(-DHAVE_V4L2)
aux_source_directory(libv4l2cpp/src LIBSRC_FILES)
Expand Down

0 comments on commit 18ae650

Please sign in to comment.