-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathCMakeLists.txt
1977 lines (1746 loc) · 87.1 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
cmake_minimum_required(VERSION 3.19)
include(CheckFunctionExists)
get_filename_component(ICQ_ROOT "${CMAKE_SOURCE_DIR}" ABSOLUTE)
set(PRODUCT_SPEC_DIR "${ICQ_ROOT}/products/${PRODUCT}")
if(EXISTS "${PRODUCT_SPEC_DIR}")
message(STATUS "PRODUCT_SPEC_DIR = ${PRODUCT_SPEC_DIR}")
else()
message(FATAL_ERROR "Folder ${PRODUCT_SPEC_DIR} is not exists!)")
endif()
include(${PRODUCT_SPEC_DIR}/project_settings.cmake)
project(${APP_PROJECT_NAME})
message(STATUS "")
message(STATUS "[CMAKE]")
message(STATUS "[CMAKE] Using <CMakeLists.txt>")
message(STATUS "[CMAKE]")
message(STATUS "[CMAKE] CMake version = ${CMAKE_VERSION}")
if(NOT PRODUCT)
set(PRODUCT "icq")
message(STATUS "")
message(STATUS "[INFO] Default product is ${PRODUCT}")
endif()
message(STATUS "[INFO] PRODUCT is ${PRODUCT}")
add_definitions(-DSUPPORT_EXTERNAL_CONFIG)
message(STATUS "add_definitions(-DSUPPORT_EXTERNAL_CONFIG)")
if(NOT WIN32)
CHECK_FUNCTION_EXISTS(secure_getenv HAVE_SECURE_GETENV)
if(HAVE_SECURE_GETENV)
add_definitions(-DHAVE_SECURE_GETENV=1)
message(STATUS "add_definitions(-DHAVE_SECURE_GETENV=1)")
endif()
endif()
if(NOT APP_ENVIRONMENT)
message(STATUS "APP_ENVIRONMENT is empty")
else()
message(STATUS "APP_ENVIRONMENT is ${APP_ENVIRONMENT}")
add_definitions(-DAPP_ENVIRONMENT="${APP_ENVIRONMENT}")
endif()
if(BUILD_FOR_STORE)
message(STATUS "[cmake] This build for Store -> BUILD_FOR_STORE")
add_definitions(-DBUILD_FOR_STORE=1)
message(STATUS "add_definitions(-DBUILD_FOR_STORE=1)")
endif()
if(BUILD_PKG_MSI)
message(STATUS "[cmake] This build makes MSI package -> BUILD_PKG_MSI")
message(STATUS "add_definitions(-DBUILD_PKG_MSI=1)")
add_definitions(-DBUILD_PKG_MSI=1)
endif()
if(BUILD_PKG_RPM)
message(STATUS "[cmake] This build makes RPM package -> BUILD_PKG_RPM")
message(STATUS "add_definitions(-DBUILD_PKG_RPM=1)")
add_definitions(-DBUILD_PKG_RPM=1)
endif()
option(IM_QT_DYNAMIC "Qt dynamic linking" ON)
if(NOT IM_QT_DYNAMIC)
add_definitions(-DIM_QT_STATIC)
set(IM_QT_STATIC YES)
message(STATUS "[INFO] Qt linking: static")
message(STATUS "[INFO] add_definitions(-DIM_QT_STATIC)")
else()
add_definitions(-DIM_QT_DYNAMIC)
set(IM_QT_STATIC NO)
message(STATUS "[INFO] Qt linking: dynamic")
message(STATUS "[INFO] add_definitions(-DIM_QT_DYNAMIC)")
endif()
if (STRIP_VOIP)
add_definitions(-DSTRIP_VOIP)
endif()
message(STATUS "DIR CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
find_package(Git)
if (GIT_FOUND)
message(STATUS "git found: ${GIT_EXECUTABLE} in version ${GIT_VERSION_STRING}")
if(GIT_VERSION_STRING VERSION_LESS 2.23.0)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
execute_process(
COMMAND ${GIT_EXECUTABLE} branch --show-current
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "")
message(STATUS "[BRANCH] Current GIT BRANCH NAME = ${GIT_BRANCH_NAME}")
message(STATUS "[BRANCH] Current GIT COMMIT HASH = ${GIT_COMMIT_HASH}")
message(STATUS "")
if (ENABLE_BUILD_INFO)
add_definitions("-DGIT_BRANCH_NAME=\"${GIT_BRANCH_NAME}\"")
message(STATUS "add_definitions(-DGIT_BRANCH_NAME=${GIT_BRANCH_NAME})")
add_definitions("-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
message(STATUS "add_definitions(-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH})")
endif()
endif (GIT_FOUND)
if (ENABLE_BUILD_INFO)
string(TIMESTAMP BUILD_TIME "%d/%m/%y %H:%M")
string(TIMESTAMP BUILD_TIME_SHORT "%m%Y")
add_definitions("-DBUILD_TIME=\"${BUILD_TIME}\"")
add_definitions("-DBUILD_TIME_SHORT=\"${BUILD_TIME_SHORT}\"")
message(STATUS "add_definitions(-DBUILD_TIME=${BUILD_TIME})")
message(STATUS "Current BILD TIME = ${BUILD_TIME}")
endif()
if(IM_QT_DYNAMIC)
if (HAS_WEB_ENGINE)
message(STATUS "[INFO] Qt WebEngine: ON")
add_definitions(-DHAS_WEB_ENGINE)
endif()
if (HAS_OAUTH2)
message(STATUS "[INFO] OAuth2: ON")
add_definitions(-DHAS_OAUTH2)
endif()
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(ICQ_DEBUG ON)
set(ICQ_BIN_DIR "${ICQ_ROOT}/bin/Debug")
set(ICQ_LIB_DIR "${ICQ_ROOT}/bin/Debug")
set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "" FORCE)
if(APPLE)
add_definitions(-DDEBUG=1)
message(STATUS "add_definitions(-DDEBUG=1)")
endif()
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(ICQ_RELEASE ON)
set(ICQ_BIN_DIR "${ICQ_ROOT}/bin/Release")
set(ICQ_LIB_DIR "${ICQ_ROOT}/bin/Release")
set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "" FORCE)
add_definitions(-DNDEBUG)
else()
message(FATAL_ERROR "Need to specify CMAKE_BUILD_TYPE (-DCMAKE_BUILDTYPE=Debug|Release)")
endif()
message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_CONFIGURATION_TYPES is ${CMAKE_CONFIGURATION_TYPES}")
file(MAKE_DIRECTORY ${ICQ_BIN_DIR})
message(STATUS "binaries output: " ${ICQ_BIN_DIR})
message(STATUS "libraries output: " ${ICQ_LIB_DIR})
set(ICQ_CORELIB_STATIC_LINKING ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(ENABLE_ASAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
list(APPEND _build_flags "-fsanitize=address")
endif()
if(ENABLE_TSAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
list(APPEND _build_flags "-fsanitize=thread")
endif()
if(ENABLE_UBSAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
list(APPEND _build_flags "-fsanitize=undefined")
endif()
if (NOT STRIP_VOIP)
if(VOIP_AS_MODULE)
# When building voip library from source (to do this, just add voip3 symlink to voip3 repo), include
# voip sources before mangling flags, CMake options, etc. to avoid interference with voip build scripts
add_subdirectory(voip3)
set(VOIP_LIBRARIES libvoip::sdk_cpp_merged)
endif()
endif()
if(MSVC)
set(ICQ_PLATFORM windows)
set(ICQ_ARCH x86)
if(NOT IM_QT_DYNAMIC)
if(ICQ_DEBUG)
add_definitions(/MTd)
else()
add_definitions(/MT)
endif()
endif()
add_definitions(/Zi)
add_definitions(/MP)
set(CMAKE_HAVE_PTHREAD_H OFF)
add_definitions(-D_UNICODE)
add_definitions(-DUNICODE)
#add_definitions(-D_VARIADIC_MAX=6)
add_definitions(-D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
add_definitions(/Zm500)
add_definitions(/W4)
add_definitions(/wd4100)
add_definitions(/we5038) # Wreorder
add_definitions(/we4018) # '<': signed/unsigned mismatch
add_definitions(/we4067)
add_definitions(/we4389) # '==': signed/unsigned mismatch
add_definitions(/we4189) # local variable is initialized but not referenced
add_definitions(/we4172) # returning address of local variable or temporary
add_definitions(/we4150) # deletion of pointer to incomplete type 'type'; no destructor called
add_definitions(/we4245)
add_definitions(/we4263)
add_definitions(/we4264)
add_definitions(/we4553)
add_definitions(/we4573)
add_definitions(/we4834) # 'nodiscard' attribute
add_definitions(/we4715) # not all control paths return a value
add_definitions(/we4130) #'==': logical operation on address of string constant
add_definitions(/we4099) # type name first seen using 'struct' now seen using 'class'
add_definitions(/we4146)
add_definitions(/we4114)
add_definitions(/we4551)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:3145728") # for emoji map
#add_definitions(/we4266) #update boost and qt or disable this warning for these headers
set(WIN32_COMMON_OPTS "/Ob2 /Oi /Ot /GS- /GF /Gy /Gw /fp:except- /arch:SSE2 /Zc:inline")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${WIN32_COMMON_OPTS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${WIN32_COMMON_OPTS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /OPT:NOREF /OPT:NOICF")
set(WIN_SDK_DIR "$ENV{ProgramFiles\(x86\)}/Windows Kits/10")
set(WIN_SDK_VER "10.0.18362.0")
include_directories("${WIN_SDK_DIR}/Include/${WIN_SDK_VER}/shared")
include_directories("${WIN_SDK_DIR}/Include/${WIN_SDK_VER}/winrt")
include_directories("${WIN_SDK_DIR}/Include/${WIN_SDK_VER}/um")
link_directories("${WIN_SDK_DIR}/Lib/${WIN_SDK_VER}/um/x86")
elseif(APPLE)
set(ICQ_PLATFORM macos)
set(ICQ_ARCH x64)
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym")
set(CMAKE_XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS "YES")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
set(MACOS_COMMON_FLAGS "-fvisibility-inlines-hidden -fvisibility=hidden -fasm-blocks -stdlib=libc++")
set(MACOS_COMMON_FLAGS "${MACOS_COMMON_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -Werror=most -Werror=switch")
list(APPEND _build_flags "-fvisibility-inlines-hidden")
list(APPEND _build_flags "-fvisibility=hidden")
list(APPEND _build_flags "-fasm-blocks")
list(APPEND _build_flags "-stdlib=libc++")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(MACOS_COMMON_FLAGS "${MACOS_COMMON_FLAGS} -ffunction-sections -fdata-sections -fno-stack-protector")
list(APPEND _build_flags "-ffunction-sections")
list(APPEND _build_flags "-fdata-sections")
list(APPEND _build_flags "-fno-stack-protector")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MACOS_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MACOS_COMMON_FLAGS} -Werror=inconsistent-missing-override -Werror=effc++ -Werror=empty-body")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
add_definitions(-Werror=return-stack-address)
elseif(UNIX)
set(LINUX ON)
message(STATUS "Linux x64")
set(LINUX64 ON)
set(ICQ_ARCH x64)
set(ARCH_FLAGS "-m64")
set(ICQ_PLATFORM linux)
set(ICQ_BIN_DIR "${ICQ_ROOT}/bin/${CMAKE_CONFIGURATION_TYPES}64")
set(ICQ_LIB_DIR "${ICQ_ROOT}/bin/${CMAKE_CONFIGURATION_TYPES}64")
add_definitions(-fPIC)
add_definitions(-Werror=return-local-addr)
if (RELATIVE_DEBUG_PATHS)
add_definitions(-fdebug-prefix-map=${ICQ_ROOT}=.)
endif()
set(LINUX_COMMON_FLAGS "-g -DBOOST_NO_AUTO_PTR -Wno-deprecated-declarations")
list(APPEND _build_flags "-g")
list(APPEND _build_flags "-DBOOST_NO_AUTO_PTR")
if(ENABLE_LTO)
list(APPEND _build_flags "-flto")
set(LINUX_COMMON_FLAGS "${LINUX_COMMON_FLAGS} -flto")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(LINUX_COMMON_FLAGS "${LINUX_COMMON_FLAGS} -ffunction-sections -fdata-sections -fno-stack-protector -U_FORTIFY_SOURCE")
list(APPEND _build_flags "-ffunction-sections")
list(APPEND _build_flags "-fdata-sections")
list(APPEND _build_flags "-fno-stack-protector")
list(APPEND _build_flags "-U_FORTIFY_SOURCE")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_FLAGS} ${LINUX_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAGS} ${LINUX_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ARCH_FLAGS} -no-pie -Wl,--version-script=${ICQ_ROOT}/icq.exports -Wl,--gc-sections -Wl,--no-as-needed")
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Map=${ICQ_BIN_DIR}/icq.map -Wl,--cref")
if(NOT DISABLE_STATIC_CXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
message(STATUS "[flags] CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
message(STATUS "[flags] CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
message(STATUS "[flags] CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "[flags] CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}")
else()
message(FATAL_ERROR "Unknown platform")
endif()
if(LINUX)
if(NOT USE_TOOLCHAIN)
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=1)
message(STATUS "")
message(STATUS "[flags] set _GLIBCXX_USE_CXX11_ABI=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=1")
message(STATUS "[flags] CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
message(STATUS "")
endif()
endif()
# --------------------------- linux toolchain --------------------------------
# i.e. -DUSE_TOOLCHAIN=/storage/toolchains
if(USE_TOOLCHAIN)
if(LINUX)
message(STATUS "")
message(STATUS "[linux toolchain] --- --- --- -> ")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
message(STATUS "[toolchain x86_64]")
set(TOOLCHAIN_NAME "x86_64-centos7-linux-gnu")
set(TOOLCHAIN_ARCH "x86_64-pc-linux-gnu")
set(TOOLCHAIN_PATH "${USE_TOOLCHAIN}/${TOOLCHAIN_NAME}")
if (NOT EXISTS "${TOOLCHAIN_PATH}")
message(FATAL_ERROR "Toolchain ${TOOLCHAIN_PATH} not found!)")
endif()
set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-gcc" CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-g++" CACHE FILEPATH "" FORCE)
set(CMAKE_LINKER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ld" CACHE FILEPATH "" FORCE)
set(CMAKE_C_COMPILER_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ar" CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ar" CACHE FILEPATH "" FORCE)
set(CMAKE_C_COMPILER_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ranlib" CACHE FILEPATH "" FORCE)
set(CMAKE_CXX_COMPILER_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ranlib" CACHE FILEPATH "" FORCE)
set(CMAKE_OBJCOPY "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-objcopy" CACHE FILEPATH "" FORCE)
set(CMAKE_OBJDUMP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-objdump" CACHE FILEPATH "" FORCE)
set(CMAKE_NM "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-nm" CACHE FILEPATH "" FORCE)
set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ar" CACHE FILEPATH "" FORCE)
set(CMAKE_ADDR2LINE "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-addr2line" CACHE FILEPATH "" FORCE)
set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ranlib" CACHE FILEPATH "" FORCE)
set(CMAKE_READELF "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-readelf" CACHE FILEPATH "" FORCE)
set(CMAKE_STRIP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-strip" CACHE FILEPATH "" FORCE)
set(CMAKE_SYSROOT "${TOOLCHAIN_PATH}/${TOOLCHAIN_NAME}/sysroot")
set(CMAKE_TC_ROOT_PATH "${TOOLCHAIN_PATH}/${TOOLCHAIN_NAME}")
set(CMAKE_FIND_ROOT_PATH "${TOOLCHAIN_PATH}/${TOOLCHAIN_NAME}/sysroot")
message(STATUS "TOOLCHAIN_NAME -> ${TOOLCHAIN_NAME}")
message(STATUS "TOOLCHAIN_ARCH -> ${TOOLCHAIN_ARCH}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
message(STATUS "")
message(STATUS "[toolchain] CMAKE_TRY_COMPILE_TARGET_TYPE = ${CMAKE_TRY_COMPILE_TARGET_TYPE}")
message(STATUS "[toolchain] CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}")
message(STATUS "[toolchain] CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
message(STATUS "[toolchain] CMAKE_LINKER = ${CMAKE_LINKER}")
message(STATUS "")
message(STATUS "[toolchain] CMAKE_SYSROOT = ${CMAKE_SYSROOT}")
message(STATUS "[toolchain] CMAKE_FIND_ROOT_PATH = ${CMAKE_FIND_ROOT_PATH}")
message(STATUS "[toolchain] CMAKE_SYSTEM_INCLUDE_PATH = ${CMAKE_SYSTEM_INCLUDE_PATH}")
message(STATUS "[toolchain] CMAKE_SYSTEM_FRAMEWORK_PATH = ${CMAKE_SYSTEM_FRAMEWORK_PATH}")
message(STATUS "")
file(GLOB gcc_include_version RELATIVE "${CMAKE_TC_ROOT_PATH}/include/c++" "${CMAKE_TC_ROOT_PATH}/include/c++/*")
include_directories(${CMAKE_TC_ROOT_PATH}/include/c++/${gcc_include_version})
include_directories(${CMAKE_TC_ROOT_PATH}/include/c++/${gcc_include_version}/bits)
include_directories(${CMAKE_TC_ROOT_PATH}/include)
include_directories(${CMAKE_FIND_ROOT_PATH}/usr/include/X11)
include_directories(${CMAKE_FIND_ROOT_PATH}/usr/include/GL)
include_directories(${CMAKE_FIND_ROOT_PATH}/usr/include)
link_directories("${CMAKE_FIND_ROOT_PATH}/lib")
link_directories("${CMAKE_FIND_ROOT_PATH}/usr/lib")
message(STATUS "[linux toolchain] <- --- --- ---")
message(STATUS "")
endif()
endif()
# -----------------------------------------------------------------------------
#shared definitions for linux and mac
if (NOT MSVC)
add_definitions(-Werror=reorder)
add_definitions(-Wno-error=unused) #fixme
# add_definitions(-Werror=unused-result)
add_definitions(-Wno-error=missing-braces) #fixme
endif()
if (APPLE)
add_definitions(-Werror=unused-comparison)
add_definitions(-Werror=unused-lambda-capture)
endif()
message(STATUS "building on: ${ICQ_PLATFORM}")
if(ICQ_CORELIB_STATIC_LINKING)
message(STATUS "corelib linking: static")
add_definitions(-DICQ_CORELIB_STATIC_LINKING)
else()
message(STATUS "corelib linking: dynamic")
endif()
option(ABORT_ON_ASSERT "Abort on asserts" OFF)
if (ABORT_ON_ASSERT)
add_definitions(-DABORT_OB_ASSERTS)
endif()
# --------------------------- paths -----------------------------------------
set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY_DEBUG ${ICQ_BIN_DIR})
set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY_RELEASE ${ICQ_BIN_DIR})
set(CMAKE_EXECUTABLE_OUTPUT_PATH ${ICQ_BIN_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${ICQ_LIB_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${ICQ_LIB_DIR})
set(CMAKE_LIBRARY_OUTPUT_PATH ${ICQ_LIB_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${ICQ_BIN_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${ICQ_BIN_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ICQ_BIN_DIR})
# -------------------------- validator --------------------------------------
if(RUN_VALIDATOR)
message(STATUS "[STAGE] VALIDATORS")
find_package(PythonInterp 3 REQUIRED)
message(STATUS "[INFO] PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}")
execute_process(COMMAND
"${PYTHON_EXECUTABLE}" buildsystem/validator_products_json.py --products "${ICQ_ROOT}/products"
WORKING_DIRECTORY ${ICQ_ROOT}
RESULT_VARIABLE RETURN_VALUE)
if (NOT RETURN_VALUE EQUAL 0)
message(STATUS "Fix JSON or update validator rules in buildsystem/validator_products_json.py")
message(FATAL_ERROR "Products JSON check failed, return value ${RETURN_VALUE}")
else()
message(STATUS "Products JSON ${ICQ_ROOT}/products are valid")
endif()
endif()
# -----------------------------------------------------------------------------
message(STATUS "")
message(STATUS "[requirements] Reading common variables from requirements/CMakeLists.txt")
include(requirements/common.cmake)
# -------------------------- external ---------------------------------------
# message(STATUS "")
# message(STATUS "[EXTERNAL DEPENDENCIES]")
if(LINUX)
include(requirements/linux.cmake)
elseif(APPLE)
include(requirements/macos.cmake)
else()
include(requirements/windows.cmake)
endif()
common_print_dependencies_info()
message(STATUS "[requirements] ICQ_EXTERNAL = ${ICQ_EXTERNAL}")
include_directories(${ICQ_EXTERNAL})
# -----------------------------------------------------------------------------
set(STATIC_RUNTIME_PREFIX "")
if(IM_QT_DYNAMIC)
if(MSVC)
set(QT_LIB_EXT "lib")
set(QT_DLL_EXT "dll")
set(QT_SUP_EXT "lib")
set(QT_PLUGIN_EXT "dll")
elseif(APPLE)
set(QT_LIB_EXT "dylib")
set(QT_SUP_EXT "a")
set(QT_PLUGIN_EXT "dylib")
else()
set(QT_LIB_EXT "so")
set(QT_SUP_EXT "a")
set(QT_PLUGIN_EXT "so")
endif()
else()
if(MSVC)
set(QT_LIB_EXT "lib")
set(QT_SUP_EXT "lib")
set(QT_PLUGIN_EXT "lib")
set(STATIC_RUNTIME_PREFIX "/static_runtime")
else()
set(QT_LIB_EXT "a")
set(QT_SUP_EXT "a")
set(QT_PLUGIN_EXT "a")
endif()
endif()
# ------------------------ set_lib_var --------------------------------------
macro(set_lib_var varName libName)
SET(${varName} "${libName}/lib")
message(STATUS "[lib] ${varName} -> ${${varName}}")
endmacro(set_lib_var)
# ------------------------ set_include_var ----------------------------------
macro(set_include_var varName includePath)
SET(${varName} "${includePath}")
include_directories("${includePath}")
message(STATUS "[include] ${varName} -> ${${varName}}")
# message(STATUS "[include] include_directories(${includePath})")
endmacro(set_include_var)
# ------------------- platform specific path ---------------------------------
set(ICQ_PLATFORM_SPECIFIC "${ICQ_EXTERNAL}/additionals")
# -------------------------- boost ---------------------------------------
if(LINUX)
add_definitions(-DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX) # fix missed SYS_getrandom in older kernels
endif()
set_lib_var(BOOST_LIBRARY_DIR "${pkg_boost_location}")
set_include_var(BOOST_INCLUDEDIR "${pkg_boost_location}/include")
set(Boost_USE_STATIC_LIBS ON)
if(NOT IM_QT_DYNAMIC)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
set(Boost_NO_SYSTEM_PATHS ON)
if(MSVC)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
find_package(Boost REQUIRED chrono date_time filesystem locale system thread regex)
elseif(APPLE)
find_package(Boost REQUIRED)
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_chrono.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_locale.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_system.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_filesystem.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_regex.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_thread.a")
elseif(LINUX)
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_filesystem.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_locale.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_system.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_thread.a")
set(Boost_LIBRARIES ${Boost_LIBRARIES} "${BOOST_LIBRARY_DIR}/libboost_regex.a")
endif()
# -------------------------- rapidjson ----------------------------------------
add_definitions(-DRAPIDJSON_HAS_STDSTRING=1 -DUSE_RAPIDJSON)
set_include_var(RAPID_JSON_HEADERS "${pkg_src_rapidjson_location}/include")
# -------------------------- nghttp2 ------------------------------------
add_definitions(-DNGHTTP2_STATICLIB)
set_lib_var(NGHTTP2_LIBRARY_DIR "${pkg_nghttp2_location}")
set_include_var(NGHTTP2_INCLUDE_DIR "${pkg_nghttp2_location}/include")
if(MSVC)
set(NGHTTP2_LIBRARIES "${NGHTTP2_LIBRARY_DIR}/nghttp2.lib")
message(STATUS "[INFO] NGHTTP2_LIBRARIES = ${NGHTTP2_LIBRARIES}")
else()
set(NGHTTP2_LIBRARIES "${NGHTTP2_LIBRARY_DIR}/libnghttp2.a")
endif()
# -------------------------- curl ---------------------------------------
add_definitions(-DCURL_STATICLIB)
set_lib_var(CURL_LIBRARY_DIR "${pkg_curl_location}")
set_include_var(CURL_INCLUDE_DIR "${pkg_curl_location}/include/curl")
if(MSVC)
set(CURL_LIBRARIES
optimized "${CURL_LIBRARY_DIR}/libcurl.lib"
debug "${CURL_LIBRARY_DIR}/libcurld.lib")
else()
set(CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl.a")
endif()
# -------------------------- openssl --------------------------------------
set_lib_var(OPENSSL_LIBRARY_DIR "${pkg_openssl_location}")
set_include_var(OPENSSL_INCLUDE_DIR "${pkg_openssl_location}/include")
if(MSVC)
set(OPENSSL_LIBRARIES
optimized "${OPENSSL_LIBRARY_DIR}/libcrypto.lib" optimized "${OPENSSL_LIBRARY_DIR}/libssl.lib"
debug "${OPENSSL_LIBRARY_DIR}/libcrypto.lib" debug "${OPENSSL_LIBRARY_DIR}/libssl.lib")
elseif(LINUX)
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARY_DIR}/libssl.a" "${OPENSSL_LIBRARY_DIR}/libcrypto.a")
elseif(APPLE)
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARY_DIR}/libssl.a" "${OPENSSL_LIBRARY_DIR}/libcrypto.a")
endif()
# -------------------------- zlib ---------------------------------------
set_include_var(ZLIB_INCLUDE_DIR "${pkg_zlib_location}/include")
if(MSVC)
# just precompiled binary
message(INFO "[lib] ZLIB_LIBRARIES = ${pkg_bin_zlib.lib_location}")
set(ZLIB_LIBRARIES "${pkg_bin_zlib.lib_location}")
else()
set_lib_var(ZLIB_LIBRARY_DIR "${pkg_zlib_location}")
endif()
# -------------------------- OpenAl --------------------------
if (NOT STRIP_AV_MEDIA)
if(APPLE)
set(DEFAULT_USE_SYSTEM_OPENAL ON)
else()
set(DEFAULT_USE_SYSTEM_OPENAL OFF)
endif()
option(USE_SYSTEM_OPENAL "Use system openal." ${DEFAULT_USE_SYSTEM_OPENAL})
if (USE_SYSTEM_OPENAL)
message(STATUS "[INFO] OpenAL: System")
add_definitions(-DUSE_SYSTEM_OPENAL)
else()
message(STATUS "[INFO] OpenAL: External")
set_lib_var(OPENAL_LIBRARY_DIR "${pkg_openal_location}")
set_include_var(OPENAL_INCLUDE_DIR "${pkg_openal_location}/include")
add_definitions(-DAL_LIBTYPE_STATIC)
if(MSVC)
set(OPEN_AL_LIBRARIES
optimized "${OPENAL_LIBRARY_DIR}/OpenAL32.lib"
debug "${OPENAL_LIBRARY_DIR}/OpenAL32.lib")
else()
set(OPEN_AL_LIBRARIES "${OPENAL_LIBRARY_DIR}/libopenal.a")
endif()
endif()
endif()
# -------------------------- ffmpeg --------------------------
if (STRIP_AV_MEDIA)
add_definitions(-DSTRIP_AV_MEDIA)
else()
set_lib_var(FFMPEG_LIBRARY_DIR "${pkg_ffmpeg_location}")
set_include_var(FFMPEG_INCLUDE_DIR "${pkg_ffmpeg_location}/include")
if (MSVC)
set(LIBRARY_EXTENTION "lib")
else()
set(LIBRARY_EXTENTION "a")
endif()
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "${FFMPEG_LIBRARY_DIR}/libavfilter.${LIBRARY_EXTENTION}")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "${FFMPEG_LIBRARY_DIR}/libavformat.${LIBRARY_EXTENTION}") # libavformat.a depends on libavcodec.a
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "${FFMPEG_LIBRARY_DIR}/libavcodec.${LIBRARY_EXTENTION}")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "${FFMPEG_LIBRARY_DIR}/libavutil.${LIBRARY_EXTENTION}")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "${FFMPEG_LIBRARY_DIR}/libswresample.${LIBRARY_EXTENTION}")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "${FFMPEG_LIBRARY_DIR}/libswscale.${LIBRARY_EXTENTION}")
endif()
# -------------------------- rlottie --------------------------------------
if (NOT STRIP_AV_MEDIA)
set_lib_var(RLOTTIE_LIBRARY_DIR "${pkg_rlottie_location}")
set_include_var(RLOTTIE_INCLUDE_DIR "${pkg_rlottie_location}/include")
if(MSVC)
set(RLOTTIE_LIBRARIES
optimized "${RLOTTIE_LIBRARY_DIR}/rlottie.lib"
debug "${RLOTTIE_LIBRARY_DIR}/rlottie.lib")
else()
set(RLOTTIE_LIBRARIES "${RLOTTIE_LIBRARY_DIR}/librlottie.a")
endif()
endif()
# -------------------------- minizip --------------------------------------
set(IM_MINIZIP "${pkg_src_minizip_location}/include")
include_directories(${IM_MINIZIP})
message(STATUS "[include] include_directories(${IM_MINIZIP})")
# -------------------------- d3dcompiler -----------------------------------
set(D3D_COMPILER_LIBRARY "${pkg_bin_d3dcompiler_47.dll_location}")
# -------------------------- GPU blacklist -----------------------------------
set(GPU_BLACKLIST "${ICQ_ROOT}/config/qt/${ICQ_PLATFORM}/gpu_blacklist.json")
# -------------------------- mesa3d ---------------------------------------
set(MESA_LIBRARY "${pkg_mesa3d_location}/bin/opengl32sw.dll")
set(MESA_LIBRARY2 "${pkg_mesa3d_location}/bin/libgallium_wgl.dll")
# ------------------- windows runtime libraries ----------------------------
if (IM_QT_DYNAMIC)
if (MSVC)
set(WINSDK_RUNTIME "${pkg_runtime_location}")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(RUNTIME_LIBRARIES_TO_COPY
${WINSDK_RUNTIME}/concrt140d.dll
${WINSDK_RUNTIME}/msvcp140d.dll
${WINSDK_RUNTIME}/vccorlib140d.dll
${WINSDK_RUNTIME}/vcruntime140d.dll
${WINSDK_RUNTIME}/msvcp140d_codecvt_ids.dll
${WINSDK_RUNTIME}/ucrtbased.dll
)
else()
set(RUNTIME_LIBRARIES_TO_COPY
${WINSDK_RUNTIME}/concrt140.dll
${WINSDK_RUNTIME}/msvcp140.dll
${WINSDK_RUNTIME}/vccorlib140.dll
${WINSDK_RUNTIME}/vcruntime140.dll
${WINSDK_RUNTIME}/msvcp140_codecvt_ids.dll
${WINSDK_RUNTIME}/ucrtbase.dll
${WINSDK_RUNTIME}/api-ms-win-core-console-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-console-l1-2-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-datetime-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-debug-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-errorhandling-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-file-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-file-l1-2-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-file-l2-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-handle-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-heap-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-interlocked-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-libraryloader-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-localization-l1-2-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-memory-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-namedpipe-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-processenvironment-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-processthreads-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-processthreads-l1-1-1.dll
${WINSDK_RUNTIME}/api-ms-win-core-profile-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-rtlsupport-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-string-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-synch-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-synch-l1-2-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-sysinfo-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-timezone-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-core-util-l1-1-0.dll
${WINSDK_RUNTIME}/API-MS-Win-core-xstate-l2-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-conio-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-convert-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-environment-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-filesystem-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-heap-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-locale-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-math-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-multibyte-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-private-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-process-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-runtime-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-stdio-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-string-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-time-l1-1-0.dll
${WINSDK_RUNTIME}/api-ms-win-crt-utility-l1-1-0.dll
)
endif()
endif()
endif()
# -------------------------- libvoip ----------------------------------------
if (NOT STRIP_VOIP)
set(VOIP_LIBS_NAME "voip3_${VOIP_LIBS_VERSION}_desktop")
set(VOIP_LIBS_FILE_DESTINATION "${DOWNLOADS_PATH}/${VOIP_LIBS_NAME}.zip")
set(VOIP_LIBS_FILE_MD5 "${VOIP_LIBS_FILE_DESTINATION}.md5")
set(VOIP_LIBS_URL "${DOWNLOADS_URL}/Voiplib/${VOIP_LIBS_VERSION}/${VOIP_LIBS_NAME}.zip")
set(VOIPLIB_ROOT "${ICQ_ROOT}/core/Voip/libvoip_${VOIP_LIBS_VERSION}")
include_directories(${VOIPLIB_ROOT})
message(STATUS "")
message(STATUS "[VOIP]")
message(STATUS "[VOIP] DOWNLOADS_URL = ${DOWNLOADS_URL}")
message(STATUS "[VOIP] DOWNLOADS_PATH = ${DOWNLOADS_PATH}")
message(STATUS "[VOIP] VOIP_LIBS_VERSION = ${VOIP_LIBS_VERSION}")
message(STATUS "[VOIP] VOIP_LIBS_NAME = ${VOIP_LIBS_NAME}")
message(STATUS "[VOIP] VOIP_LIBS_FILE_DESTINATION = ${VOIP_LIBS_FILE_DESTINATION}")
message(STATUS "[VOIP] VOIP_LIBS_FILE_MD5 = ${VOIP_LIBS_FILE_MD5}")
message(STATUS "[VOIP] VOIP_LIBS_URL = ${VOIP_LIBS_URL}")
message(STATUS "[VOIP] VOIPLIB_ROOT = ${VOIPLIB_ROOT}")
if(NOT EXISTS "${VOIP_LIBS_FILE_MD5}")
message(STATUS "[md5] No md5 hash, continue")
common_download_file("${VOIP_LIBS_URL}" "${VOIP_LIBS_FILE_DESTINATION}" "${VOIP_LIBS_FILE_MD5}")
common_file_verify_md5("${VOIP_LIBS_FILE_DESTINATION}" "${VOIP_LIBS_FILE_MD5}")
common_file_extract("${VOIP_LIBS_FILE_DESTINATION}" "${VOIPLIB_ROOT}" 1 "${VOIP_LIBS_FILE_MD5}")
else()
message(STATUS "[md5] Reading MD5 HASH from md5 file")
file(READ "${VOIP_LIBS_FILE_MD5}" VOIP_LIBS_FILE_WITH_MD5)
string(STRIP "${VOIP_LIBS_FILE_WITH_MD5}" VOIP_LIBS_FILE_WITH_MD5)
message(STATUS "[md5] VOIP_LIBS_FILE_WITH_MD5 = ${VOIP_LIBS_FILE_WITH_MD5}")
message(STATUS "[md5] Checksum MD5 HASH")
file(MD5 "${VOIP_LIBS_FILE_DESTINATION}" VOIP_LIBS_FILE_ZIPFILE_MD5)
message(STATUS "[md5] ${VOIP_LIBS_FILE_DESTINATION} = ${VOIP_LIBS_FILE_ZIPFILE_MD5}")
IF(NOT "${VOIP_LIBS_FILE_WITH_MD5}" MATCHES "${VOIP_LIBS_FILE_ZIPFILE_MD5}")
message(STATUS "[md5] MD5 mismatch")
message(STATUS "[md5] The file will be re-downloaded")
common_download_file("${VOIP_LIBS_URL}" "${VOIP_LIBS_FILE_DESTINATION}" "${VOIP_LIBS_FILE_MD5}")
common_file_verify_md5("${VOIP_LIBS_FILE_DESTINATION}" "${VOIP_LIBS_FILE_MD5}")
common_file_extract("${VOIP_LIBS_FILE_DESTINATION}" "${VOIPLIB_ROOT}" 1 "${VOIP_LIBS_FILE_MD5}")
else()
# Don't download if exists & don't extract if exists
message(STATUS "[md5] file: OK, verified")
message(STATUS "")
common_file_extract("${VOIP_LIBS_FILE_DESTINATION}" "${VOIPLIB_ROOT}" 0 "${VOIP_LIBS_FILE_MD5}")
endif()
endif()
if(MSVC)
set(VOIP_LIBRARIES "${VOIP_LIBRARIES}" msdmo.lib dmoguids.lib wmcodecdspuuid.lib amstrmid.lib winmm.lib secur32.lib ws2_32.lib comsuppw.lib)
set(VOIP_LIBRARIES "${VOIP_LIBRARIES}" optimized comsuppw.lib debug comsuppwd.lib)
endif()
if(NOT VOIP_AS_MODULE)
include_directories("${VOIPLIB_ROOT}/include")
if(MSVC)
set(VOIP_LIBRARIES "${VOIP_LIBRARIES}" optimized "${VOIPLIB_ROOT}/lib/windows.Release.x86/libvoip_sdk_merged_x86.lib" debug "${VOIPLIB_ROOT}/lib/windows.Debug.x86/libvoip_sdk_merged_x86d.lib")
elseif(APPLE)
set(VOIP_LIBRARIES "${VOIPLIB_ROOT}/lib/macos.Release.x64/libvoip_sdk_merged_x64.a")
elseif(LINUX)
set(VOIP_LIBRARIES "${VOIPLIB_ROOT}/lib/linux.Release.x64/libvoip_sdk_merged_x64.a")
endif()
endif()
endif()
# -----------------------------------------------------------------------------
# ------------------------ additional libs & xkb ------------------------------
if(LINUX)
set_lib_var(DBUS_LIBRARY_DIR ${pkg_libdbus_location})
set_lib_var(XLIBS_LIBRARY_DIR "${pkg_xlibs-bundle_location}")
set_include_var(XLIBS_INCLUDE_DIR "${pkg_xlibs-bundle_location}/include")
message(STATUS "[lib] XLIBS_LIBRARY_DIR -> ${XLIBS_LIBRARY_DIR}")
set(ADDITIONAL_LIBRARIES
"${DBUS_LIBRARY_DIR}/libdbus-1.a"
"${XLIBS_LIBRARY_DIR}64/libxkbcommon.so"
"${XLIBS_LIBRARY_DIR}64/libxkbcommon-x11.so"
"${XLIBS_LIBRARY_DIR}/libXi.so"
"${XLIBS_LIBRARY_DIR}/libXau.so"
"${XLIBS_LIBRARY_DIR}/libXdmcp.so"
"${XLIBS_LIBRARY_DIR}/libxcb-util.so"
"${XLIBS_LIBRARY_DIR}/libXext.so"
"${XLIBS_LIBRARY_DIR}/libX11.so"
"${XLIBS_LIBRARY_DIR}/libXrandr.so"
"${XLIBS_LIBRARY_DIR}/libXrender.so"
"${XLIBS_LIBRARY_DIR}/libXdamage.so"
"${XLIBS_LIBRARY_DIR}/libXfixes.so"
"${XLIBS_LIBRARY_DIR}/libXcomposite.so"
"${XLIBS_LIBRARY_DIR}64/libGl.so"
)
message(STATUS "[libs] ADDITIONAL_LIBRARIES -> ${ADDITIONAL_LIBRARIES}")
set(XCB_LIBRARIES
"${XLIBS_LIBRARY_DIR}/libxcb.so"
"${XLIBS_LIBRARY_DIR}/libxcb-icccm.so"
"${XLIBS_LIBRARY_DIR}/libxcb-ewmh.so"
"${XLIBS_LIBRARY_DIR}/libxcb-image.so"
"${XLIBS_LIBRARY_DIR}/libxcb-keysyms.so"
"${XLIBS_LIBRARY_DIR}/libxcb-randr.so"
"${XLIBS_LIBRARY_DIR}/libxcb-render.so"
"${XLIBS_LIBRARY_DIR}/libxcb-render-util.so"
"${XLIBS_LIBRARY_DIR}/libxcb-shape.so"
"${XLIBS_LIBRARY_DIR}/libxcb-shm.so"
"${XLIBS_LIBRARY_DIR}/libxcb-sync.so"
"${XLIBS_LIBRARY_DIR}/libxcb-util.so"
"${XLIBS_LIBRARY_DIR}/libxcb-xfixes.so"
"${XLIBS_LIBRARY_DIR}/libxcb-xinerama.so"
"${XLIBS_LIBRARY_DIR}/libxcb-xkb.so"
"${XLIBS_LIBRARY_DIR}/libX11-xcb.so"
)
message(STATUS "[libs] XCB_LIBRARIES -> ${XCB_LIBRARIES}")
endif()
# -------------------------- qt ---------------------------------------
message(STATUS "")
set(ICQ_QT_ROOT "${pkg_qt_location}")
message(STATUS "[INFO] ICQ_QT_ROOT = ${ICQ_QT_ROOT}")
set(ICQ_QT_BIN_DIR "${ICQ_QT_ROOT}/bin")
set(ICQ_QT_LIB_DIR "${ICQ_QT_ROOT}/lib")
set(ICQ_QT_INCLUDE_DIR "${ICQ_QT_ROOT}/include")
set(ICQ_QT_LIBEXEC_DIR "${ICQ_QT_ROOT}/libexec")
set(ICQ_QT_PLUGINS_DIR "${ICQ_QT_ROOT}/plugins")
set(ICQ_QT_RESOURCES_DIR "${ICQ_QT_ROOT}/resources")
set(ICQ_QT_QML_DIR "${ICQ_QT_ROOT}/qml")
if(LINUX)
EXEC_PROGRAM("chmod +x ${pkg_bin_lrelease_location}")
EXEC_PROGRAM("chmod +x ${pkg_bin_moc_location}")
EXEC_PROGRAM("chmod +x ${pkg_bin_rcc_location}")
EXEC_PROGRAM("chmod +x ${pkg_bin_uic_location}")
set(IM_QT_BIN_LRELEASE "${pkg_bin_lrelease_location}")
set(IM_QT_BIN_MOC "${ICQ_QT_ROOT}/bin/moc")
set(IM_QT_BIN_RCC "${ICQ_QT_ROOT}/bin/rcc")
set(IM_QT_BIN_UIC "${ICQ_QT_ROOT}/bin/uic")
elseif(MSVC)
set(IM_QT_BIN_LRELEASE "${pkg_bin_lrelease.exe_location}")
get_filename_component(IM_QT_BIN_MOC "${ICQ_QT_BIN_DIR}/moc.exe" ABSOLUTE)
get_filename_component(IM_QT_BIN_RCC "${ICQ_QT_BIN_DIR}/rcc.exe" ABSOLUTE)
get_filename_component(IM_QT_BIN_UIC "${ICQ_QT_BIN_DIR}/uic.exe" ABSOLUTE)
else()
get_filename_component(IM_QT_BIN_LRELEASE "${ICQ_QT_BIN_DIR}/lrelease" ABSOLUTE)
get_filename_component(IM_QT_BIN_MOC "${ICQ_QT_BIN_DIR}/moc" ABSOLUTE)
get_filename_component(IM_QT_BIN_RCC "${ICQ_QT_BIN_DIR}/rcc" ABSOLUTE)
get_filename_component(IM_QT_BIN_UIC "${ICQ_QT_BIN_DIR}/uic" ABSOLUTE)
endif()
message(STATUS "[Qt Utils] IM_QT_BIN_LRELEASE = ${IM_QT_BIN_LRELEASE}")
message(STATUS "[Qt Utils] IM_QT_BIN_MOC = ${IM_QT_BIN_MOC}")
message(STATUS "[Qt Utils] IM_QT_BIN_RCC = ${IM_QT_BIN_RCC}")
message(STATUS "[Qt Utils] IM_QT_BIN_UIC = ${IM_QT_BIN_UIC}")
set(ICQ_QT_VERSION "${pkg_qt_headers}")
string(REGEX REPLACE "-.+$" "" ICQ_QT_VERSION ${ICQ_QT_VERSION})
set(QT_MAJOR_VERSION "5")
include_directories("${ICQ_QT_INCLUDE_DIR}")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtCore")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtCore/${ICQ_QT_VERSION}/QtCore")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtCore/${ICQ_QT_VERSION}")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtGui")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtGui/${ICQ_QT_VERSION}/QtGui")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtGui/${ICQ_QT_VERSION}")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtWidgets")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtWidgets/${ICQ_QT_VERSION}/QtWidgets")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtWidgets/${ICQ_QT_VERSION}")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtOpenGL")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtNetwork")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtSvg")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtMacExtras")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtX11Extras")
if(IM_AUTO_TESTING)
message(STATUS "[INFO] include: QtTest")
include_directories("${ICQ_QT_INCLUDE_DIR}/QtTest")
endif()
if(NOT IM_QT_DYNAMIC)
add_definitions(-DQT_STATIC)
endif()
include(requirements/QtQuickFunctions.cmake)
if(MSVC)
set(QT_LIBRARIES
optimized ${ICQ_QT_LIB_DIR}/Qt5Gui.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Guid.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Core.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Cored.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Concurrent.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Concurrentd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5EventDispatcherSupport.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5EventDispatcherSupportd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5FontDatabaseSupport.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5FontDatabaseSupportd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Network.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Networkd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Multimedia.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Multimediad.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5MultimediaWidgets.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5MultimediaWidgetsd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Multimedia.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Multimediad.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Test.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Testd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5ThemeSupport.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5ThemeSupportd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5OpenGL.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5OpenGLd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Svg.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Svgd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5PlatformCompositorSupport.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5PlatformCompositorSupportd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5Widgets.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5Widgetsd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5WinExtras.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5WinExtrasd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/Qt5WindowsUIAutomationSupport.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/Qt5WindowsUIAutomationSupportd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/qtpcre2.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/qtpcre2d.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/qtmain.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/qtmaind.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/qtharfbuzz.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/qtharfbuzzd.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/qtfreetype.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/qtfreetyped.${QT_LIB_EXT}
optimized ${ICQ_QT_LIB_DIR}/qtlibpng.${QT_LIB_EXT} debug ${ICQ_QT_LIB_DIR}/qtlibpngd.${QT_LIB_EXT}