aisouard / libwebrtc

:package: Google's WebRTC implementation in a single static library.
https://axel.isouard.fr/libwebrtc
Apache License 2.0
640 stars 190 forks source link

Is there a easy way to run the sample? #44

Closed zombiecong closed 7 years ago

zombiecong commented 7 years ago

Hi, can i run the sample by the release library without building all the webrtc source? I find you open a issue #6 .

aisouard commented 7 years ago

Hello,

Sure, you have to download a release: https://github.com/aisouard/libwebrtc/releases/tag/v1.0.0 Extract the include and lib folders inside the /usr/local directory.

Then use this CMakeLists.txt, depending on your platform, assuming you're using Linux:

cmake_minimum_required(VERSION 3.3)
project(sample)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(X11 REQUIRED)

list(APPEND LIBWEBRTC_LIBRARIES webrtc ${X11_LIBRARIES} ${CMAKE_DL_LIBS} rt Threads::Threads)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x -pthread")
add_definitions(-DWEBRTC_POSIX -D_GLIBCXX_USE_CXX11_ABI=0)

set(SOURCE_FILES main.cpp)
add_executable(sample ${SOURCE_FILES})
target_link_libraries(sample ${LIBWEBRTC_LIBRARIES})

I might add an option to specify an existing library and include directory.

zombiecong commented 7 years ago

thanks for your reply, how about using it in windows?

aisouard commented 7 years ago

Sorry for the delay, I don't have the settings in my mind right now.

cmake_minimum_required(VERSION 3.3)
project(sample)

list(APPEND LIBWEBRTC_LIBRARIES webrtc.lib msdmo.lib wmcodecdspuuid.lib dmoguids.lib
     crypt32.lib iphlpapi.lib ole32.lib secur32.lib winmm.lib ws2_32.lib)

# Set to /MTd in debug
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
add_definitions(WEBRTC_WIN NOMINMAX _CRT_SECURE_NO_WARNINGS)

set(SOURCE_FILES main.cpp)
add_executable(sample ${SOURCE_FILES})
target_link_libraries(sample ${LIBWEBRTC_LIBRARIES})
zombiecong commented 7 years ago

@aisouard Thank you very much. I will test it next week.