-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
170 lines (132 loc) · 7.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
cmake_minimum_required(VERSION 3.5)
project(SoftPhone VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets Quick Multimedia Gui)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Quick Multimedia Gui)
#set(PROJECT_SOURCES
# main.cpp
# mainwindow.cpp
# mainwindow.h
# mainwindow.ui
#)
qt_add_resources(RESOURCES sounds.qrc images.qrc qmlResource.qrc)
set(bsoncxx_DIR C:/Mongo/mongoCPPCore/install/lib/cmake/bsoncxx-3.7.0)
set(mongocxx_DIR C:/Mongo/mongoCPPCore/install/lib/cmake/mongocxx-3.7.0)
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
file(GLOB_RECURSE QMLFILES ${CMAKE_CURRENT_SOURCE_DIR}/*.qml)
file(GLOB_RECURSE UIFILES ${CMAKE_CURRENT_SOURCE_DIR}/*.ui)
file(GLOB_RECURSE QT_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(SoftPhone
MANUAL_FINALIZATION
${HEADERS}
${SOURCES}
${QMLFILES}
${UIFILES}
${RESOURCES}
)
# qt_add_executable(
# )
qt_add_qml_module(SoftPhone
URI SoftPhone
VERSION 1.0
QML_FILES main.qml
QML/PhoneKeyboard.qml
QML/PhoneButton.qml
QML/ToolBar/ToolBar.qml
QML/ToolBar/ToolBarMenuButton.qml
# QML_FILES QMLFILES
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET SoftPhone APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(SoftPhone SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(SoftPhone
${PROJECT_SOURCES}
)
endif()
endif()
target_include_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/MSVC2022x64noBoost/include")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/MSVC2022x64noBoost/lib")
target_include_directories(SoftPhone PUBLIC "C:/Mongo/mongoCPPCore/install/include")
target_link_directories(SoftPhone PUBLIC "C:/Mongo/mongoCPPCore/install/lib")
target_link_libraries(SoftPhone PRIVATE MongoCore)
target_link_libraries(SoftPhone PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia Qt${QT_VERSION_MAJOR}::Gui SerikBLDCore)
find_package(mongocxx REQUIRED)
find_package(bsoncxx REQUIRED)
include_directories(${LIBMONGOCXX_INCLUDE_DIR})
include_directories(${LIBBSONCXX_INCLUDE_DIR})
target_link_libraries(SoftPhone PRIVATE mongo::bsoncxx_shared)
target_link_libraries(SoftPhone PRIVATE mongo::mongocxx_shared)
add_definitions(-DPJ_NATIVE_STRING_IS_UNICODE=1)
add_definitions(-DPJ_WIN32=1)
add_definitions(-DPJ_IS_LITTLE_ENDIAN=1)
add_definitions(-DPJ_IS_BIG_ENDIAN=1)
add_definitions(-DUNICODE=0)
target_include_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjsip/include")
target_include_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjlib/include")
target_include_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjlib-util/include")
target_include_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjmedia/include")
target_include_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjnath/include")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/lib")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjlib/lib")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjlib-util/lib")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjmedia/lib")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjnath/lib")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjsip/lib")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/pjnath/lib")
target_link_directories(SoftPhone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../SoftPhoneLib/pjproject-2.12/third_party/lib")
target_link_libraries(SoftPhone PUBLIC libpjproject-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjlib-util-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjsua2-lib-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjsua-lib-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjsip-ua-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjsip-simple-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjsip-core-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjmedia-codec-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjmedia-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjmedia-codec-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjmedia-audiodev-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjnath-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC pjlib-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC libbaseclasses-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC libg7221codec-x86_64-x64-vc14-Release-Dynamic)
#target_link_libraries(SoftPhone PUBLIC libportaudio-i386-Win32-vc14-Release-Dynamic \
target_link_libraries(SoftPhone PUBLIC libgsmcodec-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC libilbccodec-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC libspeex-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC libresample-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC libmilenage-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC libsrtp-x86_64-x64-vc14-Release-Dynamic)
target_link_libraries(SoftPhone PUBLIC winmm)
target_link_libraries(SoftPhone PUBLIC ole32)
target_link_libraries(SoftPhone PUBLIC ws2_32)
target_link_libraries(SoftPhone PUBLIC wsock32)
target_link_libraries(SoftPhone PUBLIC gdi32)
set_target_properties(SoftPhone PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
install(TARGETS SoftPhone
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(SoftPhone)
endif()