Skip to content

Commit

Permalink
build: the last alterations allowing the UWP build to pass
Browse files Browse the repository at this point in the history
Change-Id: I1d315ed93adf4b58dada2721278b209d87216e0e
Tuleap: #790
  • Loading branch information
atraczyk committed Jan 23, 2017
1 parent d5e52e7 commit 114df59
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 39 deletions.
32 changes: 23 additions & 9 deletions MSVC/ring-daemon.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)..\contrib\build\FFmpegInterop\ffmpeg\Build\Windows10\x64\include;$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\src;$(ProjectDir)..\src\client;$(ProjectDir)..\src\config;$(ProjectDir)..\src\dring;$(ProjectDir)..\src\hooks;$(ProjectDir)..\src\iax;$(ProjectDir)..\src\im;$(ProjectDir)..\src\media;$(ProjectDir)..\src\ringdht;$(ProjectDir)..\src\security;$(ProjectDir)..\src\sip;$(ProjectDir)..\src\upnp;$(ProjectDir)..\src\ringdht\eth;$(ProjectDir)..\contrib\build;$(ProjectDir)..\contrib\build\include;$(ProjectDir)..\contrib\build\pjproject\pjlib\include;$(ProjectDir)..\contrib\build\pjproject\pjnath\include;$(ProjectDir)..\contrib\build\pjproject\pjlib-util\include;$(ProjectDir)..\contrib\build\pjproject\pjsip\include;$(ProjectDir)..\contrib\build\pjproject\third_party\speex\include;$(ProjectDir)..\contrib\build\pjproject\third_party;$(ProjectDir)..\contrib\build\pjproject\pjmedia\include;$(ProjectDir)..\contrib\build\boost;$(ProjectDir)..\contrib\build\cryptopp;$(ProjectDir)..\contrib\build\restbed\source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BOOST_SYSTEM_NO_DEPRECATED;PJ_OS_HAS_CHECK_STACK=1;STATIC_GETOPT;_USE_MATH_DEFINES;PCRE_STATIC;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;HAVE_CONFIG_H;WIN32_LEAN_AND_MEAN;RING_UWP;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>BOOST_SYSTEM_NO_DEPRECATED;PJ_OS_HAS_CHECK_STACK=1;STATIC_GETOPT;_USE_MATH_DEFINES;PCRE_STATIC;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;HAVE_CONFIG_H;WIN32_LEAN_AND_MEAN;RING_UWP;WIN32_NATIVE;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996;4503;4180;4244;4267;</DisableSpecificWarnings>
<SuppressStartupBanner>true</SuppressStartupBanner>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand All @@ -444,7 +444,7 @@
</Command>
</PreBuildEvent>
<Lib>
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;advapi32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libsamplerate.lib;libsndfile.lib;libgnutls.lib;lib_json.lib;opendht.lib;argon.lib;blake.lib;pcre.lib;yaml-cpp.lib;portaudio-UWP.lib;libupnp.lib;cryptlib.lib;boost_system.lib;boost_random.lib;pjsip-core-x86_64-x64-vc14-Release.lib;pjsip-simple-x86_64-x64-vc14-Release.lib;pjsua2-lib-x86_64-x64-vc14-Release.lib;pjsua-lib-x86_64-x64-vc14-Release.lib;pjsip-ua-x86_64-x64-vc14-Release.lib;pjmedia-codec-x86_64-x64-vc14-Release.lib;pjmedia-x86_64-x64-vc14-Release.lib;pjlib-util-x86_64-x64-vc14-Release.lib;libspeex-x86_64-x64-vc14-Release.lib;pjlib-x86_64-x64-vc14-Release.lib;pjnath-x86_64-x64-vc14-Release.lib;restbed.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;iphlpapi.lib;advapi32.lib;avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libsamplerate.lib;libgnutls.lib;lib_json.lib;opendht.lib;argon.lib;blake.lib;pcre.lib;yaml-cpp.lib;portaudio-UWP.lib;libupnp.lib;cryptlib.lib;boost_system.lib;boost_random.lib;pjsip-core-x86_64-x64-vc14-Release.lib;pjsip-simple-x86_64-x64-vc14-Release.lib;pjsua2-lib-x86_64-x64-vc14-Release.lib;pjsua-lib-x86_64-x64-vc14-Release.lib;pjsip-ua-x86_64-x64-vc14-Release.lib;pjmedia-codec-x86_64-x64-vc14-Release.lib;pjmedia-x86_64-x64-vc14-Release.lib;pjlib-util-x86_64-x64-vc14-Release.lib;libspeex-x86_64-x64-vc14-Release.lib;pjlib-x86_64-x64-vc14-Release.lib;pjnath-x86_64-x64-vc14-Release.lib;restbed.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir)..\contrib\build\FFmpegInterop\ffmpeg\Build\Windows10\x64\bin;$(ProjectDir)..\contrib\build\lib\x64;$(ProjectDir)..\contrib\build\boost\stage\lib;$(ProjectDir)..\contrib\build\pjproject\pjsip\lib;$(ProjectDir)..\contrib\build\pjproject\pjmedia\lib;$(ProjectDir)..\contrib\build\pjproject\pjlib-util\lib;$(ProjectDir)..\contrib\build\pjproject\third_party\lib;$(ProjectDir)..\contrib\build\pjproject\pjlib\lib;$(ProjectDir)..\contrib\build\pjproject\pjnath\lib;$(ProjectDir)..\contrib\build\libnatpmp\msvc\x64\Release;$(ProjectDir)..\contrib\build\restbed\build\Release;$(ProjectDir)..\contrib\build\restbed\dependency\openssl\out32dll</AdditionalLibraryDirectories>
<AdditionalOptions>/ignore:4006 /ignore:4221 %(AdditionalOptions)</AdditionalOptions>
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
Expand All @@ -466,7 +466,9 @@
<ClInclude Include="..\src\config\serializable.h" />
<ClInclude Include="..\src\config\yamlparser.h" />
<ClInclude Include="..\src\dirent.h" />
<ClInclude Include="..\src\dlfcn.h" />
<ClInclude Include="..\src\dlfcn.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\dring\account_const.h" />
<ClInclude Include="..\src\dring\callmanager_interface.h" />
<ClInclude Include="..\src\dring\call_const.h" />
Expand Down Expand Up @@ -530,8 +532,12 @@
<ClInclude Include="..\src\media\video\video_scaler.h" />
<ClInclude Include="..\src\media\video\video_sender.h" />
<ClInclude Include="..\src\noncopyable.h" />
<ClInclude Include="..\src\plugin_loader.h" />
<ClInclude Include="..\src\plugin_manager.h" />
<ClInclude Include="..\src\plugin_loader.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\plugin_manager.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\preferences.h" />
<ClInclude Include="..\src\rational.h" />
<ClInclude Include="..\src\registration_states.h" />
Expand Down Expand Up @@ -573,8 +579,8 @@
<ClInclude Include="..\src\sip\siptransport.h" />
<ClInclude Include="..\src\sip\sipvoiplink.h" />
<ClInclude Include="..\src\sip\sip_utils.h" />
<ClInclude Include="..\src\smartools.h" />
<ClInclude Include="..\src\string_utils.h" />
<ClInclude Include="..\src\sys_time.h" />
<ClInclude Include="..\src\threadloop.h" />
<ClInclude Include="..\src\thread_pool.h" />
<ClInclude Include="..\src\upnp\upnp_context.h" />
Expand All @@ -583,6 +589,7 @@
<ClInclude Include="..\src\utf8_utils.h" />
<ClInclude Include="..\src\winsyslog.h" />
<ClInclude Include="config.h" />
<ClInclude Include="sys_time.h" />
<ClInclude Include="unistd.h" />
</ItemGroup>
<ItemGroup>
Expand All @@ -600,7 +607,9 @@
<ClCompile Include="..\src\client\videomanager.cpp" />
<ClCompile Include="..\src\conference.cpp" />
<ClCompile Include="..\src\config\yamlparser.cpp" />
<ClCompile Include="..\src\dlfcn.c" />
<ClCompile Include="..\src\dlfcn.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\fileutils.cpp" />
<ClCompile Include="..\src\hooks\urlhook.cpp" />
<ClCompile Include="..\src\ice_transport.cpp" />
Expand Down Expand Up @@ -648,8 +657,12 @@
<ClCompile Include="..\src\media\video\video_rtp_session.cpp" />
<ClCompile Include="..\src\media\video\video_scaler.cpp" />
<ClCompile Include="..\src\media\video\video_sender.cpp" />
<ClCompile Include="..\src\plugin_loader_dl.cpp" />
<ClCompile Include="..\src\plugin_manager.cpp" />
<ClCompile Include="..\src\plugin_loader_dl.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\plugin_manager.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseLib|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\preferences.cpp" />
<ClCompile Include="..\src\ringdht\eth\libdevcore\Common.cpp" />
<ClCompile Include="..\src\ringdht\eth\libdevcore\CommonData.cpp" />
Expand Down Expand Up @@ -682,6 +695,7 @@
<ClCompile Include="..\src\sip\siptransport.cpp" />
<ClCompile Include="..\src\sip\sipvoiplink.cpp" />
<ClCompile Include="..\src\sip\sip_utils.cpp" />
<ClCompile Include="..\src\smartools.cpp" />
<ClCompile Include="..\src\string_utils.cpp" />
<ClCompile Include="..\src\threadloop.cpp" />
<ClCompile Include="..\src\thread_pool.cpp" />
Expand Down
24 changes: 15 additions & 9 deletions MSVC/ring-daemon.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@
<ClInclude Include="..\src\noncopyable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\plugin_loader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\plugin_manager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\preferences.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -364,9 +358,6 @@
<ClInclude Include="..\src\string_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\sys_time.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\threadloop.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -514,6 +505,18 @@
<ClInclude Include="..\src\compiler_intrinsics.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="sys_time.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\plugin_loader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\plugin_manager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\smartools.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\preferences.cpp">
Expand Down Expand Up @@ -828,5 +831,8 @@
<ClCompile Include="..\src\ringdht\namedirectory.cpp">
<Filter>Source Files\ringdht</Filter>
</ClCompile>
<ClCompile Include="..\src\smartools.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions contrib/src/ffmpeg/fetch_and_patch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ cd %BUILD%

