Browse Source

Merge pull request #221 from hanseuljun/fix-uwp

Remove RTC_API from the deletePeer()s.
Paul-Louis Ageneau 4 years ago
parent
commit
3af0e3b38b
3 changed files with 19 additions and 8 deletions
  1. 17 6
      CMakeLists.txt
  2. 1 1
      examples/copy-paste-capi/answerer.c
  3. 1 1
      examples/copy-paste-capi/offerer.c

+ 17 - 6
CMakeLists.txt

@@ -12,6 +12,9 @@ option(NO_EXAMPLES "Disable examples" OFF)
 option(NO_TESTS "Disable tests build" OFF)
 option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
 option(CAPI_STDCALL "Set calling convention of C API callbacks stdcall" OFF)
+# Option USE_SRTP defaults to AUTO (enabled if libSRTP is found, else disabled)
+set(USE_SRTP AUTO CACHE STRING "Use libSRTP and enable media support")
+set_property(CACHE USE_SRTP PROPERTY STRINGS AUTO ON OFF)
 
 if(USE_NICE)
 	option(USE_JUICE "Use libjuice" OFF)
@@ -20,9 +23,9 @@ else()
 endif()
 
 if(USE_GNUTLS)
-	option(USE_NETTLE "Use Nettle instead of OpenSSL in libjuice" ON)
+	option(USE_NETTLE "Use Nettle in libjuice" ON)
 else()
-	option(USE_NETTLE "Use Nettle instead of OpenSSL in libjuice" OFF)
+	option(USE_NETTLE "Use Nettle in libjuice" OFF)
 endif()
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -162,8 +165,18 @@ if(WIN32)
 	target_link_libraries(datachannel-static PRIVATE ws2_32) # winsock2
 endif()
 
-find_package(SRTP)
-if(SRTP_FOUND)
+if(USE_SRTP STREQUAL "AUTO")
+	find_package(SRTP)
+	if(SRTP_FOUND)
+		message(STATUS "LibSRTP found, compiling with media transport")
+	else()
+		message(STATUS "LibSRTP NOT found, compiling WITHOUT media transport")
+	endif()
+elseif(USE_SRTP)
+	find_package(SRTP REQUIRED)
+endif()
+
+if(USE_SRTP AND SRTP_FOUND)
 	if(NOT TARGET SRTP::SRTP)
 		add_library(SRTP::SRTP UNKNOWN IMPORTED)
 		set_target_properties(SRTP::SRTP PROPERTIES
@@ -171,13 +184,11 @@ if(SRTP_FOUND)
 			IMPORTED_LINK_INTERFACE_LANGUAGES C
 			IMPORTED_LOCATION ${SRTP_LIBRARIES})
 	endif()
-	message(STATUS "LibSRTP found, compiling with media transport")
 	target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
 	target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
 	target_link_libraries(datachannel PRIVATE SRTP::SRTP)
 	target_link_libraries(datachannel-static PRIVATE SRTP::SRTP)
 else()
-	message(STATUS "LibSRTP NOT found, compiling WITHOUT media transport")
 	target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=0)
 	target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=0)
 endif()

+ 1 - 1
examples/copy-paste-capi/answerer.c

@@ -48,7 +48,7 @@ static void RTC_API stateChangeCallback(int pc, rtcState state, void *ptr);
 static void RTC_API gatheringStateCallback(int pc, rtcGatheringState state, void *ptr);
 static void RTC_API closedCallback(int id, void *ptr);
 static void RTC_API messageCallback(int id, const char *message, int size, void *ptr);
-static void RTC_API deletePeer(Peer *peer);
+static void deletePeer(Peer *peer);
 
 char *state_print(rtcState state);
 char *rtcGatheringState_print(rtcGatheringState state);

+ 1 - 1
examples/copy-paste-capi/offerer.c

@@ -48,7 +48,7 @@ static void RTC_API gatheringStateCallback(int pc, rtcGatheringState state, void
 static void RTC_API openCallback(int id, void *ptr);
 static void RTC_API closedCallback(int id, void *ptr);
 static void RTC_API messageCallback(int id, const char *message, int size, void *ptr);
-static void RTC_API deletePeer(Peer *peer);
+static void deletePeer(Peer *peer);
 
 char *state_print(rtcState state);
 char *rtcGatheringState_print(rtcGatheringState state);