@@ -44,6 +44,11 @@ SET(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third_party)
4444SET (LIBSHOGUN_SRC_DIR ${CMAKE_SOURCE_DIR} /src/shogun)
4545SET (COMMON_MODULAR_SRC_DIR ${CMAKE_SOURCE_DIR} /src/interfaces/modular/)
4646
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+
4752# check whether any of the modular interfaces are turned ON
4853IF (
4954 PythonModular OR LuaModular OR RModular OR
@@ -184,15 +189,9 @@ ENDIF()
184189# clang with -std=c++11 and -stdlib=libc++ does not work
185190# well with swig generated cxx hence disable c++11 for this case.
186191
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" )))
196195 INCLUDE (CheckCXX11Features)
197196
198197 IF (_HAS_CXX11_FLAG)
@@ -212,6 +211,12 @@ IF (NOT ((CYGWIN AND ENABLE_TESTING) OR (DARWIN AND COMPILE_MODULAR_INTERFACE)))
212211 IF (HAVE_CXX11_ATOMIC)
213212 LIST (APPEND DEFINES HAVE_CXX11_ATOMIC)
214213 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} " )
215220ENDIF ()
216221
217222include (CheckIncludeFileCXX)
@@ -825,11 +830,15 @@ IF (PythonModular OR PythonStatic)
825830 SET (TARGET_SWIGFLAGS "-builtin\; -modern\; -modernargs" )
826831 ENDIF ()
827832
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 ()
829836 ENDIF ()
830837
831838 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 ()
833842 ENDIF ()
834843ENDIF ()
835844
@@ -843,7 +852,9 @@ IF (LuaModular)
843852 ENDIF ()
844853 SET (LUA_EXECUTABLE lua)
845854 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 ()
847858ENDIF ()
848859
849860# java modular
@@ -865,7 +876,9 @@ IF (JavaModular)
865876 ENDIF ()
866877
867878 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 ()
869882ENDIF ()
870883
871884# ruby modular
@@ -874,7 +887,7 @@ IF (RubyModular)
874887 FIND_PACKAGE (RubyNArray REQUIRED)
875888 SET (NARRAY_LIB ${RUBY_NARRAY_LIBRARY} )
876889 UNSET (TARGET_SWIGFLAGS)
877- add_subdirectory (src/interfaces/ruby_modular)
890+ add_subdirectory (${CMAKE_SOURCE_DIR} / src/interfaces/ruby_modular)
878891ENDIF ()
879892
880893# octave modular
@@ -886,19 +899,25 @@ IF (OctaveModular OR OctaveStatic)
886899
887900 IF (OctaveModular)
888901 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 ()
890905 ENDIF ()
891906
892907 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 ()
894911 ENDIF ()
895912ENDIF ()
896913
897914# csharp modular
898915IF (CSharpModular)
899916 FIND_PACKAGE (CSharp REQUIRED)
900917 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 ()
902921ENDIF ()
903922
904923# r modular
@@ -907,32 +926,42 @@ IF (RModular OR RStatic)
907926
908927 IF (RModular)
909928 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 ()
911932 ENDIF ()
912933
913934 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 ()
915938 ENDIF ()
916939ENDIF ()
917940
918941# perl modular
919942IF (PerlModular)
920943 FIND_PACKAGE (FindPerlLibs REQUIRED)
921944 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 ()
923948ENDIF ()
924949
925950IF (MatlabStatic)
926951 FIND_PACKAGE (Matlab REQUIRED)
927952 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 ()
929956 ELSE ()
930957 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" )
931958 ENDIF ()
932959ENDIF ()
933960
934961IF (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 ()
936965ENDIF ()
937966
938967IF (SVMLight)
@@ -945,6 +974,7 @@ OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of Shogun builds
945974IF (BUILD_DASHBOARD_REPORTS)
946975 file (TO_CMAKE_PATH "${CMAKE_SOURCE_DIR} /configs/valgrind.supp" VALGRIND_SUPPRESSION_FILE)
947976 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" )
948978 include (CTest)
949979ENDIF ()
950980
@@ -957,13 +987,15 @@ IF(ENABLE_TESTING)
957987 enable_testing ()
958988 ENDIF ()
959989
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)
962993
963994
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 ()
967999 ENDIF ()
9681000ENDIF ()
9691001
@@ -973,10 +1005,14 @@ SET(CONFIGURE_OPTIONS "TODO")
9731005SET (COMPFLAGS_CPP "${MERGED_CXX_FLAGS} " )
9741006SET (LINKFLAGS "${POSTLINKFLAGS} " )
9751007
976- add_subdirectory (src/shogun)
1008+ IF (EXISTS ${CMAKE_SOURCE_DIR} /src/shogun)
1009+ add_subdirectory (${CMAKE_SOURCE_DIR} /src/shogun)
1010+ ENDIF ()
9771011
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 ()
9801016ENDIF ()
9811017
9821018# general cpack settings
0 commit comments