Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
fdf53cc
Add initial support for building with CMake
aymanalqadhi Jun 3, 2025
83c1376
Merge branch 'master' into cmake-build
aymanalqadhi Jul 3, 2025
7e27b87
Fix speex package version check
aymanalqadhi Jul 3, 2025
b832ca4
Fix endianness definition check
aymanalqadhi Jul 4, 2025
0a3d564
Refactor WebRTC architecture detection
aymanalqadhi Jul 4, 2025
86ddf7f
Import `SpeexDSP` for AEC
aymanalqadhi Jul 4, 2025
4289e3c
Add architecture definitions to `pjlib`
aymanalqadhi Jul 4, 2025
e3de3e0
Various fixes to option handling
aymanalqadhi Jul 4, 2025
868710c
Clean up root `CMakeLists.txt`
aymanalqadhi Jul 4, 2025
5708fbf
Add test apps
aymanalqadhi Jul 4, 2025
14df9bd
Explicitly link against the math library where needed
aymanalqadhi Jul 4, 2025
6f9bec3
Make compiler options specification code more portable for third part…
aymanalqadhi Jul 4, 2025
74bd216
Update minimum required version
aymanalqadhi Jul 4, 2025
f01c554
Fix include directories detection issues when building with make
aymanalqadhi Jul 5, 2025
caa7458
Specify header files via `target_sources`
aymanalqadhi Jul 5, 2025
84701f6
Remove `pjsdp` target
aymanalqadhi Jul 5, 2025
0197cae
Minor fixes for third-party libs
aymanalqadhi Jul 5, 2025
d21d4f5
Add bundled third party libraries' headers via `target_sources`
aymanalqadhi Jul 6, 2025
ab97939
Fix OpenSSL GCM capability check
aymanalqadhi Jul 7, 2025
e55e007
Simplify third party dependencies management
aymanalqadhi Jul 7, 2025
2e70c0f
Add a starting point to implement installation
aymanalqadhi Jul 7, 2025
42a1711
Add support for `MbedTLS` and `GnuTLS` SSL backends
aymanalqadhi Jul 7, 2025
c638a30
Add `pjlib++` interface library
aymanalqadhi Jul 7, 2025
6cadb4f
Fix `webrtc_aec3` package help string
aymanalqadhi Jul 7, 2025
fe0be41
Merge branch 'pjsip:master' into cmake-build
aymanalqadhi Jul 7, 2025
9431933
Fix `libupnp` importing logic
aymanalqadhi Jul 7, 2025
e1ce2f4
Excluded added third-party subdirectories from `all` target
aymanalqadhi Jul 7, 2025
bf4a18a
Make WebRTC parameters use variables instead of an `INTERFACE` target
aymanalqadhi Jul 7, 2025
3deb856
Fix third-party target inclusion
aymanalqadhi Jul 7, 2025
e87fca5
Fix erroneous check for `m` library
aymanalqadhi Jul 27, 2025
a18ff68
Don't search for a math library on Windows
a-lerion Jul 28, 2025
67bc0b6
Fix warning
a-lerion Jul 28, 2025
c01ea0a
Fix include if both Windows Sockets and Windows Sockets 2 are available
a-lerion Jul 28, 2025
9de3118
Remove duplicate includes
a-lerion Jul 28, 2025
dfae3b7
Fix use of math constants
a-lerion Jul 28, 2025
d0634ba
Remove WEBRTC_POSIX compile definition from Windows
a-lerion Jul 28, 2025
35417db
Use config mode first when searching for OpenSSL
a-lerion Jul 28, 2025
47d3615
Remove min/max MSVC macro
a-lerion Jul 28, 2025
dcf91a5
Use pjmedia audiodev wasapi_dev.cpp for a UWP build
a-lerion Jul 28, 2025
9bead8f
Fix defining WIN32_LEAN_AND_MEAN
a-lerion Jul 28, 2025
380d8dd
Link to Windows Sockets 2 or Windows Sockets based on headers available
a-lerion Jul 28, 2025
5962c76
Fix platform spelling
a-lerion Aug 1, 2025
5fd7246
Check PJMEDIA_WITH_SRTP too when linking OpenSSL
a-lerion Aug 1, 2025
3b5221b
Move NOMINMAX from webrtc_aec3 library to the WEBRTC_COMPILE_DEFINITI…
a-lerion Aug 1, 2025
f7471d6
Revert a generator expression around wasapi_dev.cpp
a-lerion Aug 1, 2025
115999c
Fix architecture check
a-lerion Aug 2, 2025
4a79cd8
Simplify matches and use a condition syntax
a-lerion Aug 2, 2025
fab8a0b
Move include closer to first use
a-lerion Aug 2, 2025
d3185bd
Link a missing dependency
a-lerion Aug 2, 2025
27cfc8f
Add an option to use a static runtime of MSVC
a-lerion Aug 2, 2025
9222f41
Add a module to find `WASAPI`
aymanalqadhi Aug 2, 2025
91a842c
Expose pjlib's SSL link libraries via an interface target
aymanalqadhi Aug 2, 2025
1bc1f4d
Fix `pjlib++` header files' paths
aymanalqadhi Aug 2, 2025
34e5a99
Make third_party libraries build only when needed
aymanalqadhi Aug 2, 2025
95feae9
Add `pjlib-ssl` to exported target
aymanalqadhi Aug 8, 2025
fcf57a9
Merge branch 'master' into cmake-build
aymanalqadhi Aug 28, 2025
ab6bb5d
Use C11 atomics when available (#4570)
aymanalqadhi Sep 1, 2025
9d07352
Merge branch 'master' into cmake-build
aymanalqadhi Sep 2, 2025
87cf352
Remove untested module
aymanalqadhi Sep 4, 2025
5b0a471
Show experimental-status notice message on CMake configuration start
aymanalqadhi Sep 4, 2025
b90d100
Update experimental-status notice message formatting
aymanalqadhi Sep 5, 2025
d52a154
Link against `CoreFoundation` framework when compiling for APPLE targets
aymanalqadhi Sep 5, 2025
8d2903a
Add a module to find `CoreAudio` framework and its dependencies
aymanalqadhi Sep 5, 2025
b7bb625
Disable WebRTC/WebRTC_AEC3 for APPLE targets
aymanalqadhi Sep 5, 2025
bc63240
Properly find `CoreAudio` framework for APPLE targets
aymanalqadhi Sep 5, 2025
2a4902c
Fix a typo in link libraries visibility
aymanalqadhi Sep 6, 2025
eb818f4
Fallback to copying files if creating a symbolic link fails
aymanalqadhi Sep 8, 2025
08829aa
Copy files directly instead of relying on `COPY_ON_ERROR` on Windows
aymanalqadhi Sep 9, 2025
673866b
Fix typo in test targets enabling check
aymanalqadhi Sep 11, 2025
ce454f3
Add required link libraries to `pjsip-test` and `pjsua2-test` targets
aymanalqadhi Sep 11, 2025
bbca4f4
Use `main.c` as test target entrypoint on Windows
aymanalqadhi Sep 11, 2025
cb2f193
Disable WebRTC/WebRTC_AEC3 for MinGW/Cygwin
aymanalqadhi Sep 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 190 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
cmake_minimum_required(VERSION 3.28...4.0)

project(pjproject
VERSION 2.15
DESCRIPTION "Multimedia communication library"
HOMEPAGE_URL "http://www.pjsip.org"
LANGUAGES C CXX
)

# project modules
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# experimental warning notice
option(PJ_SKIP_EXPERIMENTAL_NOTICE OFF)
if (NOT PJ_SKIP_EXPERIMENTAL_NOTICE)
message(WARNING
" ****************************************************\n"
" * Building `pjproject` with CMake is experimental *\n"
" *--------------------------------------------------*\n"
" * Tested platforms: *\n"
" * - Linux x86_64 *\n"
" ****************************************************\n"
"Set `PJ_SKIP_EXPERIMENTAL_NOTICE=ON` to disable this warning"
)
endif()

# ##############################################################################
# Testing support

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()

if(BUILD_TESTING)
if(CMAKE_SYSTEM_NAME MATCHES "rtems")
set(PJ_TEST_MAIN "main_rtems.c")
else()
set(PJ_TEST_MAIN "main.c")
endif()
endif()

# ##############################################################################
# Installation preparation

include(GNUInstallDirs)

# add `$ORIGIN` to targets' RPATH
if(BUILD_SHARED_LIBS)
if(APPLE)
list(APPEND CMAKE_INSTALL_RPATH
"@loader_path"
"@executable_path/../${CMAKE_INSTALL_LIBDIR}"
)
elseif(UNIX)
list(APPEND CMAKE_INSTALL_RPATH
"$ORIGIN"
"$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
)
endif()
endif()

# ##############################################################################
# Sub-directories

# base library
add_subdirectory(pjlib)

# third-party libraries
add_subdirectory(third_party)

# remaning libraries
add_subdirectory(pjlib-util)
add_subdirectory(pjnath)
add_subdirectory(pjmedia)
add_subdirectory(pjsip)
add_subdirectory(pjsip-apps)

# ##############################################################################
# Installation

set(install_targets
pjlib
pjlib-ssl
pjlib++
pjlib-util
pjnath
pjmedia
pjmedia-codec
pjmedia-audiodev
pjmedia-videodev
pjsip
pjsip-simple
pjsip-ua
pjsua-lib
pjsua2
pjsua
)

# set `VERSION` and `SO_VERSION`
foreach(target IN LISTS install_targets)
set_target_properties(${target} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
endforeach()

# install targets
install(
TARGETS ${install_targets}
EXPORT PjTargets

FILE_SET HEADERS
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT PjDevelopment
FILE_SET config_headers
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT PjDevelopment
RUNTIME
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT PjRuntime
LIBRARY
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT PjRuntime
NAMELINK_COMPONENT PjDevelopment
ARCHIVE
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT PjDevelopment
)

# ##############################################################################
# CMAKe Package config

include(CMakePackageConfigHelpers)

set(PJ_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Pj")
set(PJ_CMAKE_TARGETS_FILE "PjTargets.cmake")
set(PJ_CMAKE_CONFIG_FILE "PjConfig.cmake")
set(PJ_CMAKE_CONFIG_VERSION_FILE "jConfigVersion.cmake")

# install exports
install(
EXPORT PjTargets
NAMESPACE Pj::
FILE "${PJ_CMAKE_TARGETS_FILE}"
DESTINATION "${PJ_CMAKE_INSTALL_DIR}"
COMPONENT PjDevelopment
)

# write package config
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Pj/${PJ_CMAKE_CONFIG_FILE}.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PJ_CMAKE_CONFIG_FILE}"

INSTALL_DESTINATION "${PJ_CMAKE_INSTALL_DIR}"
)

# write package config version
write_basic_package_version_file(
"${PJ_CMAKE_CONFIG_VERSION_FILE}"

COMPATIBILITY SameMajorVersion
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PJ_CMAKE_CONFIG_FILE}"
"${CMAKE_CURRENT_BINARY_DIR}/${PJ_CMAKE_CONFIG_VERSION_FILE}"

DESTINATION "${PJ_CMAKE_INSTALL_DIR}"
COMPONENT PjDevelopment
)

