@@ -44,6 +44,11 @@ SET(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third_party)
44
44
SET (LIBSHOGUN_SRC_DIR ${CMAKE_SOURCE_DIR} /src/shogun )
45
45
SET (COMMON_MODULAR_SRC_DIR ${CMAKE_SOURCE_DIR} /src/interfaces/modular/ )
46
46
47
+ INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR} /src
48
+ ${CMAKE_SOURCE_DIR} /src/shogun
49
+ ${CMAKE_BINARY_DIR} /src
50
+ ${CMAKE_BINARY_DIR} /src/shogun )
51
+
47
52
# check whether any of the modular interfaces are turned ON
48
53
IF (
49
54
PythonModular OR LuaModular OR RModular OR
@@ -184,15 +189,9 @@ ENDIF()
184
189
# clang with -std=c++11 and -stdlib=libc++ does not work
185
190
# well with swig generated cxx hence disable c++11 for this case.
186
191
187
- # TODO: until swig 2.0.11 does not support compilation with libc++
188
- # There are PRs against SWIG HEAD to fix this hence it needs to be checked
189
- # which later version can support compilation with libc++
190
- IF (COMPILE_MODULAR_INTERFACE AND ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "Clang" ) AND NOT SWIG_VERSION VERSION_GREATER "2.0.11" )
191
- SET (CMAKE_CXX_FLAGS "-stdlib=libstdc++ ${CMAKE_CXX_FLAGS} " )
192
- SET (SWIG_CXX_COMPILER_FLAGS "-stdlib=libstdc++ ${SWIG_CXX_COMPILER_FLAGS} " )
193
- ENDIF ()
194
-
195
- IF (NOT ((CYGWIN AND ENABLE_TESTING ) OR (DARWIN AND COMPILE_MODULAR_INTERFACE )))
192
+ # this has been only fixed in swig 2.0.12 or later.
193
+ IF (NOT ((CYGWIN AND ENABLE_TESTING ) OR (DARWIN AND COMPILE_MODULAR_INTERFACE
194
+ AND SWIG_VERSION VERSION_LESS "2.0.12" )))
196
195
INCLUDE (CheckCXX11Features )
197
196
198
197
IF (_HAS_CXX11_FLAG )
@@ -212,6 +211,12 @@ IF (NOT ((CYGWIN AND ENABLE_TESTING) OR (DARWIN AND COMPILE_MODULAR_INTERFACE)))
212
211
IF (HAVE_CXX11_ATOMIC )
213
212
LIST (APPEND DEFINES HAVE_CXX11_ATOMIC )
214
213
ENDIF ()
214
+ ELSEIF (DARWIN AND ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "Clang" ) AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0" ))
215
+ # osx clang 5.0.0 or later uses libc++ by default
216
+ # this is causing problems with source generated by swig version earlier than 3.0.0
217
+ # force to use libstdc++ for compilation of sources
218
+ SET (CMAKE_CXX_FLAGS "-stdlib=libstdc++ ${CMAKE_CXX_FLAGS} " )
219
+ SET (SWIG_CXX_COMPILER_FLAGS "-stdlib=libstdc++ ${SWIG_CXX_COMPILER_FLAGS} " )
215
220
ENDIF ()
216
221
217
222
include (CheckIncludeFileCXX )
@@ -825,11 +830,15 @@ IF (PythonModular OR PythonStatic)
825
830
SET (TARGET_SWIGFLAGS "-builtin\; -modern\; -modernargs" )
826
831
ENDIF ()
827
832
828
- add_subdirectory (src/interfaces/python_modular )
833
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/python_modular )
834
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/python_modular )
835
+ ENDIF ()
829
836
ENDIF ()
830
837
831
838
IF (PythonStatic )
832
- add_subdirectory (src/interfaces/python_static )
839
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/python_static )
840
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/python_static )
841
+ ENDIF ()
833
842
ENDIF ()
834
843
ENDIF ()
835
844
@@ -843,7 +852,9 @@ IF (LuaModular)
843
852
ENDIF ()
844
853
SET (LUA_EXECUTABLE lua )
845
854
UNSET (TARGET_SWIGFLAGS )
846
- add_subdirectory (src/interfaces/lua_modular )
855
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/lua_modular )
856
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/lua_modular )
857
+ ENDIF ()
847
858
ENDIF ()
848
859
849
860
# java modular
@@ -865,7 +876,9 @@ IF (JavaModular)
865
876
ENDIF ()
866
877
867
878
SET (TARGET_SWIGFLAGS "-package\; org.shogun" )
868
- add_subdirectory (src/interfaces/java_modular )
879
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/java_modular )
880
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/java_modular )
881
+ ENDIF ()
869
882
ENDIF ()
870
883
871
884
# ruby modular
@@ -874,7 +887,7 @@ IF (RubyModular)
874
887
FIND_PACKAGE (RubyNArray REQUIRED )
875
888
SET (NARRAY_LIB ${RUBY_NARRAY_LIBRARY} )
876
889
UNSET (TARGET_SWIGFLAGS )
877
- add_subdirectory (src/interfaces/ruby_modular )
890
+ add_subdirectory (${CMAKE_SOURCE_DIR} / src/interfaces/ruby_modular )
878
891
ENDIF ()
879
892
880
893
# octave modular
@@ -886,19 +899,25 @@ IF (OctaveModular OR OctaveStatic)
886
899
887
900
IF (OctaveModular )
888
901
UNSET (TARGET_SWIGFLAGS )
889
- add_subdirectory (src/interfaces/octave_modular )
902
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/octave_modular )
903
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/octave_modular )
904
+ ENDIF ()
890
905
ENDIF ()
891
906
892
907
IF (OctaveStatic )
893
- add_subdirectory (src/interfaces/octave_static )
908
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/octave_static )
909
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/octave_static )
910
+ ENDIF ()
894
911
ENDIF ()
895
912
ENDIF ()
896
913
897
914
# csharp modular
898
915
IF (CSharpModular )
899
916
FIND_PACKAGE (CSharp REQUIRED )
900
917
UNSET (TARGET_SWIGFLAGS )
901
- add_subdirectory (src/interfaces/csharp_modular )
918
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/csharp_modular )
919
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/csharp_modular )
920
+ ENDIF ()
902
921
ENDIF ()
903
922
904
923
# r modular
@@ -907,32 +926,42 @@ IF (RModular OR RStatic)
907
926
908
927
IF (RModular )
909
928
UNSET (TARGET_SWIGFLAGS )
910
- add_subdirectory (src/interfaces/r_modular )
929
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/r_modular )
930
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/r_modular )
931
+ ENDIF ()
911
932
ENDIF ()
912
933
913
934
IF (RStatic )
914
- add_subdirectory (src/interfaces/r_static )
935
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/r_static )
936
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/r_static )
937
+ ENDIF ()
915
938
ENDIF ()
916
939
ENDIF ()
917
940
918
941
# perl modular
919
942
IF (PerlModular )
920
943
FIND_PACKAGE (FindPerlLibs REQUIRED )
921
944
UNSET (TARGET_SWIGFLAGS )
922
- #add_subdirectory(src/interfaces/perl_modular)
945
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/perl_modular )
946
+ #add_subdirectory(${CMAKE_SOURCE_DIR}/src/interfaces/perl_modular)
947
+ ENDIF ()
923
948
ENDIF ()
924
949
925
950
IF (MatlabStatic )
926
951
FIND_PACKAGE (Matlab REQUIRED )
927
952
IF (MATLAB_FOUND )
928
- add_subdirectory (src/interfaces/matlab_static )
953
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/matlab_modular )
954
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/matlab_static )
955
+ ENDIF ()
929
956
ELSE ()
930
957
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" )
931
958
ENDIF ()
932
959
ENDIF ()
933
960
934
961
IF (CmdLineStatic )
935
- add_subdirectory (src/interfaces/cmdline_static )
962
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/interfaces/cmdline_static )
963
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/interfaces/cmdline_static )
964
+ ENDIF ()
936
965
ENDIF ()
937
966
938
967
IF (SVMLight )
@@ -945,6 +974,7 @@ OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of Shogun builds
945
974
IF (BUILD_DASHBOARD_REPORTS )
946
975
file (TO_CMAKE_PATH "${CMAKE_SOURCE_DIR} /configs/valgrind.supp" VALGRIND_SUPPRESSION_FILE )
947
976
SET (MEMORYCHECK_SUPPRESSIONS_FILE ${VALGRIND_SUPPRESSION_FILE} CACHE FILEPATH "File that contains suppressions for the memory checker" )
977
+ SET (MEMORYCHECK_COMMAND_OPTIONS "-q --tool=memcheck --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1" )
948
978
include (CTest )
949
979
ENDIF ()
950
980
@@ -957,13 +987,15 @@ IF(ENABLE_TESTING)
957
987
enable_testing ()
958
988
ENDIF ()
959
989
960
- # add integration tests
961
- add_subdirectory (tests/integration )
990
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /tests )
991
+ # add integration tests
992
+ add_subdirectory (${CMAKE_SOURCE_DIR} /tests/integration )
962
993
963
994
964
- # add unit tests
965
- IF (NOT TRAVIS_DISABLE_UNIT_TESTS )
966
- add_subdirectory (tests/unit )
995
+ # add unit tests
996
+ IF (NOT TRAVIS_DISABLE_UNIT_TESTS )
997
+ add_subdirectory (${CMAKE_SOURCE_DIR} /tests/unit )
998
+ ENDIF ()
967
999
ENDIF ()
968
1000
ENDIF ()
969
1001
@@ -973,10 +1005,14 @@ SET(CONFIGURE_OPTIONS "TODO")
973
1005
SET (COMPFLAGS_CPP "${MERGED_CXX_FLAGS} " )
974
1006
SET (LINKFLAGS "${POSTLINKFLAGS} " )
975
1007
976
- add_subdirectory (src/shogun )
1008
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/shogun )
1009
+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/shogun )
1010
+ ENDIF ()
977
1011
978
- IF (BUILD_EXAMPLES OR ENABLE_TESTING )
979
- add_subdirectory (examples )
1012
+ IF (EXISTS ${CMAKE_SOURCE_DIR} /examples )
1013
+ IF (BUILD_EXAMPLES OR ENABLE_TESTING )
1014
+ add_subdirectory (${CMAKE_SOURCE_DIR} /examples )
1015
+ ENDIF ()
980
1016
ENDIF ()
981
1017
982
1018
# general cpack settings
0 commit comments