forked from shogun-toolbox/shogun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
973 lines (844 loc) · 29 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
# Instructions:
# $ mkdir build
# $ cd build
# $ cmake ..
# $ make
project(shogun)
cmake_minimum_required(VERSION 2.8.4)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
include(ShogunUtils)
# CCACHE
OPTION(ENABLE_CCACHE "Enable ccache for compilation" ON)
FIND_PACKAGE(CCache)
if(CCACHE_FOUND AND ENABLE_CCACHE)
SET(CCACHE "ccache" CACHE STRING "ccache")
SET(CMAKE_C_COMPILER_ARG1 ${CMAKE_C_COMPILER})
SET(CMAKE_C_COMPILER ${CCACHE})
SET(CMAKE_CXX_COMPILER_ARG1 ${CMAKE_CXX_COMPILER})
SET(CMAKE_CXX_COMPILER ${CCACHE})
SET(CMAKE_C_FLAGS "${CCACHE_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CCACHE_FLAGS} ${CMAKE_CXX_FLAGS}")
endif()
SET(CPACK_PACKAGE_CONTACT [email protected])
################# VARIABLES #####################
SET(DEFINES "SWIG_TYPE_TABLE=shogun;SHOGUN")
SET(INCLUDES "")
SET(EXT_SRC_HEADER "h")
SET(EXT_SRC_C "c")
SET(EXT_SRC_CPP "cpp")
SET(EXT_SRC_SWIG "_wrap.cxx")
SET(EXT_SRC_TEST "_unittest.cc")
SET(EXT_INP_SWIG "i")
SET(EXT_IF_SWIG "py")
SET(EXT_CPP_TMP "${EXT_SRC_CPP}.templ")
SET(EXT_CPP_SH "${EXT_SRC_CPP}.sh")
SET(EXT_CPP_PY "${EXT_SRC_CPP}.py")
SET(EXT_SRC_TEST_TMP "${EXT_SRC_TEST}.jinja2")
SET(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third_party)
SET(LIBSHOGUN_SRC_DIR ${CMAKE_SOURCE_DIR}/src/shogun)
SET(COMMON_MODULAR_SRC_DIR ${CMAKE_SOURCE_DIR}/src/interfaces/modular/)
# check whether any of the modular interfaces are turned ON
IF (
PythonModular OR LuaModular OR RModular OR
OctaveModular OR JavaModular OR PerlModular OR
RubyModular OR CSharpModular
)
FIND_PACKAGE(SWIG 2.0.4 REQUIRED)
# use our own UseSWIG.cmake in order to be able to enable ccache-swig
SET(SWIG_USE_FILE ${CMAKE_SOURCE_DIR}/cmake/UseSWIG.cmake)
IF(ENABLE_CCACHE AND CCACHE_SWIG)
SET(CCACHE_SWIG_EXECUTABLE ${CCACHE_SWIG})
ENDIF()
SET(COMPILE_MODULAR_INTERFACE 1)
ENDIF()
# Detect OS
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET(DARWIN 1)
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(LINUX 1)
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
SET(FREEBSD 1)
ENDIF()
# Get processor type, sets MACHINE macro
IF(NOT WIN32)
execute_process(COMMAND uname -m
OUTPUT_VARIABLE MACHINE_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(MACHINE ${MACHINE_OUTPUT})
ENDIF()
SET(EXT_LIB_SWIG_RUBY_MODULAR ".so")
if(DARWIN)
SET(EXT_LIB_SWIG_RUBY_MODULAR ".bundle")
ENDIF()
################ COMPILER #######################
# g++ version needs to be => 4.3
IF(CMAKE_COMPILER_IS_GNUCXX)
# in order to support cmake 2.8.7 and older
IF(NOT CMAKE_CXX_COMPILER_VERSION)
include(CheckCompiler)
ENDIF()
IF("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.3.0")
MESSAGE(FATAL_ERROR "g++ version is too old")
ENDIF()
ENDIF()
#Build type
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: Debug Release Distribution."
FORCE )
endif()
# set the flags for the build types
IF(MSVC)
SET(COMPILER_WARNINGS "/Wall")
ELSE()
SET(COMPILER_WARNINGS "-Wall -Wno-unused-parameter -Wformat -Wformat-security -Wparentheses -Wshadow -Wno-unknown-pragmas -Wno-deprecated")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(RELEASE_COMPILER_FLAGS "-fexpensive-optimizations -frerun-cse-after-loop -fcse-follow-jumps -finline-functions -fschedule-insns2 -fthread-jumps -fforce-addr -fstrength-reduce -funroll-loops -mfpmath=sse")
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(RELEASE_COMPILER_FLAGS "-finline-functions -funroll-loops")
ENDIF()
SET(SWIG_CXX_COMPILER_FLAGS "-O0 -g")
SET(CMAKE_C_FLAGS "${COMPILER_WARNINGS} -g ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${COMPILER_WARNINGS} -g ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS_RELEASE "-O3 ${RELEASE_COMPILER_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 ${RELEASE_COMPILER_FLAGS}")
SET(CMAKE_C_FLAGS_DISTRIBUTION "-O2")
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O2")
OPTION(ENABLE_COVERAGE "Enable code coverage" OFF)
IF(ENABLE_COVERAGE)
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
ENDIF()
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
ENDIF()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage")
ENDIF()
IF(ENABLE_TSAN)
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(WARNING "Thread-sanitizer results with an optimised (non-Debug) build may be misleading")
ENDIF()
SET(SANITIZER_FLAGS "-fsanitize=thread -fPIE")
SET(SANITIZER_LIBRARY -pie)
IF(CMAKE_COMPILER_IS_GNUCXX)
LIST(APPEND SANITIZER_LIBRARY -ltsan)
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
LIST(APPEND SANITIZER_LIBRARY -fsanitize=thread)
ENDIF()
ENDIF()
IF(ENABLE_ASAN)
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(WARNING "Address-sanitizer results with an optimised (non-Debug) build may be misleading")
ENDIF()
SET(SANITIZER_FLAGS "-fsanitize=address -fno-omit-frame-pointer")
SET(SANITIZER_LIBRARY -fsanitize=address)
IF(CMAKE_COMPILER_IS_GNUCXX)
LIST(APPEND SANITIZER_LIBRARY -lasan)
ENDIF()
ENDIF()
IF(ENABLE_MSAN)
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(WARNING "Memory-sanitizer results with an optimised (non-Debug) build may be misleading")
ENDIF()
SET(SANITIZER_FLAGS "-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer")
SET(SANITIZER_LIBRARY)
IF(CMAKE_COMPILER_IS_GNUCXX)
LIST(APPEND SANITIZER_LIBRARY -lmsan)
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
LIST(APPEND SANITIZER_LIBRARY -fsanitize=memory)
ENDIF()
ENDIF()
IF(ENABLE_UBSAN)
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(WARNING "Memory-sanitizer results with an optimised (non-Debug) build may be misleading")
ENDIF()
SET(SANITIZER_FLAGS "-fsanitize=undefined")
SET(SANITIZER_LIBRARY)
IF(CMAKE_COMPILER_IS_GNUCXX)
LIST(APPEND SANITIZER_LIBRARY -lubsan)
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
LIST(APPEND SANITIZER_LIBRARY -fsanitize=undefined)
ENDIF()
ENDIF()
# check for supported c++11 features
#
# clang with -std=c++11 and -stdlib=libc++ does not work
# well with swig generated cxx
# hence disable c++11 for this case.
IF (NOT ((CYGWIN AND ENABLE_TESTING) OR (DARWIN AND COMPILE_MODULAR_INTERFACE)))
INCLUDE(CheckCXX11Features)
IF(_HAS_CXX11_FLAG)
LIST(APPEND DEFINES HAVE_CXX11)
SET(HAVE_CXX11 1)
SET(CMAKE_CXX_FLAGS "${CXX11_COMPILER_FLAGS} ${CMAKE_CXX_FLAGS}")
SET(SWIG_CXX_COMPILER_FLAGS "${CXX11_COMPILER_FLAGS} ${SWIG_CXX_COMPILER_FLAGS}")
ENDIF()
IF(_HAS_CXX0X_FLAG)
LIST(APPEND DEFINES HAVE_CXX0X)
SET(HAVE_CXX0X 1)
SET(CMAKE_CXX_FLAGS "${CXX11_COMPILER_FLAGS} ${CMAKE_CXX_FLAGS}")
SET(SWIG_CXX_COMPILER_FLAGS "${CXX11_COMPILER_FLAGS} ${SWIG_CXX_COMPILER_FLAGS}")
ENDIF()
IF (HAVE_CXX11_ATOMIC)
LIST(APPEND DEFINES HAVE_CXX11_ATOMIC)
ENDIF()
ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES "Release")
# there's a bug on FreeBSD -march=native.
# for some CPU types it does not detect the right flags
# see: http://www.freebsd.org/cgi/query-pr.cgi?pr=178792&cat=
IF (NOT (FREEBSD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")))
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
SET(SWIG_CXX_COMPILER_FLAGS "${SWIG_CXX_COMPILER_FLAGS} -march=native")
ENDIF()
ENDIF()
###### MALLOC LIBRARY ###########
SET(EXTERNAL_MALLOC_CFLAGS "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
if (MALLOC_REPLACEMENT MATCHES "Jemalloc")
include(external/Jemalloc)
SET(USE_JEMALLOC 1)
LIST(APPEND DEFINES USE_JEMALLOC)
LIST(INSERT INCLUDES 0 ${Jemalloc_INCLUDE_DIR})
SET(CMAKE_CXX_FLAGS "${EXTERNAL_MALLOC_CFLAGS} ${CMAKE_CXX_FLAGS}")
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${Jemalloc_LIBRARIES})
elseif(MALLOC_REPLACEMENT MATCHES "TCMalloc")
include(external/TCMalloc)
SET(USE_TCMALLOC 1)
LIST(APPEND DEFINES USE_TCMALLOC)
LIST(INSERT INCLUDES 0 ${TCMalloc_INCLUDE_DIR})
SET(CMAKE_CXX_FLAGS "${EXTERNAL_MALLOC_CFLAGS} ${CMAKE_CXX_FLAGS}")
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${TCMalloc_LIBRARIES})
elseif(MALLOC_REPLACEMENT MATCHES "Hoard")
find_package(Hoard)
if (Hoard_FOUND)
SET(USE_HOARD 1)
LIST(APPEND DEFINES USE_HOARD)
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${Hoard_LIBRARIES})
else ()
message(FATAL_ERROR "Unable to use hoard malloc: library not found")
endif ()
else()
message(STATUS "Using system's malloc")
endif()
############### VERSION #####################
FILE(STRINGS "@CMAKE_SOURCE_DIR@/NEWS" NEWS LIMIT_COUNT 5)
STRING(REGEX REPLACE ".*SHOGUN Release version ([0-9.]*).*" "\\1" VERSION "${NEWS}")
STRING(REGEX REPLACE ".*SHOGUN Release version.*\\(libshogun ([0-9.]*).*" "\\1" LIBSHOGUNVER "${NEWS}")
STRING(REGEX REPLACE ".*SHOGUN Release version.*\\(libshogun ([0-9]*).*" "\\1" LIBSHOGUNSO "${NEWS}")
STRING(REGEX REPLACE ".*SHOGUN Release version.*data ([0-9.]*).*" "\\1" DATAVER "${NEWS}")
STRING(REGEX REPLACE "([0-9]*).[0-9]*.[0-9]*" "\\1" SHOGUN_VERSION_MAJOR "${VERSION}")
STRING(REGEX REPLACE "[0-9]*.([0-9]*).[0-9]*" "\\1" SHOGUN_VERSION_MINOR "${VERSION}")
STRING(REGEX REPLACE "[0-9]*.[0-9]*.([0-9]*)" "\\1" SHOGUN_VERSION_PATCH "${VERSION}")
SET(BUILD_STATIC "Build a statically linked binary" OFF)
################# EXAMPLES ##################
OPTION(BUILD_EXAMPLES "Build Examples" ON)
################# DATATYPES #################
LIST(APPEND DEFINES USE_CHAR)
LIST(APPEND DEFINES USE_BOOL)
LIST(APPEND DEFINES USE_UINT8)
LIST(APPEND DEFINES USE_UINT16)
#LIST(APPEND DEFINES USE_UINT32)
LIST(APPEND DEFINES USE_UINT64)
#LIST(APPEND DEFINES USE_INT8)
#LIST(APPEND DEFINES USE_INT16)
LIST(APPEND DEFINES USE_INT32)
LIST(APPEND DEFINES USE_INT64)
LIST(APPEND DEFINES USE_FLOAT32)
LIST(APPEND DEFINES USE_FLOAT64)
LIST(APPEND DEFINES USE_COMPLEX128)
#LIST(APPEND DEFINES USE_FLOATMAX)
IF(MSVC)
include(external/MSIntTypes)
LIST(APPEND INCLUDES ${THIRD_PARTY_DIR}/MSIntTypes)
include(external/MSDirent)
LIST(APPEND INCLUDES ${MSDIRENT_INCLUDE_DIR})
ENDIF()
# detect word size
IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT DARWIN)
SET(CMAKE_SWIG_FLAGS -DSWIGWORDSIZE64)
ENDIF()
#interfaces
OPTION(PythonModular "Python Modular" OFF)
OPTION(LuaModular "Lua Modular" OFF)
OPTION(RModular "R Modular" OFF)
OPTION(OctaveModular "Octave Modular" OFF)
OPTION(JavaModular "Java Modular" OFF)
OPTION(PerlModular "Perl Modular" OFF)
OPTION(RubyModular "Ruby Modular" OFF)
OPTION(CSharpModular "CSharp Modular" OFF)
OPTION(PythonStatic "Python Static" OFF)
OPTION(RStatic "R Static" OFF)
OPTION(CmdLineStatic "CmdLine Static" OFF)
OPTION(MatlabStatic "Matlab Static" OFF)
OPTION(OctaveStatic "Octave Static" OFF)
# SVMLight
OPTION(USE_SVMLIGHT "SVMLight" ON)
SET(SVMLightWarning "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
SET(SVMLightWarning "${SVMLightWarning}\nWARNING: SHOGUN is built using SVMlight which was written")
SET(SVMLightWarning "${SVMLightWarning}\nby Thorsten Joachims and uses a different non GPL compatible license.")
SET(SVMLightWarning "${SVMLightWarning}\nTo build a fully GPL'd SHOGUN use")
SET(SVMLightWarning "${SVMLightWarning}\nThe SVMlight license can be found in LICENSE.SVMlight. In case")
SET(SVMLightWarning "${SVMLightWarning}\nyou do not know or cannot agree to the licensing terms expressed in")
SET(SVMLightWarning "${SVMLightWarning}\nLICENSE.SVMlight press ctrl+c to abort configure now.")
SET(SVMLightWarning "${SVMLightWarning}\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
IF(USE_SVMLIGHT)
LIST(APPEND DEFINES USE_SVMLIGHT)
ENDIF()
#Trace memory allocs
OPTION(TRACE_MEMORY_ALLOCS "Memory allocation tracing" OFF)
IF(TRACE_MEMORY_ALLOCS)
LIST(APPEND DEFINES TRACE_MEMORY_ALLOCS)
ENDIF()
# HMM
OPTION(USE_HMMDEBUG "HMM cache" OFF)
IF(USE_HMMDEBUG)
LIST(APPEND DEFINES USE_HMMDEBUG)
ENDIF()
OPTION(USE_HMMCACHE "HMM cache" ON)
IF(USE_HMMCACHE)
LIST(APPEND DEFINES USE_HMMCACHE)
ENDIF()
OPTION(USE_HMMPARALLEL "Parallel structures in hmm training" OFF)
IF(USE_HMMPARALLEL)
SET(USE_HMMPARALLEL_STRUCTURES 1)
LIST(APPEND DEFINES USE_HMMPARALLEL_STRUCTURES USE_HMMPARALLEL)
ENDIF()
# Viterbi path debug
OPTION(USE_PATHDEBUG "Viterbi path debugging" OFF)
IF(USE_PATHDEBUG)
LIST(APPEND DEFINES USE_PATHDEBUG)
ENDIF()
# big states
OPTION(USE_BIGSTATES "Big (16bit) state" ON)
IF(USE_BIGSTATES)
LIST(APPEND DEFINES USE_BIGSTATES)
ENDIF()
# Large file
OPTION(HAVE_LARGEFILE "Large file support" ON)
IF(HAVE_LARGEFILE)
LIST(APPEND DEFINES HAVE_LARGEFILE)
ENDIF()
#kernelcache to use 4-byte-floating-point values instead of 8-byte-doubles
OPTION(USE_SHORTREAL_KERNELCACHE "Kernelcache to use 4-byte-floating-point values instead of 8-byte-doubles" ON)
IF(USE_SHORTREAL_KERNELCACHE)
LIST(APPEND DEFINES USE_SHORTREAL_KERNELCACHE)
ENDIF()
# PRNG settings
SET(MEXP "19937" CACHE STRING "PRNG Mersenne exponent")
SET(SFMT_MEXP ${MEXP})
SET(DSFMT_MEXP ${MEXP})
LIST(APPEND DEFINES DSFMT_MEXP=${MEXP} SFMT_MEXP=${MEXP})
# Reference counting
OPTION(USE_REFERENCE_COUNTING "Reference Counting" ON)
IF(USE_REFERENCE_COUNTING)
LIST(APPEND DEFINES USE_REFERENCE_COUNTING)
ENDIF()
OPTION(USE_LOGCACHE "Use (1+exp(x)) log cache (is much faster but less accurate)" OFF)
IF(USE_LOGCACHE)
LIST(APPEND DEFINES USE_LOGCACHE)
ENDIF()
OPTION(USE_LOGSUMARRAY "Use sum array, supposed to be a bit more accurate" OFF)
IF(USE_LOGSUMARRAY)
LIST(APPEND DEFINES USE_LOGSUMARRAY)
ENDIF()
######################### LIBRARIES #########################
# check for math functions
include(CheckFunctionExists)
IF(UNIX)
SET(CMAKE_REQUIRED_LIBRARIES m)
ENDIF()
CHECK_FUNCTION_EXISTS(log2 HAVE_LOG2)
IF(HAVE_LOG2)
LIST(APPEND DEFINES HAVE_LOG2)
ENDIF()
CHECK_FUNCTION_EXISTS(powl HAVE_POWL)
IF(HAVE_POWL)
LIST(APPEND DEFINES HAVE_POWL)
ENDIF()
CHECK_FUNCTION_EXISTS(lgammal HAVE_LGAMMAL)
IF(HAVE_LGAMMAL)
LIST(APPEND DEFINES HAVE_LGAMMAL)
ENDIF()
CHECK_FUNCTION_EXISTS(sqrtl HAVE_SQRTL)
IF(HAVE_SQRTL)
LIST(APPEND DEFINES HAVE_SQRTL)
ENDIF()
# check SSE and SSE2 intrinsics header
IF(NOT CYGWIN)
include(CheckIncludeFile)
CHECK_INCLUDE_FILE(xmmintrin.h HAVE_BUILTIN_VECTOR)
CHECK_INCLUDE_FILE(emmintrin.h HAVE_SSE2)
IF(HAVE_SSE2)
LIST(APPEND DEFINES HAVE_SSE2)
ENDIF(HAVE_SSE2)
ENDIF(NOT CYGWIN)
FIND_PACKAGE(GDB)
IF (GDB_FOUND)
SET(GDB_DEFAULT_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/src/.gdb)
ENDIF()
FIND_PACKAGE(Mosek)
IF (MOSEK_FOUND)
SET(USE_MOSEK 1)
LIST(APPEND DEFINES USE_MOSEK)
LIST(APPEND INCLUDES ${MOSEK_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${MOSEK_LIBRARY})
ENDIF()
FIND_PACKAGE(Threads)
IF (CMAKE_USE_PTHREADS_INIT)
SET(HAVE_PTHREAD 1)
LIST(APPEND DEFINES HAVE_PTHREAD)
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${CMAKE_THREAD_LIBS_INIT})
ENDIF()
FIND_PACKAGE(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
FIND_PACKAGE(PkgConfig)
# prefer original LAPACK, if needed
OPTION(USE_ORIGINAL_LAPACK "Original LAPACK" OFF)
FIND_PACKAGE(LAPACK)
IF (LAPACK_FOUND)
# find out whether it is Accelerate.framework we found for LaPack/BLAS
IF("${LAPACK_LIBRARIES}" MATCHES ".*/Accelerate.framework$")
SET(HAVE_MVEC 1)
LIST(APPEND DEFINES HAVE_MVEC)
#Accelerate framework provides HAVE_CATLAS
SET(HAVE_CATLAS 1)
LIST(APPEND DEFINES HAVE_CATLAS)
SET(HAVE_LAPACK 1)
LIST(APPEND DEFINES HAVE_LAPACK)
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LAPACK_LIBRARIES})
ELSEIF("${LAPACK_LIBRARIES}" MATCHES ".*/mkl_.*")
SET(HAVE_LAPACK 1)
SET(HAVE_MKL 1)
LIST(APPEND DEFINES HAVE_LAPACK HAVE_MKL)
ELSE()
FIND_PACKAGE(Atlas)
IF(ATLAS_FOUND)
SET(HAVE_ATLAS 1)
SET(HAVE_LAPACK 1)
LIST(APPEND DEFINES HAVE_LAPACK HAVE_ATLAS)
LIST(APPEND INCLUDES ${ATLAS_INCLUDES})
IF(USE_ORIGINAL_LAPACK)
SET(ATLAS_CLAPACK_LIBRARY)
FOREACH(ITR ${ATLAS_LIBRARIES})
IF(ITR MATCHES ".*atlas.*lapack.*" OR ITR MATCHES ".*lapack.*atlas.*")
STRING(REGEX REPLACE "lapack" "clapack" ITR ${ITR})
LIST(APPEND ATLAS_CLAPACK_LIBRARY ${ITR})
ENDIF(ITR MATCHES ".*atlas.*lapack.*" OR ITR MATCHES ".*lapack.*atlas.*")
ENDFOREACH(ITR ${ATLAS_LIBRARIES})
MESSAGE(STATUS "using ATLAS-CLAPACK from: ${ATLAS_CLAPACK_LIBRARY}")
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LAPACK_LIBRARIES} ${ATLAS_CLAPACK_LIBRARY} ${ATLAS_LIBRARIES})
ELSE(USE_ORIGINAL_LAPACK)
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${ATLAS_LIBRARIES})
ENDIF(USE_ORIGINAL_LAPACK)
ELSE()
FIND_PACKAGE(CBLAS)
if(CBLAS_LIBRARY)
SET(HAVE_LAPACK 1)
LIST(APPEND DEFINES HAVE_LAPACK)
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LAPACK_LIBRARIES} ${CBLAS_LIBRARY})
else()
SET(HAVE_LAPACK 1)
LIST(APPEND DEFINES HAVE_LAPACK)
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LAPACK_LIBRARIES})
endif()
ENDIF()
ENDIF()
ENDIF()
FIND_PACKAGE(GLPK)
IF (GLPK_FOUND)
SET(USE_GLPK 1)
LIST(APPEND DEFINES USE_GLPK)
LIST(APPEND INCLUDES ${GLPK_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${GLPK_LIBRARY})
ENDIF()
FIND_PACKAGE(CPLEX)
IF (CPLEX_FOUND)
SET(USE_CPLEX 1)
LIST(APPEND DEFINES USE_CPLEX)
LIST(APPEND INCLUDES ${CPLEX_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${CPLEX_LIBRARY})
ENDIF()
FIND_PACKAGE(ARPACK)
IF (ARPACK_FOUND)
SET(HAVE_ARPACK 1)
LIST(APPEND DEFINES HAVE_ARPACK)
LIST(APPEND INCLUDES ${ARPACK_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${ARPACK_LIB})
ENDIF()
OPTION(BUNDLE_EIGEN "Bundle Eigen" OFF)
IF(BUNDLE_EIGEN)
include(external/Eigen3)
SET(HAVE_EIGEN3 1)
LIST(APPEND DEFINES HAVE_EIGEN3)
LIST(APPEND SYSTEM_INCLUDES ${EIGEN_INCLUDE_DIR})
ELSE()
FIND_PACKAGE(Eigen3 3.1.2)
IF (EIGEN3_FOUND)
SET(HAVE_EIGEN3 1)
LIST(APPEND DEFINES HAVE_EIGEN3)
LIST(APPEND SYSTEM_INCLUDES ${EIGEN_INCLUDE_DIR})
ENDIF()
ENDIF()
# COLPACK
OPTION(BUNDLE_COLPACK "Bundle COLPACK" OFF)
IF(BUNDLE_COLPACK)
include(external/ColPack)
SET(HAVE_COLPACK 1)
LIST(APPEND DEFINES HAVE_COLPACK)
LIST(APPEND INCLUDES ${COLPACK_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${COLPACK_LDFLAGS})
ELSE()
IF (PKG_CONFIG_FOUND)
pkg_search_module(COLPACK libColPack>=1.0.9 ColPack>=1.0.9)
IF (COLPACK_FOUND)
SET(HAVE_COLPACK 1)
LIST(APPEND DEFINES HAVE_COLPACK)
LIST(APPEND INCLUDES ${COLPACK_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${COLPACK_LDFLAGS})
ENDIF()
ENDIF()
ENDIF()
OPTION(BUNDLE_NLOPT "Bundle NLOPT" OFF)
IF(BUNDLE_NLOPT)
include(external/NLopt)
SET(HAVE_NLOPT 1)
LIST(APPEND DEFINES HAVE_NLOPT)
LIST(APPEND INCLUDES ${NLOPT_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${NLOPT_LIBRARIES})
ELSE()
FIND_PACKAGE(NLopt)
IF (NLOPT_FOUND)
SET(HAVE_NLOPT 1)
LIST(APPEND DEFINES HAVE_NLOPT)
LIST(APPEND INCLUDES ${NLOPT_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${NLOPT_LIBRARIES})
ENDIF()
ENDIF()
FIND_PACKAGE(LpSolve)
IF (LPSOLVE_FOUND)
SET(USE_LPSOLVE 1)
LIST(APPEND DEFINES USE_LPSOLVE YY_NEVER_INTERACTIVE PARSER_LP INVERSE_ACTIVE=INVERSE_LUSOL RoleIsExternalInvEngine)
LIST(APPEND INCLUDES ${LPSOLVE_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LPSOLVE_LIBRARIES})
ENDIF()
FIND_PACKAGE(ColPack)
IF(COLPACK_FOUND)
SET(HAVE_COLPACK 1)
LIST(APPEND DEFINES HAVE_COLPACK)
LIST(APPEND INCLUDES ${COLPACK_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${COLPACK_LIBRARIES})
ENDIF()
OPTION(BUNDLE_ARPREC "Bundle ARPREC" OFF)
IF(BUNDLE_ARPREC)
include(external/ARPREC)
SET(HAVE_ARPREC 1)
LIST(APPEND DEFINES HAVE_ARPREC)
LIST(APPEND INCLUDES ${ARPREC_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${ARPREC_LIBRARIES})
ELSE()
FIND_PACKAGE(ARPREC)
IF(ARPREC_FOUND)
SET(HAVE_ARPREC 1)
LIST(APPEND DEFINES HAVE_ARPREC)
LIST(APPEND INCLUDES ${ARPREC_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${ARPREC_LIBRARIES})
ENDIF()
ENDIF()
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
SET(HAVE_DOXYGEN 1)
LIST(APPEND DEFINES HAVE_DOXYGEN)
ENDIF()
# detect PYTHON
FIND_PACKAGE(PythonInterp REQUIRED)
# JSON
OPTION(BUNDLE_JSON "Bundle JSON" OFF)
IF(BUNDLE_JSON)
include(external/JSON)
SET(HAVE_JSON 1)
LIST(APPEND DEFINES HAVE_JSON)
LIST(APPEND INCLUDES ${JSON_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${JSON_LDFLAGS})
ELSE()
IF (PKG_CONFIG_FOUND)
pkg_search_module(JSON libjson>=0.11 json>=0.11 json-c>=0.11)
IF (JSON_FOUND)
SET(HAVE_JSON 1)
LIST(APPEND DEFINES HAVE_JSON)
LIST(APPEND INCLUDES ${JSON_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${JSON_LDFLAGS})
ENDIF()
ENDIF()
ENDIF()
FIND_PACKAGE(LibXml2)
IF (LIBXML2_FOUND)
SET(HAVE_XML 1)
LIST(APPEND DEFINES HAVE_XML)
LIST(APPEND INCLUDES ${LIBXML2_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LIBXML2_LIBRARIES})
ENDIF()
FIND_PACKAGE(HDF5)
IF (HDF5_FOUND)
SET(HAVE_HDF5 1)
LIST(APPEND DEFINES HAVE_HDF5)
LIST(APPEND INCLUDES ${HDF5_INCLUDE_DIRS})
SET(HDF5_LIBRARIES "${HDF5_LIBRARIES_RELEASE}")
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${HDF5_LIBRARIES})
ENDIF()
FIND_PACKAGE(CURL)
IF (CURL_FOUND)
SET(HAVE_CURL 1)
LIST(APPEND DEFINES HAVE_CURL)
LIST(APPEND INCLUDES ${CURL_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${CURL_LIBRARIES})
ENDIF(CURL_FOUND)
FIND_PACKAGE(ZLIB)
IF (ZLIB_FOUND)
SET(USE_GZIP 1)
LIST(APPEND DEFINES USE_GZIP)
LIST(APPEND INCLUDES ${ZLIB_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${ZLIB_LIBRARIES})
ENDIF()
FIND_PACKAGE(BZip2)
IF (BZIP2_FOUND)
SET(USE_BZIP2 1)
LIST(APPEND DEFINES USE_BZIP2)
LIST(APPEND INCLUDES ${BZIP_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${BZIP2_LIBRARIES})
ENDIF()
FIND_PACKAGE(LibLZMA)
IF (LIBLZMA_FOUND)
SET(USE_LZMA 1)
LIST(APPEND DEFINES USE_LZMA)
LIST(APPEND INCLUDES ${LIBLZMA_INCLUDE_DIRS})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LIBLZMA_LIBRARIES})
ENDIF()
FIND_PACKAGE(SNAPPY)
IF (SNAPPY_FOUND)
SET(USE_SNAPPY 1)
LIST(APPEND DEFINES USE_SNAPPY)
LIST(APPEND INCLUDES ${SNAPPY_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${SNAPPY_LIBRARIES})
ENDIF()
FIND_PACKAGE(LZO)
IF (LZO_FOUND)
SET(USE_LZO 1)
LIST(APPEND DEFINES USE_LZO)
LIST(APPEND INCLUDES ${LZO_INCLUDE_DIR})
SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${LZO_LIBS})
ENDIF()
FIND_PACKAGE(Spinlock)
IF (SPINLOCK_FOUND)
SET(USE_SPINLOCKS 1)
LIST(APPEND DEFINES USE_SPINLOCKS)
ENDIF()
#FIND_PACKAGE(Protobuf)
#IF (PROTOBUF_FOUND)
# SET(HAVE_PROTOBUF 1)
# LIST(APPEND DEFINES HAVE_PROTOBUF)
# LIST(APPEND INCUDES ${PROTOBUF_INCLUDE_DIRS})
# SET(POSTLINKFLAGS ${POSTLINKFLAGS} ${PROTOBUF_LIBRARIES})
#ENDIF()
#SWIG Interfaces
SET(CMAKE_SWIG_FLAGS "${CMAKE_SWIG_FLAGS};-w473;-w454;-w312;-w325;-fvirtual")
OPTION(USE_SWIG_DIRECTORS "" OFF)
# python modular
IF (PythonModular OR PythonStatic)
# find python library for the found python interpreter
# i.e. versions should match!
set(Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(NumPy REQUIRED)
LIST(APPEND DEFINES HAVE_PYTHON)
IF(PythonModular)
#custom swig flags for python modular interface
IF(${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3)
SET(TARGET_SWIGFLAGS "-builtin\;-modern\;-modernargs\;-py3")
LIST(APPEND DEFINES PYTHON3)
ELSE()
SET(TARGET_SWIGFLAGS "-builtin\;-modern\;-modernargs")
ENDIF()
add_subdirectory(src/interfaces/python_modular)
ENDIF()
IF(PythonStatic)
add_subdirectory(src/interfaces/python_static)
ENDIF()
ENDIF()
# lua modular
IF (LuaModular)
#FIND_PACKAGE(Lua51 REQUIRED)
pkg_search_module(LUA REQUIRED lua lua5.1)
IF (NOT LUA_FOUND)
MESSAGE(FATAL_ERROR "Lua could not be found!\n"
"Lua is required for compiling lua modular interface!")
ENDIF ()
SET(LUA_EXECUTABLE lua)
UNSET(TARGET_SWIGFLAGS)
add_subdirectory(src/interfaces/lua_modular)
ENDIF()
# java modular
IF (JavaModular)
FIND_PACKAGE(Java REQUIRED)
FIND_PACKAGE(JNI REQUIRED)
#find jblas
INCLUDE(UseJava)
FIND_JAR(JBLAS NAMES jblas jblas-1.2.0
PATHS /usr/lib/java /opt/local/share/java
ENV JBLAS_PATH)
IF(JBLAS)
LIST(APPEND DEFINES HAVE_JBLAS)
SET(HAVE_JBLAS 1)
ELSE()
MESSAGE(FATAL_ERROR "JBlas could not be found!\n"
"It is required for java modular interface!!!")
ENDIF()
SET(TARGET_SWIGFLAGS "-package\;org.shogun")
add_subdirectory(src/interfaces/java_modular)
ENDIF()
# ruby modular
IF (RubyModular)
FIND_PACKAGE(Ruby REQUIRED)
FIND_PACKAGE(RubyNArray REQUIRED)
SET(NARRAY_LIB ${RUBY_NARRAY_LIBRARY})
UNSET(TARGET_SWIGFLAGS)
add_subdirectory(src/interfaces/ruby_modular)
ENDIF()
# octave modular
IF (OctaveModular OR OctaveStatic)
FIND_PACKAGE(Octave 3.6 REQUIRED)
LIST(APPEND DEFINES HAVE_OCTAVE)
LIST(APPEND DEFINES "OCTAVE_APIVERSION=${OCTAVE_API_VERSION}")
SET(OCTAVE_APIVERSION ${OCTAVE_API_VERSION})
IF(OctaveModular)
UNSET(TARGET_SWIGFLAGS)
add_subdirectory(src/interfaces/octave_modular)
ENDIF()
IF(OctaveStatic)
add_subdirectory(src/interfaces/octave_static)
ENDIF()
ENDIF()
# csharp modular
IF (CSharpModular)
FIND_PACKAGE(CSharp REQUIRED)
UNSET(TARGET_SWIGFLAGS)
add_subdirectory(src/interfaces/csharp_modular)
ENDIF()
# r modular
IF (RModular OR RStatic)
FIND_PACKAGE(R REQUIRED)
IF (RModular)
UNSET(TARGET_SWIGFLAGS)
add_subdirectory(src/interfaces/r_modular)
ENDIF()
IF (RStatic)
add_subdirectory(src/interfaces/r_static)
ENDIF()
ENDIF()
# perl modular
IF (PerlModular)
FIND_PACKAGE(FindPerlLibs REQUIRED)
UNSET(TARGET_SWIGFLAGS)
#add_subdirectory(src/interfaces/perl_modular)
ENDIF()
IF (MatlabStatic)
FIND_PACKAGE(Matlab REQUIRED)
IF(MATLAB_FOUND)
add_subdirectory(src/interfaces/matlab_static)
ELSE()
MESSAGE(FATAL_ERROR "Could not find Matlab, which is required for compiling matlab_static interface. Try setting MATLAB_ROOT enviroment variable to the right path")
ENDIF()
ENDIF()
IF (CmdLineStatic)
add_subdirectory(src/interfaces/cmdline_static)
ENDIF()
IF (SVMLight)
MESSAGE(STATUS ${SVMLightWarning})
ENDIF()
################# TESTING ###################
#TODO: finish!!!
OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of Shogun builds" OFF)
IF(BUILD_DASHBOARD_REPORTS)
file(TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/configs/valgrind.supp" VALGRIND_SUPPRESSION_FILE)
SET(MEMORYCHECK_SUPPRESSIONS_FILE ${VALGRIND_SUPPRESSION_FILE} CACHE FILEPATH "File that contains suppressions for the memory checker")
include(CTest)
ENDIF()
OPTION(ENABLE_TESTING "Enable testing" OFF)
OPTION(TRAVIS_DISABLE_UNIT_TESTS "Disable unit testing to speed up jobs on travis-ci" OFF)
OPTION(TRAVIS_DISABLE_LIBSHOGUN_TESTS "Disable libshogun tests to speed up jobs on travis-ci" OFF)
IF(ENABLE_TESTING)
FIND_PACKAGE(Jinja2)
IF(NOT BUILD_DASHBOARD_REPORTS)
enable_testing()
ENDIF()
# add integration tests
add_subdirectory(tests/integration)
# add unit tests
IF (NOT TRAVIS_DISABLE_UNIT_TESTS)
add_subdirectory(tests/unit)
ENDIF()
ENDIF()
# save configuration options
MergeCFLAGS()
SET(CONFIGURE_OPTIONS "TODO")
SET(COMPFLAGS_CPP "${MERGED_CXX_FLAGS}")
SET(LINKFLAGS "${POSTLINKFLAGS}")
add_subdirectory(src/shogun)
IF(BUILD_EXAMPLES OR ENABLE_TESTING)
add_subdirectory(examples)
ENDIF()
# general cpack settings
set(CPACK_PACKAGE_NAME "shogun")
set(CPACK_PACKAGE_VENDOR "shogun")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/README")
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/src/COPYRIGHT")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Shogun Machine Learning Toolbox")
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${SHOGUN_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SHOGUN_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SHOGUN_VERSION_PATCH})
# debian package settings
set(CPACK_DEB_COMPONENT_INSTALL ON)
# rpm package settings
set(CPACK_RPM_COMPONENT_INSTALL ON)
INCLUDE(CPack)
message(STATUS "===================================================================================================================")
message(STATUS "Summary of Configuration Variables")
include(FeatureSummary)
feature_summary(WHAT ALL)
message(STATUS "===================================================================================================================")
message(STATUS "Enabled Interfaces")
message(STATUS " libshogun is ON")
PrintInterfaceStatus("python modular" PythonModular)
PrintInterfaceStatus("octave modular" OctaveModular)
PrintInterfaceStatus("java modular" JavaModular)
PrintInterfaceStatus("perl modular" PerlModular)
PrintInterfaceStatus("ruby modular" RubyModular)
PrintInterfaceStatus("csharp modular" CSharpModular)
PrintInterfaceStatus("R modular" RModular)
PrintInterfaceStatus("lua modular" LuaModular)
message(STATUS "")
message(STATUS "Enabled legacy interfaces")
PrintInterfaceStatus("cmdline static" CmdLineStatic)
PrintInterfaceStatus("python static" PythonStatic)
PrintInterfaceStatus("octave static" OctaveStatic)
PrintInterfaceStatus("matlab static" MatlabStatic)
PrintInterfaceStatus("R static" RStatic)
message(STATUS "===================================================================================================================")
message(STATUS "To compile shogun type")
message(STATUS " make")
message(STATUS "")
message(STATUS "To install shogun to ${CMAKE_INSTALL_PREFIX} type")
message(STATUS " make install")
message(STATUS "")
message(STATUS "or to install to a custom directory")
message(STATUS " make install DESTDIR=/my/special/path")
message(STATUS " (or rerun cmake with -DCMAKE_INSTALL_PREFIX=/my/special/path) to just change the prefix")
message(STATUS "===================================================================================================================")