forked from OpenCPN/OpenCPN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
2756 lines (2415 loc) · 105 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
#---------------------------------------------------------------------------
## Author: Dave Register
## DEB config from: antonm - Anton Martchukov <[email protected]>
## Update: sethdart (Jean-Eudes Onfray)
## with parts from balp (Anders Arnholm)
##***************************************************************************
## * Copyright (C) 2010 by David S. Register *
## * This program is free software; you can redistribute it and/or modify *
## * it under the terms of the GNU General Public License as published by *
## * the Free Software Foundation; either version 2 of the License, or *
## * (at your option) any later version. *
## * *
## * This program is distributed in the hope that it will be useful, *
## * but WITHOUT ANY WARRANTY; without even the implied warranty of *
## * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
## * GNU General Public License for more details. *
## * *
## * You should have received a copy of the GNU General Public License *
## * along with this program; if not, write to the *
## * Free Software Foundation, Inc., *
## * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
## ***************************************************************************
#
# Configuring opencpn
# ===================
#
# Sound:
# - Without options, defaults to using SYSTEM_CMD_SOUND using platform
# dependent command line tools such as aplay, afplay or mediaplayer.
# - With ENABLE_SYSTEM_CMD_SOUND disabled falls back to wxSound backend.
# This is known to be broken on at least Linux, and only supports .wav
# files on all platforms.
# - ENABLE_PORTAUDIO builds using [lib]portaudio if available.
# - ENABLE_SYSTEM_CMD_SOUND builds using platform dependent command line
# tools such as aplay, afplay or mediaplayer.
# - ENABLE_SNDFILE adds libsndfile support to portaudio. libsndfile
# supports a wide range of audio formats instead of .wav only.
#
# Bundled libraries:
# - USE_BUNDLED_LIBS forces use of external/bundled libraries including
# wxsvg and liblz4.
# - If found, the system tinyxml library is used unconditionally.
# Documentation:
# - BUNDLE_DOCS governs inclusion of docs in the package.
# - Note that documentation is available in a separate download from
# opencpn website.
#
# Tidal/current and GSHHS wallpaper
# - BUNDLE_TCDATA (boolean) includes tide/current harmonics data in package
# - BUNDLE_GSHHS (NONE,MIN,[CRUDE],LOW,INTERMEDIATE,HIGH,FULL) governs the
# wallpaper map used as last resort and world overview.
#TODO:
# - cross platform compiling
# - test with Win & OSX
# USE_GLU_TESS
# USE_GLU_DLL
# I also find it deficient in some areas. For instance, I cannot make it output a VS project with certain compile switches set as desired, namely /MT vs /MD. This means I must manually set this and other compiler options after the CMake step. Sometimes I forget. Grrr...
# set /MT for Release build, and /MTd for debug.
# define minimum cmake version
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.1)
IF (COMMAND cmake_policy)
if (POLICY CMP0043)
CMAKE_POLICY(SET CMP0043 NEW)
endif (POLICY CMP0043)
if (POLICY CMP0025)
CMAKE_POLICY(SET CMP0025 NEW)
endif ()
ENDIF (COMMAND cmake_policy)
PROJECT(OpenCPN)
SET(CMAKE_VERBOSE_MAKEFILE ON)
message(STATUS "cmake version: ${CMAKE_VERSION}")
IF(APPLE)
SET(PACKAGE_NAME OpenCPN)
ELSE(APPLE)
SET(PACKAGE_NAME opencpn)
ENDIF(APPLE)
IF(NOT MSVC)
SET(OBJ_VISIBILITY "-fvisibility=hidden" )
ENDIF()
# Locations where cmake looks for cmake modules.
SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/build
${CMAKE_SOURCE_DIR}/
${CMAKE_SOURCE_DIR}/cmake
)
set (CMAKE_CXX_STANDARD 11)
message(STATUS "Setting C++11 standard via cmake standard mechanism")
OPTION(OCPN_USE_LIBCPP "Use C++11 and libc++ instead of libstdc++ on macOS" ON)
if ( CMAKE_VERSION VERSION_GREATER 3.4 )
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Add clang-tidy automatically to builds")
if (ENABLE_CLANG_TIDY)
find_program (CLANG_TIDY_EXE NAMES "clang-tidy" PATHS /usr/local/opt/llvm/bin )
if (CLANG_TIDY_EXE)
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
#For more, see http://clang.llvm.org/extra/clang-tidy/
#set(CLANG_TIDY_CHECKS "-*,modernize-*")
set(CLANG_TIDY_CHECKS "-*,performance-*")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-checks=${CLANG_TIDY_CHECKS};-header-filter='${CMAKE_SOURCE_DIR}/*'"
CACHE STRING "" FORCE)
else()
message(AUTHOR_WARNING "clang-tidy not found!")
set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE) # delete it
endif()
endif()
endif()
# Add support for address etc sanitizers, part 1/2 (other half after ADD_EXECUTABLE)
if ( CMAKE_VERSION VERSION_GREATER 3.4 )
set(ENABLE_SANITIZER "none" CACHE STRING "Add clang sanitizer to the build")
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS none address memory thread undefined)
if (NOT "${ENABLE_SANITIZER}" MATCHES "none")
add_compile_options(-fsanitize=${ENABLE_SANITIZER})
endif()
endif()
if ( CMAKE_VERSION VERSION_GREATER 3.9 )
set(ENABLE_CPPCHECK OFF CACHE BOOL "Add cppcheck automatically to builds")
if (ENABLE_CPPCHECK)
find_program (CPPCHECK_EXECUTABLE NAMES "cppcheck" )
set(CMAKE_CXX_CPPCHECK ${CPPCHECK_EXECUTABLE})
endif()
endif()
INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
IF(OCPN_CI_BUILD)
INCLUDE(Utils)
TODAY(DATE)
COMMIT_ID(COMMIT)
SET(VERSION_TAIL "+${COMMIT}")
SET(VERSION_DATE "${DATE}")
ENDIF(OCPN_CI_BUILD)
SET(PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_TAIL}" )
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/version.h")
MESSAGE(FATAL_ERROR "There exists a relic 'include/version.h' in the source tree! Remove it.")
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/version.h")
#Red Hat: /etc/redhat-release
#Slackware: /etc/slackware-version
#Slamd64: /etc/slamd64-version
#Gentoo: /etc/gentoo-release
#Ubuntu: /etc/debian_version
# Based on code from nohal
IF (NOT WIN32)
# default
SET (ARCH "i386")
SET (LIB_INSTALL_DIR "lib")
IF (EXISTS /etc/debian_version)
SET (PACKAGE_FORMAT "DEB")
#SET (PACKAGE_DEPS "libc6, libwxgtk3.0-0, wx3.0-i18n, libglu1-mesa (>= 7.0.0), libgl1-mesa-glx (>= 7.0.0), zlib1g, bzip2, libtinyxml2.6.2, libportaudio2, libsqlite3")
SET (PACKAGE_RECS "xcalib,xdg-utils")
SET (LIB_INSTALL_DIR "lib")
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "arm64")
ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "armhf")
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "amd64")
ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "i386")
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
SET(TENTATIVE_PREFIX "/usr/local")
ENDIF (EXISTS /etc/debian_version)
IF (EXISTS /etc/redhat-release)
SET (PACKAGE_FORMAT "RPM")
# SET (PACKAGE_DEPS "wxGTK mesa-libGLU mesa-libGL gettext zlib bzip2 portaudio")
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "aarch64")
ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "armhf")
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "x86_64")
SET (LIB_INSTALL_DIR "lib64")
ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "i386")
SET (LIB_INSTALL_DIR "lib")
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
ENDIF (EXISTS /etc/redhat-release)
IF (EXISTS /etc/suse-release OR EXISTS /etc/SuSE-release)
SET (PACKAGE_FORMAT "RPM")
# SET (PACKAGE_DEPS "libwx_baseu-2_8-0-wxcontainer MesaGLw libbz2-1 portaudio")
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "aarch64")
ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "armhf")
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
ELSE (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "x86_64")
SET (LIB_INSTALL_DIR "lib")
# In recent openSUSE versions (as of 2016), lib64 is mostly used when there are both 32-bit and 64-bit versions, although not limited to that.
# This CMake variable only affects the location of OpenCPN plugins at installation time, and nothing more than that.
# At run time, the plugin directory is determined by wxStandardPaths::GetPluginsDir(), which returns "lib", so this can be considered canonical.
ELSE (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET (ARCH "i386")
SET (LIB_INSTALL_DIR "lib")
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
ENDIF (EXISTS /etc/suse-release OR EXISTS /etc/SuSE-release)
IF (EXISTS /etc/gentoo-release)
SET (LIB_INSTALL_DIR "lib${LIB_SUFFIX}")
ENDIF (EXISTS /etc/gentoo-release)
IF(APPLE)
IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
# IF (CMAKE_OSX_64)
SET(ARCH "x86_64")
# ENDIF (CMAKE_OSX_64)
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
ENDIF()
ELSE (NOT WIN32)
# On WIN32 probably CMAKE_SIZEOF_VOID_P EQUAL 8, but we don't use it at all now...
SET (ARCH "i386")
ENDIF (NOT WIN32)
#IF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
# SET (ARCH "armhf")
#ENDIF (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
MESSAGE (STATUS "*** Build Architecture is ${ARCH}")
SET(PACKAGE_RELEASE "1" CACHE STRING "Package release number")
# Detect the Apple Version of the build machine
IF (APPLE)
EXEC_PROGRAM(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
STRING(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
MESSAGE(STATUS "*** Building on DARWIN_VERSION=${DARWIN_VERSION}")
IF (DARWIN_VERSION GREATER 11)
SET(APPLE_MODERN 1 INTERNAL)
ENDIF (DARWIN_VERSION GREATER 11)
ENDIF(APPLE)
MESSAGE (STATUS "*** Staging to build ${PACKAGE_NAME} ${PACKAGE_VERSION} ***")
#If on Windows or Apple, build the monolithic package, to override use a non-sense values from the commandline (due to cmake inability to distinguish between not set and set to FALSE):
#cmake -DBUNDLE_DOCS=BLAH -DBUNDLE_TCDATA=BLAH -DBUNDLE_GSHHS=BLAH ..
IF(APPLE OR WIN32)
SET(BUNDLE_DOCS "ON" CACHE BOOL "Include documentation in package")
SET(BUNDLE_TCDATA "ON" CACHE BOOL "Include tide/current harmonics data in package")
SET(BUNDLE_GSHHS "CRUDE" CACHE STRING "Include GSHHS wallpaper map in package (NONE,MIN,[CRUDE],LOW,INTERMEDIATE,HIGH,FULL)")
ELSE(APPLE OR WIN32)
SET(BUNDLE_DOCS "OFF" CACHE BOOL "Include documentation in package")
SET(BUNDLE_TCDATA "OFF" CACHE BOOL "Include tide/current harmonics data in package")
SET(BUNDLE_GSHHS "NONE" CACHE STRING "Include GSHHS wallpaper map in package (NONE,MIN,[CRUDE],LOW,INTERMEDIATE,HIGH,FULL)")
ENDIF(APPLE OR WIN32)
IF(UNIX)
SET(USE_BUNDLED_LIBS "OFF" CACHE BOOL "Use bundled libraries instead of system's")
ELSE(UNIX)
SET(USE_BUNDLED_LIBS "ON" CACHE BOOL "Use bundled libraries instead of system's")
ENDIF(UNIX)
IF(APPLE OR WIN32)
IF(NOT BUNDLE_DOCS)
SET (BUNDLE_DOCS "ON")
ENDIF(NOT BUNDLE_DOCS)
IF(NOT BUNDLE_GSHHS)
SET (BUNDLE_GSHHS "CRUDE")
ENDIF(NOT BUNDLE_GSHHS)
IF(NOT BUNDLE_TCDATA)
SET (BUNDLE_TCDATA "ON")
ENDIF(NOT BUNDLE_TCDATA)
ENDIF(APPLE OR WIN32)
IF(BUNDLE_DOCS MATCHES "ON")
MESSAGE (STATUS "*** Package will include documentation ***")
IF(UNIX AND NOT APPLE)
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_docs ON")
ENDIF(UNIX AND NOT APPLE)
ELSE(BUNDLE_DOCS MATCHES "ON")
MESSAGE (STATUS "*** Package will NOT include documentation ***")
IF(UNIX AND NOT APPLE)
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_docs OFF")
ENDIF(UNIX AND NOT APPLE)
ENDIF(BUNDLE_DOCS MATCHES "ON")
IF(BUNDLE_GSHHS MATCHES "NONE|MIN|CRUDE|LOW|INTERMEDIATE|HIGH|FULL")
# Possible values: NONE (default), MIN (=Only crude polygons, no borders/rivers), CRUDE, LOW, INTERMEDIATE, HIGH, FULL
MESSAGE (STATUS "*** Package will include GSHHS basechart level: ${BUNDLE_GSHHS} ***")
IF(UNIX AND NOT APPLE)
IF(BUNDLE_GSHHS MATCHES "NONE")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full OFF")
ENDIF(BUNDLE_GSHHS MATCHES "NONE")
IF(BUNDLE_GSHHS MATCHES "MIN")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full OFF")
ENDIF(BUNDLE_GSHHS MATCHES "MIN")
IF(BUNDLE_GSHHS MATCHES "CRUDE")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full OFF")
ENDIF(BUNDLE_GSHHS MATCHES "CRUDE")
IF(BUNDLE_GSHHS MATCHES "LOW")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full OFF")
ENDIF(BUNDLE_GSHHS MATCHES "LOW")
IF(BUNDLE_GSHHS MATCHES "INTERMEDIATE")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full OFF")
ENDIF(BUNDLE_GSHHS MATCHES "INTERMEDIATE")
IF(BUNDLE_GSHHS MATCHES "HIGH")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full OFF")
ENDIF(BUNDLE_GSHHS MATCHES "HIGH")
IF(BUNDLE_GSHHS MATCHES "FULL")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high ON")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full ON")
ENDIF(BUNDLE_GSHHS MATCHES "FULL")
ENDIF(UNIX AND NOT APPLE)
ELSE(BUNDLE_GSHHS MATCHES "NONE|MIN|CRUDE|LOW|INTERMEDIATE|HIGH|FULL")
SET(BUNDLE_GSHHS "NONE")
MESSAGE (STATUS "*** Package will NOT include GSHHS data ***")
IF(UNIX AND NOT APPLE)
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_min OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_crude OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_low OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_intermediate OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_high OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_gshhs_full OFF")
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_tcdata OFF")
ENDIF(UNIX AND NOT APPLE)
ENDIF(BUNDLE_GSHHS MATCHES "NONE|MIN|CRUDE|LOW|INTERMEDIATE|HIGH|FULL")
IF(BUNDLE_TCDATA MATCHES "ON")
MESSAGE (STATUS "*** Package will include tide and current data ***")
IF(UNIX AND NOT APPLE)
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_tcdata ON")
ENDIF(UNIX AND NOT APPLE)
ELSE(BUNDLE_TCDATA MATCHES "ON")
MESSAGE (STATUS "*** Package will NOT include tide and current data ***")
IF(UNIX AND NOT APPLE)
SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}\n%define _include_tcdata OFF")
ENDIF(UNIX AND NOT APPLE)
ENDIF(BUNDLE_TCDATA MATCHES "ON")
# To build for android, use this cmake invocation..
#$cmake -DUSE_GARMINHOST=OFF -D_wx_selected_config=androideabi-qt
#-DCMAKE_TOOLCHAIN_FILE=../buildandroid/build_android.cmake
#-DwxQt_Build=build_android_53 -DwxQt_Base=/home/dsr/Projects/wxqt/wxWidgets
#-DQt_Base /home/dsr/Qt/5.3) ..
IF(DEFINED _wx_selected_config)
MESSAGE (STATUS "selected config ${_wx_selected_config}")
IF(_wx_selected_config MATCHES "androideabi-qt")
MESSAGE (STATUS "Building for wxQt-Android")
MESSAGE (STATUS "Qt_Base: " ${Qt_Base})
MESSAGE (STATUS "wxQt_Base/Build: " ${wxQt_Base} "/" ${wxQt_Build})
SET(QT_ANDROID "ON")
ENDIF(_wx_selected_config MATCHES "androideabi-qt")
ENDIF(DEFINED _wx_selected_config)
IF((_wx_selected_config MATCHES "qt-armv7"))
#SET(CMAKE_BUILD_TYPE Debug)
ENDIF()
IF((_wx_selected_config MATCHES "qt-armv7"))
SET(wxWidgets_USE_LIBS base core xml html adv aui)
ELSE()
SET(wxWidgets_USE_LIBS net xml html adv aui core base)
ENDIF()
OPTION (USE_GL "Enable OpenGL support" ON)
# Prefer libGL.so to libOpenGL.so, see CMP0072
set (OpenGL_GL_PREFERENCE "LEGACY")
# Search for opengles, short of running a program to test the speed
# of acceleration, I simply use gles on "native linux" arm systems
IF (ARCH MATCHES "arm*" AND (NOT QT_ANDROID) )
find_path(OPENGLESv1_INCLUDE_DIR GLES/gl.h )
IF (OPENGLESv1_INCLUDE_DIR)
MESSAGE (STATUS "Found OpenGLESv1")
ADD_DEFINITIONS(-DocpnUSE_GLES)
ADD_DEFINITIONS(-DocpnUSE_GL)
SET(OPENGLES_FOUND "YES")
SET(OPENGL_FOUND "YES")
SET(wxWidgets_USE_LIBS ${wxWidgets_USE_LIBS} gl )
add_subdirectory(src/glshim)
SET(OPENGL_LIBRARIES "GL_static" "EGL" "X11" "drm" )
ENDIF()
ENDIF()
# Building for QT_ANDROID involves a cross-building environment,
# So the include directories, flags, etc must be stated explicitly
# without trying to locate them on the host build system.
IF(QT_ANDROID)
MESSAGE (STATUS "Using GLESv1 for Android")
ADD_DEFINITIONS(-DocpnUSE_GLES)
ADD_DEFINITIONS(-DocpnUSE_GL)
ADD_DEFINITIONS(-DARMHF)
SET(OPENGLES_FOUND "YES")
SET(OPENGL_FOUND "YES")
SET(wxWidgets_USE_LIBS ${wxWidgets_USE_LIBS} gl )
add_subdirectory(src/glshim)
ENDIF(QT_ANDROID)
IF ((NOT OPENGLES_FOUND) AND (NOT QT_ANDROID))
IF(USE_GL)
FIND_PACKAGE(OpenGL)
ELSE(USE_GL)
MESSAGE (STATUS "OpenGL disabled by option..." )
ENDIF(USE_GL)
IF(OPENGL_FOUND)
SET(wxWidgets_USE_LIBS gl ${wxWidgets_USE_LIBS} )
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
MESSAGE (STATUS "Found OpenGL...." )
MESSAGE (STATUS " GL Lib: " ${OPENGL_LIBRARIES})
MESSAGE (STATUS " GL Include: " ${OPENGL_INCLUDE_DIR})
ADD_DEFINITIONS(-DocpnUSE_GL)
# We need to remove GLU from the OPENGL_LIBRARIES list
FOREACH (_currentLibFile ${OPENGL_LIBRARIES})
#MESSAGE (STATUS " Lib File: " ${_currentLibFile})
SET(UCNAME ${_currentLibFile})
string(TOUPPER ${UCNAME} UCNAME)
IF(NOT ${UCNAME} MATCHES "(.*)GLU(.*)")
SET( REVISED_OPENGL_LIBRARIES ${_currentLibFile} ${REVISED_OPENGL_LIBRARIES})
ENDIF()
ENDFOREACH (_currentLibFile )
SET( OPENGL_LIBRARIES ${REVISED_OPENGL_LIBRARIES})
MESSAGE (STATUS " Revised GL Lib: " ${OPENGL_LIBRARIES})
ELSE(OPENGL_FOUND)
MESSAGE (STATUS "OpenGL not found..." )
ENDIF(OPENGL_FOUND)
ENDIF()
MESSAGE (STATUS " Adding local GLU" )
add_subdirectory(src/glu)
SET( OPENGL_LIBRARIES "GLU_static" ${OPENGL_LIBRARIES})
MESSAGE (STATUS " Revised GL Lib (with local): " ${OPENGL_LIBRARIES})
MESSAGE (STATUS " Adding local LIBTESS2" )
add_subdirectory(src/libtess2)
SET( OPENGL_LIBRARIES "TESS2_static" ${OPENGL_LIBRARIES})
SET(EXTRA_LIBS ${EXTRA_LIBS} "TESS2_static")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/libtess2/Include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/libtess2/Source)
MESSAGE (STATUS " Revised EXTRA_LIBS (with local libtess2): " ${EXTRA_LIBS})
IF(NOT QT_ANDROID)
# Find wxWidgets here, and the setting get inherited by all plugins.
# These options can be used to set the linux widgets build type
SET( wxWidgets_USE_DEBUG OFF)
SET( wxWidgets_USE_UNICODE ON)
SET( wxWidgets_USE_UNIVERSAL OFF)
SET( wxWidgets_USE_STATIC OFF)
set (WXWIDGETS_FORCE_VERSION CACHE VERSION "Force usage of a specific wxWidgets version.")
if(WXWIDGETS_FORCE_VERSION)
set (wxWidgets_CONFIG_OPTIONS --version=${WXWIDGETS_FORCE_VERSION})
endif()
IF(MSVC)
# Exclude wxexpat.lib, since we use our own version.
# Other things are excluded as well, but we don't need them
SET(wxWidgets_EXCLUDE_COMMON_LIBRARIES TRUE)
ENDIF(MSVC)
IF(WIN32 OR APPLE OR QT_ANDROID)
FIND_PACKAGE(wxWidgets REQUIRED)
IF(MSYS)
# this is to convert msys to windows paths, and handle the missing /usr
STRING( REGEX REPLACE "/usr/local" ";C:/MinGW/msys/1.0/local" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}" )
ENDIF(MSYS)
INCLUDE(${wxWidgets_USE_FILE})
MESSAGE (STATUS "Found wxWidgets..." )
MESSAGE (STATUS " wxWidgets Include: ${wxWidgets_INCLUDE_DIRS}")
MESSAGE (STATUS " wxWidgets Libraries: ${wxWidgets_LIBRARIES}")
ENDIF(WIN32 OR APPLE OR QT_ANDROID)
# We need to remove GLU from the wxWidgets_LIBRARIES list
# It only appears to get on the list for MSW...
FOREACH (_currentLibFile ${wxWidgets_LIBRARIES})
SET(UCNAME ${_currentLibFile})
string(TOUPPER ${UCNAME} UCNAME)
IF(NOT ${UCNAME} MATCHES "(.*)GLU(.*)")
SET( REVISED_wxWidgets_LIBRARIES ${REVISED_wxWidgets_LIBRARIES} ${_currentLibFile})
ENDIF()
ENDFOREACH (_currentLibFile )
SET( wxWidgets_LIBRARIES ${REVISED_wxWidgets_LIBRARIES})
MESSAGE (STATUS " Revised wxWidgets Libraries: ${wxWidgets_LIBRARIES}")
ENDIF(NOT QT_ANDROID)
MESSAGE (STATUS "")
MESSAGE (STATUS "*** Staging to build ${PACKAGE_NAME} ***")
#SET(CMAKE_BUILD_TYPE Debug)
IF( NOT CMAKE_BUILD_TYPE )
SET( CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE )
ENDIF( NOT CMAKE_BUILD_TYPE )
MESSAGE (STATUS "Build type: ${CMAKE_BUILD_TYPE}")
IF (NOT CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX ${TENTATIVE_PREFIX})
ENDIF (NOT CMAKE_INSTALL_PREFIX)
MESSAGE (STATUS "*** Will install to ${CMAKE_INSTALL_PREFIX} ***")
SET(PREFIX_BIN bin)
SET(PREFIX_INCLUDE include)
SET(PREFIX_DATA share)
SET(PREFIX_PKGDATA ${PREFIX_DATA}/${PACKAGE_NAME})
SET(PREFIX_LIB "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# require proper c++
#ADD_DEFINITIONS( "-Wall -ansi -pedantic -Wno-variadic-macros" )
#TODO: Should we use -fno-stack-protector
# IF NOT DEBUGGING CFLAGS="-O2 -march=native"
IF(NOT WIN32 AND NOT APPLE )
ADD_DEFINITIONS( "-Wall -Wno-unused -fexceptions -rdynamic" )
ADD_DEFINITIONS( " -g -fno-strict-aliasing")
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
ADD_DEFINITIONS( " -O0")
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
ADD_DEFINITIONS( " -DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\"")
# profiling with gprof
# ADD_DEFINITIONS( -pg )
# SET(CMAKE_EXE_LINKER_FLAGS -pg)
# profiling with gcov
# ADD_DEFINITIONS( "-fprofile-arcs -ftest-coverage" )
# SET(EXTRA_LIBS ${EXTRA_LIBS} "gcov")
ENDIF(NOT WIN32 AND NOT APPLE)
IF(MINGW)
ADD_DEFINITIONS( "-Wall -Wno-unused -Wno-cpp -fexceptions" )
ADD_DEFINITIONS( " -g -fno-strict-aliasing")
ENDIF(MINGW)
IF( APPLE )
ADD_DEFINITIONS( "-Wall -Wno-unused -fexceptions -Wno-overloaded-virtual" )
ADD_DEFINITIONS( " -g -fno-strict-aliasing")
ADD_DEFINITIONS( " -Wno-deprecated -Wno-deprecated-declarations -Wno-unknown-pragmas" )
ADD_DEFINITIONS( " -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_" )
ENDIF(APPLE)
#Enable CrashReporting for Windows (visual studio) and Linux
IF(MSVC OR (NOT APPLE AND NOT QT_ANDROID AND NOT MINGW))
OPTION (OCPN_USE_CRASHREPORT "Enable crash reporting" ON)
ELSE()
SET(OCPN_USE_CRASHREPORT FALSE)
ENDIF()
IF(OCPN_USE_CRASHREPORT)
MESSAGE (STATUS "Crash reporting enabled")
IF(MSVC)
MESSAGE (STATUS "Using Windows CrashRpt")
ADD_DEFINITIONS(-DOCPN_USE_CRASHRPT)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/buildwin/crashrpt)
SET(EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_SOURCE_DIR}/buildwin/crashrpt/CrashRpt1403.lib)
SET(CMAKE_EXE_LINKER_FLAGS /DEBUG)
ELSE(MSVC)
IF(NOT APPLE AND NOT QT_ANDROID AND NOT MINGW)
IF(CMAKE_BUILD_TYPE MATCHES "Rel*")
MESSAGE (STATUS "Using Linux crash reporting")
ADD_DEFINITIONS(-DLINUX_CRASHRPT)
ENDIF()
ENDIF()
ENDIF(MSVC)
ENDIF(OCPN_USE_CRASHREPORT)
# Add some definitions to satisfy MS
IF(MSVC)
ADD_DEFINITIONS(-D__MSVC__)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-DPSAPI_VERSION=1)
ENDIF(MSVC)
IF (NOT WIN32 AND NOT APPLE)
IF(QT_ANDROID)
SET(CMAKE_BUILD_TYPE Debug)
ADD_DEFINITIONS(-D__WXQT__)
ADD_DEFINITIONS(-DOCPN_USE_WRAPPER)
ADD_DEFINITIONS(-D__OCPN__ANDROID__)
ADD_DEFINITIONS(-DANDROID)
SET(CMAKE_CXX_FLAGS "-pthread -fPIC -s -O2")
## Compiler flags
# if(CMAKE_COMPILER_IS_GNUCXX)
# set(CMAKE_CXX_FLAGS "-O2") ## Optimize
# endif()
set(CMAKE_EXE_LINKER_FLAGS "-s") ## Strip binary
INCLUDE_DIRECTORIES("${Qt_Base}/android_armv7/include/QtCore")
INCLUDE_DIRECTORIES("${Qt_Base}/android_armv7/include")
INCLUDE_DIRECTORIES("${Qt_Base}/android_armv7/include/QtWidgets")
INCLUDE_DIRECTORIES("${Qt_Base}/android_armv7/include/QtGui")
INCLUDE_DIRECTORIES("${Qt_Base}/android_armv7/include/QtOpenGL")
INCLUDE_DIRECTORIES("${Qt_Base}/android_armv7/include/QtTest")
INCLUDE_DIRECTORIES( "${wxQt_Base}/${wxQt_Build}/lib/wx/include/arm-linux-androideabi-qt-unicode-static-3.1")
INCLUDE_DIRECTORIES("${wxQt_Base}/include")
ADD_DEFINITIONS(-DQT_WIDGETS_LIB)
ENDIF(QT_ANDROID)
ENDIF (NOT WIN32 AND NOT APPLE)
OPTION(OCPN_NEW_SERIAL "Use new serial communication implementation" ON)
IF(OCPN_NEW_SERIAL)
if(APPLE)
find_library(IOKIT_LIBRARY IOKit)
find_library(FOUNDATION_LIBRARY Foundation)
endif()
## Sources
set(serial_SRCS
src/serial/src/serial.cc
src/serial/include/serial/serial.h
src/serial/include/serial/v8stdint.h
)
if(APPLE)
# If OSX
list(APPEND serial_SRCS src/serial/src/impl/unix.cc)
list(APPEND serial_SRCS src/serial/src/impl/list_ports/list_ports_osx.cc)
elseif(UNIX)
# If unix
list(APPEND serial_SRCS src/serial/src/impl/unix.cc)
list(APPEND serial_SRCS src/serial/src/impl/list_ports/list_ports_linux.cc)
else()
# If windows
list(APPEND serial_SRCS src/serial/src/impl/win.cc)
list(APPEND serial_SRCS src/serial/src/impl/list_ports/list_ports_win.cc)
endif()
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/serial/include)
## Add serial library
add_library(SERIAL ${serial_SRCS})
if(APPLE)
target_link_libraries(SERIAL ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
elseif(UNIX)
target_link_libraries(SERIAL rt pthread)
else()
target_link_libraries(SERIAL setupapi)
endif()
set(EXTRA_LIBS ${EXTRA_LIBS} SERIAL)
add_definitions(-DocpnUSE_NEWSERIAL)
message(STATUS "Using new serial library...")
ENDIF(OCPN_NEW_SERIAL)
OPTION(OCPN_USE_CURL "Use Curl libraries" ON)
IF(OCPN_USE_CURL)
ADD_DEFINITIONS(-D__OCPN_USE_CURL__)
IF(WIN32)
INSTALL(FILES "${CMAKE_SOURCE_DIR}/buildwin/curl-ca-bundle.crt" "${CMAKE_SOURCE_DIR}/buildwin/libeay32.dll" "${CMAKE_SOURCE_DIR}/buildwin/ssleay32.dll" DESTINATION ".")
INSTALL(FILES "${CMAKE_SOURCE_DIR}/buildwin/curl-ca-bundle.crt" DESTINATION ".")
IF(MSVC)
SET(CURL_LIBRARIES "${CMAKE_SOURCE_DIR}/buildwin/libcurl.lib")
INSTALL(FILES "buildwin/libcurl.dll" DESTINATION ".")
INSTALL(FILES "buildwin/zlib1.dll" DESTINATION ".")
ELSE(MSVC) ## mingw
SET(CURL_LIBRARIES "curl.dll")
INSTALL(FILES "buildwin/libcurl.dll" DESTINATION ".")
ENDIF(MSVC)
OPTION(OCPN_USE_EXTERN_CURL "Use external libcurl" OFF)
ELSE(WIN32)
SET(OCPN_USE_EXTERN_CURL ON)
ENDIF(WIN32)
IF(NOT QT_ANDROID)
IF(OCPN_USE_EXTERN_CURL)
FIND_PACKAGE(CURL REQUIRED)
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
ELSE(OCPN_USE_EXTERN_CURL)
INCLUDE("Curl")
MESSAGE (STATUS "Using bundled curl library...")
ENDIF(OCPN_USE_EXTERN_CURL)
SET(SRC_WXCURL
src/wxcurl/base.cpp
src/wxcurl/dav.cpp
src/wxcurl/davtool.cpp
src/wxcurl/dialog.cpp
src/wxcurl/ftp.cpp
src/wxcurl/http.cpp
src/wxcurl/panel.cpp
src/wxcurl/telnet.cpp
src/wxcurl/thread.cpp
src/wxcurl/utils.cpp
)
INCLUDE( FindPkgConfig )
PKG_SEARCH_MODULE(SYS_WXCURL libwxcurl wxcurl)
IF (SYS_WXCURL_FOUND AND USE_BUNDLED_LIBS MATCHES "OFF")
message (STATUS "Building with system wxcurl")
INCLUDE_DIRECTORIES(${SYS_WXCURL_INCLUDE_DIR})
SET(EXTRA_LIBS ${EXTRA_LIBS} ${SYS_WXCURL_LIBRARIES})
ELSE (SYS_WXCURL_FOUND AND USE_BUNDLED_LIBS MATCHES "OFF")
message (STATUS "Building with bundled wxcurl")
ADD_LIBRARY(WXCURL STATIC ${SRC_WXCURL})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/wxcurl)
SET(EXTRA_LIBS ${EXTRA_LIBS} WXCURL)
ENDIF (SYS_WXCURL_FOUND AND USE_BUNDLED_LIBS MATCHES "OFF")
SET(EXTRA_LIBS ${EXTRA_LIBS} ${CURL_LIBRARIES})
MESSAGE (STATUS "CURL_LIBRARIES:" ${CURL_LIBRARIES})
IF(WIN32 AND OCPN_USE_EXTERN_CURL)
FIND_LIBRARY(CURL_LIBRARY_DLL NAMES
curl
curllib
libcurl_imp
curllib_static
libcurl
PATH_SUFFIXES dll
)
INSTALL(FILES ${CURL_LIBRARY_DLL} DESTINATION ".")
ENDIF(WIN32 AND OCPN_USE_EXTERN_CURL)
ENDIF(NOT QT_ANDROID)
ENDIF(OCPN_USE_CURL)
OPTION(OCPN_USE_SVG "Use SVG graphics" ON)
OPTION(OCPN_USE_LZMA "Use LZMA for chart compression" ON)
OPTION(OCPN_CI_BUILD "Use CI build versioning rules" OFF)
IF(OCPN_USE_SVG)
MESSAGE(STATUS "SVG support enabled...")
IF(NOT QT_ANDROID)
IF(NOT WIN32)
#Find Cairo
IF( CAIRO_INCLUDE_DIR )
# Already in cache, be silent
SET( CAIRO_FIND_QUIETLY TRUE )
ENDIF( CAIRO_INCLUDE_DIR )
SET(CAIRO_INC_LOOK_PATHS /usr/local/include /usr/include )
IF(APPLE)
IF(NOT APPLE_MODERN)
SET(CAIRO_INC_LOOK_PATHS /usr/local/Cellar/cairo/1.14.6/include)
SET(LOOK_OPTION NO_DEFAULT_PATH)
ENDIF(NOT APPLE_MODERN)
ENDIF(APPLE)
FIND_PATH( CAIRO_INCLUDE_DIR cairo.h
PATHS ${CAIRO_INC_LOOK_PATHS}
PATH_SUFFIXES cairo/ libcairo/ cairo/libcairo/
${LOOK_OPTION} )
message(STATUS " Cairo include directory found: ${CAIRO_INCLUDE_DIR}")
SET(CAIRO_LIB_LOOK_PATHS /usr/lib /usr/local/lib /usr/lib/i386-linux-gnu)
IF(APPLE)
IF(NOT APPLE_MODERN)
SET(CAIRO_LIB_LOOK_PATHS /usr/local/Cellar/cairo/1.14.6/lib)
SET(LOOK_OPTION NO_DEFAULT_PATH)
ENDIF(NOT APPLE_MODERN)
ENDIF(APPLE)
SET( CAIRO_NAMES libcairo cairo )
FIND_LIBRARY( CAIRO_LIBRARY
NAMES ${CAIRO_NAMES}
PATHS ${CAIRO_LIB_LOOK_PATHS}
${LOOK_OPTION})
message(STATUS " Cairo library found: ${CAIRO_LIBRARY}")
GET_FILENAME_COMPONENT( CAIRO_LIBRARY_DIR ${CAIRO_LIBRARY} PATH )
# handle the QUIETLY and REQUIRED arguments and set CAIRO_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( "FindPackageHandleStandardArgs" )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( "CAIRO" DEFAULT_MSG CAIRO_INCLUDE_DIR CAIRO_LIBRARY )
MARK_AS_ADVANCED( CAIRO_INCLUDE_DIR CAIRO_LIBRARY )
IF ( NOT CAIRO_FOUND )
message(FATAL_ERROR "Cairo component required, but not found!")
ENDIF()
# Some systems (e.g ARMHF RPI2) require some extra libraries
# This is not exactly a general solution, but probably harmless where not needed.
IF(NOT APPLE)
FIND_LIBRARY( PANGOCAIRO_LIBRARY NAMES pangocairo-1.0 PATHS /usr/lib /usr/local/lib)
FIND_LIBRARY( PANGOFT2_LIBRARY NAMES pangoft2-1.0 PATHS /usr/lib /usr/local/lib)
FIND_LIBRARY( PANGOXFT_LIBRARY NAMES pangoxft-1.0 PATHS /usr/lib /usr/local/lib)
FIND_LIBRARY( GDK_PIXBUF_LIBRARY NAMES gdk_pixbuf-2.0 PATHS /usr/lib /usr/local/lib)
FIND_PACKAGE_HANDLE_STANDARD_ARGS( "CAIRO_EXTRAS" DEFAULT_MSG PANGOCAIRO_LIBRARY
PANGOFT2_LIBRARY PANGOXFT_LIBRARY GDK_PIXBUF_LIBRARY)
ENDIF(NOT APPLE)
IF ( CAIRO_EXTRAS_FOUND )
SET( CAIRO_EXTRA_LIBRARIES ${PANGOCAIRO_LIBRARY} ${PANGOFT2_LIBRARY} ${PANGOXFT_LIBRARY} ${GDK_PIXBUF_LIBRARY} )
message(STATUS "Cairo Extra Libraries: " ${CAIRO_EXTRA_LIBRARIES})
ENDIF ( CAIRO_EXTRAS_FOUND )
# Find FFMPEG - we have it disabled in our wxSVG
#set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE AVRESAMPLE)
#unset(FFMPEG_LIBRARIES CACHE)
#find_package(FFmpeg)
#if ( NOT AVCODEC_FOUND OR NOT AVFORMAT_FOUND OR NOT AVUTIL_FOUND OR NOT SWSCALE_FOUND )
# message(FATAL_ERROR "FFmpeg component required, but not found!")
#endif()
#set(VIDEO_FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARIES})
FIND_PACKAGE(EXPAT REQUIRED)
INCLUDE(FindEXIF)
ELSE(NOT WIN32)
#On Windows, we have our own expat
SET(EXPAT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/buildwin/expat-2.2.5/include)
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR})
#And cairo
SET(CAIRO_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/buildwin/gtk/include)
ENDIF(NOT WIN32)
INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
IF(APPLE)
INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR}/..)
ENDIF(APPLE)
#INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS})
ADD_DEFINITIONS(-DUSE_RENDER_CAIRO)
ADD_DEFINITIONS(-DocpnUSE_SVG)
IF(WIN32)
SET(SVG_LIBS
${CMAKE_SOURCE_DIR}/buildwin/gtk/cairo.lib
${CMAKE_SOURCE_DIR}/buildwin/expat-2.2.5/expat.lib
${CMAKE_SOURCE_DIR}/buildwin/archive.lib
)
FILE(GLOB gtkdll_files "${CMAKE_CURRENT_SOURCE_DIR}/buildwin/gtk/*.dll")
INSTALL(FILES ${gtkdll_files} DESTINATION ".")
FILE(GLOB expatdll_files "${CMAKE_CURRENT_SOURCE_DIR}/buildwin/expat-2.2.5/*.dll")
INSTALL(FILES ${expatdll_files} DESTINATION ".")
MESSAGE(STATUS "GTK and Expat DLLs bundled into the installer package...")
ELSE(WIN32)
SET(SVG_LIBS
${CAIRO_LIBRARY}
${CAIRO_EXTRA_LIBRARIES}
# ${FFMPEG_LIBRARIES}
${EXPAT_LIBRARIES}
${EXIF_LIBRARIES}
${GTK_LIBRARIES}
)
ENDIF(WIN32)
SET(SRC_WXSVG
src/wxsvg/src/CSSStyleDeclaration.cpp
src/wxsvg/src/CSSValue.cpp
src/wxsvg/src/Elements_CopyConstructors.cpp
src/wxsvg/src/Elements_GetAttribute.cpp
src/wxsvg/src/Elements_GetAttributes.cpp
src/wxsvg/src/Elements_HasAttribute.cpp
src/wxsvg/src/Elements_SetAttribute.cpp
src/wxsvg/src/GetSVGDocument.cpp
src/wxsvg/src/NodeList.cpp
src/wxsvg/src/SVGAngle.cpp
src/wxsvg/src/SVGAnimateTransformElement.cpp
src/wxsvg/src/SVGAnimateMotionElement.cpp
src/wxsvg/src/SVGAnimatedType.cpp
src/wxsvg/src/SVGAnimationElement.cpp
src/wxsvg/src/SVGCanvas.cpp
src/wxsvg/src/SVGCanvasItem.cpp
src/wxsvg/src/SVGCircleElement.cpp
src/wxsvg/src/SVGColor.cpp
src/wxsvg/src/SVGDocument.cpp
src/wxsvg/src/SVGElementInstanceList.cpp
src/wxsvg/src/SVGEllipseElement.cpp
src/wxsvg/src/SVGFEGaussianBlurElement.cpp
src/wxsvg/src/SVGFilterElement.cpp
src/wxsvg/src/SVGFitToViewBox.cpp
src/wxsvg/src/SVGImageElement.cpp
src/wxsvg/src/SVGLength.cpp
src/wxsvg/src/SVGLengthList.cpp
src/wxsvg/src/SVGLineElement.cpp
src/wxsvg/src/SVGLocatable.cpp
src/wxsvg/src/SVGMarkerElement.cpp
src/wxsvg/src/SVGMatrix.cpp
src/wxsvg/src/SVGNumberList.cpp
src/wxsvg/src/SVGPaint.cpp
src/wxsvg/src/SVGPathElement.cpp
src/wxsvg/src/SVGPathSegList.cpp
src/wxsvg/src/SVGPoint.cpp
src/wxsvg/src/SVGPointList.cpp
src/wxsvg/src/SVGPolygonElement.cpp
src/wxsvg/src/SVGPolylineElement.cpp
src/wxsvg/src/SVGPreserveAspectRatio.cpp
src/wxsvg/src/SVGRadialGradientElement.cpp
src/wxsvg/src/SVGRect.cpp
src/wxsvg/src/SVGRectElement.cpp
src/wxsvg/src/SVGSVGElement.cpp
src/wxsvg/src/SVGStringList.cpp
src/wxsvg/src/SVGStylable.cpp
src/wxsvg/src/SVGTests.cpp
src/wxsvg/src/SVGTextContentElement.cpp
src/wxsvg/src/SVGTextElement.cpp
src/wxsvg/src/SVGTransform.cpp
src/wxsvg/src/SVGTransformList.cpp
src/wxsvg/src/SVGTransformable.cpp
src/wxsvg/src/SVGUseElement.cpp
src/wxsvg/src/SVGVideoElement.cpp
src/wxsvg/src/imagsvg.cpp
#src/wxsvg/src/mediadec_ffmpeg.cpp
src/wxsvg/src/svgctrl.cpp
src/wxsvg/src/cairo/SVGCanvasCairo.cpp
src/wxsvg/src/cairo/SVGCanvasCairo.h
src/wxsvg/src/cairo/SVGCanvasImageCairo.cpp
src/wxsvg/src/cairo/SVGCanvasImageCairo.h
src/wxsvg/src/cairo/SVGCanvasPathCairo.cpp
src/wxsvg/src/cairo/SVGCanvasPathCairo.h
src/wxsvg/src/cairo/SVGCanvasTextCairo.cpp
src/wxsvg/src/cairo/SVGCanvasTextCairo.h
src/wxsvg/src/svgxml/svgxml.cpp
src/wxsvg/src/svgxml/svgxmlhelpr.cpp
)
if(EXIF_FOUND)
SET(SRC_WXSVG ${SRC_WXSVG} src/wxsvg/src/ExifHandler.cpp)
ADD_DEFINITIONS(-DwxsvgUSE_EXIF)
INCLUDE_DIRECTORIES(${EXIF_INCLUDE_DIR})
endif()
PKG_SEARCH_MODULE(WXSVG libwxsvg wxsvg)
IF (WXSVG_FOUND AND USE_BUNDLED_LIBS MATCHES "OFF")
message (STATUS "Building with system wxsvg includes")
INCLUDE_DIRECTORIES(${WXSVG_INCLUDE_DIR})
SET(EXTRA_LIBS ${EXTRA_LIBS} ${WXSVG_LIBRARIES})
ELSE (WXSVG_FOUND AND USE_BUNDLED_LIBS MATCHES "OFF")