-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
717 lines (632 loc) · 23.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
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
INCLUDE (CheckLibraryExists)
INCLUDE (CheckTypeSize)
INCLUDE (CheckIncludeFile)
INCLUDE (CheckFunctionExists)
INCLUDE (FindPkgConfig)
# Apparently buggy:
# INCLUDE (FindThreads)
SET (HAVE_MATLAB_GEQ_2007A TRUE CACHE BOOL "Have Matlab >= 2007a? Also see BUILD_WITH_GCC_3_3")
SET (BUILD_WITH_GCC_3_3 FALSE CACHE BOOL "Enable/disable gcc-3.3 (for matlab < 2007a)")
SET (BUILD_WITH_GCC_3_4 FALSE CACHE BOOL "Enable/disable gcc-3.4 (for matlab >= 2006b)")
# SET (BUILD_GUILE_MODULE FALSE CACHE BOOL "Enable/disable building the guile module")
SET (BUILD_PYTHON_MODULE FALSE CACHE BOOL "Enable/disable building the golib python extension")
SET (BUILD_PYTHON_EMBED FALSE CACHE BOOL "Enable/disable python embedding module (Gopython)")
SET (PYTHON_INSTALL_DIR $ENV{HOME}/.python CACHE PATH "Directory which holds python modules -- often pointed to by the environment variable PYTHONPATH")
SET (BUILD_MATLAB_MODULE FALSE CACHE BOOL "Enable/disable building the matlab module (Gomatlab)")
SET (BUILD_MATLAB_MEX FALSE CACHE BOOL "Enable/disable building the matlab mex modules")
SET (BUILD_GUI_MODULE FALSE CACHE BOOL "Enable/disable building the GUI module (Gogui)")
SET (BUILD_GUI_MODULE_OPENGL FALSE CACHE BOOL "Enable/disable building the OpenGL widget (needs Gogl)")
SET (BUILD_GL_MODULE FALSE CACHE BOOL "Enable/disable building the OpenGL module (Gogl)")
SET (LINK_GFORTRAN FALSE CACHE BOOL "Link gfortran library (for atlas 3.6)")
IF (HAVE_MATLAB_GEQ_2007A)
ADD_DEFINITIONS (-DHAVE_MATLAB_GEQ_2007A)
SET (HAVE_MATLAB_GEQ_2007A 1)
ENDIF (HAVE_MATLAB_GEQ_2007A)
set (MODULE_THREADS TRUE CACHE BOOL "Build threading classes")
set (MODULE_CAIROPLOT FALSE CACHE BOOL "Build cairo plotting classes")
set (MODULE_NETWORK FALSE CACHE BOOL "Build networking")
set (MODULE_GRIDS TRUE CACHE BOOL "Build classes for grids / signal3d")
set (MODULE_MATH TRUE CACHE BOOL "Build math classes")
set (MODULE_CONTAINERS TRUE CACHE BOOL "Build containers")
set (MODULE_VIDEO FALSE CACHE BOOL "Build video")
set (MODULE_GNUPLOT TRUE CACHE BOOL "Build support for calling gnuplot")
PROJECT (Go)
SET (TARGETNAME Go)
set (CMAKE_FIND_FRAMEWORK FIRST)
if (APPLE)
set (OSX 1)
endif (APPLE)
## Aufteilung:
# thread: Thread-Klasse
# data/misc/base: Datenstrukturen, Objekte, basic file io, log, object messages, exceptions, types, ...
# math: Mathematik-Klassen und -Funktionen (keine goSignal!)
# signal: goSignal3D und alle Funktionen Signalverarbeitungsklassen;
# Bilder laden / speichern
# system: Process, Directory, ...
# plot: Plotting
# gui
# gl
# matlab
SET (BASE_SOURCES
# src/math/mean.cpp
# src/math/variance.cpp
src/misc/goargs.cpp
src/misc/goofffile.cpp
src/misc/godate.cc # DEPRECATE
src/misc/gofileio.cc
# src/misc/gostatusobject.cc # not in windows!
src/misc/gotransferfunction.cc # DEPRECATE -- apparently only used in the Diplomarbeit renderer
# src/misc/goplot.cpp # not in windows!
# src/misc/govideocapture.cpp # not in windows!
# src/network/goconnection.cc # not in windows!
# src/network/gonetobject.cc # not in windows!
# src/network/gonetwork.cc # not in windows!
# src/network/goserver.cc # not in windows!
# src/signal/gosignal3dgenericiterator.cpp
# src/system/godirectory.cc # not in windows!
# src/system/goprocess.cc # not in windows!
src/system/goenvironment.cpp
# src/thread/gosynchronized.cc # not in windows!
# src/math/gonubs.cpp
### For general SVD:
## BLAS part:
#src/clapack/blas/lsame.c
#src/clapack/blas/xerbla.c
#src/clapack/blas/s_copy.c ## in f2c
#src/clapack/blas/s_cmp.c ## in f2c
)
## Base and stuff
SET (BASE_SOURCES ${BASE_SOURCES}
src/misc/goobjectmessage.cc
src/misc/goglobal.cpp
src/misc/golog.cpp
src/misc/goobjectbase.cc
src/misc/goexception.cc
src/nifty/gorandom.cc
src/types/gotype.cpp)
SET (VIDEO_SOURCES
src/misc/govideocapture.cpp # not in windows!
)
set (GNUPLOT_SOURCES
src/plot/gognuplot.cpp # not plotting in windows!
src/plot/gosingleplot.cpp
src/plot/gomultiplotter.cpp
src/plot/gnuplot.cpp # not in windows!
src/plot/gnuplot_helperfunctions.cpp
src/plot/goplotter.cpp
)
IF (NOT WIN32)
SET (BASE_SOURCES ${BASE_SOURCES}
src/misc/goconfigfile.cc # not in windows! (deprecated anyway)
src/misc/goconfigfileaccess.cc
src/system/goprocess.cc # not in windows!
# Can I remove any of these permanently?
src/system/godirectory.cc # not in windows!
# src/misc/gostatusobject.cc # not in windows!
)
ENDIF (NOT WIN32)
## System, threads
SET (THREAD_SOURCES
src/thread/gosynchronized.cc # not in windows!
src/thread/gothreadobject.cc
src/thread/gothread.cc
src/thread/goconsumer.cc # DEPRECATE
src/thread/goproducer.cc # DEPRECATE
)
SET (NETWORK_SOURCES
src/network/goconnection.cc # not in windows!
src/network/gonetobject.cc # not in windows!
src/network/gonetwork.cc # not in windows!
src/network/goserver.cc # not in windows!
)
## Data containers
SET (CONTAINER_SOURCES
src/data/goarrayi.cc
# src/data/golisti.cc
# src/data/goheapi.cc
# src/data/gotreei.cc
src/data/gobtreei.cpp
src/data/goqueuei.cc
src/data/gostring.cc
src/data/gohashtablei.cpp)
## goMath
SET (MATH_SOURCES
src/math/contours.cpp
src/math/goreparam.cpp
src/math/covariance.cpp
src/math/gomanifold.cpp
src/math/lapack.cpp
src/math/planelinecut.cpp
src/math/barycentric.cpp
src/math/gocubicspline.cpp
src/math/gocubicsplinend.cpp
src/math/viewsphere.cpp
src/math/pairwisedistances.cpp
src/math/gosvd.cpp
src/math/goaffinetransform.cpp
src/math/affinematch.cpp
src/math/getknee.cpp
src/math/goresample.cpp
src/math/govector.cpp
src/math/gokmeans.cpp
src/math/gokmeansspatial.cpp
src/math/go3vectori.cc
src/math/go44matrix.cc
src/math/go4vectori.cc
src/math/gomatrix.cpp
src/math/gocomplex.cc
src/math/goposition.cc
src/math/goquaternion.cc
# src/math/golinearalgebra.cc
# src/math/gopdf.cpp
src/math/gogausspdf.cpp
src/math/gopoint.cpp ## Deprecate this, do not use
src/math/gomath.cpp
# src/math/goeigenvalue.cpp
src/math/cg.cpp
src/math/integrate.cpp
src/math/getroots.cpp
src/math/gopointcloud.cpp
src/math/gocurve.cpp
)
set (SEISPACK_SOURCES
src/seispack/bakvec.c
src/seispack/balanc.c
src/seispack/balbak.c
src/seispack/bandr.c
src/seispack/bandv.c
src/seispack/bisect.c
src/seispack/bqr.c
src/seispack/cbabk2.c
src/seispack/cbal.c
src/seispack/cdiv.c
src/seispack/cg.c
src/seispack/ch.c
src/seispack/cinvit.c
src/seispack/combak.c
src/seispack/comhes.c
src/seispack/comlr2.c
src/seispack/comlr.c
src/seispack/comqr2.c
src/seispack/comqr.c
src/seispack/cortb.c
src/seispack/corth.c
src/seispack/csroot.c
src/seispack/elmbak.c
src/seispack/elmhes.c
src/seispack/eltran.c
src/seispack/epslon.c
src/seispack/figi2.c
src/seispack/figi.c
src/seispack/hqr2.c
src/seispack/hqr.c
src/seispack/htrib3.c
src/seispack/htribk.c
src/seispack/htrid3.c
src/seispack/htridi.c
src/seispack/imtql1.c
src/seispack/imtql2.c
src/seispack/imtqlv.c
src/seispack/invit.c
src/seispack/minfit.c
src/seispack/ortbak.c
src/seispack/orthes.c
src/seispack/ortran.c
src/seispack/pythag.c
src/seispack/qzhes.c
src/seispack/qzit.c
src/seispack/qzval.c
src/seispack/qzvec.c
src/seispack/ratqr.c
src/seispack/rebakb.c
src/seispack/rebak.c
src/seispack/reduc2.c
src/seispack/reduc.c
src/seispack/rg.c
src/seispack/rgg.c
src/seispack/rsb.c
src/seispack/rs.c
src/seispack/rsgab.c
src/seispack/rsgba.c
src/seispack/rsg.c
src/seispack/rsm.c
src/seispack/rsp.c
src/seispack/rst.c
src/seispack/rt.c
src/seispack/svd.c
src/seispack/tinvit.c
src/seispack/tql1.c
src/seispack/tql2.c
src/seispack/tqlrat.c
src/seispack/trbak1.c
src/seispack/trbak3.c
src/seispack/tred1.c
src/seispack/tred2.c
src/seispack/tred3.c
src/seispack/tridib.c
src/seispack/tsturm.c
src/seispack/r_sign.c)
## goSignal
SET (SIGNAL_SOURCES
# src/signal/icv.cpp
src/signal/smooth.cpp
src/signal/convert.cpp
src/signal/canny.cpp
src/signal/defaultsize.cpp
src/signal/sobel2d.cpp
## goSignal namespace hinzufuegen:
src/signal/minmax.cpp
src/signal/crop.cpp
src/signal/gosignaloperation.cpp
src/signal/centerofmass.cpp
src/signal/transform.cpp
src/signal/gosignal3dref.cpp
src/signal/gogaussimage.cpp
src/signal/gosignal3dbase.cpp
src/signal/gosubsignal3d.cc
src/signal/gosignal3d.cc
src/signal/gofilter3d.cpp
src/signal/godwt.cc
src/signal/gohaar3d.cpp
src/signal/godwt3d.cpp
src/signal/gofilter1d.cpp
src/signal/gosignalhelper.cpp
src/signal/gohistogram.cpp
src/signal/gosignal3diterator.cpp
src/signal/binaryimage.cpp
## Bei math Namespace aendern:
src/math/godenoise.cpp
src/math/stencil.cpp
src/math/gradient.cpp
src/math/divnormalizedgrad2d.cpp
src/math/divergence.cpp
src/math/gobiorthowavelet.cpp
src/math/vectormult.cpp)
# Cairo plotting
SET (CAIRO_SOURCES
src/plot/cairoplot.cpp
src/plot/graph.cpp
src/plot/object2dbox.cpp
src/plot/object2dtext.cpp
src/plot/object2dimage.cpp
src/plot/object2dpoints.cpp
src/plot/texttraits.cpp
src/plot/plot.cpp
src/plot/graphaxis.cpp)
set (SOURCES ${BASE_SOURCES})
if (MODULE_CONTAINERS)
set (SOURCES ${SOURCES} ${CONTAINER_SOURCES})
endif (MODULE_CONTAINERS)
if (MODULE_MATH)
set (SOURCES ${SOURCES} ${MATH_SOURCES})
endif (MODULE_MATH)
if (MODULE_GRIDS)
set (SOURCES ${SOURCES} ${SIGNAL_SOURCES})
endif (MODULE_GRIDS)
if (MODULE_NETWORK)
set (SOURCES ${SOURCES} ${NETWORK_SOURCES})
endif (MODULE_NETWORK)
if (MODULE_THREADS)
set (SOURCES ${SOURCES} ${THREAD_SOURCES})
endif (MODULE_THREADS)
if (MODULE_CAIROPLOT)
set (SOURCES ${SOURCES} ${CAIRO_SOURCES})
endif (MODULE_CAIROPLOT)
if (MODULE_VIDEO)
set (SOURCES ${SOURCES} ${VIDEO_SOURCES})
endif (MODULE_VIDEO)
if (MODULE_GNUPLOT)
set (SOURCES ${SOURCES} ${GNUPLOT_SOURCES})
endif (MODULE_GNUPLOT)
IF (BUILD_PYTHON_EMBED)
## SET (SOURCES src/python/gopython.cpp ${SOURCES})
include (FindSWIG)
# FIND_PROGRAM (SWIG_EXECUTABLE NAMES swig)
## Create include file for swig runtime
EXEC_PROGRAM (${SWIG_EXECUTABLE} ARGS "-python -external-runtime ${PROJECT_SOURCE_DIR}/include/golib_swig_python.h")
ENDIF (BUILD_PYTHON_EMBED)
SET (GOPATH ${PROJECT_SOURCE_DIR})
#
# Find out the machine type. Currently, assume only
# x86 and amd64 machines are supported.
#
EXEC_PROGRAM (uname ARGS -m OUTPUT_VARIABLE UNAME_M)
IF (UNAME_M MATCHES x86_64)
SET (MACHINE_TYPE "amd64")
ELSE (UNAME_M MATCHES x86_64)
SET (MACHINE_TYPE "x86")
ENDIF (UNAME_M MATCHES x86_64)
MESSAGE ("Machine type is ${MACHINE_TYPE}")
# This was introduced for guile 1.6.x. 1.8 should be threadsafe. Not tried
# though.
SET (GO_GUILE_MULTITHREAD 0)
CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
CHECK_TYPE_SIZE("short int" SIZEOF_SHORT_INT)
CHECK_TYPE_SIZE("int" SIZEOF_INT)
CHECK_TYPE_SIZE("long int" SIZEOF_LONG_INT)
CHECK_TYPE_SIZE("long long int" SIZEOF_LONG_LONG_INT)
CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
# We have 64 bit integers:
IF (${SIZEOF_LONG_LONG_INT} MATCHES 8)
SET (HAVE_INT64 1)
ENDIF (${SIZEOF_LONG_LONG_INT} MATCHES 8)
# SET (CMAKE_REQUIRED_INCLUDES /usr/include /usr/local/include)
find_file (CLAPACK_H clapack.h PATHS /usr/include/atlas /usr/include ${CMAKE_INSTALL_PREFIX}/include)
if (CLAPACK_H)
get_filename_component (CLAPACK_INCLUDE_DIR ${CLAPACK_H} PATH)
message ("Location: ${CLAPACK_INCLUDE_DIR}")
include_directories (${CLAPACK_INCLUDE_DIR})
endif (CLAPACK_H)
CHECK_INCLUDE_FILE (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILE (time.h HAVE_TIME_H)
CHECK_INCLUDE_FILE (unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE (sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE (errno.h HAVE_ERRNO_H)
CHECK_INCLUDE_FILE (linux/videodev2.h HAVE_LINUX_VIDEODEV2_H)
CHECK_INCLUDE_FILE (linux/videodev.h HAVE_LINUX_VIDEODEV_H)
CHECK_INCLUDE_FILE (f2c.h HAVE_F2C_H)
CHECK_INCLUDE_FILE (clapack.h HAVE_CLAPACK_H)
SET (HAVE_LINUX_VIDEODEV_H 0)
IF (NOT HAVE_F2C_H)
MESSAGE ("f2c.h not found --- please install f2c.")
ENDIF (NOT HAVE_F2C_H)
IF (NOT HAVE_CLAPACK_H)
MESSAGE ("clapack.h not found --- please install it through the ATLAS library.")
ENDIF (NOT HAVE_CLAPACK_H)
CHECK_FUNCTION_EXISTS (tmpnam_r HAVE_TMPNAM_R)
CHECK_FUNCTION_EXISTS (tmpnam HAVE_TMPNAM)
CHECK_FUNCTION_EXISTS (unlink HAVE_UNLINK)
CHECK_FUNCTION_EXISTS (modf HAVE_MODF)
CHECK_FUNCTION_EXISTS (getenv HAVE_GETENV)
CHECK_FUNCTION_EXISTS (stat HAVE_STAT)
CHECK_FUNCTION_EXISTS (mkdir HAVE_MKDIR)
#FIND_LIBRARY (ATLAS NAMES atlas PATHS ${GOPATH}/extra/lib)
#FIND_LIBRARY (CBLAS NAMES cblas PATHS ${GOPATH}/extra/lib)
IF (WIN32)
# FIND_LIBRARY (LAPACK_ATLAS NAMES lapack_atlas PATHS /usr/lib /usr/lib64 /usr/lib/atlas ${GOPATH}/extra/lib)
FIND_LIBRARY (F2C NAMES f2c PATHS $ENV{HOME}/lib ${GOPATH}/extra/lib)
FIND_LIBRARY (ATLAS NAMES atlas PATHS $ENV{HOME}/lib ${GOPATH}/extra/lib)
FIND_LIBRARY (F77BLAS NAMES f77blas PATHS $ENV{HOME}/lib ${GOPATH}/extra/lib)
FIND_LIBRARY (LAPACK NAMES lapack PATHS $ENV{HOME}/lib /usr/lib/atlas/sse2 /usr/lib/atlas ${GOPATH}/extra/lib)
FIND_LIBRARY (BLAS NAMES cblas blas PATHS $ENV{HOME}/lib /usr/lib/atlas/sse2 /usr/lib/atlas ${GOPATH}/extra/lib)
FIND_LIBRARY (DEVIL NAMES DevIL IL PATHS $ENV{HOME}/lib /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
FIND_LIBRARY (DEVILU NAMES ILU PATHS $ENV{HOME}/lib /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
FIND_LIBRARY (PTHREAD NAMES pthread PATHS $ENV{HOME}/lib /usr/lib /usr/local/lib)
ELSE (WIN32)
if (APPLE)
message ("Building for MACOSX")
find_library (ACCELERATE Accelerate)
# find_library (VECLIB vecLib)
find_library (PTHREAD NAMES pthread) # PATHS /usr/lib /usr/local/lib)
find_library (DEVIL NAMES DevIL IL PATHS $ENV{HOME}/lib /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
find_library (DEVILU NAMES ILU PATHS $ENV{HOME}/lib /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
if (ACCELERATE)
message ("Found Accelerate")
link_libraries (${ACCELERATE})
endif (ACCELERATE)
# if (VECLIB)
# message ("Found vecLib")
# link_libraries (${VECLIB})
# #find_path (CBLAS_INCLUDE_DIR cblas.h)
# #include_directories (${CBLAS_INCLUDE_DIR})
# endif (VECLIB)
#if (BUILD_GL_MODULE)
# find_library (OPENGL OpenGL)
# link_libraries (${OPENGL})
#endif (BUILD_GL_MODULE)
find_library (LAPACKE lapacke PATHS ${GOPATH}/tools/lapacke)
link_libraries (${LAPACKE})
include_directories (${GOPATH}/tools/lapacke/include)
add_definitions (-DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE)
pkg_search_module (DEVIL REQUIRED IL)
pkg_search_module (DEVILU REQUIRED ILU)
#find_library (DEVIL NAMES IL PATHS /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
#find_library (DEVILU NAMES ILU PATHS /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
link_libraries (${DEVIL_LDFLAGS})
link_libraries (${DEVILU_LDFLAGS})
set (EXTRA_INCLUDE_PATH ${EXTRA_INCLUDE_PATH} ${DEVIL_INCLUDE_DIRS})
set (EXTRA_INCLUDE_PATH ${EXTRA_INCLUDE_PATH} ${DEVILU_INCLUDE_DIRS})
else (APPLE)
FIND_LIBRARY (LAPACK_ATLAS NAMES lapack_atlas PATHS /usr/lib /usr/lib64 /usr/lib/atlas ${GOPATH}/extra/lib)
FIND_LIBRARY (LAPACK NAMES lapack PATHS /usr/lib/atlas/sse2 /usr/lib/atlas ${GOPATH}/extra/lib)
FIND_LIBRARY (BLAS NAMES blas PATHS /usr/lib/atlas/sse2 /usr/lib/atlas ${GOPATH}/extra/lib)
FIND_LIBRARY (DEVIL NAMES IL PATHS /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
FIND_LIBRARY (DEVILU NAMES ILU PATHS /usr/lib /usr/local/lib ${GOPATH}/extra/lib $ENV{HOME}/Software/lib)
FIND_LIBRARY (PTHREAD NAMES pthread PATHS /usr/lib /usr/local/lib)
endif (APPLE)
ENDIF (WIN32)
## Cairo and Pango (for use of the goPlot library)
if (MODULE_CAIROPLOT)
pkg_search_module (CAIRO REQUIRED cairo)
pkg_search_module (PANGO REQUIRED pango)
pkg_search_module (PANGOCAIRO REQUIRED pangocairo)
IF (CAIRO_FOUND)
MESSAGE("Found cairo.")
#message(${CAIRO_INCLUDE_DIRS})
#message(${CAIRO_LDFLAGS})
SET (EXTRA_INCLUDE_PATH ${EXTRA_INCLUDE_PATH} ${CAIRO_INCLUDE_DIRS})
LINK_LIBRARIES (${CAIRO_LDFLAGS})
SET (HAVE_CAIRO 1)
ENDIF (CAIRO_FOUND)
IF (PANGO_FOUND)
MESSAGE("Found pango.")
#message(${PANGO_INCLUDE_DIRS})
#message(${PANGO_LDFLAGS})
SET (EXTRA_INCLUDE_PATH ${EXTRA_INCLUDE_PATH} ${PANGO_INCLUDE_DIRS})
LINK_LIBRARIES (${PANGO_LDFLAGS})
SET (HAVE_PANGO 1)
ENDIF (PANGO_FOUND)
IF (PANGOCAIRO_FOUND)
MESSAGE("Found pangocairo.")
#message(${PANGOCAIRO_INCLUDE_DIRS})
#message(${PANGOCAIRO_LDFLAGS})
SET (EXTRA_INCLUDE_PATH ${EXTRA_INCLUDE_PATH} ${PANGOCAIRO_INCLUDE_DIRS})
LINK_LIBRARIES (${PANGOCAIRO_LDFLAGS})
SET (HAVE_PANGOCAIRO 1)
ENDIF (PANGOCAIRO_FOUND)
endif (MODULE_CAIROPLOT)
#FIND_LIBRARY (F2C NAMES f2c PATHS /usr/lib /usr/local/lib)
#CHECK_LIBRARY_EXISTS (atlas ATL_cputime "${GOPATH}/extra" HAVE_LIBATLAS)
#IF (${HAVE_LIBATLAS} MATCHES 1)
# SET (EXTRA_LIBS "${EXTRA_LIBS} -latlas")
#ENDIF (${HAVE_LIBATLAS} MATCHES 1)
#CHECK_LIBRARY_EXISTS (cblas cblas_dgemm "${GOPATH}/extra" HAVE_LIBCBLAS)
#IF (${HAVE_LIBATLAS} MATCHES 1)
# SET (EXTRA_LIBS "${EXTRA_LIBS} -lcblas")
#ENDIF (${HAVE_LIBATLAS} MATCHES 1)
#CHECK_LIBRARY_EXISTS (IL ilInit "" HAVE_LIBIL)
#IF (${HAVE_LIBIL} MATCHES 1)
# SET (EXTRA_LIBS "${EXTRA_LIBS} -lIL")
#ENDIF (${HAVE_LIBIL} MATCHES 1)
#CHECK_LIBRARY_EXISTS (ILU iluInit "" HAVE_LIBILU)
#IF (${HAVE_LIBILU} MATCHES 1)
# SET (EXTRA_LIBS "${EXTRA_LIBS} -lILU")
#ENDIF (${HAVE_LIBILU} MATCHES 1)
CHECK_LIBRARY_EXISTS (fftw fftw_create_plan "" HAVE_LIBFFTW)
IF (${HAVE_LIBFFTW} MATCHES 1)
SET (EXTRA_LIBS "${EXTRA_LIBS} -lfftw")
ENDIF (${HAVE_LIBFFTW} MATCHES 1)
CHECK_LIBRARY_EXISTS (nsl connect "" HAVE_LIBNSL)
IF (${HAVE_LIBNSL} MATCHES 1)
SET (EXTRA_LIBS "${EXTRA_LIBS} -lnsl")
ENDIF (${HAVE_LIBNSL} MATCHES 1)
CHECK_LIBRARY_EXISTS (socket connect "" HAVE_LIBSOCKET)
IF (${HAVE_LIBSOCKET} MATCHES 1)
SET (EXTRA_LIBS "${EXTRA_LIBS} -lsocket")
ENDIF (${HAVE_LIBSOCKET} MATCHES 1)
IF (LINK_GFORTRAN)
# FIND_LIBRARY (GFORTRAN NAMES gfortran PATHS /usr/lib /usr/local/lib)
#IF (GFORTRAN)
# SET (EXTRA_LIBS "${EXTRA_LIBS} ${GFORTRAN}")
#ELSE (GFORTRAN)
# MESSAGE ("*** LINK_GFORTRAN selected, but gfortran library not found! ***")
#ENDIF (GFORTRAN)
SET (EXTRA_LIBS "${EXTRA_LIBS} -lgfortran")
ENDIF (LINK_GFORTRAN)
# SET (EXTRA_INCLUDE_PATH "")
INCLUDE_DIRECTORIES (${EXTRA_INCLUDE_PATH}
${GOPATH}/include
${GOPATH}/plot/include
${GOPATH}/extra/include
$ENV{HOME}/include) # Only in windows!
##
## If your system compiler is a gcc 4.x,
## set this explicitly to a 3.x version if using Matlab.
## Matlab links to the old libstdc++ version 5 which
## causes severe crashes when using it with libstdc++ version 6.
##
#IF (BUILD_MATLAB_MODULE AND ${MACHINE_TYPE} STREQUAL "x86")
# SET (CMAKE_CXX_COMPILER g++-3.3)
# SET (CMAKE_C_COMPILER gcc-3.3)
#ENDIF (BUILD_MATLAB_MODULE AND ${MACHINE_TYPE} STREQUAL "x86")
## For now, always set to 3.3
IF (BUILD_WITH_GCC_3_3)
SET (CMAKE_CXX_COMPILER g++-3.3)
SET (CMAKE_C_COMPILER gcc-3.3)
ENDIF (BUILD_WITH_GCC_3_3)
IF (BUILD_WITH_GCC_3_4)
SET (CMAKE_CXX_COMPILER g++-3.4)
SET (CMAKE_C_COMPILER gcc-3.4)
ENDIF (BUILD_WITH_GCC_3_4)
set(CMAKE_CXX_STANDARD 11)
# Add -MT flag!
IF(UNIX)
ADD_DEFINITIONS (-Wall $ENV{CPPFLAGS} -D_REENTRANT)
ENDIF(UNIX)
if (NOT APPLE)
IF (LAPACK_ATLAS)
LINK_LIBRARIES (${LAPACK_ATLAS})
ENDIF (LAPACK_ATLAS)
IF (LAPACK)
LINK_LIBRARIES (${LAPACK})
ENDIF (LAPACK)
IF (F77BLAS)
LINK_LIBRARIES (${F77BLAS})
ENDIF (F77BLAS)
IF (BLAS)
LINK_LIBRARIES (${BLAS})
ENDIF (BLAS)
IF (CBLAS)
LINK_LIBRARIES (${CBLAS})
ENDIF (CBLAS)
IF (ATLAS)
LINK_LIBRARIES (${ATLAS})
ENDIF (ATLAS)
IF (F2C)
LINK_LIBRARIES (${F2C})
ENDIF (F2C)
endif (NOT APPLE)
IF (DEVIL)
SET (HAVE_LIBIL 1)
LINK_LIBRARIES (${DEVIL})
ENDIF (DEVIL)
IF (DEVILU)
SET (HAVE_LIBILU 1)
LINK_LIBRARIES (${DEVILU})
ENDIF (DEVILU)
IF (PTHREAD)
SET (HAVE_LIBPTHREAD 1)
LINK_LIBRARIES (${PTHREAD})
ENDIF (PTHREAD)
CONFIGURE_FILE (${GOPATH}/include/goconfig.h.cmake.in
${GOPATH}/include/goconfig.h)
#
# pkg-config file
set (PCLIBS "-lGo")
set (PCINCLUDES "-I${GOPATH}/include -I${GOPATH}/tools/lapacke/include")
set (GOLIB_PKG_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" CACHE PATH "Where to install pkg-config files")
set (PCLIBDIR "-L${CMAKE_INSTALL_PREFIX}/lib")
CONFIGURE_FILE (${GOPATH}/golib.pc.cmakeconfig
${GOPATH}/golib.pc
@ONLY)
ADD_LIBRARY (${TARGETNAME} SHARED ${SOURCES})
# STRING (STRIP ${EXTRA_LIBS} EXTRA_LIBS) ## Remove trailing and leading whitespaces (leads to error in newer cmake)
TARGET_LINK_LIBRARIES (${TARGETNAME} ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})
INSTALL_TARGETS (/lib ${TARGETNAME})
INSTALL (FILES ${GOPATH}/golib.pc DESTINATION ${GOLIB_PKG_CONFIG_INSTALL_DIR})
#IF (BUILD_PYTHON_EMBED)
# SET_TARGET_PROPERTIES (${TARGETNAME} PROPERTIES LINK_FLAGS ${PYTHON_LDFLAGS})
#ENDIF (BUILD_PYTHON_EMBED)
IF (BUILD_PYTHON_EMBED OR BUILD_PYTHON_MODULE)
include (FindPythonLibs)
SET (EXTRA_INCLUDE_PATH ${EXTRA_INCLUDE_PATH} ${PYTHON_INCLUDE_PATH})
#EXEC_PROGRAM (python ARGS "-c \"import distutils.sysconfig; print distutils.sysconfig.get_config_var('INCLUDEPY')\"" OUTPUT_VARIABLE PYTHON_INCLUDE)
#SET (EXTRA_INCLUDE_PATH ${EXTRA_INCLUDE_PATH} ${PYTHON_INCLUDE})
#EXEC_PROGRAM (python ARGS "-c \"import distutils.sysconfig; print distutils.sysconfig.get_config_var('BLDLIBRARY')\"" OUTPUT_VARIABLE PYTHON_LDFLAGS)
ENDIF (BUILD_PYTHON_EMBED OR BUILD_PYTHON_MODULE)
IF (BUILD_PYTHON_EMBED)
ADD_SUBDIRECTORY (${PROJECT_SOURCE_DIR}/pythonembed)
ENDIF (BUILD_PYTHON_EMBED)
# If the the environment variable MATLAB is set, assume the matlab module
# should be built. This creates the build directory, but it is not
# automatically descended into. The user has to do that.
IF (BUILD_MATLAB_MODULE)
IF(DEFINED ENV{MATLAB})
MESSAGE ("MATLAB path is $ENV{MATLAB}")
SET (EXTRA_INCLUDE_PATH $ENV{HOME}/Software/include)
ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/matlab)
ELSE(DEFINED ENV{MATLAB})
MESSAGE ("*** MATLAB environment variable was not declared. ***")
ENDIF(DEFINED ENV{MATLAB})
SET(HAVE_MATLAB 1)
ENDIF (BUILD_MATLAB_MODULE)
IF (BUILD_GUILE_MODULE)
ADD_SUBDIRECTORY (${PROJECT_SOURCE_DIR}/swig)
ENDIF (BUILD_GUILE_MODULE)
IF (BUILD_PYTHON_MODULE)
ADD_SUBDIRECTORY (${PROJECT_SOURCE_DIR}/python)
IF (NOT EXISTS ${PYTHON_INSTALL_DIR})
MAKE_DIRECTORY (${PYTHON_INSTALL_DIR})
ENDIF (NOT EXISTS ${PYTHON_INSTALL_DIR})
ENDIF (BUILD_PYTHON_MODULE)
IF (BUILD_GUI_MODULE)
ADD_SUBDIRECTORY (${PROJECT_SOURCE_DIR}/gui)
ENDIF (BUILD_GUI_MODULE)
IF (BUILD_GL_MODULE)
ADD_SUBDIRECTORY (${PROJECT_SOURCE_DIR}/gl)
ENDIF (BUILD_GL_MODULE)
## Python install target
#ADD_CUSTOM_TARGET (install-py cp ${PYTHON_FILES} ${PYTHON_INSTALL_DIR})