Support Mac OSX build

master
Ryan Lee 2016-06-25 13:30:10 +09:00
parent cb327e67d8
commit e5d09a458f
13 changed files with 66 additions and 20 deletions

View File

@ -53,9 +53,8 @@ if (MSVC)
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
elseif (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
elseif (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

View File

@ -33,6 +33,7 @@ if (MSVC)
else()
set(WEBSOCKETPP_DEFINES
-D_WEBSOCKETPP_CPP11_STL_
-DASIO_STANDALONE
)
endif()

View File

@ -1,4 +1,4 @@
macro (MERGE_STATIC_LIBRARIES TARGET LIBRARIES LIBRARIES_DEBUG)
macro (MERGE_STATIC_LIBRARIES TARGET_LIB LIBRARIES LIBRARIES_DEBUG)
if("${CMAKE_CFG_INTDIR}" STREQUAL ".")
set(multiconfig FALSE)
@ -24,12 +24,29 @@ macro (MERGE_STATIC_LIBRARIES TARGET LIBRARIES LIBRARIES_DEBUG)
string(TOUPPER "${CONFIG_TYPE}" _CONFIG_TYPE)
string(TOUPPER "STATIC_LIBRARY_FLAGS_${CONFIG_TYPE}" PROPNAME)
if ("${_CONFIG_TYPE}" STREQUAL "DEBUG")
set_property (TARGET ${TARGET} APPEND PROPERTY ${PROPNAME} "${LIBS_DEBUG}")
set_property (TARGET ${TARGET_LIB} APPEND PROPERTY ${PROPNAME} "${LIBS_DEBUG}")
else()
set_property (TARGET ${TARGET} APPEND PROPERTY ${PROPNAME} "${LIBS}")
set_property (TARGET ${TARGET_LIB} APPEND PROPERTY ${PROPNAME} "${LIBS}")
endif()
endforeach()
else (APPLE)
# Use OSX's libtool to merge archives
if(multiconfig)
message(FATAL_ERROR "Multiple configurations are not supported")
endif()
set(outfile $<TARGET_FILE:${TARGET_LIB}>)
set(target_temp_file "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${TARGET_LIB}_temp.a")
add_custom_command(TARGET ${TARGET_LIB} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${outfile}"
"${target_temp_file}"
COMMAND rm "${outfile}"
COMMAND /usr/bin/libtool -no_warning_for_no_symbols -static -o "${outfile}"
${LIBRARIES} "${target_temp_file}"
COMMAND rm "${target_temp_file}"
)
endif (WIN32)
endmacro (MERGE_STATIC_LIBRARIES)

View File

@ -10,7 +10,12 @@
#include <iostream>
#include <string>
#include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#include <sys/uio.h>
#else
#include <io.h>
#endif
#include <fcntl.h>
#include <signal.h>
#include "throughnet.h"

View File

@ -10,7 +10,18 @@
#include "webrtc/base/json.h"
#include "webrtc/base/signalthread.h"
#ifdef WEBRTC_POSIX
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/messagequeue.h"
namespace rtc {
MessageHandler::~MessageHandler() {
MessageQueueManager::Clear(this);
}
} // namespace rtc
#endif // WEBRTC_POSIX
namespace tn {

View File

@ -29,7 +29,7 @@ public:
explicit Control();
explicit Control(std::shared_ptr<Signal> signal);
~Control();
virtual ~Control();
//
// Initialize and release

View File

@ -172,12 +172,12 @@ class FakeAudioCaptureModule
int32_t ResetAudioDevice() override;
int32_t SetLoudspeakerStatus(bool enable) override;
int32_t GetLoudspeakerStatus(bool* enabled) const override;
virtual bool BuiltInAECIsAvailable() const { return false; }
virtual int32_t EnableBuiltInAEC(bool enable) { return -1; }
virtual bool BuiltInAGCIsAvailable() const { return false; }
virtual int32_t EnableBuiltInAGC(bool enable) { return -1; }
virtual bool BuiltInNSIsAvailable() const { return false; }
virtual int32_t EnableBuiltInNS(bool enable) { return -1; }
virtual bool BuiltInAECIsAvailable() const override { return false; }
virtual int32_t EnableBuiltInAEC(bool enable) override { return -1; }
virtual bool BuiltInAGCIsAvailable() const override { return false; }
virtual int32_t EnableBuiltInAGC(bool enable) override { return -1; }
virtual bool BuiltInNSIsAvailable() const override { return false; }
virtual int32_t EnableBuiltInNS(bool enable) override { return -1; }
// End of functions inherited from webrtc::AudioDeviceModule.
// The following function is inherited from rtc::MessageHandler.

View File

@ -202,9 +202,15 @@ const asio::error_code& engine::map_error_code(
// If there's data yet to be read, it's an error.
if (BIO_wpending(ext_bio_))
{
#if defined(OPENSSL_IS_BORINGSSL)
ec = asio::error_code(
ERR_PACK(ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD),
asio::error::get_ssl_category());
#else // defined(OPENSSL_IS_BORINGSSL)
ec = asio::error_code(
ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ),
asio::error::get_ssl_category());
#endif // defined(OPENSSL_IS_BORINGSSL)
return ec;
}
@ -216,9 +222,15 @@ const asio::error_code& engine::map_error_code(
// Otherwise, the peer should have negotiated a proper shutdown.
if ((::SSL_get_shutdown(ssl_) & SSL_RECEIVED_SHUTDOWN) == 0)
{
#if defined(OPENSSL_IS_BORINGSSL)
ec = asio::error_code(
ERR_PACK(ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD),
asio::error::get_ssl_category());
#else // defined(OPENSSL_IS_BORINGSSL)
ec = asio::error_code(
ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ),
asio::error::get_ssl_category());
#endif // defined(OPENSSL_IS_BORINGSSL)
}
return ec;

View File

@ -29,6 +29,7 @@
#define WINCRYPT_X509_CERT_PAIR ((LPCSTR) 53)
#define WINCRYPT_X509_EXTENSIONS ((LPCSTR) 5)
#define WINCRYPT_X509_NAME ((LPCSTR) 7)
#endif // WIN32 || _WIN32
#ifdef __cplusplus
extern "C" {
@ -40,7 +41,6 @@ extern "C" {
#ifdef __cplusplus
}
#endif
#endif // WIN32 || _WIN32
//
// End of throughnet patch

View File

@ -379,7 +379,7 @@ uint64_t PeerDataChannelObserver::BufferedAmount() {
bool PeerDataChannelObserver::IsWritable() {
if (channel_ == nullptr) return false;
if (!IsOpen() || channel_->buffered_amount() >= 0) return false;
if (!IsOpen() || channel_->buffered_amount() > 0) return false;
return true;
}

View File

@ -96,8 +96,8 @@ public:
// Implements CreateSessionDescriptionObserver.
//
void OnSuccess(webrtc::SessionDescriptionInterface* desc);
void OnFailure(const std::string& error) {}
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
void OnFailure(const std::string& error) override {}
//
// PeerDataChannelObserver

View File

@ -91,8 +91,8 @@ public:
#endif //DEBUG
typedef websocketpp::client<client_config> client_type;
Signal::Signal();
Signal::~Signal();
Signal();
~Signal();
void SignIn(const std::string& id, const std::string& password);
void SignOut();

View File

@ -7,6 +7,7 @@
#ifndef __THROUGHNET_THROUGHENT_H__
#define __THROUGHNET_THROUGHENT_H__
#include <string>
#include <map>
#include <memory>
#include <functional>
@ -46,8 +47,8 @@ public:
// APIs
//
static void Throughnet::Run();
static void Throughnet::Stop();
static void Run();
static void Stop();
void SignIn(const std::string alias = "", const std::string id = "", const std::string password = "");
void SignOut();