- Windows build improvements + minor fixes (nothing critical, just to be on the safe side)

This commit is contained in:
2026-02-17 04:33:05 +03:00
parent 8f8bfda9df
commit cc470f7cf6
4 changed files with 63 additions and 10 deletions

55
build_windows.py Normal file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python3
# This script is just to check if the library is buildable
from pathlib import Path
import os
import multiprocessing
import shutil
# Temporary build directory
DIR_BUILD = 'build_windows'
# This directory
DIR_THIS = Path(__file__).parent.resolve()
# Path to app
DIR_SOURCE = (DIR_THIS / '../src').resolve()
CMAKE_GENERATOR = '-G "Visual Studio 17 2022" -A x64'
# Not used yet
CMAKE_BUILD_TYPE = 'Debug'
def make_build() -> Path:
if Path(DIR_BUILD).exists():
shutil.rmtree(DIR_BUILD)
os.mkdir(DIR_BUILD)
os.chdir(DIR_BUILD)
if os.environ['VCPKG_ROOT']:
vcpkg_root = os.environ['VCPKG_ROOT']
else:
vcpkg_root = 'C:\\tools\\vcpkg'
if not Path(vcpkg_root).exists():
print(f'Failed to find vcpkg (OpenSSL libraries needed)')
exit(1)
cmd = f'cmake ../src {CMAKE_GENERATOR} -D CMAKE_TOOLCHAIN_FILE="{vcpkg_root}\\scripts\\buildsystems\\vcpkg.cmake"'
print(cmd)
retcode = os.system(cmd)
if retcode != 0:
raise RuntimeError('Problem when configuring the project')
cmd = f'cmake --build . -j {multiprocessing.cpu_count()}'
retcode = os.system(cmd)
if retcode != 0:
raise RuntimeError('Problem when building the project')
os.chdir('..')
return Path(DIR_BUILD) / 'Debug' / 'rtphone.lib'
if __name__ == '__main__':
p = make_build()
print (f'Built: {p}')

View File

@@ -16,15 +16,13 @@ option (USE_MUSL "Build with MUSL library" OFF)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
set (RUNTIME_CPU_CAPABILITY_DETECTION ON)
set (LIB_PLATFORM ${CMAKE_CURRENT_SOURCE_DIR}/libs/libraries)
#include (${LIB_PLATFORM}/platform_libs.cmake)
find_package(OpenSSL REQUIRED)
set (OPENSSL_SSL OpenSSL::SSL)
set (OPENSSL_CRYPTO OpenSSL::Crypto)
message("Libraries: ${LIB_PLATFORM}")
# set (OPENSSL_INCLUDE ${LIB_PLATFORM}/openssl/1.1/include)
message ("Using OpenSSL include files from ${OPENSSL_INCLUDE}")
message ("Using OpenSSL libs: ${OPENSSL_SSL} and ${OPENSSL_CRYPTO}")
include_directories(${OPENSSL_INCLUDE})
# include_directories(${OPENSSL_INCLUDE})
# Used defines for our project
set (DEFINES -DUSE_OPENSSL)

View File

@@ -110,13 +110,13 @@ timespec chronox::toTimespec(uint64_t milliseconds)
uint64_t chronox::toTimestamp(const timeval& ts)
{
return ts.tv_sec * 1000 + ts.tv_usec / 1000;
return (uint64_t)ts.tv_sec * 1000 + ts.tv_usec / 1000;
}
int64_t chronox::getDelta(const timespec& a, const timespec& b)
{
uint64_t ms_a = a.tv_sec * 1000 + a.tv_nsec / 10000000;
uint64_t ms_b = b.tv_sec * 1000 + b.tv_nsec / 10000000;
uint64_t ms_a = (uint64_t)a.tv_sec * 1000 + a.tv_nsec / 10000000;
uint64_t ms_b = (uint64_t)b.tv_sec * 1000 + b.tv_nsec / 10000000;
return ms_a - ms_b;
}

View File

@@ -626,7 +626,7 @@ int AmrWbCodec::decodePlain(std::span<const uint8_t> input, std::span<uint8_t> o
size_t dataOutSizeInBytes = 0;
for (AmrFrame& frame: ap.mFrames)
{
memset(dataOut, 0, static_cast<size_t>(pcmLength()));
memset(dataOut, 0, static_cast<size_t>(output.size()));
if (frame.mData)
{