forked from fte-team/fteqw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1698 lines (1554 loc) · 57.9 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
#Note: this file was made primarily to support msvc and its project file incompatibilities nightmare.
#Its also useful for various other IDEs like QtCreator etc.
#It uses system libraries, so it will have dependancy issues with public releases where those dependancies are distro/version-specific.
#Public builds are still built using the (overcomplicated) traditional (g)makefile.
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
cmake_policy(SET CMP0063 NEW)
PROJECT(FTEQuake)
INCLUDE_DIRECTORIES(
engine/common
engine/client
engine/qclib
engine/gl
engine/server
engine
)
IF (EXISTS ${CMAKE_SOURCE_DIR}/.svn)
EXECUTE_PROCESS(COMMAND
"svnversion"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE FTE_REVISON
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
IF (NOT "${FTE_REVISON}" STREQUAL "")
MESSAGE(STATUS "FTE SVN Revision ${FTE_REVISON}")
IF(FTE_REVISON MATCHES "M")
MESSAGE(STATUS "--- PRIVATE CHANGES DETECTED ---")
SET(FTE_REVISON SVNREVISION=${FTE_REVISON})
ELSE()
MESSAGE(STATUS "No local changes")
EXECUTE_PROCESS(COMMAND
svn info --show-item last-changed-date --no-newline
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE FTE_DATE
)
SET(FTE_REVISON SVNREVISION=${FTE_REVISON} SVNDATE=${FTE_DATE})
ENDIF()
ENDIF()
ENDIF()
IF (EXISTS ${CMAKE_SOURCE_DIR}/.git)
EXECUTE_PROCESS(COMMAND
git describe --always --long --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE FTE_REVISON_GIT
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(COMMAND
git log -1 --format=%cs
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE FTE_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(COMMAND
git branch --show-current
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE FTE_BRANCH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(COMMAND
git rev-parse --is-shallow-repository
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE FTE_GIT_IS_SHALLOW
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
IF(FTE_GIT_IS_SHALLOW STREQUAL true)
MESSAGE(STATUS "shallow clone prevents calculation of revision number.")
SET(SVNREVISION "git-${FTE_REVISON_GIT}") #if its a shallow clone then we can't count commits properly so don't know what revision we actually are.
ELSE()
EXECUTE_PROCESS(COMMAND
git rev-list HEAD --count
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE SVNREVISION
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
MATH(EXPR SVNREVISION "${SVNREVISION} + 29") #not all svn commits managed to appear im the git repo, so we have a small bias to keep things consistent.
IF (FTE_BRANCH STREQUAL "master")
SET(SVNREVISION "${SVNREVISION}-git-${FTE_REVISON_GIT}")
ELSE()
SET(SVNREVISION "${FTE_BRANCH}-${SVNREVISION}-git-${FTE_REVISON_GIT}") #weird branches get a different form of revision, to reduce confusion.
ENDIF()
ENDIF()
MESSAGE(STATUS "FTE GIT ${FTE_BRANCH} Revision ${SVNREVISION}, ${FTE_DATE}")
SET(FTE_REVISON SVNREVISION=${SVNREVISION} SVNDATE=${FTE_DATE} FTE_BRANCH=${FTE_BRANCH})
ENDIF()
#plugins need visibility hidden in order to avoid conflicts with function names that match the engine.
#this is consistent with how windows works so no great loss.
#plus it means that gcc can inline more (with LTO), including optimising args.
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
IF(${CMAKE_VERSION} VERSION_LESS "3.9.0")
MESSAGE(STATUS "no LTO - old cmake.")
ELSE()
cmake_policy(SET CMP0069 NEW)
IF(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
#use LTO where possible. reportedly requires cmake 3.9 to actually work
INCLUDE(CheckIPOSupported)
check_ipo_supported(RESULT result)
IF(result)
SET(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
MESSAGE(STATUS "Using LTO.")
ELSE()
MESSAGE(STATUS "no LTO - not supported.")
ENDIF()
ELSE()
MESSAGE(STATUS "no LTO - debug.")
ENDIF()
ENDIF()
SET(FTE_BUILD_CONFIG ${CMAKE_HOME_DIRECTORY}/engine/common/config_fteqw.h CACHE FILEPATH "Which build config file to use to control supported features.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};CONFIG_FILE_NAME=${FTE_BUILD_CONFIG})
SET(FTE_USE_SDL false CACHE BOOL "Force the use of SDL instead of using native builds.")
INCLUDE(GNUInstallDirs)
SET(FTE_INSTALL_BINDIR games CACHE STRING "Binary dir to install to.")
SET(FTE_INSTALL_LIBDIR fteqw CACHE STRING "Binary dir to install to.")
IF(NOT WIN32)
SET(SYS_LIBS ${SYS_LIBS} m)
ELSE()
SET(SYS_LIBS ${SYS_LIBS})
ENDIF()
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};ZLIB_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${ZLIB_LIBRARIES})
SET(FTESV_LIBS ${FTESV_LIBS} ${ZLIB_LIBRARIES})
SET(FTEQCC_LIBS ${FTEQCC_LIBS} ${ZLIB_LIBRARIES})
ELSE()
MESSAGE(WARNING "libz library NOT available. compressed pk3 will not be available.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_ZLIB)
ENDIF()
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};AVAIL_BZLIB;BZLIB_STATIC)
SET(FTE_LIBS ${FTE_LIBS} bz2)
SET(FTESV_LIBS ${FTESV_LIBS} bz2)
# MESSAGE(STATUS "bzip2 library found. bz2-compressed pk3s will work for the price of extra bloat! yay!")
ELSE()
MESSAGE(WARNING "bzip2 library NOT available. bz2-compressed pk3s will not be available, as if anyone cares.")
ENDIF()
SET(OpenGL_GL_PREFERENCE LEGACY)
FIND_PACKAGE(OpenGL)
IF(OpenGL_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};GLQUAKE)
ELSE()
MESSAGE(WARNING "opengl library NOT available. Will depend upon vulkan.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_OPENGL)
ENDIF()
SET(FTE_DEP_JPEG true CACHE BOOL "Link against libjpeg.")
IF(FTE_DEP_JPEG)
FIND_PACKAGE(JPEG)
ENDIF()
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES( ${JPEG_INCLUDE_DIRS} )
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBJPEG_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${JPEG_LIBRARIES})
ELSE()
MESSAGE(WARNING "libjpeg library NOT available. Who cares?")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_JPEG)
ENDIF()
FIND_PACKAGE(PNG)
IF(PNG_FOUND)
INCLUDE_DIRECTORIES( ${PNG_INCLUDE_DIRS} )
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBPNG_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${PNG_LIBRARIES})
ELSE()
MESSAGE(WARNING "libpng library NOT available. Good luck with screenshots.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_PNG)
ENDIF()
FIND_PACKAGE(Freetype)
IF(FREETYPE_FOUND)
INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} )
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBFREETYPE_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${FREETYPE_LIBRARIES})
FIND_PACKAGE(Fontconfig)
IF(Fontconfig_FOUND)
INCLUDE_DIRECTORIES( ${Fontconfig_INCLUDE_DIRS} )
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};LIBFONTCONFIG_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${Fontconfig_LIBRARIES})
ELSEIF()
MESSAGE(WARNING "fontconfig library NOT available. I hope you're not using any system fonts.")
ENDIF()
ELSE()
MESSAGE(WARNING "freetype library NOT available. I hope you're okay with ascii.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_FREETYPE)
ENDIF()
FIND_PATH(VULKAN_INCLUDE_DIR vulkan/vulkan.h)
IF(VULKAN_INCLUDE_DIR)
INCLUDE_DIRECTORIES( ${VULKAN_INCLUDE_DIR} )
SET(FTE_DEFINES ${FTE_DEFINES};VKQUAKE) #no libs required, thankfully
ELSE()
MESSAGE(WARNING "Vulkan headers NOT available.")
ENDIF()
FIND_LIBRARY(VORBISFILE_LIBRARY NAMES vorbisfile)
IF(NOT VORBISFILE_LIBRARY)
INCLUDE_DIRECTORIES( ${VORBISFILE_INCLUDE_DIRS} )
MESSAGE(WARNING "libvorbisfile library NOT available. Who listens to the bgm anyway?")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_OGG)
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-sign")
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-pointer-sign -Wno-unknown-pragmas -Wno-format-zero-length -Wno-strict-aliasing -Wno-error=cpp")
ELSE()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
ENDIF()
endif()
IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes") #
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wold-style-definition") #k&r c is weird and can't cope with 64bit types.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wold-style-declaration") #
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith") #void* stuff
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wvla") #msvc doesn't support vla
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeclaration-after-statement") #msvc doesn't allow defs after statements, and they're so very tempting...
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-truncation=1")
#TODO SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes") #for finding missing statics.
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") #
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wswitch-enum") #to warn about omitted enums despite default.
#might as well do this, public builds use the regular Makefile.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-pointer-sign -Wno-unknown-pragmas -Wno-format-zero-length -Wno-strict-aliasing -Wno-error=cpp")
ELSE()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
ENDIF()
IF (NOT FTE_USE_SDL)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--warn-common")
ENDIF()
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wc++-compat") #lul, thousands of errors!
ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
IF(NOT ${WIN32})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong")
ENDIF()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEBUG")
ENDIF()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTE_LIBRARY_PATH=${CMAKE_INSTALL_FULL_LIBDIR}/${FTE_INSTALL_LIBDIR} -DFTE_DATA_DIR=${CMAKE_INSTALL_FULL_DATAROOTDIR}")
FUNCTION(EMBED_PLUGIN_META PLUGNAME PLUGTITLE PLUGDESC)
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES OUTPUT_NAME "${PLUGNAME}")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
SET(INSTALLTARGS ${INSTALLTARGS} "plug_${PLUGNAME}" PARENT_SCOPE)
#sadly we need to use a temp zip file, because otherwise zip insists on using zip64 extensions which breaks zip -A (as well as any attempts to read any files).
ADD_CUSTOM_COMMAND(
TARGET plug_${PLUGNAME} POST_BUILD
COMMAND /bin/echo -e "{\\n package fteplug_${PLUGNAME}\\n ver \"${SVNREVISION}\"\\n category Plugins\\n title \"${PLUGTITLE}\"\\n gamedir \"\"\\n desc \"${PLUGDESC}\"\\n}" | zip -q -9 -fz- $<TARGET_FILE:plug_${PLUGNAME}>.zip -
COMMAND cmake -E cat $<TARGET_FILE:plug_${PLUGNAME}>.zip >> "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND zip -A "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND cmake -E rm $<TARGET_FILE:plug_${PLUGNAME}>.zip
VERBATIM)
ENDFUNCTION()
IF(${ANDROID})
# FIND_PACKAGE(Freetype REQUIRED)
# INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} )
SET(FTE_DEFINES ${FTE_DEFINES};ANDROID;VKQUAKE;MULTITHREAD)
SET(FTE_LIBS ${FTE_LIBS} android log EGL ${SYS_LIBS} ${CMAKE_DL_LIBS})
SET(FTE_ARCH_FILES
engine/client/sys_droid.c
engine/common/sys_linux_threads.c
engine/client/snd_droid.c
engine/client/cd_null.c
engine/gl/gl_viddroid.c
)
ELSEIF(WIN32 AND NOT FTE_USE_SDL)
INCLUDE_DIRECTORIES(engine/libs engine/libs/freetype2/include)
# LINK_DIRECTORIES(engine/libs/mingw64-libs)
# engine/server/sv_sys_win.c
SET(FTE_LIBS ${FTE_LIBS} ole32 gdi32 wsock32 winmm dxguid)
SET(FTE_DEFINES ${FTE_DEFINES};D3D9QUAKE;D3D11QUAKE)
SET(FTE_ARCH_FILES
engine/client/winquake.rc
engine/common/sys_win_threads.c
engine/common/net_ssl_winsspi.c
engine/common/fs_win32.c
engine/client/cd_win.c
engine/client/in_win.c
engine/client/snd_al.c
engine/client/snd_directx.c
engine/client/snd_wasapi.c
engine/client/snd_win.c
engine/client/snd_xaudio.c
engine/client/sys_win.c
engine/gl/gl_vidnt.c
engine/d3d/d3d_backend.c
engine/d3d/d3d_image.c
engine/d3d/d3d_shader.c
engine/d3d/d3d11_backend.c
engine/d3d/d3d11_image.c
engine/d3d/d3d11_shader.c
engine/d3d/d3d8_backend.c
engine/d3d/d3d8_image.c
engine/d3d/vid_d3d.c
engine/d3d/vid_d3d11.c
engine/d3d/vid_d3d8.c
)
SET(FTESV_LIBS ${FTESV_LIBS} wsock32 winmm)
SET(FTESV_ARCH_FILES
engine/client/winquake.rc
engine/common/sys_win_threads.c
engine/common/net_ssl_winsspi.c
engine/common/fs_win32.c
engine/server/sv_sys_win.c
)
ELSEIF(UNIX AND NOT FTE_USE_SDL) #linux(ish)
#openbsd will have issues with snd_linux.c
FIND_PACKAGE(GnuTLS)
IF(NOT GNUTLS_FOUND)
MESSAGE(WARNING "gnutls library NOT available. HTTPS/DTLS will not be available.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_GNUTLS)
ELSE()
SET(GNUTLS_STATIC false CACHE BOOL "Link gnutls statically.") #usually as an .so though. :/
IF(GNUTLS_STATIC)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};GNUTLS_STATIC)
SET(FTE_LIBS ${FTE_LIBS} ${GNUTLS_LIBRARY})
SET(FTESV_LIBS ${FTESV_LIBS} ${GNUTLS_LIBRARY})
ENDIF()
ENDIF()
#linux-only packages
FIND_PACKAGE(ALSA)
IF(ALSA_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};AUDIO_ALSA;AUDIO_PULSE)
ELSE()
MESSAGE(WARNING "asound (alsa) library NOT available.")
ENDIF()
FIND_PACKAGE(X11)
IF(X11_FOUND)
IF (NOT X11_Xcursor_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_X11_CURSOR)
MESSAGE(WARNING "Xcursor library NOT available.")
ENDIF()
IF (NOT X11_Xrandr_FOUND)
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_X11_RANDR)
MESSAGE(WARNING "Xrandr library NOT available.")
ENDIF()
ELSE()
MESSAGE(WARNING "x11 library NOT available.")
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};NO_X11)
ENDIF()
SET(FTE_DEFINES ${FTE_DEFINES};DYNAMIC_SDL;MULTITHREAD)
SET(FTE_LIBS ${FTE_LIBS} ${SYS_LIBS} ${CMAKE_DL_LIBS} pthread ${SDL2_LIBRARIES})
SET(FTE_ARCH_FILES ${FTE_ARCH_FILES}
engine/client/sys_linux.c
engine/common/sys_linux_threads.c
engine/common/net_ssl_gnutls.c
engine/client/snd_al.c
engine/client/snd_alsa.c
engine/client/snd_linux.c
engine/client/snd_pulse.c
engine/client/snd_sdl.c #we use SDL audio even without sys_sdl, because of pulseaudio fucking over alsa, alsa fucking over oss3, and oss4 not being used. Either way, openal should be the default anyway.
engine/client/cd_linux.c
engine/gl/gl_vidlinuxglx.c
engine/gl/gl_videgl.c
# engine/gl/gl_vidrpi.c
# engine/gl/gl_vidwayland.c
)
#openbsd uses a libossaudio library for all the oss stuff, use that to ensure that we still get sound
FIND_LIBRARY(
OSSAUDIO_LIBRARY
NAMES ossaudio
)
IF(OSSAUDIO_LIBRARY)
SET(FTE_LIBS ${FTE_LIBS} ${OSSAUDIO_LIBRARY})
ENDIF()
#on linux, use wayland (we normally dynamically link, but we still need headers).
FIND_LIBRARY(
WAYLAND_CLIENT_LIBRARY
NAMES wayland-client libwayland-client
)
FIND_LIBRARY(
WAYLAND_EGL
NAMES wayland-egl
)
FIND_LIBRARY(
HAVE_XKBCOMMON
NAMES xkbcommon
)
IF(NOT HAVE_XKBCOMMON)
MESSAGE(WARNING "xkbcommon library not found, needed for wayland to be usable.")
UNSET(WAYLAND_CLIENT_LIBRARY)
ENDIF()
IF(WAYLAND_CLIENT_LIBRARY AND WAYLAND_EGL)
# SET(FTE_LIBS ${FTE_LIBS} ${WAYLAND_CLIENT_LIBRARY} ${HAVE_XKBCOMMON} ${WAYLAND_EGL})
# SET(FTE_DEFINES ${FTE_DEFINES};STATIC_WAYLAND)
SET(FTE_DEFINES ${FTE_DEFINES};WAYLANDQUAKE;USE_EGL)
SET(FTE_ARCH_FILES ${FTE_ARCH_FILES}
engine/gl/gl_vidwayland.c
)
ELSE()
MESSAGE(WARNING "Wayland library NOT available. X11 will live forever anyway.")
IF(NOT X11_FOUND)
MESSAGE(WARNING "No renderers supported!")
SET(FTE_NO_RENDERERS 1)
ENDIF()
ENDIF()
SET(FTESV_DEFINES MULTITHREAD)
SET(FTESV_ARCH_FILES ${FTESV_ARCH_FILES}
engine/server/sv_sys_unix.c
engine/common/sys_linux_threads.c
engine/common/net_ssl_gnutls.c
)
SET(FTESV_LIBS ${FTESV_LIBS} ${SYS_LIBS} ${CMAKE_DL_LIBS} pthread)
ELSEIF(1) #SDL
# FIND_PACKAGE(Freetype REQUIRED)
# INCLUDE_DIRECTORIES(engine/libs engine/libs/freetype2/include)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_SEARCH_MODULE(sdl2 REQUIRED sdl2)
FIND_PACKAGE(SDL2 REQUIRED)
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
#SDL2.0.7 supports vulkan, so lets use it.
SET(FTE_DEFINES ${FTE_DEFINES};FTE_SDL;MULTITHREAD)
SET(FTE_LIBS ${FTE_LIBS} ${SYS_LIBS} ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
SET(FTE_ARCH_FILES
engine/client/sys_sdl.c
engine/client/snd_al.c
engine/client/snd_sdl.c
engine/client/in_sdl.c
engine/client/cd_sdl.c
engine/gl/gl_vidsdl.c
)
SET(FTESV_DEFINES FTE_SDL)
SET(FTESV_LIBS ${FTESV_LIBS} ${SYS_LIBS} ${CMAKE_DL_LIBS} ${SDL2_LIBRARIES})
IF(WIN32)
SET(FTE_LIBS ${FTE_LIBS} wsock32 gdi32 ole32)
SET(FTE_DEFINES ${FTE_DEFINES};NO_DIRECTX)
SET(FTE_ARCH_FILES ${FTE_ARCH_FILES}
engine/client/winquake.rc
engine/common/net_ssl_winsspi.c
)
SET(FTESV_ARCH_FILES ${FTESV_ARCH_FILES}
engine/client/winquake.rc
engine/common/net_ssl_winsspi.c
engine/server/sv_sys_win.c
)
ELSE()
SET(FTE_ARCH_FILES ${FTE_ARCH_FILES}
engine/common/net_ssl_gnutls.c
)
SET(FTESV_ARCH_FILES ${FTESV_ARCH_FILES}
engine/common/net_ssl_gnutls.c
engine/common/sys_linux_threads.c
engine/server/sv_sys_unix.c
)
ENDIF()
ELSE()
# engine/common/sys_linux_threads.c
# engine/common/net_ssl_gnutls.c
# engine/server/sv_sys_unix.c
# engine/client/snd_alsa.c
# engine/client/snd_droid.c
# engine/client/snd_linux.c
# engine/client/snd_macos.c
# engine/client/snd_morphos.c
# engine/client/snd_sblaster.c
# engine/client/snd_sdl.c
# engine/client/snd_sndio.c
# engine/client/sys_dos.c
# engine/client/sys_droid.c
# engine/client/sys_linux.c
# engine/client/sys_morphos.c
# engine/client/sys_plugfte.c
# engine/client/sys_sdl.c
# engine/client/sys_xdk.c
# engine/client/cd_linux.c
# engine/client/cd_null.c
# engine/client/cd_sdl.c
# engine/client/in_morphos.c
# engine/client/in_sdl.c
# engine/gl/gl_viddroid.c
# engine/gl/gl_videgl.c
# engine/gl/gl_vidlinuxglx.c
# engine/gl/gl_vidmacos.c
# engine/gl/gl_vidmorphos.c
# engine/gl/gl_vidnull.c
# engine/gl/gl_vidrpi.c
# engine/gl/gl_vidsdl.c
# engine/gl/gl_vidtinyglstubs.c
# engine/gl/gl_vidwayland.c
ENDIF()
SET(FTE_GL_FILES
#These are GL-specific, but can be left even if no gl is supported.
engine/gl/gl_backend.c
engine/gl/gl_bloom.c
engine/gl/gl_draw.c
engine/gl/gl_rmain.c
engine/gl/gl_rmisc.c
engine/gl/gl_rsurf.c
engine/gl/gl_screen.c
engine/gl/gl_vidcommon.c
engine/gl/glmod_doom.c
)
SET(FTE_VK_FILES
engine/vk/vk_backend.c
engine/vk/vk_init.c
)
SET(FTE_QCVM_FILES
engine/qclib/comprout.c
engine/qclib/initlib.c
engine/qclib/pr_edict.c
engine/qclib/pr_exec.c
engine/qclib/pr_multi.c
engine/qclib/qcc_cmdlib.c
engine/qclib/qcc_pr_comp.c
engine/qclib/qcc_pr_lex.c
# engine/qclib/decomp.c
# engine/qclib/packager.c
# engine/qclib/pr_x86.c
# engine/qclib/qccgui.c
# engine/qclib/qccguistuff.c
# engine/qclib/qcctui.c
engine/qclib/qccmain.c
engine/qclib/qcd_main.c
engine/qclib/qcdecomp.c
)
SET(FTE_COMMON_FILES
#these files are common to both server-only and client+server builds.
engine/common/cmd.c
engine/common/com_mesh.c
engine/common/com_bih.c
engine/common/common.c
engine/common/json.c
engine/common/crc.c
engine/common/cvar.c
engine/common/fs.c
engine/common/fs_dzip.c
engine/common/fs_pak.c
engine/common/fs_stdio.c
engine/common/fs_xz.c
engine/common/fs_zip.c
engine/common/gl_q2bsp.c
engine/common/huff.c
engine/common/log.c
engine/common/mathlib.c
engine/common/md4.c
engine/common/net_chan.c
engine/common/net_ice.c
engine/common/net_wins.c
engine/common/plugin.c
engine/common/pmove.c
engine/common/pmovetst.c
engine/common/pr_bgcmd.c
engine/common/q1bsp.c
engine/common/q2pmove.c
engine/common/qvm.c
engine/common/sha1.c
engine/common/sha2.c
engine/common/translate.c
engine/common/zone.c
#important headers
engine/common/bothdefs.h
engine/common/config_fteqw.h
engine/common/config_minimal.h
engine/common/config_nocompat.h
engine/common/config_wastes.h
engine/common/config_freecs.h
engine/common/config_fteqw_noweb.h
#useless headers that I'll never search for
engine/client/api_menu.h
engine/client/cdaudio.h
engine/client/client.h
engine/client/cl_ignore.h
engine/client/cl_master.h
engine/client/input.h
engine/client/keys.h
engine/client/menu.h
engine/client/merged.h
engine/client/modelgen.h
engine/client/quakedef.h
engine/client/render.h
engine/client/sbar.h
engine/client/screen.h
engine/client/sound.h
engine/client/spritegn.h
# engine/client/sys_plugfte.h
engine/client/vid.h
engine/client/view.h
engine/client/wad.h
# engine/client/winquake.h
engine/common/bothdefs.h
engine/common/bspfile.h
engine/common/cmd.h
engine/common/com_mesh.h
engine/common/common.h
engine/common/console.h
engine/common/cvar.h
engine/common/fs.h
engine/common/mathlib.h
engine/common/net.h
engine/common/netinc.h
engine/common/particles.h
engine/common/pmove.h
engine/common/pr_common.h
engine/common/protocol.h
engine/common/sys.h
engine/common/translate.h
engine/common/ui_public.h
engine/common/vm.h
engine/common/world.h
engine/common/zone.h
engine/gl/gl_draw.h
engine/gl/gl_model.h
engine/gl/glquake.h
engine/gl/glsupp.h
engine/gl/gl_terrain.h
engine/gl/gl_videgl.h
engine/gl/model_hl.h
engine/gl/shader.h
engine/http/iweb.h
engine/qclib/cmdlib.h
engine/qclib/execloop.h
engine/qclib/gui.h
engine/qclib/hash.h
engine/qclib/pr_comp.h
engine/qclib/progsint.h
engine/qclib/progslib.h
engine/qclib/progtype.h
engine/qclib/qcc.h
engine/qclib/qcd.h
engine/server/progdefs.h
engine/server/progs.h
engine/server/q2game.h
engine/server/server.h
#engine/server/svhl_gcapi.h
engine/server/sv_sql.h
#engine/sw/sw.h
#engine/sw/sw_spans.h
engine/vk/vkrenderer.h
engine/web/ftejslib.h
#sigh
engine/client/pr_skelobj.c
engine/client/m_download.c
engine/client/net_master.c
#these are here because of hitmodel etc
engine/gl/gl_heightmap.c
engine/gl/gl_hlmdl.c
engine/gl/gl_model.c
engine/server/sv_move.c
engine/server/sv_phys.c
engine/server/world.c
${FTE_QCVM_FILES}
engine/qclib/hash.c
engine/http/httpclient.c
)
SET(FTE_SERVER_FILES
engine/server/net_preparse.c
engine/server/pr_cmds.c
engine/server/pr_lua.c
engine/server/pr_q1qvm.c
engine/server/savegame.c
engine/server/sv_ccmds.c
engine/server/sv_chat.c
engine/server/sv_cluster.c
engine/server/sv_demo.c
engine/server/sv_ents.c
engine/server/sv_init.c
engine/server/sv_main.c
engine/server/sv_master.c
engine/server/sv_mvd.c
engine/server/sv_nchan.c
engine/server/sv_rankin.c
engine/server/sv_send.c
engine/server/sv_sql.c
engine/server/sv_user.c
# engine/server/svhl_game.c
# engine/server/svhl_phys.c
# engine/server/svhl_world.c
engine/server/svq2_ents.c
engine/server/svq2_game.c
)
#these files are only in the client
SET(FTE_CLIENT_FILES
engine/client/cl_cam.c
engine/client/cl_demo.c
engine/client/cl_ents.c
engine/client/cl_ignore.c
engine/client/cl_input.c
engine/client/cl_main.c
engine/client/cl_parse.c
engine/client/cl_pred.c
engine/client/cl_screen.c
engine/client/cl_tent.c
# engine/client/clhl_game.c
engine/client/clq2_cin.c
engine/client/clq2_ents.c
engine/client/console.c
engine/client/fragstats.c
engine/client/image.c
engine/client/in_generic.c
engine/client/keys.c
engine/client/m_items.c
engine/client/m_master.c
engine/client/m_mp3.c
engine/client/m_multi.c
engine/client/m_options.c
engine/client/m_script.c
engine/client/m_native.c
engine/client/m_single.c
engine/client/menu.c
engine/client/p_classic.c
engine/client/p_null.c
engine/client/p_script.c
engine/client/pr_clcmd.c
engine/client/pr_csqc.c
engine/client/pr_menu.c
engine/client/r_2d.c
engine/client/r_d3.c
engine/client/r_part.c
engine/client/r_partset.c
engine/client/r_surf.c
engine/client/renderer.c
engine/client/renderque.c
engine/client/roq_read.c
engine/client/sbar.c
engine/client/skin.c
engine/client/snd_dma.c
engine/client/snd_mem.c
engine/client/snd_mix.c
engine/client/snd_mp3.c
engine/client/snd_ov.c
engine/client/textedit.c
engine/client/valid.c
engine/client/view.c
engine/client/wad.c
engine/client/zqtp.c
#These are generic renderer files and no longer gl-specific (for the most part)
engine/gl/gl_alias.c
engine/gl/gl_font.c
engine/gl/gl_ngraph.c
engine/gl/gl_rlight.c
engine/gl/gl_shader.c
engine/gl/gl_shadow.c
engine/gl/gl_warp.c
engine/gl/ltface.c
#these are renderer-specific
engine/client/vid_headless.c
${FTE_GL_FILES}
${FTE_VK_FILES}
)
SET(FTE_Q3_FILES
plugins/quake3/botlib/be_aas_bspq3.c
plugins/quake3/botlib/be_aas_entity.c
plugins/quake3/botlib/be_aas_move.c
plugins/quake3/botlib/be_aas_routealt.c
plugins/quake3/botlib/be_ai_char.c
plugins/quake3/botlib/be_ai_goal.c
plugins/quake3/botlib/be_ai_weight.c
plugins/quake3/botlib/l_crc.c
plugins/quake3/botlib/l_memory.c
plugins/quake3/botlib/l_struct.c
plugins/quake3/botlib/be_aas_cluster.c
plugins/quake3/botlib/be_aas_file.c
plugins/quake3/botlib/be_aas_optimize.c
plugins/quake3/botlib/be_aas_route.c
plugins/quake3/botlib/be_ai_chat.c
plugins/quake3/botlib/be_ai_move.c
plugins/quake3/botlib/be_ea.c
plugins/quake3/botlib/l_libvar.c
plugins/quake3/botlib/l_precomp.c
plugins/quake3/botlib/be_aas_debug.c
plugins/quake3/botlib/be_aas_main.c
plugins/quake3/botlib/be_aas_reach.c
plugins/quake3/botlib/be_aas_sample.c
plugins/quake3/botlib/be_ai_gen.c
plugins/quake3/botlib/be_ai_weap.c
plugins/quake3/botlib/be_interface.c
plugins/quake3/botlib/l_log.c
plugins/quake3/botlib/l_script.c
plugins/quake3/botlib/standalone.c
plugins/quake3/clq3_cg.c
plugins/quake3/clq3_ui.c
plugins/quake3/clq3_parse.c
plugins/quake3/svq3_game.c
plugins/quake3/q3common.c
plugins/quake3/q3common.h
plugins/quake3/clq3defs.h
plugins/quake3/q3g_public.h
)
#For annoying compressed gltf2 files.
SET(FTE_DEP_DRACO false CACHE BOOL "Link against libdraco.")
IF(FTE_DEP_DRACO)
FIND_LIBRARY(
DRACO_LIBRARY
NAMES draco
)
IF(DRACO_LIBRARY)
SET(DRACO_FILES plugins/models/draco.cpp)
SET(DRACO_CFLAGS HAVE_DRACO)
SET(FTE_COMMON_FILES ${FTE_COMMON_FILES} ${DRACO_FILES})
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};${DRACO_CFLAGS})
SET(FTE_LIBS ${FTE_LIBS} ${DRACO_LIBRARY})
SET(FTESV_LIBS ${FTESV_LIBS} ${DRACO_LIBRARY})
ELSE()
MESSAGE(WARNING "draco library not found, needed for GLTF's KHR_draco_mesh_compression to be usable.")
ENDIF()
ENDIF()
SET(FTE_PLUG_QUAKE3 true CACHE BOOL "Compile Quake3 plugin.")
IF(FTE_PLUG_QUAKE3)
IF (0)
SET(FTE_DEFINES ${FTE_DEFINES};${Q3_DEFINES})
SET(FTE_LIBS ${FTE_LIBS} quake3)
#define the modules and make sure they're linked (one generic, one for server-only builds.
ADD_LIBRARY(quake3 STATIC ${FTE_Q3_FILES})
SET_TARGET_PROPERTIES(quake3 PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON};BOTLIB;BOTLIB_STATIC;FTEPLUGIN;STATIC_Q3")
TARGET_LINK_LIBRARIES(quake3 m)
#ADD_LIBRARY(q3sv STATIC EXCLUDE_FROM_ALL ${FTE_Q3_FILES})
#SET_TARGET_PROPERTIES(q3sv PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON};BOTLIB;BOTLIB_STATIC;SERVERONLY")
#SET_TARGET_PROPERTIES(q3sv PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
#TARGET_LINK_LIBRARIES(q3sv m)
#SET(FTESV_LIBS ${FTESV_LIBS} q3sv)
ELSE()
#define the modules and make sure they're linked (one generic, one for server-only builds.
ADD_LIBRARY(plug_quake3 MODULE ${FTE_Q3_FILES} plugins/plugin.c)
SET_TARGET_PROPERTIES(plug_quake3 PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_REVISON};BOTLIB;BOTLIB_STATIC;FTEPLUGIN")
TARGET_LINK_LIBRARIES(plug_quake3 m)
EMBED_PLUGIN_META(quake3 "Quake3 Compat" "Provides compatability with Quake3's gamecode.")
ENDIF()
ENDIF()
FILE(STRINGS "${FTE_BUILD_CONFIG}" BULLET_INTERNAL REGEX "^#define[\t ]+USE_INTERNAL_BULLET")
IF(BULLET_INTERNAL)
#Built-in bullet physics plugin...
FIND_PACKAGE(Bullet REQUIRED)
SET(FTE_COMMON_FILES ${FTE_COMMON_FILES} plugins/bullet/bulletplug.cpp)
INCLUDE_DIRECTORIES( ${BULLET_INCLUDE_DIRS} )
SET(FTE_LIBS ${FTE_LIBS} ${BULLET_LIBRARIES})
SET(FTESV_LIBS ${FTESV_LIBS} ${BULLET_LIBRARIES})
ELSE()
#Bullet Physics library plugin
SET(FTE_PLUG_BULLET true CACHE BOOL "Compile bullet rigid body physics plugin.")
IF(FTE_PLUG_BULLET)
FIND_PACKAGE(Bullet)
IF (BULLET_FOUND)
ADD_LIBRARY(plug_bullet MODULE
plugins/plugin.c
plugins/bullet/bulletplug.cpp
)
TARGET_INCLUDE_DIRECTORIES(plug_bullet PUBLIC ${BULLET_INCLUDE_DIRS})
SET_TARGET_PROPERTIES(plug_bullet PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
TARGET_LINK_LIBRARIES(plug_bullet ${SYS_LIBS} ${BULLET_LIBRARIES})
EMBED_PLUGIN_META(bullet "Bullet Physics Plugin" "Provides Rigid Body Physics.")
ELSE()
MESSAGE(WARNING "bullet library not detected, skipping plugin")
ENDIF()
ENDIF()
ENDIF()
#ODE Physics library plugin
SET(FTE_PLUG_ODE true CACHE STRING "Compile ODE rigid body physics plugin.")
SET_PROPERTY(CACHE FTE_PLUG_ODE PROPERTY STRINGS false true static)
IF(FTE_PLUG_ODE)
FIND_PATH(LIBODE_INCLUDE_DIR ode/ode.h)
IF (LIBODE_INCLUDE_DIR)
FIND_LIBRARY(LIBODE_LIBRARY ode)
ENDIF()
IF (LIBODE_LIBRARY)
IF (FTE_PLUG_ODE STREQUAL "static")
#SET (FTE_COMMON_FILES ${FTE_COMMON_FILES} engine/common/com_phys_ode.c)
SET(FTE_LIB_DEFINES "${FTE_LIB_DEFINES};USE_INTERNAL_ODE;ODE_STATIC")
SET(FTE_LIBS ${FTE_LIBS} ${LIBODE_LIBRARY})
SET(FTESV_LIBS ${FTESV_LIBS} ${LIBODE_LIBRARY})
SET(FTE_INCLUDES ${FTE_INCLUDES} ${ODE_INCLUDE_DIRS})
ELSE()
ADD_LIBRARY(plug_ode MODULE
plugins/plugin.c
engine/common/com_phys_ode.c
engine/common/mathlib.c
)
TARGET_INCLUDE_DIRECTORIES(plug_ode PUBLIC ${ODE_INCLUDE_DIRS})
SET_TARGET_PROPERTIES(plug_ode PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;ODE_STATIC")
TARGET_LINK_LIBRARIES(plug_ode ${SYS_LIBS} ${LIBODE_LIBRARY})
EMBED_PLUGIN_META(ode "ODE Physics" "Provides Rigid Body Physics behaviours.")
ENDIF()
ELSE()
MESSAGE(WARNING "ODE library not found, no ode plugin for you")
ENDIF()
ENDIF()
IF(ANDROID)
#android sucks. everything is a library. so we build the engine as a shared library and completely ignore dedicated servers+tools
SET(FTE_ENGINE_FTEDROID true CACHE BOOL "Compile ftedroid engine shared library.")
IF(FTE_ENGINE_FTEDROID)
ADD_LIBRARY(ftedroid MODULE
${FTE_ARCH_FILES}
${FTE_COMMON_FILES}
${FTE_CLIENT_FILES}
)
SET_TARGET_PROPERTIES(ftedroid PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_DEFINES};${FTE_REVISON}")
TARGET_INCLUDE_DIRECTORIES(ftedroid PUBLIC ${FTE_INCLUDES})
TARGET_LINK_LIBRARIES(ftedroid ${FTE_LIBS} )
SET(INSTALLTARGS ${INSTALLTARGS} ftedroid)
ENDIF()
ELSE()
#systems that actually have executables...
SET(FTE_ENGINE true CACHE BOOL "Compile fteqw engine binary.")
IF(FTE_ENGINE)
ADD_EXECUTABLE(fteqw WIN32
${FTE_ARCH_FILES}
${FTE_COMMON_FILES}
${FTE_CLIENT_FILES}
${FTE_SERVER_FILES}
)
SET_TARGET_PROPERTIES(fteqw PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES};${FTE_DEFINES};${FTE_REVISON}")
TARGET_INCLUDE_DIRECTORIES(fteqw PUBLIC ${FTE_INCLUDES})
TARGET_LINK_LIBRARIES(fteqw ${FTE_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} fteqw)
ADD_CUSTOM_TARGET(fteqw-i18n ALL
VERBATIM
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND xgettext --output=${CMAKE_CURRENT_BINARY_DIR}/fteqw.pot -k -kCon_TPrintf -kCon_SafeTPrintf -kNetchan_OutOfBandTPrintf:4 -kSV_OutOfBandTPrintf:4 -klangtext -kSV_TPrintToClient:3 -kSV_ClientTPrintf:3 -kSV_BroadcastTPrintf:2 -kCVARAFCD:6 -kCVARAFD:5 -kCVARFCD:5 -kCVARAD:4 -kCVARFD:4 -kCVARCD:4 -kCVARD:3 -kCmd_AddCommandD:3 -kCmd_AddCommandAD:4 -kMenu_Prompt:4:5:6 -kHost_EndGame ${FTE_ARCH_FILES} ${FTE_COMMON_FILES} ${FTE_CLIENT_FILES} ${FTE_SERVER_FILES}
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/fteqw.pot"
SOURCES
${FTE_ARCH_FILES} ${FTE_COMMON_FILES} ${FTE_CLIENT_FILES} ${FTE_SERVER_FILES}
)
ENDIF()
SET(FTE_ENGINE_SERVER_ONLY true CACHE BOOL "Compile fteqw-sv (server only) engine binary.")
IF(FTE_ENGINE_SERVER_ONLY)
ADD_EXECUTABLE(fteqw-sv
${FTESV_ARCH_FILES}
${FTE_COMMON_FILES}
${FTE_SERVER_FILES}
)