Skip to content

Commit ec4a082

Browse files
authored
Merge branch 'develop' into 80-standard-time
2 parents 4addd83 + 752f2f9 commit ec4a082

File tree

6 files changed

+447
-2
lines changed

6 files changed

+447
-2
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
################################################################################
44

55
/.vs
6-
/out/build/x64-debug
6+
/out
77
/temp

CMakeLists.txt

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ITNOA
2+
# CMakeList.txt : CMake project for SipCmd, include source and define
3+
# project specific logic here.
4+
#
5+
cmake_minimum_required (VERSION 3.8)
6+
7+
project ("SipCmd" VERSION 1.0 LANGUAGES CXX)
8+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
9+
10+
set(PTLib_USE_STATIC_LIBS 1)
11+
find_package(PTLib REQUIRED)
12+
13+
set(OPAL_USE_STATIC_LIBS 1)
14+
find_package(OPAL REQUIRED)
15+
16+
# Add source to this project's library.
17+
add_library(SipCmdLib "src/commands.cpp" "src/channels.cpp")
18+
19+
target_include_directories(SipCmdLib PUBLIC ${PTLIB_INCLUDE_DIRS})
20+
target_link_libraries(SipCmdLib PRIVATE ${PTLIB_LIBRARIES})
21+
22+
target_include_directories(SipCmdLib PUBLIC ${OPAL_INCLUDE_DIRS})
23+
target_link_libraries(SipCmdLib PRIVATE ${OPAL_LIBRARIES})
24+
25+
# Add source to this project's executable.
26+
add_executable (SipCmd "src/main.cpp")
27+
28+
target_link_libraries(SipCmd PRIVATE SipCmdLib)
29+
message(${PTLIB_INCLUDE_DIRS})
30+
31+
if (CMAKE_VERSION VERSION_GREATER 3.10)
32+
set_property(TARGET SipCmdLib PROPERTY CXX_STANDARD 14)
33+
set_property(TARGET SipCmd PROPERTY CXX_STANDARD 14)
34+
endif()
35+
36+
# TODO: Add tests and install targets if needed.

CMakePresets.json

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "windows-base",
6+
"hidden": true,
7+
"generator": "Ninja",
8+
"binaryDir": "${sourceDir}/out/build/${presetName}",
9+
"installDir": "${sourceDir}/out/install/${presetName}",
10+
"cacheVariables": {
11+
"CMAKE_C_COMPILER": "cl.exe",
12+
"CMAKE_CXX_COMPILER": "cl.exe"
13+
},
14+
"condition": {
15+
"type": "equals",
16+
"lhs": "${hostSystemName}",
17+
"rhs": "Windows"
18+
}
19+
},
20+
{
21+
"name": "x64-debug",
22+
"displayName": "x64 Debug",
23+
"inherits": "windows-base",
24+
"architecture": {
25+
"value": "x64",
26+
"strategy": "external"
27+
},
28+
"cacheVariables": {
29+
"CMAKE_BUILD_TYPE": "Debug"
30+
}
31+
},
32+
{
33+
"name": "x64-release",
34+
"displayName": "x64 Release",
35+
"inherits": "x64-debug",
36+
"cacheVariables": {
37+
"CMAKE_BUILD_TYPE": "Release"
38+
}
39+
},
40+
{
41+
"name": "x86-debug",
42+
"displayName": "x86 Debug",
43+
"inherits": "windows-base",
44+
"architecture": {
45+
"value": "x86",
46+
"strategy": "external"
47+
},
48+
"cacheVariables": {
49+
"CMAKE_BUILD_TYPE": "Debug"
50+
}
51+
},
52+
{
53+
"name": "x86-release",
54+
"displayName": "x86 Release",
55+
"inherits": "x86-debug",
56+
"cacheVariables": {
57+
"CMAKE_BUILD_TYPE": "Release"
58+
}
59+
},
60+
{
61+
"name": "linux-debug",
62+
"displayName": "Linux Debug",
63+
"generator": "Ninja",
64+
"binaryDir": "${sourceDir}/out/build/${presetName}",
65+
"installDir": "${sourceDir}/out/install/${presetName}",
66+
"cacheVariables": {
67+
"CMAKE_BUILD_TYPE": "Debug"
68+
},
69+
"condition": {
70+
"type": "equals",
71+
"lhs": "${hostSystemName}",
72+
"rhs": "Linux"
73+
},
74+
"vendor": {
75+
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
76+
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
77+
}
78+
}
79+
},
80+
{
81+
"name": "macos-debug",
82+
"displayName": "macOS Debug",
83+
"generator": "Ninja",
84+
"binaryDir": "${sourceDir}/out/build/${presetName}",
85+
"installDir": "${sourceDir}/out/install/${presetName}",
86+
"cacheVariables": {
87+
"CMAKE_BUILD_TYPE": "Debug"
88+
},
89+
"condition": {
90+
"type": "equals",
91+
"lhs": "${hostSystemName}",
92+
"rhs": "Darwin"
93+
},
94+
"vendor": {
95+
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
96+
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
97+
}
98+
}
99+
}
100+
]
101+
}