git clone --recursive %FFMPEG_URL%

cd FFmpegInterop\ffmpeg
git apply --reject --whitespace=fix %SRC%\ffmpeg\0004-avformat-fix-find_stream_info-not-considering-extradata.patch

cd %SRC%
2 changes: 1 addition & 1 deletion src/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace ring {

class VoIPLink;
class Account;
class AccountVideoCodecInfo;
struct AccountVideoCodecInfo;

template <class T> using CallMap = std::map<std::string, std::shared_ptr<T> >;

Expand Down
11 changes: 11 additions & 0 deletions src/dlfcn.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* dlfcn-win32
* Copyright (c) 2007 Ramiro Polla
Expand Down Expand Up @@ -135,7 +136,9 @@ void *dlopen( const char *file, int mode )
UINT uMode;
current_error = NULL;
/* Do not let Windows display the critical-error-handler message box */
#ifndef RING_UWP
uMode = SetErrorMode( SEM_FAILCRITICALERRORS );
#endif
if( file == 0 )
{
/* POSIX says that if the value of file is 0, a handle on a global
Expand All @@ -146,7 +149,9 @@ void *dlopen( const char *file, int mode )
* symbols only from the original program file. For objects loaded with
* the RTLD_GLOBAL flag, we create our own list later on.
*/
#ifndef RING_UWP
hModule = GetModuleHandle( NULL );
#endif
if( !hModule )
save_err_ptr_str( file );
}
Expand All @@ -170,8 +175,10 @@ else
* to UNIX's search paths (start with system folders instead of current
* folder).
*/
#ifndef RING_UWP
hModule = LoadLibraryEx( (LPSTR) lpFileName, NULL,
LOAD_WITH_ALTERED_SEARCH_PATH );
#endif
/* If the object was loaded with RTLD_GLOBAL, add it to list of global
* objects, so that its symbols may be retrieved even if the handle for
* the original program file is passed. POSIX says that if the same
Expand All @@ -185,7 +192,9 @@ else if( (mode & RTLD_GLOBAL) )
global_add( hModule );
}
/* Return to previous state of the error-mode bit flags. */
#ifndef RING_UWP
SetErrorMode( uMode );
#endif
return (void *) hModule;
}
int dlclose( void *handle )
Expand Down Expand Up @@ -216,7 +225,9 @@ void *dlsym( void *handle, const char *name )
/* If the handle for the original program file is passed, also search
* in all globally loaded objects.
*/
#ifndef RING_UWP
hModule = GetModuleHandle( NULL );
#endif
if( hModule == handle )
{
global_object *pobject;
Expand Down
2 changes: 1 addition & 1 deletion src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ vlogger(const int level, const char *format, va_list ap)
format = sep + 2;
fputs(getHeader(ctx.c_str()).c_str(), stderr);
#ifdef RING_UWP
char tmp[2048];
char tmp[4096];
vsprintf(tmp, format, ap);
ring::emitSignal<DRing::DebugSignal::MessageSend>(getHeader(ctx.c_str()).c_str() + std::string(tmp));
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/media/media_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ namespace ring {

class AudioBuffer;
class MediaIOHandle;
class MediaDescription;
class AccountCodecInfo;
struct MediaDescription;
struct AccountCodecInfo;

class MediaEncoderException : public std::runtime_error {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/media/video/video_sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// Forward declarations
namespace ring {
class SocketPair;
class AccountVideoCodecInfo;
struct AccountVideoCodecInfo;
}

namespace ring { namespace video {
Expand Down
12 changes: 11 additions & 1 deletion src/ringdht/ringaccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ RingAccount::revokeDevice(const std::string& password, const std::string& device
[fa,sthis,password](const std::shared_ptr<dht::crypto::Certificate>& crt) mutable
{
sthis->foundAccountDevice(crt);
auto a = fa->get();
ArchiveContent a = fa->get();
// Add revoked device to the revocation list and resign it
if (not a.revoked)
a.revoked = std::make_shared<decltype(a.revoked)::element_type>();
Expand Down Expand Up @@ -1986,13 +1986,23 @@ RingAccount::doRegister_()
auto dht_log_level = Manager::instance().dhtLogLevel.load();
if (dht_log_level > 0) {
static auto silent = [](char const* /*m*/, va_list /*args*/) {};
#ifndef RING_UWP
static auto log_error = [](char const* m, va_list args) { vlogger(LOG_ERR, m, args); };
static auto log_warn = [](char const* m, va_list args) { vlogger(LOG_WARNING, m, args); };
static auto log_debug = [](char const* m, va_list args) { vlogger(LOG_DEBUG, m, args); };
dht_.setLoggers(
log_error,
(dht_log_level > 1) ? log_warn : silent,
(dht_log_level > 2) ? log_debug : silent);
#else
static auto log_all = [](char const* m, va_list args) {
char tmp[2048];
vsprintf(tmp, m, args);
auto now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
ring::emitSignal<DRing::DebugSignal::MessageSend>(std::to_string(now) + " " + std::string(tmp));
};
dht_.setLoggers(log_all, log_all, silent);
#endif
}

dht_.importValues(loadValues());
Expand Down
8 changes: 6 additions & 2 deletions src/security/tls_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class IceSocket;
} // namespace ring

namespace dht { namespace crypto {
class Certificate;
class PrivateKey;
struct Certificate;
struct PrivateKey;
}} // namespace dht::crypto

namespace ring { namespace tls {
Expand All @@ -65,6 +65,10 @@ class DhParams {
DhParams() = default;
DhParams(DhParams&&) = default;

DhParams& operator =(const DhParams& other){
return *this;
}

/** Take ownership of gnutls_dh_params */
explicit DhParams(gnutls_dh_params_t p) : params_(p, gnutls_dh_params_deinit) {};

Expand Down
6 changes: 6 additions & 0 deletions src/security/tlsvalidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@
#include <netinet/in.h>
#include <netdb.h>
#else
#ifndef RING_UWP
#define close(x) closesocket(x)
#endif
#endif
#include <unistd.h>
#include <fcntl.h>

#ifdef RING_UWP
#include "windirent.h"
#endif

namespace ring { namespace tls {

//Map the internal ring Enum class of the exported names
Expand Down
2 changes: 1 addition & 1 deletion src/sip/sdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Sdp::findCodecByPayload(const unsigned payloadType)
static void
randomFill(std::vector<uint8_t>& dest)
{
std::uniform_int_distribution<uint8_t> rand_byte(0, 255);
std::uniform_int_distribution<int> rand_byte{ 0, std::numeric_limits<uint8_t>::max() };
random_device rdev;
std::generate(dest.begin(), dest.end(), std::bind(rand_byte, std::ref(rdev)));
}
Expand Down
2 changes: 2 additions & 0 deletions src/sip/sipaccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,8 @@ std::string SIPAccount::getLoginName()
#ifndef _WIN32
struct passwd * user_info = getpwuid(getuid());
return user_info ? user_info->pw_name : "";
#elif defined (RING_UWP)
return "Unknown";
#else
TCHAR username[UNLEN + 1];
DWORD size = UNLEN + 1;
Expand Down
8 changes: 7 additions & 1 deletion src/sip/sipaccount.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,15 @@ class SIPAccount : public SIPAccountBase {
* The type of this instance is given in template argument.
* This type can be any base class of SIPCall class (included).
*/
#ifndef RING_UWP
template <class T=SIPCall>
std::shared_ptr<enable_if_base_of<T, SIPCall> >
newOutgoingCall(const std::string& toUrl);
newOutgoingCall(const std::string& toUrl);
#else
template <class T>
std::shared_ptr<T>
newOutgoingCall(const std::string& toUrl);
#endif

/**
* Create incoming SIPCall.
Expand Down
6 changes: 3 additions & 3 deletions src/sip/siptransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ SipTransportBroker::getTlsTransport(const std::shared_ptr<TlsListener>& l, const
remoteAddr.setPort(pjsip_transport_get_default_port_for_type(l->get()->type));

RING_DBG("Get new TLS transport to %s", remoteAddr.toString(true).c_str());
pjsip_tpselector sel {PJSIP_TPSELECTOR_LISTENER, {
.listener = l->get()
}};
pjsip_tpselector sel;
sel.type = PJSIP_TPSELECTOR_LISTENER;
sel.u.listener = l->get();

pjsip_tx_data tx_data;
tx_data.dest_info.name = pj_str_t{(char*)remote_name.data(), (pj_ssize_t)remote_name.size()};
Expand Down
2 changes: 1 addition & 1 deletion src/sip/sipvoiplink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ SIPVoIPLink::~SIPVoIPLink()
for (int timeout = 0;
pjsip_tsx_layer_get_tsx_count() and timeout < MAX_TIMEOUT_ON_LEAVING;
timeout++)
sleep(1);
std::this_thread::sleep_for(std::chrono::seconds(1));

pjsip_tpmgr_set_state_cb(pjsip_endpt_get_tpmgr(endpt_), nullptr);
Manager::instance().unregisterEventHandler((uintptr_t)this);
Expand Down
Loading

0 comments on commit 114df59

Please sign in to comment.