Skip to content

Commit

Permalink
Matlab add engine
Browse files Browse the repository at this point in the history
  • Loading branch information
jgillis committed Jul 27, 2024
1 parent 126cbe8 commit fab6af9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
7 changes: 6 additions & 1 deletion matlab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_library(mex SHARED src/mex.cpp include/mex.h include/mex_versions.h)
add_library(mx SHARED src/mx.cpp include/mex.h include/matrix.h include/matrix_versions.h)
add_library(ut SHARED src/ut.cpp)
add_library(eng SHARED src/eng.cpp)
add_library(eng SHARED src/eng.cpp include/engine.h include/eng_Export.h)

if (NOT MATLAB_API_VERSION)
set(MATLAB_API_VERSION 800)
Expand Down Expand Up @@ -108,6 +108,11 @@ target_include_directories(mex PUBLIC
$<INSTALL_INTERFACE:${INSTALL_PREFIX}include>
)

target_include_directories(eng PUBLIC
$<BUILD_INTERFACE:${matlab_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_include_directories(mx PUBLIC
$<BUILD_INTERFACE:${matlab_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INSTALL_PREFIX}include>
Expand Down
20 changes: 20 additions & 0 deletions matlab/include/engine.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef engine_H
#define engine_H
#include "eng_Export.h"

extern "C"
{
typedef struct mxArray_tag mxArray;
typedef struct engine Engine;

eng_Export int engEvalString(Engine *, const char *);
eng_Export Engine* engOpenSingleUse(const char *, void *, int *);
eng_Export Engine *engOpen(const char *);
eng_Export int engClose(Engine *ep);
eng_Export mxArray *engGetVariable(Engine *, const char *);
eng_Export int engPutVariable(Engine *, const char *, const mxArray *);
eng_Export int engOutputBuffer(Engine *, char *, int);

}

#endif // engine_H
15 changes: 15 additions & 0 deletions matlab/src/eng.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "engine.h"

extern "C"
{
typedef struct mxArray_tag mxArray;
typedef struct engine Engine;

int engEvalString(Engine *, const char *) { return 0; }
Engine* engOpenSingleUse(const char *, void *, int *) { return 0; }
Engine *engOpen(const char *) { return 0; }
int engClose(Engine *ep) { return 0; }
mxArray *engGetVariable(Engine *, const char *) { return 0; }
int engPutVariable(Engine *, const char *, const mxArray *) { return 0; }
int engOutputBuffer(Engine *, char *, int) { return 0; }
}

0 comments on commit fab6af9

Please sign in to comment.