forked from gnudatalanguage/gdl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1201 lines (1099 loc) · 42.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
#
# copyright : (c) 2010 Maxime Lenoir and Alain Coulais
#
# 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.
#
# requirement for CMAKE_CXX_STANDARD
if (APPLE)
cmake_minimum_required(VERSION 3.2 FATAL_ERROR) # https://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=15355
else()
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
endif()
cmake_policy(SET CMP0026 OLD) # LOCATION property
project(GDL)
set(CMAKE_CXX_STANDARD 11)
# X.X.X CVS becomes release X.X.X+1
set(VERSION "0.9.8 git")
enable_testing()
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckLibraryExists)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckCSourceRuns)
include(CheckCXXSourceCompiles)
include(FindPkgConfig)
include(FindPackageHandleStandardArgs)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules)
#### Default cached values
set(PYTHON_MODULE OFF CACHE BOOL "GDL: Build GDL as a Python module ?")
set(X11 ON CACHE BOOL "GDL: Enable X11 ?")
set(X11DIR "" CACHE PATH "GDL: Specify X11 directory tree")
# GNU Readline or BSD Editline ? if Readline OK, we don't look for Editline.
set(READLINE ON CACHE BOOL "GDL: Enable GNU Readline ?")
set(READLINEDIR "" CACHE PATH "GDL: Specify the GNU Readline directory tree")
set(EDITLINE ON CACHE BOOL "GDL: Enable BSD Editline ?")
set(EDITLINEDIR "" CACHE PATH "GDL: Specify the BSD Editline directory tree")
set(OLDPLPLOT OFF CACHE BOOL "GDL: Enable old plplot ?")
set(PLPLOTDIR "" CACHE PATH "GDL: Specify the plplot directory tree")
set(GSLDIR "" CACHE PATH "GDL: Specify the GSL directory tree")
set(ZLIBDIR "" CACHE PATH "GDL: Specify the Zlib directory tree")
set(WXWIDGETS ON CACHE BOOL "GDL: Enable WxWidgets ?")
set(WXWIDGETSDIR "" CACHE PATH "GDL: Specify WxWidgets directory tree")
set(UDUNITS OFF CACHE BOOL "GDL: Enable UDUNITS-2 ?")
set(UDUNITSDIR "" CACHE PATH "GDL: Specify the UDUNITS-2 directory tree")
set(EIGEN3 ON CACHE BOOL "GDL: Enable Eigen3 ?")
set(EIGEN3DIR "" CACHE PATH "GDL: Specify the Eigen3 directory tree")
set(PSLIB ON CACHE BOOL "GDL: Enable pslib ?")
set(PSLIBDIR "" CACHE PATH "GDL: Specify the pslib directory tree")
set(PNGLIB ON CACHE BOOL "GDL: Enable libpng ?")
set(PNGLIBDIR "" CACHE PATH "GDL: Specify the libpng directory tree")
set(GRIB OFF CACHE BOOL "GDL: Enable GRIB ?")
set(GRIBDIR "" CACHE PATH "GDL: Specifiy the ECMWF ecCodes or GRIB API directory tree")
# set(QHULL OFF CACHE BOOL "GDL: Enable Qhull ?")
# set(QHULLDIR "" CACHE PATH "GDL: Specifiy the QHULL directory tree")
set(GLPK OFF CACHE BOOL "GDL: Enable GLPK (for function SIMPLEX) ?")
set(GLPKDIR "" CACHE PATH "GDL: Specify the GLPK directory tree")
# GraphicsMagick is a good alternative to ImageMagick, if GM OK, we don't look for IM
set(GRAPHICSMAGICK ON CACHE BOOL "GDL: Enable GraphicsMagick ?")
set(GRAPHICSMAGICKDIR "" CACHE PATH "GDL: Specify the GraphicsMagick directory tree")
set(MAGICK ON CACHE BOOL "GDL: Enable ImageMagick ?")
set(MAGICKDIR "" CACHE PATH "GDL: Specifiy the ImageMagick directory tree")
set(TIFF ON CACHE BOOL "GDL: Enable libtiff ?")
set(TIFFDIR "" CACHE PATH "GDL: Specify the libtiff directory tree")
if(TIFF)
set(GEOTIFF ON CACHE BOOL "GDL: Enable libgeotiff ?")
set(GEOTIFFDIR "" CACHE PATH "GDL: Specify the libgeotiff directory tree")
endif(TIFF)
set(NETCDF ON CACHE BOOL "GDL: Enable NetCDF ?")
set(NETCDFDIR "" CACHE PATH "GDL: Specifiy the netCDF directory tree")
set(HDF ON CACHE BOOL "GDL: Enable Hdf ?")
set(HDFDIR "" CACHE PATH "GDL: Specifiy the HDF directory tree")
set(HDF5 ON CACHE BOOL "GDL: Enable Hdf5 ?")
set(HDF5DIR "" CACHE PATH "GDL: Specifiy the HDF5 directory tree")
set(FFTW ON CACHE BOOL "GDL: Enable FFTW ?")
set(FFTWDIR "" CACHE PATH "GDL: Specifiy the FFTW directory tree")
set(LIBPROJ4 OFF CACHE BOOL "GDL: Enable LIBPROJ4 ?")
set(LIBPROJ4DIR "" CACHE PATH "GDL: Specifiy the LIBPROJ4 directory tree")
set(MPICH OFF CACHE BOOL "GDL: Enable MPICH ?")
set(MPICHDIR "" CACHE PATH "GDL: Specify the MPICH (experimental) directory tree")
set(PYTHON ON CACHE BOOL "GDL: Enable Python ?")
set(PYTHONDIR "" CACHE PATH "GDL: Specifiy the use Python directory tree")
set(PYTHONVERSION "" CACHE STRING "GDL: Specify the Python version to use")
set(GSHHS ON CACHE BOOL "GDL: Enable GSHHS ?")
set(GSHHSDIR "" CACHE PATH "GDL: Specifiy the GSHHS directory tree")
if(NOT WIN32)
set(NCURSESDIR "" CACHE PATH "GDL: Specify the ncurses (or curses) directory tree")
endif(NOT WIN32)
set(OPENMP ON CACHE BOOL "GDL: Enable OpenMP ?")
# Third party libraries
set(JASPERDIR "" CACHE PATH "GDL: Specify the JasPer directory tree")
set(JPEGDIR "" CACHE PATH "GDL: Specify the JPEG directory tree")
set(SZIPDIR "" CACHE PATH "GDL: Specify the SZip directory tree")
set(GDL_DATA_DIR "/share/gnudatalanguage" CACHE PATH "GDL: data directory relative to CMAKE_INSTALL_PREFIX")
# check for 64-bit OS
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(HAVE_64BIT_OS 1)
endif(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
#### check headers and libraries
# dl
check_library_exists(dl dlopen "" HAVE_DL)
if(HAVE_DL)
set(LIBRARIES ${LIBRARIES} dl)
endif(HAVE_DL)
# malloc stats
check_function_exists(malloc_zone_statistics HAVE_MALLOC_ZONE_STATISTICS)
check_function_exists(sbrk HAVE_SBRK)
check_function_exists(mallinfo HAVE_MALLINFO)
# mallocs
check_include_file(malloc.h HAVE_MALLOC_H)
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
# locale
check_include_file(locale.h HAVE_LOCALE_H)
# std includes..
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stdlib.h HAVE_STDLIB_H)
check_include_file(string.h HAVE_STRING_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H)
#check_include_file(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H)
#sometimes it compiles but stdio_filebuf is only in gcc-x-y-z directory tree...
# would be silly not to use this functionality if present, so recheck:
if (HAVE_EXT_STDIO_FILEBUF_H)
else (HAVE_EXT_STDIO_FILEBUF_H)
check_cxx_source_compiles("
#include <ext/stdio_filebuf.h>
int main(int argc, char **argv) {
int i=0;
i+=1;
}" REALLY_HAVE_EXT_STDIO_FILEBUF_H)
endif (HAVE_EXT_STDIO_FILEBUF_H)
if (REALLY_HAVE_EXT_STDIO_FILEBUF_H)
message(STATUS "INFO: will use GNU extensions for STDIO (useful for compressed I/O) since it seems accepted by your c++ compiler.")
set (HAVE_EXT_STDIO_FILEBUF_H 1)
endif (REALLY_HAVE_EXT_STDIO_FILEBUF_H)
# dlfcn.h
check_include_file(dlfcn.h HAVE_DLFCN_H)
# inttypes.h
check_include_file(inttypes.h HAVE_INTTYPES_H)
# nexttoward
check_library_exists(m nexttoward "" HAVE_NEXTTOWARD)
# mpi
check_include_file(mpi.h HAVE_MPI_H)
# SA: whithout it compilation of antlr fails if there's a conflicting
# version of antlr in system-wide directories
include_directories(src)
if (NOT WIN32)
# Ncurses MANDATORY for readline on POSIX
# -DNCURSESDIR=DIR
set(CMAKE_PREFIX_PATH ${NCURSESDIR})
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses QUIET COMPONENTS initscr)
mark_as_advanced(CURSES_CURSES_H_PATH CURSES_FORM_LIBRARY CURSES_HAVE_CURSES_H)
if(CURSES_FOUND)
set(HAVE_LIBNCURSES 1)
set(LIBRARIES ${LIBRARIES} ${CURSES_LIBRARIES})
include_directories(${CURSES_INCLUDE_DIR})
else(CURSES_FOUND)
# search for curses
set(CURSES_NEED_NCURSES FALSE)
find_package(Curses COMPONENTS initscr)
set(HAVE_LIBCURSES ${CURSES_FOUND})
if(CURSES_FOUND)
set(LIBRARIES ${LIBRARIES} ${CURSES_LIBRARIES})
include_directories(${CURSES_INCLUDE_DIR})
else(CURSES_FOUND)
message(FATAL_ERROR "(N)Curses was not found.\n"
"Use -DNCURSESDIR=DIR to specify the curses directory tree.\n"
"(suitable Debian/Ubuntu package: libncurses-dev)\n")
endif(CURSES_FOUND)
endif(CURSES_FOUND)
endif (NOT WIN32)
# GNU Readline (GNU/Linux or OSX) or BSD Editline (OSX)
# -DREADLINE=ON|OFF
# -DREADLINEDIR=DIR or -DEDITLINEDIR=DIR
if(READLINE)
set(CMAKE_PREFIX_PATH ${READLINEDIR})
find_package(Readline QUIET)
set(HAVE_LIBREADLINE ${READLINE_FOUND})
if(READLINE_FOUND)
if(NOT WIN32)
# readline needs (n)curses (not on Windows)
set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARIES})
endif(NOT WIN32)
check_library_exists("${READLINE_LIBRARIES}" rl_get_screen_size "" RL_GET_SCREEN_SIZE)
if(NOT RL_GET_SCREEN_SIZE)
message(STATUS "WARNING: Older GNU readline without rl_get_screen_size was found.\n"
"For resized terminals the size might not be updated correctly.\n"
"If this is a problem please install a recent version of readline.")
endif(NOT RL_GET_SCREEN_SIZE)
set(LIBRARIES ${LIBRARIES} ${READLINE_LIBRARIES})
include_directories(${READLINE_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES)
else(READLINE_FOUND)
if(EDITLINE)
message(STATUS "WARNING: GNU readline was not found, now looking for BSD Editline.\n")
else(EDITLINE)
message(FATAL_ERROR "GNU readline was not found.\n"
"Use -DREADLINEDIR=no to explicitely disable it.\n"
"(suitable Debian/Ubuntu package: libreadline-gplv2-dev)\n"
"(suitable Fedora package: readline-devel)")
endif(EDITLINE)
endif(READLINE_FOUND)
endif(READLINE)
#
# if Readline found, we do not look for Editline
#
if(READLINE_FOUND)
if (EDITLINE)
message(STATUS "INFO: We prefer to use Readline than Editline.\n"
"Feedback welcome on OSX Readline ...")
set(EDITLINE OFF)
endif(EDITLINE)
endif(READLINE_FOUND)
# BSD Editline (a BSD clone of GNU Readline, present by default on OSX)
# -DEDITLINE=ON|OFF
# -DEDITLINEDIR=DIR
if(EDITLINE)
set(CMAKE_PREFIX_PATH ${EDITLINEDIR})
find_package(Editline QUIET)
set(HAVE_LIBEDITLINE ${EDITLINE_FOUND})
if(EDITLINE_FOUND)
if(NOT WIN32)
# readline needs (n)curses (not on Windows)
set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARIES})
endif(NOT WIN32)
set(LIBRARIES ${LIBRARIES} ${EDITLINE_LIBRARIES})
include_directories(${EDITLINE_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES)
else(EDITLINE_FOUND)
message(FATAL_ERROR "requested BSD Editline was not found.\n"
"Use -DEDITLINE=no to explicitely disable it.\n")
endif(EDITLINE_FOUND)
endif(EDITLINE)
# zlib MANDATORY
# -DZLIBDIR=DIR
set(CMAKE_PREFIX_PATH ${ZLIBDIR})
find_package(ZLIB QUIET)
set(HAVE_LIBZ ${ZLIB_FOUND})
if(ZLIB_FOUND)
set(LIBRARIES ${LIBRARIES} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIR})
else(ZLIB_FOUND)
message(FATAL_ERROR "ZLib library is required but was not found.\n"
"Use -DZLIBDIR=DIR to specify the zlib directory tree.\n"
"(suitable Debian/Ubuntu package: zlib1g-dev)\n"
"(suitable Fedora package: zlib-devel)")
endif(ZLIB_FOUND)
# libpng
# -DPNGLIB=ON|OFF
# -DPNGLIBDIR=DIR
if(PNGLIB)
set(CMAKE_PREFIX_PATH ${PNGLIBDIR})
find_package(PNG QUIET)
set(USE_PNGLIB ${PNG_FOUND})
if(PNG_FOUND)
set(LIBRARIES ${LIBRARIES} ${PNG_LIBRARIES})
set(LINK_DIRECTORIES ${LINK_DIRECTORIES} ${PNG_LIBRARY_DIRS})
include_directories(${PNG_INCLUDE_DIRS})
else(PNG_FOUND)
message(FATAL_ERROR "libpng is required but was not found.\n"
"Use -DPNGLIBDIR=DIR to specify the libpng directory tree.\n"
"Use -DPNGLIB=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libpng-dev)\n"
"(suitable Fedora package: libpng-devel)")
endif(PNG_FOUND)
endif(PNGLIB)
# openmp
# -DOPENMP=ON|OFF
if(OPENMP)
find_package(OpenMP QUIET)
set(USE_OPENMP ${OPENMP_FOUND})
if(OPENMP_FOUND)
add_definitions(${OpenMP_CXX_FLAGS})
if(MSVC)
set(LIBRARIES ${LIBRARIES} vcomp)
elseif(WIN32)
set(LIBRARIES ${LIBRARIES} gomp pthread)
else()
set(LIBRARIES ${LIBRARIES} ${OpenMP_CXX_FLAGS})
endif()
else(OPENMP_FOUND)
message(FATAL_ERROR "Your compiler does not support OpenMP or OpenMP was not found"
"note that disabling OpenMP will incur significant performance penalty !\n"
"Use -DCMAKE_CXX_COMPILER=PATH and -DCMAKE_C_COMPILER=PATH to specify the compiler path."
"(find_package(OpenMP) will find OpenMP only if both are set !)\n"
"Use -DOPENMP=OFF to not use it.\n"
"(suitable Homebrew compiler package: llvm)"
"(suitable Homebrew library package: libomp)")
endif(OPENMP_FOUND)
else(OPENMP)
# we need to define those semaphore posix symbols, do it with threads libs
find_package(Threads)
if(THREADS_FOUND)
set(LIBRARIES ${LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
else(THREADS_FOUND)
check_library_exists(rt sem_unlink "" HAVE_RT)
if(HAVE_RT)
set(LIBRARIES ${LIBRARIES} rt)
else(HAVE_RT)
message(FATAL_ERROR "Missing a POSIX semaphore symbols (rt or threads).\n")
endif(HAVE_RT)
endif(THREADS_FOUND)
endif(OPENMP)
# GSL MANDATORY
# -DGSLDIR=DIR
set(CMAKE_PREFIX_PATH ${GSLDIR})
find_package(GSL QUIET)
set(HAVE_LIBGSL ${GSL_FOUND})
set(HAVE_LIBGSLCBLAS ${GSL_FOUND})
if(GSL_FOUND)
set(LIBRARIES ${LIBRARIES} ${GSL_LIBRARIES})
include_directories(${GSL_INCLUDE_DIR})
else(GSL_FOUND)
message(FATAL_ERROR "Gnu Scientific library (1.7 or higher) and libgslcblas are mandatory.\n"
"Use -DGSLDIR=DIR to specify the gsl directory tree.\n"
"(suitable Debian/Ubuntu package: libgsl0-dev)\n"
"(suitable Fedora package: gsl-devel)")
endif(GSL_FOUND)
if(UNIX)
set(CMAKE_PREFIX_PATH ${RPCDIR})
find_package(RPC QUIET)
set(HAVE_RPC ${RPC_FOUND})
if(RPC_FOUND)
set(LIBRARIES ${LIBRARIES} ${RPC_LIBRARIES})
include_directories(${RPC_INCLUDE_DIR})
else(RPC_FOUND)
message(FATAL_ERROR "RPC support is mandatory.\n"
"Note that SunRPC has been removed in glibc-2.26 and later, "
"while being optional in earlier versions. Consider using the "
"recommended and more modern libtirpc instead.\n"
"Use -DRPCDIR=DIR to specify the rpc directory tree.\n")
endif(RPC_FOUND)
elseif (WIN32 AND NOT CYGWIN)
set(CMAKE_PREFIX_PATH ${XDRDIR})
find_package(Xdr)
set(HAVE_LIBXDR ${XDR_FOUND})
if(XDR_FOUND)
set(LIBRARIES ${LIBRARIES} ${XDR_LIBRARY})
include_directories(${XDR_INCLUDE_DIR})
else(XDR_FOUND)
message(FATAL_ERROR "bsd-xdr library is required but was not found.\n"
"Use -DXDRDIR=DIR to specify the bsd-xdr directory tree.")
endif(XDR_FOUND)
set(CMAKE_PREFIX_PATH ${PCREDIR})
find_package(PCRE)
set(HAVE_LIBPCRE ${PCRE_FOUND})
if(PCRE_FOUND)
set(LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES})
include_directories(${PCRE_INCLUDE_DIR})
else(PCRE_FOUND)
message(FATAL_ERROR "pcre library is required but was not found.\n"
"Use -DPCREDIR=DIR to specify the pcre directory tree.")
endif(PCRE_FOUND)
LINK_LIBRARIES(shlwapi)
endif()
# PLplot MANDATORY
# -DOLDPLPLOT=ON|OFF
# -DPLPLOTDIR=DIR
set(HAVE_OLDPLPLOT ${OLDPLPLOT})
set(CMAKE_PREFIX_PATH ${PLPLOTDIR})
find_package(Plplot QUIET)
set(HAVE_LIBPLPLOTCXXD ${PLPLOT_FOUND})
if(PLPLOT_FOUND)
set(LIBRARIES ${LIBRARIES} ${PLPLOT_LIBRARIES})
include_directories(${PLPLOT_INCLUDE_DIR})
else(PLPLOT_FOUND)
message(FATAL_ERROR "plplot library is required but was not found.\n"
"Use -DPLPLOTDIR=DIR to specify the plplot directory tree.\n"
"(suitable Debian/Ubuntu packages: libplplot-dev, [plplot9-driver-xwin])"
"(suitable Fedora package: plplot-devel)")
endif(PLPLOT_FOUND)
if(PLPLOT_FOUND)
message(STATUS "Warning, if you have plplot version > 5.11 and wxWidgets enabled, please read carefully file README")
check_library_exists("${PLPLOT_LIBRARIES}" c_plslabelfunc "" HAVE_PLPLOT_SLABELFUNC)
if(HAVE_PLPLOT_SLABELFUNC)
set(HAVE_PLPLOT_SLABELFUNC 1)
else(HAVE_PLPLOT_SLABELFUNC)
message(STATUS "warning, due to old plplot library, [XYZ]TICKFORMAT option for plot axis will not be supported.\n"
"you should upgrade to plplot version > 5.9.6")
endif(HAVE_PLPLOT_SLABELFUNC)
set(CMAKE_REQUIRED_INCLUDES "${PLPLOT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${PLPLOT_LIBRARIES}")
#the following does not work with clang (???)
check_library_exists("${PLPLOT_LIBRARIES}" c_plwidth "" HAVE_PLPLOT_WIDTH)
#give it a 2nd try...
if(NOT HAVE_PLPLOT_WIDTH)
check_cxx_source_compiles("#include <plplot/plstream.h>
int main(int argc, char **argv) {
plstream *p = new plstream();
PLFLT w = 0.5;
p->width(w);
}" HAVE_PLPLOT_WIDTH)
if(HAVE_PLPLOT_WIDTH)
set(HAVE_PLPLOT_WIDTH 1)
endif(HAVE_PLPLOT_WIDTH)
endif(NOT HAVE_PLPLOT_WIDTH)
check_library_exists("${PLPLOT_LIBRARIES}" plstrl "" PLPLOT_PRIVATE_NOT_HIDDEN)
if(PLPLOT_PRIVATE_NOT_HIDDEN)
set(PLPLOT_PRIVATE_NOT_HIDDEN 1)
else(PLPLOT_PRIVATE_NOT_HIDDEN)
message(STATUS "Using a plplot library without private functions - workarounds will be used.")
endif(PLPLOT_PRIVATE_NOT_HIDDEN)
check_cxx_source_compiles("#include <plplot/plstream.h>
int main(){PLINT n; PLFLT x,y;plcallback::fill(n,&x,&y);}" PLPLOT_HAS_PLCALLBACK)
if(PLPLOT_HAS_PLCALLBACK)
set(PLPLOT_HAS_PLCALLBACK 1)
endif(PLPLOT_HAS_PLCALLBACK)
endif(PLPLOT_FOUND)
# GraphicsMagick (GM) is an alternative to the classical ImageMagick Lib (IM).
# It was experienced that GM was more stable in time than IM
#
# -DGRAPHICSMAGICK=ON|OFF
# -DGRAPHICSMAGICKDIR=DIR
#
if(GRAPHICSMAGICK)
set(CMAKE_PREFIX_PATH ${GRAPHICSMAGICKDIR})
find_package(GraphicsMagick QUIET)
set(USE_MAGICK ${GRAPHICSMAGICK_FOUND})
if(GRAPHICSMAGICK_FOUND)
include_directories(${GRAPHICSMAGICK_INCLUDE_DIR})
set(LIBRARIES ${LIBRARIES} ${GRAPHICSMAGICK_LIBRARIES})
else(GRAPHICSMAGICK_FOUND)
message( STATUS
"GRAPHICSMAGICK is strongly suggested but was not found.
Use -DGRAPHICSMAGICKDIR=DIR to specify the GraphicsMagick directory tree.
Use -DGRAPHICSMAGICK=OFF to not use it.
(suitable Fedora package: GraphicsMagick-c++-devel
Debian/Ubuntu package: libgraphicsmagick++1-dev)\n")
message( STATUS
"Looking for ImageMagick")
endif(GRAPHICSMAGICK_FOUND)
endif(GRAPHICSMAGICK)
#
# if GM found, we do not look for IM
#
if(GRAPHICSMAGICK_FOUND)
if (MAGICK)
message(STATUS "INFO: We prefer to use GraphicsMagick than ImageMagick")
set(MAGICK OFF)
endif(MAGICK)
endif(GRAPHICSMAGICK_FOUND)
# ImageMagick
# -DMAGICK=ON|OFF
# -DMAGICKDIR=DIR
if(MAGICK)
set(CMAKE_PREFIX_PATH ${MAGICKDIR})
find_package(ImageMagick QUIET COMPONENTS Magick++ MagickWand MagickCore)
mark_as_advanced(ImageMagick_EXECUTABLE_DIR ImageMagick_Magick++_INCLUDE_DIR ImageMagick_Magick++_LIBRARY
ImageMagick_MagickCore_INCLUDE_DIR ImageMagick_MagickCore_LIBRARY ImageMagick_MagickWand_INCLUDE_DIR ImageMagick_MagickWand_LIBRARY)
set(USE_MAGICK ${ImageMagick_FOUND})
if(ImageMagick_FOUND)
find_program(MAGICKXXCONFIG Magick++-config)
if(MAGICKXXCONFIG)
execute_process(COMMAND ${MAGICKXXCONFIG} "--libs" OUTPUT_VARIABLE MAGICKXXCONFIGLIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LIBRARIES ${LIBRARIES} ${MAGICKXXCONFIGLIBS})
else(MAGICKXXCONFIG)
message(FATAL_ERROR "ImageMagick is required but was not found (Magick++-config).\n"
"Use -DMAGICKDIR=DIR to specify the ImageMagick directory.\n"
"Use -DMAGICK=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libmagick++-dev)\n"
"(suitable Fedora package: ImageMagick-c++-devel)")
endif(MAGICKXXCONFIG)
set(LIBRARIES ${LIBRARIES} ${ImageMagick_LIBRARIES})
include_directories(${ImageMagick_INCLUDE_DIRS})
set(MAGICK_LIBRARIES ${ImageMagick_LIBRARIES})
else(ImageMagick_FOUND)
message(FATAL_ERROR "ImageMagick is required but was not found.\n"
"Use -DMAGICKDIR=DIR to specify the ImageMagick directory.\n"
"Use -DMAGICK=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libmagick++-dev)\n"
"(suitable Fedora package: ImageMagick-c++-devel)")
endif(ImageMagick_FOUND)
endif(MAGICK)
# if GM or IM activated, we check whether Plplot is OK for that
if(USE_MAGICK AND NOT WIN32)
check_library_exists("${PLPLOT_LIBRARIES}" plGetDrvDir "" HAVE_PLGETDRVDIR)
if(HAVE_PLGETDRVDIR)
message(STATUS "WARNING: Dynamic drivers may have to be disabled in plplot.\n"
"To make plplot work with ImageMagick:\n"
"use -DENABLE_DYNDRIVERS=OFF cmake option when compiling plplot or\n"
"use -DMAGICK=OFF here to not use ImageMagick in GDL.")
endif(HAVE_PLGETDRVDIR)
endif(USE_MAGICK AND NOT WIN32)
# wxWidgets
# -DWXWIDGETS=ON|OFF
# -DWXWIDGETSDIR=DIR
set(wxWidgets_USE_DEBUG OFF) # Use release build
if(WXWIDGETS)
#
# we check whether plplot was compiled within wxwidgets
#
# AC 2015/04/07 this is not working well, just on few cases :(
# check_library_exists("${PLPLOT_LIBRARIES}" plD_DEVICE_INFO_wxwidgets "" HAVE_PLPLOT_WXWIDGETS)
# if(NOT HAVE_PLPLOT_WXWIDGETS)
# message(FATAL_ERROR "wxWidgets are required but PLplot wxWidgets NOT found.\n"
# "If -DWXWIDGETS=ON (default) then PLplot must have be compiled with -DPLD_wxwidgets=ON\n"
# "use -DWXWIDGETS=OFF to not use wxWidgets since it is not available here in PLplot")
# endif(NOT HAVE_PLPLOT_WXWIDGETS)
#
set(CMAKE_PREFIX_PATH ${WXWIDGETSDIR})
find_package(wxWidgets COMPONENTS base core adv)
set(HAVE_LIBWXWIDGETS ${wxWidgets_FOUND})
if(wxWidgets_FOUND)
set(LIBRARIES ${LIBRARIES} ${wxWidgets_LIBRARIES})
set(LINK_DIRECTORIES ${LINK_DIRECTORIES} ${wxWidgets_LIBRARY_DIRS})
foreach(WXDEF ${wxWidgets_DEFINITIONS})
add_definitions(-D${WXDEF})
endforeach(WXDEF ${wxWidgets_DEFINITIONS})
include_directories(${wxWidgets_INCLUDE_DIRS})
else(wxWidgets_FOUND)
message(FATAL_ERROR "wxWidgets are required but were not found.\n"
"Use -DWXWIDGETSDIR=DIR to specify the wxWidgets directory tree.\n"
"Use -DWXWIDGETS=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libwxgtk2.8-dev)\n"
"(suitable Fedora package: wxGTK-devel)")
endif(wxWidgets_FOUND)
endif(WXWIDGETS)
# libtiff
# -DTIFF=ON|OFF
# -DTIFFDIR=DIR
if(TIFF)
set(CMAKE_PREFIX_PATH ${TIFFDIR})
find_package(TIFF 4.0.3 QUIET)
set(USE_TIFF ${TIFF_FOUND})
if(TIFF_FOUND)
include_directories(${TIFF_INCLUDE_DIR})
set(LIBRARIES ${LIBRARIES} ${TIFF_LIBRARIES})
else(TIFF_FOUND)
message(FATAL_ERROR
"libtiff v4.0.3 or newer is required for TIFF support but was not found.\n"
"Use -DTIFFDIR=DIR to specify the libtiff directory tree.\n"
"Use -DTIFF=OFF to not use it.")
endif(TIFF_FOUND)
endif(TIFF)
# libgeotiff
# -DGEOTIFF=ON|OFF
# -DGEOTIFFDIR=DIR
if(GEOTIFF AND USE_TIFF)
set(CMAKE_PREFIX_PATH ${GEOTIFFDIR})
find_package(GeoTIFF QUIET)
set(USE_GEOTIFF ${GEOTIFF_FOUND})
if(GEOTIFF_FOUND)
include_directories(${GEOTIFF_INCLUDE_DIR})
set(LIBRARIES ${LIBRARIES} ${GEOTIFF_LIBRARIES})
else(GEOTIFF_FOUND)
message(FATAL_ERROR
"libgeotiff is required for GeoTIFF support but was not found.\n"
"Use -DGEOTIFFDIR=DIR to specify the libgeotiff directory tree.\n"
"Use -DGEOTIFF=OFF to not use it.")
endif(GEOTIFF_FOUND)
endif(GEOTIFF AND USE_TIFF)
# netCDF
# -DNETCDF=ON|OFF
# -DNETCDFDIR=DIR
if(NETCDF)
set(CMAKE_PREFIX_PATH ${NETCDFDIR})
find_package(NetCDF QUIET)
if(NETCDF_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${NETCDF_INCLUDE_DIRS})
check_include_file_cxx(netcdf.h HAVE_NETCDF_H)
if(HAVE_NETCDF_H)
set(LIBRARIES ${LIBRARIES} ${NETCDF_LIBRARIES})
set(LINK_DIRECTORIES ${LINK_DIRECTORIES} ${NETCDF_LIBRARY_DIRS})
include_directories(${NETCDF_INCLUDE_DIRS})
set(USE_NETCDF 1)
else(HAVE_NETCDF_H)
message(FATAL_ERROR "NetCDF installation seems not to be usable.\n"
"This suggests a conflicting netCDF-HDF4 installation e.g.\n"
"- Uninstalling HDF4 after installation of NetCDF.\n"
"- Installing NetCDF before HDF4.")
endif(HAVE_NETCDF_H)
set(CMAKE_REQUIRED_INCLUDES)
#
# are extensions NetCDF-4 available ??
check_library_exists("${NETCDF_LIBRARIES}" nc_inq_grps "" HAVE_NETCDF4)
if(HAVE_NETCDF4)
set(USE_NETCDF4 1)
else(HAVE_NETCDF4)
message(STATUS "warning, you don't have NetCDF-4 version"
"some new NetCDF capabilities in NetCDF-4 (related to Groups) will not be usable")
endif(HAVE_NETCDF4)
else(NETCDF_FOUND)
message(FATAL_ERROR "NetCDF version 3.5.1 or later is required but was not found.\n"
"Use -DNETCDFDIR=DIR to specify the netcdf directory tree.\n"
"Use -DNETCDF=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libnetcdf-dev)\n"
"(suitable Fedora package: netcdf-devel)")
endif(NETCDF_FOUND)
endif(NETCDF)
# hdf4
# -DHDF=ON|OFF
# -DHDFDIR=DIR
if(HDF)
set(CMAKE_PREFIX_PATH ${HDFDIR} ${JPEGDIR} ${SZIPDIR})
find_package(HDF QUIET)
set(USE_HDF ${HDF_FOUND})
if(HDF_FOUND)
if(NETCDF)
set(CMAKE_REQUIRED_LIBRARIES ${HDF_EXTRA_LIBRARIES})
check_library_exists("${HDF_LIBRARIES};${RPC_LIBRARIES}" sd_nccreate "" SD_NCCREATE)
if(NOT SD_NCCREATE)
message(FATAL_ERROR "HDF4 needs to be configured with the --disable-netcdf option "
"in order to be used with the original netCDF library.")
endif(NOT SD_NCCREATE)
set(CMAKE_REQUIRED_LIBRARIES)
endif(NETCDF)
set(HDF_LIBRARIES ${HDF_LIBRARIES} ${HDF_EXTRA_LIBRARIES})
set(LIBRARIES ${LIBRARIES} ${HDF_LIBRARIES})
include_directories(${HDF_INCLUDE_DIR})
else(HDF_FOUND)
message(FATAL_ERROR "HDF4 libraries were not found.\n"
"Use -DHDFDIR=DIR to specify the HDF directory tree.\n"
"Use -DHDF=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libhdf4-alt-dev)\n"
"You can use -DJPEGDIR=DIR to specify the JPEG directory tree. "
"You can also use -DSZIPDIR=DIR to specify SZip directory tree if "
"HDF was compiled with SZip support.")
endif(HDF_FOUND)
endif(HDF)
# hdf5
# -DHDF5=ON|OFF
# -DHDF5DIR=DIR
if(HDF5)
set(CMAKE_PREFIX_PATH ${HDF5DIR} ${SZIPDIR})
find_package(HDF5 QUIET)
set(USE_HDF5 ${HDF5_FOUND})
if(HDF5_FOUND)
set(LIBRARIES ${LIBRARIES} ${HDF5_LIBRARIES})
include_directories(${HDF5_INCLUDE_DIRS})
find_package(MPI QUIET)
if(MPI_FOUND)
include_directories(${MPI_INCLUDE_PATH})
set(LIBRARIES ${LIBRARIES} ${MPI_LIBRARIES})
endif(MPI_FOUND)
else(HDF5_FOUND)
message(FATAL_ERROR "HDF version 5 is required but was not found.\n"
"Use -DHDF5DIR=DIR to specify the HDF5 directory tree.\n"
"Use -DHDF5=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libhdf5-serial-dev)\n"
"(suitable Fedora package: hdf5-devel)")
endif(HDF5_FOUND)
endif(HDF5)
# fftw
# -DFFTW=ON|OFF
# -DFFTWDIR=DIR
if(FFTW)
set(CMAKE_PREFIX_PATH ${FFTWDIR})
find_package(FFTW QUIET)
set(USE_FFTW ${FFTW_FOUND})
if(FFTW_FOUND)
set(LIBRARIES ${LIBRARIES} ${FFTW_LIBRARIES})
include_directories(${FFTW_INCLUDE_DIR})
else(FFTW_FOUND)
message(FATAL_ERROR "FFTW3 is required but was not found.\n"
"Use -DFFTWDIR=DIR to specify the FFTW directory tree.\n"
"Use -DFFTW=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libfftw3-dev)\n"
"(suitable Fedora package: fftw-devel)")
endif(FFTW_FOUND)
endif(FFTW)
# libproj4
# -DLIBPROJ4=ON|OFF
# -DLIBPROJ4DIR=DIR
if(LIBPROJ4)
set(CMAKE_PREFIX_PATH ${LIBPROJ4DIR})
find_package(Libproj4)
if(LIBPROJ4_FOUND)
else(LIBPROJ4_FOUND)
find_package(Libproj4new)
endif(LIBPROJ4_FOUND)
if(LIBPROJ4_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${LIBPROJ4_LIBRARIES} ${GSL_LIBRARIES} m)
check_library_exists("${LIBPROJ4_LIBRARIES}" pj_init "" USE_LIBPROJ4_NEW)
if(USE_LIBPROJ4_NEW)
# check_library_exists("${LIBPROJ4_LIBRARIES}" proj_init "" USE_LIBPROJ4)
# if(USE_LIBPROJ4)
# define USE_LIB_PROJ4 in any case
set(USE_LIBPROJ4 1)
else(USE_LIBPROJ4_NEW)
check_library_exists("${LIBPROJ4_LIBRARIES}" proj_init "" USE_LIBPROJ4)
if(NOT USE_LIBPROJ4)
# else(USE_LIBPROJ4)
# check_library_exists("${LIBPROJ4_LIBRARIES}" pj_init "" USE_LIBPROJ4_NEW)
# if(NOT USE_LIBPROJ4_NEW)
message(FATAL_ERROR "Libproj4 is required but was not found.\n"
"Use -DLIBPROJ4DIR=DIR to specify the Libproj4 directory tree.\n"
"Use -DLIBPRJ4=OFF to not use it.")
endif(NOT USE_LIBPROJ4)
endif(USE_LIBPROJ4_NEW)
# endif(NOT USE_LIBPROJ4_NEW)
# endif(USE_LIBPROJ4)
include_directories(${LIBPROJ4_INCLUDE_DIR})
set(LIBRARIES ${LIBRARIES} ${LIBPROJ4_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES)
else(LIBPROJ4_FOUND)
message(FATAL_ERROR "Libproj4 is required but was not found.\n"
"Use -DLIBPROJ4DIR=DIR to specify the Libproj4 directory tree.\n"
"Use -DLIBPRJ4=OFF to not use it.")
endif(LIBPROJ4_FOUND)
endif(LIBPROJ4)
# mpich (experimental)
# -DMPICH=ON|OFF
# -DMPICHDIR=DIR
if(MPICH)
set(CMAKE_PREFIX_PATH ${MPICHDIR})
find_package(MPI QUIET)
set(USE_MPI ${MPI_FOUND})
if(MPI_FOUND)
include_directories(${MPI_INCLUDE_PATH})
set(LIBRARIES ${LIBRARIES} ${MPI_LIBRARIES})
else(MPI_FOUND)
message(FATAL_ERROR "MPICH is required but was not found.\n"
"Use -DMPICHDIR=DIR to specify the MPICH directory tree.\n"
"Use -DMPICH=OFF to not use it.")
endif(MPI_FOUND)
endif(MPICH)
# python
# -DPYTHON=ON|OFF
# -DPYTHON_MODULE
# -DPYTHONDIR=DIR
# -DPYTHONVERSION=VERSION
if(PYTHON OR PYTHON_MODULE)
if(PYTHON)
set(PYTHONMSG "Use -DPYTHON=OFF to disable Python support.\n")
endif(PYTHON)
if(PYTHON_MODULE)
set(PYTHON_MODULEMSG "Use -DPYTHON_MODULE=OFF to disable Python module.\n")
endif(PYTHON_MODULE)
if(PYTHONDIR)
find_library(PYTHONLIBS
NAMES python${PYTHONVERSION}
PATHS ${PYTHONDIR}
PATH_SUFFIXES lib lib/python${PYTHONVERSION}/config
NO_DEFAULT_PATH NO_CMAKE_PATH
)
string(COMPARE NOTEQUAL "${PYTHONLIBS}" "PYTHONLIBS-NOTFOUND" PYTHONLIBS_FOUND)
if (NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "Python libraries not found in ${PYTHONDIR}.")
else()
set(PYTHON_LIBRARIES "${PYTHONLIBS}")
message("-- Found Python libs: ${PYTHONLIBS}")
endif()
find_path(PYTHON_INCLUDE_DIRS
NAMES Python.h
PATHS ${PYTHONDIR}
PATH_SUFFIXES include include/python${PYTHONVERSION}
NO_DEFAULT_PATH NO_CMAKE_PATH
)
string(COMPARE NOTEQUAL "${PYTHONLIBS}" "PYTHON_INCLUDE_DIRS-NOTFOUND" PYTHONHEADERS_FOUND)
if (PYTHONHEADERS_FOUND)
message("-- Found Python headers: ${PYTHON_INCLUDE_DIRS}")
set(PYTHON_INCLUDES "${PYTHON_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "Python headers not found in ${PYTHONDIR}.")
endif()
find_program(PYTHON_EXECUTABLE NAMES python${PYTHONVERSION} PATHS ${PYTHONDIR} PATH_SUFFIXES bin NO_DEFAULT_PATH NO_CMAKE_PATH)
string(COMPARE NOTEQUAL "${PYTHON_EXECUTABLE}" "PYTHON_EXECUTABLE-NOTFOUND" PYTHON_EXECUTABLE_FOUND)
if(NOT PYTHON_EXECUTABLE_FOUND)
message(FATAL_ERROR "Python executable not found in ${PYTHONDIR}.")
else()
message("-- Found Python executable: ${PYTHON_EXECUTABLE}")
endif()
else()
if(NOT PYTHONVERSION)
set(PYTHONVERSION 2)
endif()
find_package(PythonInterp)
find_package(PythonLibs ${PYTHONVERSION})
if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING)
message(STATUS "PYTHON_EXECUTABLE: " ${PYTHON_EXECUTABLE})
message(STATUS "PYTHON_VERSION: " ${PYTHON_VERSION_STRING})
message(STATUS "PYTHON_LIBRARIES: " ${PYTHON_LIBRARIES})
message(STATUS "PYTHONLIBS_VERSION: " ${PYTHONLIBS_VERSION_STRING})
message(FATAL_ERROR "Version mismatch between python interpreter and libraries")
endif()
endif()
set(USE_PYTHON ${PYTHONLIBS_FOUND})
if(PYTHONLIBS_FOUND)
find_package(Numpy QUIET)
if(NOT PYTHON_NUMPY_FOUND)
message(FATAL_ERROR "Python numpy package was not found.\n"
"${PYTHONMSG} ${PYTHON_MODULEMSG}")
endif(NOT PYTHON_NUMPY_FOUND)
set(LIBRARIES ${LIBRARIES} ${PYTHON_LIBRARIES})
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_NUMPY_INCLUDE_DIR})
else(PYTHONLIBS_FOUND)
message(FATAL_ERROR "Python is required but was not found.\n"
"Use -DPYTHONDIR=DIR to specify the Python directory tree.\n"
"Use -DPYTHONVERSION=VERSION to help searching for the right version.\n"
"(suitable Debian/Ubuntu package: python-dev)\n"
"(suitable Fedora package: python-devel)\n"
"${PYTHONMSG} ${PYTHON_MODULEMSG}")
endif(PYTHONLIBS_FOUND)
endif(PYTHON OR PYTHON_MODULE)
# udunits
# -DUDUNITS=ON|OFF
# -DUDUNITSDIR=DIR
if(UDUNITS)
set(CMAKE_PREFIX_PATH ${UDUNITSDIR})
find_package(Udunits QUIET)
set(USE_UDUNITS ${UDUNITS_FOUND})
if(UDUNITS_FOUND)
set(LIBRARIES ${LIBRARIES} ${UDUNITS_LIBRARIES})
include_directories(${UDUNITS_INCLUDE_DIR})
else(UDUNITS_FOUND)
message(FATAL_ERROR "UDUNITS-2 is required but was not found.\n"
"Use -DUDUNITSDIR=DIR to specify the Udunits directory tree.\n"
"Use -DUDUNITS=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: libudunits2-dev)\n"
"(suitable Fedora package: udunits2-devel)")
endif(UDUNITS_FOUND)
endif(UDUNITS)
# eigen3
# -DEIGEN3=ON|OFF
# -DEIGEN3DIR=DIR
if(EIGEN3)
# cleaning Cache ...
if (EIGEN3DIR)
unset(EIGEN3_INCLUDE_DIR CACHE)
endif(EIGEN3DIR)
#
set(CMAKE_PREFIX_PATH ${EIGEN3DIR})
find_package(Eigen3 3.2.4 QUIET)
if(EIGEN3_TOO_OLD)
# on iCore 3/5/7 we must have Eigen >=3.2.4 to avoid fatal error in "test_matrix_multiply.pro"
message(FATAL_ERROR "\nEIGEN3 is required but the version found is TOO OLD."
" Please download a recent version (>=3.2.4) in a local directory."
" Then use -DEIGEN3DIR=DIR to specify the Eigen3 local directory tree.\n")
else(EIGEN3_TOO_OLD)
set(USE_EIGEN ${EIGEN3_FOUND})
if(EIGEN3_FOUND)
include_directories(${EIGEN3_INCLUDE_DIR})
if(MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-ipa-cp-clone")
endif(MINGW)
else(EIGEN3_FOUND)
message(FATAL_ERROR "EIGEN3 is required but was not found.\n"
"Use -DEIGEN3DIR=DIR to specify the Eigen3 directory tree.\n"
"Use -DEIGEN3=OFF to not use it.\n"
"(suitable Fedora package: eigen3-devel)\n"
"(suitable Debian/Ubuntu package: libeigen3-dev)")
endif(EIGEN3_FOUND)
endif(EIGEN3_TOO_OLD)
endif(EIGEN3)
# pslib
# -DPSLIB=ON|OFF
# -DPSLIBDIR=DIR
if(PSLIB)
set(CMAKE_PREFIX_PATH ${PSLIBDIR})
find_package(libps QUIET)
set(USE_PSLIB ${PSLIB_FOUND})
if(PSLIB_FOUND)
set(LIBRARIES ${LIBRARIES} ${PSLIB_LIBRARIES})
#set(LINK_DIRECTORIES ${LINK_DIRECTORIES} ${PSLIB_LIBRARY_DIRS})
include_directories(${PSLIB_INCLUDE_DIR})
else(PSLIB_FOUND)
message(FATAL_ERROR "pslib is required but was not found.\n"
"Use -DPSLIBDIR=DIR to specify the pslib directory tree.\n"
"Use -DPSLIB=OFF to not use it.\n"
"(suitable Debian/Ubuntu package: pslib-dev)\n"
"(suitable Fedora package: pslib-devel)")
endif(PSLIB_FOUND)
endif(PSLIB)
# grib
# -DGRIB=ON|OFF
# -DGRIBDIR=DIR
if(GRIB)
set(CMAKE_PREFIX_PATH ${GRIBDIR} ${JASPERDIR} ${JPEGDIR})
find_package(Grib QUIET)
set(USE_GRIB ${GRIB_FOUND})
if(GRIB_FOUND)
set(LIBRARIES ${LIBRARIES} ${GRIB_LIBRARIES})
include_directories(${GRIB_INCLUDE_DIR})
else(GRIB_FOUND)
message(FATAL_ERROR "ECMWF ecCodes or GRIB API is required but was not found.\n"
"Use -DGRIBDIR=DIR to specify the ecCodes or GRIB API directory tree.\n"
"Use -DGRIB=OFF to not use it.\n"
"Use -DJASPERDIR=DIR and|or -DJPEGDIR=DIR to specify "
"the directory trees of JasPer and openJPEG libraries.\n"
"(suitable Debian/Ubuntu package: libeccodes-dev or libgrib-api-dev)\n"
"(suitable Fedora package: grib_api-devel)\n"
"(suitable Homebrew package: eccodes)\n")
endif(GRIB_FOUND)
endif(GRIB)
# QHULL IS NOT NEEDED YET!
# # Qhull (enable TRIANGULATE and QHULL commands)
# # -DQHULL=ON|OFF
# # -DQHULLDIR=DIR
# if(QHULL)
# set(CMAKE_PREFIX_PATH ${QHULLDIR})
# find_package(QHULL QUIET)
# set(PL_HAVE_QHULL ${QHULL_FOUND})
# if(QHULL_FOUND)
# set(LIBRARIES ${LIBRARIES} ${QHULL_LIBRARIES})
# include_directories(${QHULL_INCLUDE_DIR})
# else(QHULL_FOUND)
# message(FATAL_ERROR "QHULL is required but was not found.\n"
# "Use -DQHULLDIR=DIR to specify the QHULL directory tree.\n"
# "Use -DQHULL=OFF to not use it.\n"
# "(suitable Fedora package: libqhull-devel)")
# endif(QHULL_FOUND)
# endif(QHULL)
# GLPK for Simplex ( Linear programming )
# GLPK (enable SIMPLEX command)
# -DGLPK=ON|OFF