mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 23:25:33 +00:00
Introduced USE_NICE flag
This commit is contained in:
4
.github/workflows/build-gnutls.yml
vendored
4
.github/workflows/build-gnutls.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=1
|
||||
run: cmake -B build -DUSE_GNUTLS=1
|
||||
- name: make
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
@ -30,7 +30,7 @@ jobs:
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=1
|
||||
run: cmake -B build -DUSE_GNUTLS=1
|
||||
- name: make
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
|
2
.github/workflows/build-nice.yml
vendored
2
.github/workflows/build-nice.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_JUICE=0 -DUSE_GNUTLS=1
|
||||
run: cmake -B build -DUSE_GNUTLS=1 -DUSE_NICE=1
|
||||
- name: make
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
|
6
.github/workflows/build-openssl.yml
vendored
6
.github/workflows/build-openssl.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=0
|
||||
run: cmake -B build -DUSE_GNUTLS=0
|
||||
- name: make
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
@ -30,7 +30,7 @@ jobs:
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=0
|
||||
run: cmake -B build -DUSE_GNUTLS=0
|
||||
env:
|
||||
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
|
||||
OPENSSL_LIBRARIES: /usr/local/opt/openssl/lib
|
||||
@ -48,7 +48,7 @@ jobs:
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -G "NMake Makefiles" -DUSE_JUICE=1 -DUSE_GNUTLS=0
|
||||
run: cmake -B build -G "NMake Makefiles" -DUSE_GNUTLS=0
|
||||
- name: nmake
|
||||
run: |
|
||||
cd build
|
||||
|
@ -4,12 +4,19 @@ project(libdatachannel
|
||||
VERSION 0.6.5
|
||||
LANGUAGES CXX)
|
||||
|
||||
# Options
|
||||
option(USE_GNUTLS "Use GnuTLS instead of OpenSSL" OFF)
|
||||
option(USE_JUICE "Use libjuice instead of libnice" OFF)
|
||||
option(USE_NICE "Use libnice instead of libjuice" OFF)
|
||||
option(USE_SRTP "Enable SRTP for media support" OFF)
|
||||
option(NO_WEBSOCKET "Disable WebSocket support" OFF)
|
||||
option(NO_EXAMPLES "Disable examples" OFF)
|
||||
|
||||
if(USE_NICE)
|
||||
option(USE_JUICE "Use libjuice" OFF)
|
||||
else()
|
||||
option(USE_JUICE "Use libjuice" ON)
|
||||
endif()
|
||||
|
||||
if(USE_GNUTLS)
|
||||
option(USE_NETTLE "Use Nettle instead of OpenSSL in libjuice" ON)
|
||||
else()
|
||||
@ -185,18 +192,18 @@ else()
|
||||
target_link_libraries(datachannel-static PRIVATE OpenSSL::SSL)
|
||||
endif()
|
||||
|
||||
if (USE_JUICE)
|
||||
add_subdirectory(deps/libjuice EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(datachannel PRIVATE USE_JUICE=1)
|
||||
target_compile_definitions(datachannel-static PRIVATE USE_JUICE=1)
|
||||
target_link_libraries(datachannel PRIVATE LibJuice::LibJuiceStatic)
|
||||
target_link_libraries(datachannel-static PRIVATE LibJuice::LibJuiceStatic)
|
||||
else()
|
||||
if (USE_NICE OR NOT USE_JUICE)
|
||||
find_package(LibNice REQUIRED)
|
||||
target_compile_definitions(datachannel PRIVATE USE_JUICE=0)
|
||||
target_compile_definitions(datachannel-static PRIVATE USE_JUICE=0)
|
||||
target_link_libraries(datachannel PRIVATE LibNice::LibNice)
|
||||
target_link_libraries(datachannel-static PRIVATE LibNice::LibNice)
|
||||
else()
|
||||
add_subdirectory(deps/libjuice EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(datachannel PRIVATE USE_JUICE=1)
|
||||
target_compile_definitions(datachannel-static PRIVATE USE_JUICE=1)
|
||||
target_link_libraries(datachannel PRIVATE LibJuice::LibJuiceStatic)
|
||||
target_link_libraries(datachannel-static PRIVATE LibJuice::LibJuiceStatic)
|
||||
endif()
|
||||
|
||||
add_library(LibDataChannel::LibDataChannel ALIAS datachannel)
|
||||
|
2
Jamfile
2
Jamfile
@ -15,7 +15,7 @@ lib libdatachannel
|
||||
: # requirements
|
||||
<cxxstd>17
|
||||
<include>./include/rtc
|
||||
<define>USE_JUICE=1
|
||||
<define>USE_NICE=0
|
||||
<define>RTC_ENABLE_MEDIA=0
|
||||
<define>RTC_ENABLE_WEBSOCKET=0
|
||||
<toolset>msvc:<define>WIN32_LEAN_AND_MEAN
|
||||
|
10
Makefile
10
Makefile
@ -25,17 +25,17 @@ else
|
||||
LIBS+=openssl
|
||||
endif
|
||||
|
||||
USE_JUICE ?= 0
|
||||
ifneq ($(USE_JUICE), 0)
|
||||
USE_NICE ?= 0
|
||||
ifneq ($(USE_NICE), 0)
|
||||
CPPFLAGS+=-DUSE_JUICE=0
|
||||
LIBS+=glib-2.0 gobject-2.0 nice
|
||||
else
|
||||
CPPFLAGS+=-DUSE_JUICE=1
|
||||
INCLUDES+=-I$(JUICE_DIR)/include
|
||||
LOCALLIBS+=libjuice.a
|
||||
ifneq ($(USE_GNUTLS), 0)
|
||||
LIBS+=nettle
|
||||
endif
|
||||
else
|
||||
CPPFLAGS+=-DUSE_JUICE=0
|
||||
LIBS+=glib-2.0 gobject-2.0 nice
|
||||
endif
|
||||
|
||||
USE_SRTP ?= 0
|
||||
|
20
README.md
20
README.md
@ -47,14 +47,14 @@ Features:
|
||||
Dependencies:
|
||||
- GnuTLS: https://www.gnutls.org/ or OpenSSL: https://www.openssl.org/
|
||||
|
||||
Optional dependencies:
|
||||
- libnice: https://nice.freedesktop.org/ (substituable with libjuice)
|
||||
- libSRTP: https://github.com/cisco/libsrtp (only necessary for media transport)
|
||||
|
||||
Submodules:
|
||||
- libjuice: https://github.com/paullouisageneau/libjuice
|
||||
- usrsctp: https://github.com/sctplab/usrsctp
|
||||
|
||||
Optional dependencies:
|
||||
- libnice: https://nice.freedesktop.org/ (only if selected as ICE backend instead of libjuice)
|
||||
- libSRTP: https://github.com/cisco/libsrtp (only necessary for media transport)
|
||||
|
||||
## Building
|
||||
|
||||
### Clone repository and submodules
|
||||
@ -67,33 +67,35 @@ $ git submodule update --init --recursive
|
||||
|
||||
### Building with CMake
|
||||
|
||||
The CMake library targets `libdatachannel` and `libdatachannel-static` respectively correspond to the shared and static libraries. On Windows, the DLL resulting from the shared library build only exposes the C API, use the static library for the C++ API. The default target will build tests and examples.
|
||||
The CMake library targets `libdatachannel` and `libdatachannel-static` respectively correspond to the shared and static libraries. On Windows, the DLL resulting from the shared library build only exposes the C API, use the static library for the C++ API. The default target will build tests and examples. The option `USE_GNUTLS` allows to switch between OpenSSL (default) and GnuTLS, and the option `USE_NICE` allows to switch between libjuice as submodule (default) and libnice.
|
||||
|
||||
#### POSIX-compliant operating systems (including Linux and Apple macOS)
|
||||
```bash
|
||||
$ cmake -B build -DUSE_JUICE=1 -DUSE_GNUTLS=1
|
||||
$ cmake -B build -DUSE_GNUTLS=1 -DUSE_NICE=0
|
||||
$ cd build
|
||||
$ make -j2
|
||||
```
|
||||
|
||||
#### Microsoft Windows with MinGW cross-compilation
|
||||
```bash
|
||||
$ cmake -B build -DUSE_JUICE=1 -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-x86_64-w64-mingw32.cmake # replace with your toolchain file
|
||||
$ cmake -B build -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-x86_64-w64-mingw32.cmake # replace with your toolchain file
|
||||
$ cd build
|
||||
$ make -j2
|
||||
```
|
||||
|
||||
#### Microsoft Windows with Microsoft Visual C++
|
||||
```bash
|
||||
$ cmake -B build -G "NMake Makefiles" -DUSE_JUICE=1
|
||||
$ cmake -B build -G "NMake Makefiles"
|
||||
$ cd build
|
||||
$ nmake
|
||||
```
|
||||
|
||||
### Building directly with Make (Linux only)
|
||||
|
||||
The option `USE_GNUTLS` allows to switch between OpenSSL (default) and GnuTLS, and the option `USE_NICE` allows to switch between libjuice as submodule (default) and libnice.
|
||||
|
||||
```bash
|
||||
$ make USE_JUICE=1 USE_GNUTLS=1
|
||||
$ make USE_GNUTLS=1 USE_NICE=0
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
Reference in New Issue
Block a user