From a0008244202b68124dc3cf5658aecaadbbbdc986 Mon Sep 17 00:00:00 2001 From: Viktor Gal Date: Tue, 4 Mar 2014 23:45:39 +0200 Subject: [PATCH] Fix Matlab static interface generation Matlab static generation was not generated as stated in #1777 This patch would not be possible without the help of @yage99 ! --- CMakeLists.txt | 4 ++-- src/interfaces/matlab_static/CMakeLists.txt | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c741014c553..53ec12f0f99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ ENDIF() # this has been only fixed in swig 2.0.12 or later. IF (NOT ((CYGWIN AND ENABLE_TESTING) OR (DARWIN AND COMPILE_MODULAR_INTERFACE - AND SWIG_VERSION VERSION_LESS "2.0.12"))) + AND SWIG_VERSION VERSION_LESS "2.0.12") OR MatlabStatic)) INCLUDE(CheckCXX11Features) IF(_HAS_CXX11_FLAG) @@ -950,7 +950,7 @@ ENDIF() IF (MatlabStatic) FIND_PACKAGE(Matlab REQUIRED) IF(MATLAB_FOUND) - IF(EXISTS ${CMAKE_SOURCE_DIR}/src/interfaces/matlab_modular) + IF(EXISTS ${CMAKE_SOURCE_DIR}/src/interfaces/matlab_static) add_subdirectory(${CMAKE_SOURCE_DIR}/src/interfaces/matlab_static) ENDIF() ELSE() diff --git a/src/interfaces/matlab_static/CMakeLists.txt b/src/interfaces/matlab_static/CMakeLists.txt index df808623736..82702147487 100644 --- a/src/interfaces/matlab_static/CMakeLists.txt +++ b/src/interfaces/matlab_static/CMakeLists.txt @@ -1,4 +1,5 @@ -include_directories(${MATLAB_INCLUDE_DIR}) - -add_library(matlab_static SHARED MatlabInterface.cpp) -target_link_libraries(matlab_static shogun ${MATLAB_LIBRARIES}) +ADD_CUSTOM_TARGET(matlab_static ALL + COMMAND "${MATLAB_ROOT}/bin/mex" -o sg -I${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/MatlabInterface.cpp $ + DEPENDS shogun + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Compiling MATLAB static interface")