-
Notifications
You must be signed in to change notification settings - Fork 55
/
CMakeLists.txt
1625 lines (1562 loc) · 59.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.1 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(GetVersionFromGit)
get_version_from_git(GR_VERSION GR_VERSION_FULL)
project(
GR
VERSION ${GR_VERSION}
LANGUAGES C CXX
)
include(GNUInstallDirs)
include(CheckCXXCompilerFlag)
# Honor `C_VISIBILITY_PRESET hidden` and `CXX_VISIBILITY_PRESET hidden` in static libraries
cmake_policy(SET CMP0063 NEW)
check_cxx_compiler_flag("-Werror=implicit" ERROR_IMPLICIT_SUPPORTED)
if(ERROR_IMPLICIT_SUPPORTED)
set(COMPILER_OPTION_ERROR_IMPLICIT
"-Werror=implicit"
CACHE INTERNAL "Compiler flag for generating errors on implicit declarations"
)
else()
set(COMPILER_OPTION_ERROR_IMPLICIT
""
CACHE INTERNAL "Compiler flag for generating errors on implicit declarations"
)
endif()
if(UNIX)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"/usr/local/gr"
CACHE PATH "GR install prefix" FORCE
)
endif()
endif()
set(GR_DIRECTORY
"${CMAKE_INSTALL_PREFIX}"
CACHE STRING "Default value for GRDIR"
)
option(GR_BUILD_DEMOS "Build demos for GR" OFF)
option(GR_BUILD_GKSM "Build GKS metafile reader for GR" OFF)
option(GR_INSTALL "Create installation target for GR" ON)
option(GR_USE_BUNDLED_LIBRARIES "Use thirdparty libraries bundled with GR" OFF)
option(GR_MANUAL_MOC_AND_RCC "Manually run moc and rcc instead of relying on AUTOMOC and AUTORCC" OFF)
option(GR_FIND_QT5_BY_VARIABLES "Find Qt5 based on the variables Qt5_INCLUDE_DIR and Qt5_LIBRARY_DIR" OFF)
option(GR_PREFER_XCODEBUILD "Prefer xcodebuild to build macOS applications if available" ON)
if(GR_USE_BUNDLED_LIBRARIES)
list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/3rdparty/build/")
set(GR_THIRDPARTY_LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(GR_THIRDPARTY_LIBRARY_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(GR_THIRDPARTY_LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
set(GR_THIRDPARTY_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
if(GR_FIND_QT5_BY_VARIABLES)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/optional/qt5")
endif()
if(WIN32)
set(GR_PLUGIN_SUFFIX ".dll")
else()
set(GR_PLUGIN_SUFFIX ".so")
endif()
if(APPLE)
set(DEFAULT_SHARED_LIBRARY_SUFFIX ".dylib")
else()
set(DEFAULT_SHARED_LIBRARY_SUFFIX "${GR_PLUGIN_SUFFIX}")
endif()
set(GR_SHARED_LIBRARY_SUFFIX
"${DEFAULT_SHARED_LIBRARY_SUFFIX}"
CACHE STRING "File suffix for shared libraries"
)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG
TRUE
CACHE BOOL ""
)
# Find the following packages always in system locations even if `GR_USE_BUNDLED_LIBRARIES` is set, because they are not
# located in 3rdparty
find_package(X11)
find_package(Fontconfig)
find_package(OpenGL OPTIONAL_COMPONENTS OpenGL)
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0")
find_package(
Qt6
OPTIONAL_COMPONENTS
Widgets
Core
Network
Gui
PrintSupport
)
endif()
find_package(
Qt5
OPTIONAL_COMPONENTS
Widgets
Core
Network
Gui
PrintSupport
)
find_package(Qt4)
# Find the following packages only in 3rdparty, if `GR_USE_BUNDLED_LIBRARIES` is set
if(GR_USE_BUNDLED_LIBRARIES)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
endif()
find_package(Freetype)
if(TARGET freetype AND NOT TARGET Freetype::Freetype)
add_library(Freetype::Freetype ALIAS freetype)
endif()
find_package(Jpeg REQUIRED)
find_package(Libpng REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Qhull REQUIRED)
if(TARGET Qhull::qhullstatic_r AND NOT TARGET Qhull::qhull_r)
add_library(Qhull::qhull_r ALIAS Qhull::qhullstatic_r)
endif()
find_package(Tiff)
find_package(Ffmpeg 57.48.100)
find_package(glfw3)
if(TARGET glfw AND NOT TARGET Glfw::Glfw)
add_library(Glfw::Glfw ALIAS glfw)
endif()
find_package(ZeroMQ)
if(NOT TARGET ZeroMQ::ZeroMQ)
if(TARGET libzmq)
add_library(ZeroMQ::ZeroMQ ALIAS libzmq)
elseif(TARGET libzmq-static)
add_library(ZeroMQ::ZeroMQ ALIAS libzmq-static)
get_target_property(ZeroMQ_LIBRARY libzmq-static LOCATION)
endif()
endif()
find_package(Cairo)
find_package(Agg)
find_package(Gs)
find_package(XercesC)
if(APPLE)
set(INSTALL_RPATH "${GR_DIRECTORY}/lib/;@loader_path/.")
else()
set(INSTALL_RPATH "${GR_DIRECTORY}/lib/;$ORIGIN/.")
endif()
if(Qt4_FOUND
OR (Qt5Widgets_FOUND
AND Qt5Core_FOUND
AND Qt5Network_FOUND
)
OR (Qt6Widgets_FOUND
AND Qt6Core_FOUND
AND Qt6Network_FOUND
)
)
if(GR_MANUAL_MOC_AND_RCC)
if(NOT QT_MOC_EXECUTABLE)
find_program(QT_MOC_EXECUTABLE moc CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if(NOT QT_MOC_EXECUTABLE)
message(FATAL_ERROR "Could not find moc but GR_MANUAL_MOC_AND_RCC is set.")
endif()
if(NOT QT_RCC_EXECUTABLE)
find_program(QT_RCC_EXECUTABLE rcc CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if(NOT QT_RCC_EXECUTABLE)
message(FATAL_ERROR "Could not find rcc but GR_MANUAL_MOC_AND_RCC is set.")
endif()
endif()
endif()
if(Qt4_FOUND)
set(QT4_MOC_INCLUDE_FLAGS "")
foreach(DIR IN LISTS QT_INCLUDE_DIR)
set(QT4_MOC_INCLUDE_FLAGS ${QT4_MOC_INCLUDE_FLAGS} -I${DIR})
endforeach()
if(NOT DEFINED Qt4_LIBRARY_DIR)
get_filename_component(Qt4_LIBRARY_DIR "${QT_LIBRARY_DIR}/../.." ABSOLUTE)
endif()
endif()
if(Qt5Widgets_FOUND
AND Qt5Core_FOUND
AND Qt5Network_FOUND
)
set(QT5_MOC_INCLUDE_FLAGS "")
foreach(DIR IN LISTS Qt5Core_INCLUDE_DIRS Qt5Gui_INCLUDE_DIRS Qt5Widgets_INCLUDE_DIRS)
set(QT5_MOC_INCLUDE_FLAGS ${QT5_MOC_INCLUDE_FLAGS} -I${DIR})
endforeach()
if(NOT DEFINED Qt5_LIBRARY_DIR)
get_filename_component(Qt5_LIBRARY_DIR "${Qt5_DIR}/../.." ABSOLUTE)
endif()
endif()
if(Qt6Widgets_FOUND
AND Qt6Core_FOUND
AND Qt6Network_FOUND
)
set(QT6_MOC_INCLUDE_FLAGS "")
foreach(DIR IN LISTS Qt6Core_INCLUDE_DIRS Qt6Gui_INCLUDE_DIRS Qt6Widgets_INCLUDE_DIRS)
set(QT6_MOC_INCLUDE_FLAGS ${QT6_MOC_INCLUDE_FLAGS} -I${DIR})
endforeach()
if(NOT DEFINED Qt6_LIBRARY_DIR)
get_filename_component(Qt6_LIBRARY_DIR "${Qt6_DIR}/../.." ABSOLUTE)
endif()
endif()
if(X11_FOUND)
# older versions of FindX11.cmake set variables but do not create targets
if(NOT TARGET X11::X11
AND X11_INCLUDE_DIR
AND X11_X11_LIB
AND X11_Xft_LIB
)
add_library(X11::X11 UNKNOWN IMPORTED)
set_target_properties(
X11::X11
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${X11_INCLUDE_DIR}/"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${X11_X11_LIB}"
INTERFACE_LINK_LIBRARIES "${X11_Xft_LIB}"
)
endif()
if(NOT TARGET X11::Xt
AND X11_INCLUDE_DIR
AND X11_Xt_LIB
AND TARGET X11::X11
)
add_library(X11::Xt UNKNOWN IMPORTED)
set_target_properties(
X11::Xt
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${X11_INCLUDE_DIR}/"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${X11_Xt_LIB}"
INTERFACE_LINK_LIBRARIES "X11::X11"
)
endif()
endif()
set(GKS_SOURCES
lib/gks/afm.c
lib/gks/font.c
lib/gks/socket.c
lib/gks/ft.c
lib/gks/malloc.c
lib/gks/util.c
lib/gks/compress.c
lib/gks/gks.c
lib/gks/mf.c
lib/gks/win.c
lib/gks/gksforbnd.c
lib/gks/pdf.c
lib/gks/wiss.c
lib/gks/dl.c
lib/gks/plugin.c
lib/gks/error.c
lib/gks/io.c
lib/gks/ps.c
lib/gks/resample.c
)
add_library(gks_static STATIC ${GKS_SOURCES})
add_library(gks_shared SHARED ${GKS_SOURCES})
foreach(LIBRARY gks_static gks_shared)
if(LIBRARY MATCHES "static")
set(GKS_LINK_MODE PUBLIC)
else()
set(GKS_LINK_MODE PRIVATE)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(${LIBRARY} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} pthread)
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} m)
endif()
if(FREETYPE_FOUND)
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} Freetype::Freetype)
else()
target_compile_definitions(
${LIBRARY}
${GKS_LINK_MODE}
NO_FT
)
endif()
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} ZLIB::ZLIB)
target_compile_definitions(
${LIBRARY}
${GKS_LINK_MODE}
HAVE_ZLIB
)
if(UNIX)
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} dl)
elseif(WIN32)
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} ws2_32)
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} msimg32)
target_link_libraries(${LIBRARY} ${GKS_LINK_MODE} gdi32)
endif()
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
target_compile_options(${LIBRARY} ${GKS_LINK_MODE} -pthread)
endif()
target_compile_options(${LIBRARY} PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
target_include_directories(
${LIBRARY} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_definitions(${LIBRARY} PRIVATE GRDIR="${GR_DIRECTORY}")
set_target_properties(
${LIBRARY}
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
PREFIX "lib"
IMPORT_PREFIX "lib"
OUTPUT_NAME GKS
INSTALL_RPATH "${INSTALL_RPATH}"
)
endforeach()
unset(GKS_LINK_MODE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set_target_properties(gks_static PROPERTIES OUTPUT_NAME GKSstatic)
endif()
set_target_properties(gks_shared PROPERTIES SUFFIX "${GR_SHARED_LIBRARY_SUFFIX}" EXPORT_NAME GKS)
add_library(GR::GKS ALIAS gks_static)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gr_version.h
"#ifndef GR_VERSION\n#define GR_VERSION \"${GR_VERSION_FULL}\"\n#endif\n"
)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/gr_version.h PROPERTIES GENERATED TRUE)
set(GR_SOURCES
lib/gr/boundary.c
lib/gr/contour.c
lib/gr/contourf.c
lib/gr/delaunay.c
lib/gr/gr.c
lib/gr/grforbnd.c
lib/gr/gridit.c
lib/gr/image.c
lib/gr/import.c
lib/gr/interp2.c
lib/gr/stream.c
lib/gr/md5.c
lib/gr/shade.c
lib/gr/spline.c
lib/gr/strlib.c
lib/gr/text.c
lib/gr/mathtex2.c
lib/gr/mathtex2_kerning.c
lib/gr/mathtex2.tab.c
lib/gr/threadpool.c
${CMAKE_CURRENT_BINARY_DIR}/gr_version.h
)
add_library(gr_static STATIC ${GR_SOURCES})
add_library(gr_shared SHARED ${GR_SOURCES})
foreach(LIBRARY gr_static gr_shared)
if(LIBRARY MATCHES "static")
set(GR_LINK_MODE PUBLIC)
else()
set(GR_LINK_MODE PRIVATE)
endif()
target_link_libraries(${LIBRARY} ${GR_LINK_MODE} gks_static)
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
target_link_libraries(${LIBRARY} ${GR_LINK_MODE} m)
endif()
target_link_libraries(${LIBRARY} ${GR_LINK_MODE} Qhull::qhull_r)
target_link_libraries(${LIBRARY} ${GR_LINK_MODE} Jpeg::Jpeg)
target_link_libraries(${LIBRARY} ${GR_LINK_MODE} Libpng::Libpng)
if(WIN32)
target_link_libraries(${LIBRARY} ${GR_LINK_MODE} ws2_32)
endif()
target_include_directories(
${LIBRARY} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(${LIBRARY} PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(${LIBRARY} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
target_compile_definitions(${LIBRARY} PRIVATE GRDIR="${GR_DIRECTORY}")
target_compile_options(${LIBRARY} PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
${LIBRARY}
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "${INSTALL_RPATH}"
PREFIX "lib"
IMPORT_PREFIX "lib"
OUTPUT_NAME GR
)
endforeach()
unset(GR_LINK_MODE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set_target_properties(gr_static PROPERTIES OUTPUT_NAME GRstatic)
endif()
set_target_properties(gr_shared PROPERTIES SUFFIX "${GR_SHARED_LIBRARY_SUFFIX}" EXPORT_NAME GR)
add_library(GR::GR ALIAS gr_shared)
set(GR3_SOURCES
lib/gr3/gr3.c
lib/gr3/gr3_convenience.c
lib/gr3/gr3_gr.c
lib/gr3/gr3_html.c
lib/gr3/gr3_jpeg.c
lib/gr3/gr3_mc.c
lib/gr3/gr3_png.c
lib/gr3/gr3_povray.c
lib/gr3/gr3_slices.c
lib/gr3/gr3_sr.c
)
add_library(gr3_static STATIC ${GR3_SOURCES})
add_library(gr3_shared SHARED ${GR3_SOURCES})
foreach(LIBRARY gr3_static gr3_shared)
if(LIBRARY MATCHES "static")
set(GR3_LINK_MODE PUBLIC)
else()
set(GR3_LINK_MODE PRIVATE)
endif()
if(APPLE)
target_sources(${LIBRARY} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/gr3/gr3_cgl.c)
elseif(UNIX AND NOT APPLE)
target_sources(${LIBRARY} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/gr3/gr3_glx.c)
elseif(WIN32)
target_sources(${LIBRARY} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/gr3/gr3_win.c)
endif()
target_link_libraries(${LIBRARY} ${GR3_LINK_MODE} GR::GR)
target_link_libraries(${LIBRARY} ${GR3_LINK_MODE} GR::GKS)
target_link_libraries(${LIBRARY} ${GR3_LINK_MODE} Jpeg::Jpeg)
target_link_libraries(${LIBRARY} ${GR3_LINK_MODE} Libpng::Libpng)
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
target_link_libraries(${LIBRARY} ${GR3_LINK_MODE} pthread)
target_link_libraries(${LIBRARY} ${GR3_LINK_MODE} m)
endif()
if((APPLE OR WIN32) AND OpenGL_FOUND)
target_link_libraries(${LIBRARY} ${GR3_LINK_MODE} OpenGL::GL)
endif()
if(APPLE)
# Apple has deprecated OpenGL in macOS 10.14
target_compile_definitions(${LIBRARY} PRIVATE GL_SILENCE_DEPRECATION)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(${LIBRARY} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
target_compile_definitions(${LIBRARY} PRIVATE GRDIR="${GR_DIRECTORY}")
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
target_compile_options(${LIBRARY} ${GR3_LINK_MODE} -pthread)
endif()
target_compile_options(${LIBRARY} PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
target_include_directories(
${LIBRARY} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/gr3/>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties(
${LIBRARY}
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "${INSTALL_RPATH}"
PREFIX "lib"
IMPORT_PREFIX "lib"
OUTPUT_NAME GR3
)
endforeach()
unset(GR3_LINK_MODE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set_target_properties(gr3_static PROPERTIES OUTPUT_NAME GR3static)
endif()
set_target_properties(gr3_shared PROPERTIES SUFFIX "${GR_SHARED_LIBRARY_SUFFIX}" EXPORT_NAME GR3)
add_library(GR::GR3 ALIAS gr3_shared)
if(UNIX AND NOT APPLE)
if(TARGET X11::X11
AND TARGET OpenGL::GLX
AND TARGET OpenGL::GL
)
add_library(gr3platform SHARED lib/gr3/gr3_platform_glx.c)
target_link_libraries(gr3platform PUBLIC GR::GR)
target_link_libraries(gr3platform PUBLIC X11::X11)
target_link_libraries(gr3platform PUBLIC OpenGL::GLX)
target_link_libraries(gr3platform PUBLIC OpenGL::GL)
target_compile_options(gr3platform PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
gr3platform
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "${INSTALL_RPATH}"
OUTPUT_NAME GR3platform
)
else()
target_compile_definitions(gr3_static PUBLIC -DNO_GL)
target_compile_definitions(gr3_shared PUBLIC -DNO_GL)
message(WARNING "libGR3platform.so requires X11 and will not be built.")
endif()
elseif(NOT OpenGL_FOUND)
target_compile_definitions(gr3_static PUBLIC -DNO_GL)
target_compile_definitions(gr3_shared PUBLIC -DNO_GL)
endif()
set(GRM_SOURCES
lib/grm/src/grm/args.c
lib/grm/src/grm/backtrace.c
lib/grm/src/grm/base64.c
lib/grm/src/grm/bson.c
lib/grm/src/grm/dump.c
lib/grm/src/grm/dynamic_args_array.c
lib/grm/src/grm/error.c
lib/grm/src/grm/event.c
lib/grm/src/grm/interaction.cxx
lib/grm/src/grm/json.c
lib/grm/src/grm/layout_c.cxx
lib/grm/src/grm/layout.cxx
lib/grm/src/grm/layout_error.cxx
lib/grm/src/grm/logging.c
lib/grm/src/grm/memwriter.c
lib/grm/src/grm/net.c
lib/grm/src/grm/plot.cxx
lib/grm/src/grm/util.c
lib/grm/src/grm/import.cxx
lib/grm/src/grm/utilcpp.cxx
lib/grm/src/grm/datatype/double_map.c
lib/grm/src/grm/datatype/size_t_list.c
lib/grm/src/grm/datatype/string_array_map.c
lib/grm/src/grm/datatype/string_list.c
lib/grm/src/grm/datatype/string_map.c
lib/grm/src/grm/datatype/uint_map.c
lib/grm/src/grm/dom_render/context.cxx
lib/grm/src/grm/dom_render/render.cxx
lib/grm/src/grm/dom_render/Drawable.cxx
lib/grm/src/grm/dom_render/graphics_tree/Comment.cxx
lib/grm/src/grm/dom_render/graphics_tree/Document.cxx
lib/grm/src/grm/dom_render/graphics_tree/Element.cxx
lib/grm/src/grm/dom_render/graphics_tree/Node.cxx
lib/grm/src/grm/dom_render/graphics_tree/Value.cxx
lib/grm/src/grm/dom_render/graphics_tree/util.cxx
lib/grm/src/grm/dom_render/ManageCustomColorIndex.cxx
lib/grm/src/grm/dom_render/ManageGRContextIds.cxx
lib/grm/src/grm/dom_render/ManageZIndex.cxx
)
add_library(grm_static STATIC ${GRM_SOURCES})
add_library(grm_shared SHARED ${GRM_SOURCES})
add_library(grm_shared_internal SHARED ${GRM_SOURCES})
foreach(LIBRARY grm_static grm_shared grm_shared_internal)
if(LIBRARY MATCHES "static")
set(GRM_LINK_MODE PUBLIC)
else()
set(GRM_LINK_MODE PRIVATE)
endif()
if(NOT LIBRARY MATCHES "internal")
set_target_properties(${LIBRARY} PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden)
endif()
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} GR::GKS)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} GR::GR)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} GR::GR3)
if(TARGET XercesC::XercesC)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} XercesC::XercesC)
else()
target_compile_definitions(${LIBRARY} PRIVATE NO_XERCES_C)
endif()
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} m)
endif()
if(WIN32)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} ws2_32)
endif()
target_include_directories(
${LIBRARY}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/include/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/src/> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_definitions(${LIBRARY} PRIVATE BUILDING_GR)
target_compile_definitions(${LIBRARY} PRIVATE GRDIR="${GR_DIRECTORY}")
target_compile_options(${LIBRARY} PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(${LIBRARY} PRIVATE /permissive-)
endif()
set_target_properties(
${LIBRARY}
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
CXX_STANDARD 17
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "${INSTALL_RPATH}"
PREFIX "lib"
IMPORT_PREFIX "lib"
OUTPUT_NAME GRM
)
endforeach()
unset(GRM_LINK_MODE)
set_target_properties(grm_shared_internal PROPERTIES C_VISIBILITY_PRESET default)
set_target_properties(grm_shared_internal PROPERTIES OUTPUT_NAME GRM_int)
target_include_directories(grm_shared_internal PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/gks/>)
if(WIN32)
target_compile_definitions(grm_static PRIVATE GR_STATIC_LIB)
target_compile_definitions(grm_shared PRIVATE BUILDING_DLL)
target_compile_definitions(grm_shared_internal PRIVATE BUILDING_DLL)
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set_target_properties(grm_static PROPERTIES OUTPUT_NAME GRMstatic)
endif()
set_target_properties(grm_shared PROPERTIES SUFFIX "${GR_SHARED_LIBRARY_SUFFIX}" EXPORT_NAME GRM)
set_target_properties(grm_shared_internal PROPERTIES SUFFIX "${GR_SHARED_LIBRARY_SUFFIX}")
add_library(GR::GRM ALIAS grm_shared)
set(GR_REPORT "GKS plugins:\n")
add_library(cairoplugin SHARED lib/gks/plugin/cairoplugin.c)
target_link_libraries(cairoplugin PUBLIC gks_static)
if(Cairo_FOUND)
target_link_libraries(cairoplugin PRIVATE Cairo::Cairo)
target_link_libraries(cairoplugin PRIVATE Jpeg::Jpeg)
string(APPEND GR_REPORT "- cairoplugin:\n")
string(APPEND GR_REPORT "\tPNG output: Yes\n")
string(APPEND GR_REPORT "\tBMP output: Yes\n")
string(APPEND GR_REPORT "\tJPEG output: Yes\n")
if(Tiff_FOUND)
target_link_libraries(cairoplugin PRIVATE Tiff::Tiff)
string(APPEND GR_REPORT "\tTiff output: Yes\n")
else()
string(APPEND GR_REPORT "\tTiff output: No (libtiff not found)\n")
target_compile_definitions(cairoplugin PRIVATE NO_TIFF)
endif()
target_compile_options(cairoplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
string(APPEND GR_REPORT "\tSixel output: Yes\n")
string(APPEND GR_REPORT "\tMemory output: Yes\n")
string(APPEND GR_REPORT "\tX11 output: No (not available in CMake build)\n")
else()
target_compile_definitions(cairoplugin PRIVATE NO_CAIRO)
string(APPEND GR_REPORT "- cairoplugin: No (Cairo not found)\n")
endif()
# Cairo X11 support is disabled to allow users to generate images using Cairo on systems without X11 installed
target_compile_definitions(cairoplugin PRIVATE NO_X11)
set_target_properties(
cairoplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(aggplugin SHARED lib/gks/plugin/aggplugin.cxx)
target_link_libraries(aggplugin PUBLIC gks_static)
if(Agg_FOUND)
target_link_libraries(aggplugin PRIVATE Agg::Agg)
target_link_libraries(aggplugin PRIVATE Jpeg::Jpeg)
target_link_libraries(aggplugin PRIVATE Libpng::Libpng)
string(APPEND GR_REPORT "- aggplugin: Yes\n")
target_compile_options(aggplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
else()
target_compile_definitions(aggplugin PRIVATE NO_AGG)
string(APPEND GR_REPORT "- aggplugin: No (Agg not found)\n")
endif()
set_target_properties(
aggplugin
PROPERTIES CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(videoplugin SHARED lib/gks/plugin/gif.c lib/gks/plugin/vc.c lib/gks/plugin/videoplugin.c)
target_link_libraries(videoplugin PUBLIC gks_static)
if(NOT Cairo_FOUND)
target_compile_definitions(videoplugin PRIVATE NO_CAIRO)
target_compile_definitions(videoplugin PRIVATE NO_AV)
string(APPEND GR_REPORT "- videoplugin: No (Cairo not found)\n")
elseif(NOT Ffmpeg_FOUND)
target_compile_definitions(videoplugin PRIVATE NO_CAIRO)
target_compile_definitions(videoplugin PRIVATE NO_AV)
string(APPEND GR_REPORT "- videoplugin: No (ffmpeg / ogg / theora / vpx / openh264 not found)\n")
else()
string(APPEND GR_REPORT "- videoplugin:\n")
string(APPEND GR_REPORT "\tMP4 output: Yes\n")
string(APPEND GR_REPORT "\tMOV output: Yes\n")
string(APPEND GR_REPORT "\tWEBM output: Yes\n")
string(APPEND GR_REPORT "\tOGG output: Yes\n")
string(APPEND GR_REPORT "\tGIF output: Yes\n")
string(APPEND GR_REPORT "\tAPNG output: Yes\n")
target_link_libraries(videoplugin PUBLIC Ffmpeg::Ffmpeg)
endif()
target_compile_options(videoplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
videoplugin
PROPERTIES C_STANDARD 99
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
LINKER_LANGUAGE CXX
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(pgfplugin SHARED lib/gks/plugin/pgfplugin.c)
target_link_libraries(pgfplugin PUBLIC gks_static)
target_link_libraries(pgfplugin PUBLIC Libpng::Libpng)
target_compile_options(pgfplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
pgfplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
string(APPEND GR_REPORT "- pgfplugin:\n")
string(APPEND GR_REPORT "\tTeX output: Yes\n")
add_library(wmfplugin SHARED lib/gks/plugin/wmfplugin.c)
target_link_libraries(wmfplugin PUBLIC gks_static)
target_compile_options(wmfplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
wmfplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
string(APPEND GR_REPORT "- wmfplugin:\n")
string(APPEND GR_REPORT "\tWMF output: Yes\n")
add_library(gsplugin SHARED lib/gks/plugin/gsplugin.c)
target_link_libraries(gsplugin PUBLIC gks_static)
if(NOT TARGET X11::Xt)
string(APPEND GR_REPORT "- gsplugin: No (X11 / Xt not found)\n")
target_compile_definitions(gsplugin PRIVATE NO_GS)
elseif(NOT Gs_FOUND)
string(APPEND GR_REPORT "- gsplugin: No (ghostscript not found)\n")
target_compile_definitions(gsplugin PRIVATE NO_GS)
else()
target_link_libraries(gsplugin PUBLIC X11::Xt)
target_link_libraries(gsplugin PUBLIC Gs::Gs)
string(APPEND GR_REPORT "- gsplugin:\n")
string(APPEND GR_REPORT "\tPNG outout: Yes\n")
string(APPEND GR_REPORT "\tBMP outout: Yes\n")
string(APPEND GR_REPORT "\tJPEG outout: Yes\n")
string(APPEND GR_REPORT "\tTiff outout: Yes\n")
endif()
target_compile_options(gsplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
gsplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(svgplugin SHARED lib/gks/plugin/svgplugin.c)
target_link_libraries(svgplugin PUBLIC gks_static)
target_link_libraries(svgplugin PUBLIC Libpng::Libpng)
target_compile_options(svgplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
svgplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
string(APPEND GR_REPORT "- svgplugin:\n")
string(APPEND GR_REPORT "\tSVG output: Yes\n")
add_library(glplugin SHARED lib/gks/plugin/glplugin.c)
target_link_libraries(glplugin PUBLIC gks_static)
if(TARGET Glfw::Glfw AND OpenGL_FOUND)
string(APPEND GR_REPORT "- glplugin: Yes\n")
target_link_libraries(glplugin PUBLIC Glfw::Glfw)
target_link_libraries(glplugin PUBLIC OpenGL::GL)
else()
string(APPEND GR_REPORT "- glplugin: No (GLFW / OpenGL not found)\n")
target_compile_definitions(glplugin PRIVATE NO_GLFW)
endif()
if(NOT Freetype_FOUND)
target_compile_definitions(glplugin PRIVATE NO_FT)
endif()
if(APPLE)
# Apple has deprecated OpenGL in macOS 10.14
target_compile_definitions(glplugin PRIVATE GL_SILENCE_DEPRECATION)
endif()
target_compile_options(glplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
glplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(zmqplugin SHARED lib/gks/plugin/zmqplugin.c)
target_link_libraries(zmqplugin PUBLIC gks_static)
if(ZeroMQ_FOUND)
string(APPEND GR_REPORT "- zmqplugin: Yes\n")
target_link_libraries(zmqplugin PUBLIC ZeroMQ::ZeroMQ)
else()
string(APPEND GR_REPORT "- zmqplugin: No (ZeroMQ not found)\n")
target_compile_definitions(zmqplugin PRIVATE NO_ZMQ)
endif()
target_compile_options(zmqplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
zmqplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(x11plugin SHARED lib/gks/plugin/x11plugin.c)
target_link_libraries(x11plugin PUBLIC gks_static)
if(NOT Freetype_FOUND)
target_compile_definitions(x11plugin PRIVATE NO_FT)
endif()
if(TARGET X11::Xt)
if(Xft_FOUND AND Fontconfig_FOUND)
target_link_libraries(x11plugin PUBLIC Fontconfig::Fontconfig)
else()
target_compile_definitions(x11plugin PRIVATE NO_XFT)
endif()
target_link_libraries(x11plugin PUBLIC X11::Xt)
string(APPEND GR_REPORT "- x11plugin: Yes\n")
else()
target_compile_definitions(x11plugin PRIVATE NO_X11)
target_compile_definitions(x11plugin PRIVATE NO_XFT)
string(APPEND GR_REPORT "- x11plugin: No (X11 / Xft / Xt not found)\n")
endif()
target_compile_options(x11plugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
x11plugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(qt5plugin SHARED lib/gks/plugin/qt5plugin.cxx)
target_link_libraries(qt5plugin PUBLIC gks_static)
if(Qt5Widgets_FOUND)
string(APPEND GR_REPORT "- qt5plugin: Yes\n")
target_link_libraries(qt5plugin PUBLIC Qt5::Widgets)
else()
string(APPEND GR_REPORT "- qt5plugin: No (Qt5 not found)\n")
target_compile_definitions(qt5plugin PRIVATE NO_QT5)
endif()
target_compile_options(qt5plugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
qt5plugin
PROPERTIES CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(qt6plugin SHARED lib/gks/plugin/qt6plugin.cxx)
target_link_libraries(qt6plugin PUBLIC gks_static)
if(Qt6Widgets_FOUND AND ${CMAKE_VERSION} VERSION_GREATER "3.16.0")
string(APPEND GR_REPORT "- qt6plugin: Yes\n")
target_link_libraries(qt6plugin PUBLIC Qt6::Widgets)
set_target_properties(
qt6plugin
PROPERTIES CXX_STANDARD 17
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
else()
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
string(APPEND GR_REPORT "- qt6plugin: No (CMake version < 3.16.0)\n")
else()
string(APPEND GR_REPORT "- qt6plugin: No (Qt6 not found)\n")
endif()
set_target_properties(
qt6plugin
PROPERTIES CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
target_compile_definitions(qt6plugin PRIVATE NO_QT6)
endif()
target_compile_options(qt6plugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
add_library(qtplugin SHARED lib/gks/plugin/qtplugin.cxx)
target_link_libraries(qtplugin PUBLIC gks_static)
if(Qt4_FOUND)
string(APPEND GR_REPORT "- qtplugin: Yes\n")
target_link_libraries(qtplugin PUBLIC Qt4::QtGui)
else()
string(APPEND GR_REPORT "- qtplugin: No (Qt4 not found)\n")
target_compile_definitions(qtplugin PRIVATE NO_QT)
endif()
target_compile_options(qtplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
qtplugin
PROPERTIES CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
add_library(gtkplugin SHARED lib/gks/plugin/gtkplugin.c)
target_link_libraries(gtkplugin PUBLIC gks_static)
set_target_properties(
gtkplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
target_compile_options(gtkplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
string(APPEND GR_REPORT "- gtkplugin: No (not implemented yet)\n")
if(APPLE)
add_library(quartzplugin SHARED lib/gks/plugin/quartzplugin.m)
target_link_libraries(quartzplugin PUBLIC gks_static)
if(ZeroMQ_FOUND)
target_link_libraries(quartzplugin PUBLIC ZeroMQ::ZeroMQ)
target_link_libraries(quartzplugin PUBLIC "-framework Foundation -framework ApplicationServices -framework AppKit")
target_compile_definitions(quartzplugin PRIVATE GRDIR="${GR_DIRECTORY}")
else()
target_compile_definitions(quartzplugin PRIVATE NO_GKSTERM)
endif()
target_compile_options(quartzplugin PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(
quartzplugin
PROPERTIES C_STANDARD 90
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
PREFIX ""
SUFFIX "${GR_PLUGIN_SUFFIX}"
)
endif()
if(Qt4_FOUND)
add_library(qt4gr SHARED lib/gr/qtgr/grwidget.cxx)
target_link_libraries(qt4gr PUBLIC GR::GR)
target_link_libraries(qt4gr PUBLIC Qt4::QtCore Qt4::QtGui)
if(MINGW AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
target_compile_options(qt4gr PRIVATE -fno-exceptions)
endif()
target_compile_options(qt4gr PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
set_target_properties(qt4gr PROPERTIES SUFFIX "${GR_SHARED_LIBRARY_SUFFIX}" INSTALL_RPATH "${INSTALL_RPATH}")
if(GR_MANUAL_MOC_AND_RCC)
set_target_properties(qt4gr PROPERTIES AUTOMOC OFF AUTORCC OFF)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_qt4_grwidget.cxx
COMMAND ${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${QT4_MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_qt4_grwidget.cxx
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.cxx
)
target_sources(qt4gr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/moc_qt4_grwidget.cxx)
else()
set_target_properties(qt4gr PROPERTIES AUTOMOC ON AUTORCC ON)
target_sources(qt4gr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/gr/qtgr/grwidget.h)
endif()
add_library(GR::qt4gr ALIAS qt4gr)
endif()
if(Qt5Widgets_FOUND AND Qt5Core_FOUND)
add_library(qt5gr SHARED lib/gr/qtgr/grwidget.cxx)
target_link_libraries(qt5gr PUBLIC GR::GR)
target_link_libraries(qt5gr PUBLIC Qt5::Core Qt5::Widgets)
if(MINGW AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
target_compile_options(qt5gr PRIVATE -fno-exceptions)
endif()
target_compile_options(qt5gr PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})