cmake/Modules/FindOPAL.cmake

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
#------------------------------------------------------------------------------------
2+
# ITNOA
3+
#
4+
# This file is based on https://github.com/snikulov/cmake-modules
5+
#
6+
# Locate OPAL library (http://www.opalvoip.org/)
7+
# This module defines
8+
# OPAL_FOUND, if false, do not try to link to OPAL
9+
# OPAL_LIBRARIES
10+
# OPAL_INCLUDE_DIRS, where to find opal headers
11+
#
12+
# 2013/03/19 - aagenosov
13+
# Module created
14+
# 2013/03/21 - aagenosov
15+
# Added macro to define version of OPAL
16+
# 2015/08/13 - snikulov
17+
# Added linux support
18+
#-------------------------------------------------------------------------------------
19+
20+
# get version macro
21+
# first param - path to include
22+
macro(opal_get_version _include_PATH version)
23+
if (EXISTS "${_include_PATH}/opal/buildopts.h")
24+
file(STRINGS "${_include_PATH}/opal/buildopts.h" _VER_STRING_AUX REGEX ".*#define[ ]+OPAL_VERSION[ ]+")
25+
else()
26+
file(STRINGS "${_include_PATH}/opal_config.h" _VER_STRING_AUX REGEX ".*#define[ ]+OPAL_VERSION[ ]+")
27+
endif()
28+
string(REGEX MATCHALL "[0-9]+[.][0-9]+[.][0-9]+" ${version} "${_VER_STRING_AUX}")
29+
endmacro()
30+
31+
find_package(PTLib REQUIRED)
32+
33+
include(FindPkgConfig)
34+
PKG_CHECK_MODULES(PC_OPAL "opal")
35+
36+
find_path(OPAL_INCLUDE_DIRS opal.h
37+
PATHS
38+
${PC_OPAL_INCLUDE_DIRS}
39+
/usr/local/include
40+
/usr/include
41+
/opt/local/include
42+
/opt/csw/include
43+
/opt/include
44+
$ENV{OPAL_DIR}/include
45+
${OPAL_DIR}/include
46+
)
47+
48+
if(PC_OPAL_FOUND)
49+
50+
set(OPAL_VERSION ${PC_OPAL_VERSION})
51+
set(OPAL_INCLUDE_DIRS ${PC_OPAL_INCLUDE_DIRS})
52+
53+
find_library(OPAL_LIBRARIES
54+
NAMES ${PC_OPAL_LIBRARIES}
55+
PATH ${PC_OPAL_LIBRARY_DIRS})
56+
57+
else()
58+
59+
if(OPAL_USE_STATIC_LIBS)
60+
set(opal_postfix "${opal_postfix}S")
61+
endif()
62+
63+
set(OPAL_NAME_RELEASE "opal${opal_postfix}")
64+
set(OPAL_NAME_DEBUG "opal${opal_postfix}D")
65+
set(OPAL64_NAME_RELEASE "opal64${opal_postfix}")
66+
set(OPAL64_NAME_DEBUG "opal64${opal_postfix}D")
67+
68+
69+
find_library(OPAL_LIBRARY_RELEASE
70+
NAMES
71+
${OPAL_NAME_RELEASE}
72+
${OPAL64_NAME_RELEASE}
73+
PATHS
74+
/usr/local
75+
/usr
76+
/sw
77+
/opt/local
78+
/opt/csw
79+
/opt
80+
$ENV{OPAL_DIR}/lib
81+
${OPAL_DIR}/lib
82+
NO_DEFAULT_PATH
83+
)
84+
85+
find_library(OPAL_LIBRARY_DEBUG
86+
NAMES
87+
${OPAL_NAME_DEBUG}
88+
${OPAL64_NAME_DEBUG}
89+
PATHS
90+
/usr/local
91+
/usr
92+
/sw
93+
/opt/local
94+
/opt/csw
95+
/opt
96+
$ENV{OPAL_DIR}/lib
97+
${OPAL_DIR}/lib
98+
NO_DEFAULT_PATH
99+
)
100+
101+
if(OPAL_INCLUDE_DIRS)
102+
opal_get_version(${OPAL_INCLUDE_DIRS} OPAL_VERSION)
103+
endif()
104+
105+
if(OPAL_LIBRARY_DEBUG AND OPAL_LIBRARY_RELEASE)
106+
set(OPAL_LIBRARIES
107+
debug ${OPAL_LIBRARY_DEBUG}
108+
optimized ${OPAL_LIBRARY_RELEASE}
109+
CACHE STRING "OPAL Libraries")
110+
endif()
111+
endif()
112+
113+
include(FindPackageHandleStandardArgs)
114+
115+
# handle the QUIETLY and REQUIRED arguments and set OPAL_FOUND to TRUE if
116+
# all listed variables are TRUE
117+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPAL DEFAULT_MSG OPAL_LIBRARIES OPAL_INCLUDE_DIRS)
118+
119+
MARK_AS_ADVANCED(OPAL_INCLUDE_DIRS OPAL_LIBRARIES
120+
OPAL_LIBRARY_DEBUG OPAL_LIBRARY_RELEASE)
121+
122+
if(OPAL_FOUND)
123+
message("-- OPAL version is: ${OPAL_VERSION}")
124+
# short hack for install and copy
125+
if(NOT OPAL_USE_STATIC_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
126+
find_file(OPAL_DLL_RELEASE
127+
NAMES
128+
${OPAL_NAME_RELEASE}.dll ${OPAL64_NAME_RELEASE}.dll
129+
PATHS
130+
$ENV{OPAL_DIR}/bin
131+
${OPAL_DIR}/bin
132+
NO_DEFAULT_PATH
133+
)
134+
135+
find_file(OPAL_DLL_DEBUG
136+
NAMES
137+
${OPAL_NAME_DEBUG}.dll ${OPAL64_NAME_DEBUG}.dll
138+
PATHS
139+
$ENV{OPAL_DIR}/bin
140+
${OPAL_DIR}/bin
141+
NO_DEFAULT_PATH
142+
)
143+
get_filename_component(OPAL_RUNTIME_DIR ${OPAL_DLL_DEBUG} PATH)
144+
MARK_AS_ADVANCED(OPAL_DLL_DEBUG OPAL_DLL_RELEASE OPAL_RUNTIME_DIR)
145+
endif()
146+
147+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
148+
set(PATH_TO_OPAL_PLUGINS ${OPAL_RUNTIME_DIR}/plugins)
149+
150+
if (EXISTS ${PATH_TO_OPAL_PLUGINS} AND IS_DIRECTORY ${PATH_TO_OPAL_PLUGINS})
151+
file(GLOB _opal_plugins_ "${PATH_TO_OPAL_PLUGINS}/*.dll")
152+
endif()
153+
154+
set(OPAL_PLUGINS)
155+
foreach(_plugin ${_opal_plugins_})
156+
list(APPEND OPAL_PLUGINS ${_plugin})
157+
endforeach()
158+
message("-- OPAL plugins: ${OPAL_PLUGINS}")
159+
MARK_AS_ADVANCED(PATH_TO_OPAL_PLUGINS OPAL_PLUGINS)
160+
endif()
161+
endif()

0 commit comments

Comments
 (0)