- fix Windows build issues

This commit is contained in:
2026-02-26 13:33:29 +03:00
parent 8eb6447164
commit 549eb93db7
10 changed files with 24 additions and 29 deletions

View File

@@ -37,7 +37,7 @@ set (CMAKE_FIND_LIBRARY_SUFFIXES .a .so .dylib)
# Windows-specific definitions # Windows-specific definitions
if (CMAKE_SYSTEM MATCHES "Windows*") if (CMAKE_SYSTEM MATCHES "Windows*")
set (DEFINES ${DEFINES} -DTARGET_WIN -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -D_UNICODE -D_CRT_SECURE_NO_WARNINGS) set (DEFINES ${DEFINES} -DTARGET_WIN -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -D_UNICODE -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX)
set (TARGET_WIN ON) set (TARGET_WIN ON)
endif() endif()
@@ -340,9 +340,14 @@ set (LIBS_STATIC ${LIBS_STATIC} jrtplib g729_codec gsm_codec opus
if (USE_AMR_CODEC) if (USE_AMR_CODEC)
#include (${LIB_PLATFORM}/platform_libs.cmake) #include (${LIB_PLATFORM}/platform_libs.cmake)
if (TARGET_WIN)
set (OPENCORE_AMRNB ${CMAKE_CURRENT_LIST_DIR}/libs/opencore-amr/opencore-amrnb.lib)
set (OPENCORE_AMRWB ${CMAKE_CURRENT_LIST_DIR}/libs/opencore-amr/opencore-amrwb.lib)
else()
set (OPENCORE_AMRNB opencore-amrnb) set (OPENCORE_AMRNB opencore-amrnb)
set (OPENCORE_AMRWB opencore-amrwb) set (OPENCORE_AMRWB opencore-amrwb)
message("Media: AMR NB and WB codecs will be included.") endif()
message("Media: AMR NB and WB codecs will be included: {OPENCORE_AMRNB} / {OPENCORE_AMRWB}")
set (DEFINES ${DEFINES} -DUSE_AMR_CODEC) set (DEFINES ${DEFINES} -DUSE_AMR_CODEC)
set (LIBS_STATIC ${LIBS_STATIC} ${OPENCORE_AMRNB} ${OPENCORE_AMRWB}) set (LIBS_STATIC ${LIBS_STATIC} ${OPENCORE_AMRNB} ${OPENCORE_AMRWB})
endif() endif()

View File

@@ -1,4 +1,4 @@
/* Copyright(C) 2007-2018 VoIP objects (voipobjects.com) /* Copyright(C) 2007-2026 VoIP objects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

View File

@@ -1,9 +1,8 @@
/* Copyright(C) 2007-2017 VoIPobjects (voipobjects.com) /* Copyright(C) 2007-2026 VoIPobjects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define NOMINMAX
#include "Audio_DevicePair.h" #include "Audio_DevicePair.h"
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>

View File

@@ -1,6 +1,7 @@
#include "HL_Process.h" #include "HL_Process.h"
#include <thread> #include <thread>
#include <memory> #include <memory>
#include <algorithm>
#ifdef TARGET_WIN #ifdef TARGET_WIN
# define popen _popen # define popen _popen
@@ -9,7 +10,6 @@
#if defined(TARGET_WIN) #if defined(TARGET_WIN)
#include <Windows.h> #include <Windows.h>
#include <iostream>
#include "helper/HL_String.h" #include "helper/HL_String.h"
int OsProcess::execSystem(const std::string& cmd) int OsProcess::execSystem(const std::string& cmd)
@@ -68,7 +68,7 @@ std::string OsProcess::execCommand(const std::string& cmd)
if (!dwAvail) // no data available, return if (!dwAvail) // no data available, return
break; break;
if (!::ReadFile(hPipeRead, buf, min(sizeof(buf) - 1, dwAvail), &dwRead, NULL) || !dwRead) if (!::ReadFile(hPipeRead, buf, std::min(sizeof(buf) - 1, (size_t)dwAvail), &dwRead, NULL) || !dwRead)
// error, the child process might ended // error, the child process might ended
break; break;
@@ -148,7 +148,7 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
break; break;
int filled = strlen(buf); int filled = strlen(buf);
if (!::ReadFile(hPipeRead, buf + filled, min(sizeof(buf) - 1 - filled, dwAvail), &dwRead, nullptr) || !dwRead) if (!::ReadFile(hPipeRead, buf + filled, std::min(sizeof(buf) - 1 - filled, (size_t)dwAvail), &dwRead, nullptr) || !dwRead)
// error, the child process might ended // error, the child process might ended
break; break;

View File

@@ -1,10 +1,8 @@
/* Copyright(C) 2007-2023 VoIPobjects (voipobjects.com) /* Copyright(C) 2007-2026 VoIPobjects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define NOMINMAX
#include "../engine_config.h" #include "../engine_config.h"
#include "MT_AudioCodec.h" #include "MT_AudioCodec.h"
#include "MT_CodecList.h" #include "MT_CodecList.h"

View File

@@ -1,12 +1,8 @@
/* Copyright(C) 2007-2021 VoIPobjects (voipobjects.com) /* Copyright(C) 2007-2026 VoIPobjects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if defined(TARGET_WIN) && !defined(NOMINMAX)
# define NOMINMAX
#endif
#include "../engine_config.h" #include "../engine_config.h"
#include "MT_AudioReceiver.h" #include "MT_AudioReceiver.h"
#include "MT_AudioCodec.h" #include "MT_AudioCodec.h"

View File

@@ -3,8 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define NOMINMAX
#include "ICEPlatform.h" #include "ICEPlatform.h"
#include "ICEByteBuffer.h" #include "ICEByteBuffer.h"
#include "ICEError.h" #include "ICEError.h"

View File

@@ -1,4 +1,4 @@
/* Copyright(C) 2007-2014 VoIP objects (voipobjects.com) /* Copyright(C) 2007-2026 VoIP objects (voipobjects.com)
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -6,11 +6,8 @@
#ifndef __ICE_TYPES_H #ifndef __ICE_TYPES_H
#define __ICE_TYPES_H #define __ICE_TYPES_H
#include <stdint.h> #if !defined(TARGET_WIN) && !defined(SOCKET)
//#define INVALID_SOCKET (-1)
# ifndef SOCKET
# define SOCKET int # define SOCKET int
# endif #endif
#endif #endif

View File

@@ -363,7 +363,7 @@ target_include_directories(resiprocate PUBLIC
set (RESIP_DEFINES -DUSE_SSL -DUSE_IPV6 -DUSE_ARES) set (RESIP_DEFINES -DUSE_SSL -DUSE_IPV6 -DUSE_ARES)
if (TARGET_WIN) if (TARGET_WIN)
set (RESIP_DEFINES ${RESIP_DEFINES} -DARES_LEGACY_DEFINES) set (RESIP_DEFINES ${RESIP_DEFINES} -DARES_LEGACY_DEFINES -DNOMINMAX)
else() else()
set (RESIP_DEFINES ${RESIP_DEFINES} -DHAVE_ARPA_NAMESER_H) set (RESIP_DEFINES ${RESIP_DEFINES} -DHAVE_ARPA_NAMESER_H)
endif() endif()
@@ -373,4 +373,7 @@ target_link_libraries(resiprocate PUBLIC OpenSSL::SSL)
target_link_libraries(resiprocate PUBLIC OpenSSL::Crypto) target_link_libraries(resiprocate PUBLIC OpenSSL::Crypto)
target_compile_definitions(resiprocate PUBLIC ${RESIP_DEFINES}) target_compile_definitions(resiprocate PUBLIC ${RESIP_DEFINES})
target_compile_options(resiprocate PUBLIC -Wno-deprecated -Wno-deprecated-declarations)
if (TARGET_LINUX OR TARGET_OSX OR TARGET_ANDROID OR TARGET_IOS)
target_compile_options(resiprocate PUBLIC -Wno-deprecated -Wno-deprecated-declarations)
endif()

View File

@@ -1,4 +1,3 @@
#define NOMINMAX
#include <cstddef> #include <cstddef>
#include <cstring> #include <cstring>