# ##############################################################################
# pkg-config file

set(PREFIX "${CMAKE_INSTALL_PREFIX}") # this should be done at install time
set(LIBDIR "${PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(INCLUDEDIR "${PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
set(PJ_VERSION "${PROJECT_VERSION}")
set(PJ_INSTALL_LDFLAGS "")
set(PJ_INSTALL_LDFLAGS "")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/libpjproject.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/libpjproject.pc"
)

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/libpjproject.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
36 changes: 36 additions & 0 deletions cmake/DetectWebRTCParameters.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
include(Pj/DetectArch)
pj_detect_arch(arch)
pj_detect_arch_simd_ext(simd_inst simd_flags)

set(WEBRTC_ARCH "${arch}")
set(WEBRTC_ARCH_SIMD "${simd_inst}")
set(WEBRTC_COMPILE_OPTIONS ${simd_flags})
set(WEBRTC_COMPILE_DEFINITIONS WEBRTC_APM_DEBUG_DUMP=0)

# operating system definitions
if(IOS)
list(APPEND WEBRTC_COMPILE_DEFINITIONS WEBRTC_IOS=1 WEBRTC_POSIX=1)
elseif(DARWIN)
list(APPEND WEBRTC_COMPILE_DEFINITIONS WEBRTC_MAC=1 WEBRTC_POSIX=1)
elseif(ANDROID)
list(APPEND WEBRTC_COMPILE_DEFINITIONS WEBRTC_ANDROID=1 WEBRTC_POSIX=1)
elseif(LINUX)
list(APPEND WEBRTC_COMPILE_DEFINITIONS WEBRTC_LINUX=1 WEBRTC_POSIX=1)
elseif(WIN32)
list(APPEND WEBRTC_COMPILE_DEFINITIONS WEBRTC_WIN=1)
endif()

if (MSVC)
list(APPEND WEBRTC_COMPILE_DEFINITIONS NOMINMAX)
endif()

# architecture definitions
if(arch STREQUAL "arm64")
list(APPEND WEBRTC_COMPILE_DEFINITIONS WEBRTC_ARCH_ARM64=1)
elseif(arch STREQUAL "mips")
list(APPEND WEBRTC_COMPILE_DEFINITIONS MIPS_FPU_LE=1)
endif()

if(simd_inst STREQUAL "neon")
list(APPEND WEBRTC_COMPILE_DEFINITIONS WEBRTC_HAS_NEON=1)
endif()
48 changes: 48 additions & 0 deletions cmake/FindBCG729.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_search_module(PC_BCG729 bcg729 libbcg729)
set(BCG729_VERSION ${PC_BCG729_VERSION})
endif()

find_path(BCG729_INCLUDE_DIR
NAMES
"bcg729/encoder.h"
HINTS
${PC_BCG729_INCLUDEDIR}
${PC_BCG729_INCLUDE_DIRS}
)
mark_as_advanced(BCG729_INCLUDE_DIR)

find_library(BCG729_LIBRARY
NAMES
bcg729
libbcg729
HINTS
${PC_BCG729_LIBDIR}
${PC_BCG729_LIBRARY_DIRS}
)
mark_as_advanced(BCG729_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(BCG729
REQUIRED_VARS
BCG729_LIBRARY
BCG729_INCLUDE_DIR
VERSION_VAR
BCG729_VERSION
)

if(BCG729_FOUND)
set(BCG729_LIBRARIES ${BCG729_LIBRARY})
set(BCG729_INCLUDE_DIRS ${BCG729_INCLUDE_DIR})
set(BCG729_DEFINITIONS ${PC_BCG729_CFLAGS_OTHER})

if(NOT TARGET BCG729::BCG729)
add_library(BCG729::BCG729 UNKNOWN IMPORTED)
set_target_properties(BCG729::BCG729 PROPERTIES
IMPORTED_LOCATION "${BCG729_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${BCG729_INCLUDE_DIRS}"
INTERFACE_COMPILE_OPTIONS "${BCG729_DEFINITIONS}"
)
endif()
endif()
34 changes: 34 additions & 0 deletions cmake/FindCoreAudio.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
set(_coreaudio_libs)
foreach(_coreaudio_lib IN ITEMS CoreAudio AudioToolbox Foundation AppKit)
string(TOUPPER "CoreAudio_LIBRARY_${_coreaudio_lib}" _coreaudio_lib_var)
list(APPEND _coreaudio_required_vars ${_coreaudio_lib_var})

find_library(${_coreaudio_lib_var} "${_coreaudio_lib}")
mark_as_advanced(${_coreaudio_lib_var})
if(${_coreaudio_lib_var})
list(APPEND _coreaudio_libs "${${_coreaudio_lib_var}}")
endif()
endforeach()
unset(_coreaudio_lib)
unset(_coreaudio_lib_var)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CoreAudio
REQUIRED_VARS
${_coreaudio_required_vars}
)

if(CoreAudio_FOUND)
set(CoreAudio_LIBRARIES ${_coreaudio_libs})

if(NOT TARGET CoreAudio::CoreAudio)
add_library(coreaudio INTERFACE)
set_target_properties(coreaudio PROPERTIES
INTERFACE_LINK_LIBRARIES "${CoreAudio_LIBRARIES}"
)
add_library(CoreAudio::CoreAudio ALIAS coreaudio)
endif()
endif()

unset(_coreaudio_libs)
unset(_coreaudio_required_vars)
Loading
Loading