Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jgillis committed Mar 21, 2024
1 parent 82dbc50 commit 61004ab
Show file tree
Hide file tree
Showing 11 changed files with 342 additions and 116 deletions.
48 changes: 44 additions & 4 deletions matlab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,45 @@ endif()

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(mex SHARED src/mex.cpp include/mex.h include/mex_versions.h include/mex_Export.h)
add_library(mx SHARED src/mx.cpp include/mex.h include/matrix.h include/matrix_versions.h include/mx_Export.h)
add_library(ut SHARED src/ut.cpp include/ut.h include/ut_Export.h)
add_library(eng SHARED src/eng.cpp include/eng_Export.h)

include(GenerateExportHeader)

GENERATE_EXPORT_HEADER(
mex
BASE_NAME mex
EXPORT_MACRO_NAME mex_Export
EXPORT_FILE_NAME include/mex_Export.h
STATIC_DEFINE mex_BUILT_AS_STATIC
)
GENERATE_EXPORT_HEADER(
mx
BASE_NAME mx
EXPORT_MACRO_NAME mx_Export
EXPORT_FILE_NAME include/mx_Export.h
STATIC_DEFINE mx_BUILT_AS_STATIC
)
GENERATE_EXPORT_HEADER(
ut
BASE_NAME ut
EXPORT_MACRO_NAME ut_Export
EXPORT_FILE_NAME include/ut_Export.h
STATIC_DEFINE ut_BUILT_AS_STATIC
)
GENERATE_EXPORT_HEADER(
eng
BASE_NAME eng
EXPORT_MACRO_NAME eng_Export
EXPORT_FILE_NAME include/eng_Export.h
STATIC_DEFINE eng_BUILT_AS_STATIC
)
#target_include_directories(mex PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
#target_include_directories(mx PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
#target_include_directories(ut PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
#target_include_directories(eng PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")

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

target_include_directories(ut 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
42 changes: 42 additions & 0 deletions matlab/include/eng_Export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

#ifndef eng_Export_H
#define eng_Export_H

#ifdef eng_BUILT_AS_STATIC
# define eng_Export
# define ENG_NO_EXPORT
#else
# ifndef eng_Export
# ifdef eng_EXPORTS
/* We are building this library */
# define eng_Export __attribute__((visibility("default")))
# else
/* We are using this library */
# define eng_Export __attribute__((visibility("default")))
# endif
# endif

# ifndef ENG_NO_EXPORT
# define ENG_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif

#ifndef ENG_DEPRECATED
# define ENG_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef ENG_DEPRECATED_EXPORT
# define ENG_DEPRECATED_EXPORT eng_Export ENG_DEPRECATED
#endif

#ifndef ENG_DEPRECATED_NO_EXPORT
# define ENG_DEPRECATED_NO_EXPORT ENG_NO_EXPORT ENG_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef ENG_NO_DEPRECATED
# define ENG_NO_DEPRECATED
# endif
#endif

#endif
94 changes: 47 additions & 47 deletions matlab/include/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,52 +47,52 @@ typedef char16_t mxChar;
#include <matrix_versions.h>

// methods
int mxAddField(mxArray *, const char *);
char* mxArrayToString(const mxArray *);
mxArray* mxCreateCellMatrix(mwSize, mwSize);
mxArray* mxCreateCharMatrixFromStrings(mwSize, const char **);
mxArray* mxCreateDoubleMatrix(mwSize, mwSize, mxComplexity);
mxArray* mxCreateDoubleScalar(double);
mxArray* mxCreateLogicalMatrix(mwSize, mwSize);
mxArray* mxCreateLogicalScalar(bool);
mxArray* mxCreateNumericArray(mwSize, const mwSize *, mxClassID, mxComplexity);
mxArray* mxCreateNumericMatrix(mwSize, mwSize, mxClassID, mxComplexity);
mxArray* mxCreateSparse(mwSize, mwSize, mwSize, mxComplexity);
mxArray* mxCreateString(const char *);
mxArray* mxCreateStructMatrix(mwSize, mwSize, int, const char **);
void mxDestroyArray(mxArray *);
mxArray* mxGetCell(const mxArray *, mwIndex);
mxChar* mxGetChars(const mxArray *);
mxClassID mxGetClassID(const mxArray *);
void* mxGetData(const mxArray *);
const mwSize* mxGetDimensions(const mxArray *);
mxArray* mxGetField(const mxArray *, mwIndex, const char *);
mxArray* mxGetFieldByNumber(const mxArray *, mwIndex, int);
const char* mxGetFieldNameByNumber(const mxArray *, int);
mwIndex* mxGetIr(const mxArray *);
mwIndex* mxGetJc(const mxArray *);
size_t mxGetN(const mxArray *);
size_t mxGetM(const mxArray *);
mwSize mxGetNumberOfDimensions(const mxArray *);
mwSize mxGetNumberOfElements(const mxArray *);
int mxGetNumberOfFields(const mxArray *);
mxArray* mxGetProperty(const mxArray *, const mwIndex, const char *);
double mxGetScalar(const mxArray *);
int mxGetString(const mxArray *, char *, mwSize);
bool mxIsCell(const mxArray *);
bool mxIsChar(const mxArray *);
bool mxIsComplex(const mxArray *);
bool mxIsDouble(const mxArray *);
bool mxIsLogical(const mxArray *);
bool mxIsLogicalScalar(const mxArray *);
bool mxIsLogicalScalarTrue(const mxArray *);
bool mxIsNumeric(const mxArray *);
bool mxIsSparse(const mxArray *);
bool mxIsStruct(const mxArray *);
void mxSetCell(mxArray *, mwIndex, mxArray *);
void mxSetField(mxArray *, mwIndex, const char *, mxArray *);
void mxSetProperty(mxArray *, mwIndex, const char *, const mxArray *);
void mxSetFieldByNumber(mxArray *, mwIndex, int, mxArray *);
mxArray* mxCreateCharArray(mwSize, const mwSize *);
int mx_Export mxAddField(mxArray *, const char *);
char* mx_Export mxArrayToString(const mxArray *);
mxArray* mx_Export mxCreateCellMatrix(mwSize, mwSize);
mxArray* mx_Export mxCreateCharMatrixFromStrings(mwSize, const char **);
mxArray* mx_Export mxCreateDoubleMatrix(mwSize, mwSize, mxComplexity);
mxArray* mx_Export mxCreateDoubleScalar(double);
mxArray* mx_Export mxCreateLogicalMatrix(mwSize, mwSize);
mxArray* mx_Export mxCreateLogicalScalar(bool);
mxArray* mx_Export mxCreateNumericArray(mwSize, const mwSize *, mxClassID, mxComplexity);
mxArray* mx_Export mxCreateNumericMatrix(mwSize, mwSize, mxClassID, mxComplexity);
mxArray* mx_Export mxCreateSparse(mwSize, mwSize, mwSize, mxComplexity);
mxArray* mx_Export mxCreateString(const char *);
mxArray* mx_Export mxCreateStructMatrix(mwSize, mwSize, int, const char **);
void mx_Export mxDestroyArray(mxArray *);
mxArray* mx_Export mxGetCell(const mxArray *, mwIndex);
mxChar* mx_Export mxGetChars(const mxArray *);
mxClassID mx_Export mxGetClassID(const mxArray *);
void* mx_Export mxGetData(const mxArray *);
const mwSize* mx_Export mxGetDimensions(const mxArray *);
mxArray* mx_Export mxGetField(const mxArray *, mwIndex, const char *);
mxArray* mx_Export mxGetFieldByNumber(const mxArray *, mwIndex, int);
const char* mx_Export mxGetFieldNameByNumber(const mxArray *, int);
mwIndex* mx_Export mxGetIr(const mxArray *);
mwIndex* mx_Export mxGetJc(const mxArray *);
size_t mx_Export mxGetN(const mxArray *);
size_t mx_Export mxGetM(const mxArray *);
mwSize mx_Export mxGetNumberOfDimensions(const mxArray *);
mwSize mx_Export mxGetNumberOfElements(const mxArray *);
int mx_Export mxGetNumberOfFields(const mxArray *);
mxArray* mx_Export mxGetProperty(const mxArray *, const mwIndex, const char *);
double mx_Export mxGetScalar(const mxArray *);
int mx_Export mxGetString(const mxArray *, char *, mwSize);
bool mx_Export mxIsCell(const mxArray *);
bool mx_Export mxIsChar(const mxArray *);
bool mx_Export mxIsComplex(const mxArray *);
bool mx_Export mxIsDouble(const mxArray *);
bool mx_Export mxIsLogical(const mxArray *);
bool mx_Export mxIsLogicalScalar(const mxArray *);
bool mx_Export mxIsLogicalScalarTrue(const mxArray *);
bool mx_Export mxIsNumeric(const mxArray *);
bool mx_Export mxIsSparse(const mxArray *);
bool mx_Export mxIsStruct(const mxArray *);
void mx_Export mxSetCell(mxArray *, mwIndex, mxArray *);
void mx_Export mxSetField(mxArray *, mwIndex, const char *, mxArray *);
void mx_Export mxSetProperty(mxArray *, mwIndex, const char *, const mxArray *);
void mx_Export mxSetFieldByNumber(mxArray *, mwIndex, int, mxArray *);
mxArray* mx_Export mxCreateCharArray(mwSize, const mwSize *);

#endif // matrix_H
20 changes: 11 additions & 9 deletions matlab/include/mex.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#ifndef mex_H
#define mex_H
#include "mex_Export.h"
#include "mx_Export.h"


extern "C"
Expand All @@ -12,15 +14,15 @@ extern "C"
#include <mex_versions.h>

// methods
int mexCallMATLAB(int, mxArray *[], int, mxArray *[], const char *);
void mexErrMsgIdAndTxt(const char *, const char *, ...);
mxArray *mexCallMATLABWithTrap(int, mxArray *[], int, mxArray *[], const char *);
mxArray *mexGetVariable(const char *, const char *);
int mexEvalString(const char *);
void mexWarnMsgIdAndTxt(const char *, const char *, ...);
int mexPrintf(const char*, ...);
void mexLock(void);
int mexAtExit(void (*)(void));
int mex_Export mexCallMATLAB(int, mxArray *[], int, mxArray *[], const char *);
void mex_Export mexErrMsgIdAndTxt(const char *, const char *, ...);
mxArray mex_Export *mexCallMATLABWithTrap(int, mxArray *[], int, mxArray *[], const char *);
mxArray mex_Export *mexGetVariable(const char *, const char *);
int mex_Export mexEvalString(const char *);
void mex_Export mexWarnMsgIdAndTxt(const char *, const char *, ...);
int mex_Export mexPrintf(const char*, ...);
void mex_Export mexLock(void);
int mex_Export mexAtExit(void (*)(void));

}

Expand Down
42 changes: 42 additions & 0 deletions matlab/include/mex_Export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

#ifndef mex_Export_H
#define mex_Export_H

#ifdef mex_BUILT_AS_STATIC
# define mex_Export
# define MEX_NO_EXPORT
#else
# ifndef mex_Export
# ifdef mex_EXPORTS
/* We are building this library */
# define mex_Export __attribute__((visibility("default")))
# else
/* We are using this library */
# define mex_Export __attribute__((visibility("default")))
# endif
# endif

# ifndef MEX_NO_EXPORT
# define MEX_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif

#ifndef MEX_DEPRECATED
# define MEX_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef MEX_DEPRECATED_EXPORT
# define MEX_DEPRECATED_EXPORT mex_Export MEX_DEPRECATED
#endif

#ifndef MEX_DEPRECATED_NO_EXPORT
# define MEX_DEPRECATED_NO_EXPORT MEX_NO_EXPORT MEX_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef MEX_NO_DEPRECATED
# define MEX_NO_DEPRECATED
# endif
#endif

#endif
42 changes: 42 additions & 0 deletions matlab/include/mx_Export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

#ifndef mx_Export_H
#define mx_Export_H

#ifdef mx_BUILT_AS_STATIC
# define mx_Export
# define MX_NO_EXPORT
#else
# ifndef mx_Export
# ifdef mx_EXPORTS
/* We are building this library */
# define mx_Export __attribute__((visibility("default")))
# else
/* We are using this library */
# define mx_Export __attribute__((visibility("default")))
# endif
# endif

# ifndef MX_NO_EXPORT
# define MX_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif

#ifndef MX_DEPRECATED
# define MX_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef MX_DEPRECATED_EXPORT
# define MX_DEPRECATED_EXPORT mx_Export MX_DEPRECATED
#endif

#ifndef MX_DEPRECATED_NO_EXPORT
# define MX_DEPRECATED_NO_EXPORT MX_NO_EXPORT MX_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef MX_NO_DEPRECATED
# define MX_NO_DEPRECATED
# endif
#endif

#endif
14 changes: 14 additions & 0 deletions matlab/include/ut.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef ut_H
#define ut_H
#include "ut_Export.h"

extern "C"
{

// Undocumented Matlab API
bool ut_Export utIsInterruptPending(void);
void ut_Export utSetInterruptPending(bool);

}

#endif // ut_H
42 changes: 42 additions & 0 deletions matlab/include/ut_Export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

#ifndef ut_Export_H
#define ut_Export_H

#ifdef ut_BUILT_AS_STATIC
# define ut_Export
# define UT_NO_EXPORT
#else
# ifndef ut_Export
# ifdef ut_EXPORTS
/* We are building this library */
# define ut_Export __attribute__((visibility("default")))
# else
/* We are using this library */
# define ut_Export __attribute__((visibility("default")))
# endif
# endif

# ifndef UT_NO_EXPORT
# define UT_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif

#ifndef UT_DEPRECATED
# define UT_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef UT_DEPRECATED_EXPORT
# define UT_DEPRECATED_EXPORT ut_Export UT_DEPRECATED
#endif

#ifndef UT_DEPRECATED_NO_EXPORT
# define UT_DEPRECATED_NO_EXPORT UT_NO_EXPORT UT_DEPRECATED
#endif

#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef UT_NO_DEPRECATED
# define UT_NO_DEPRECATED
# endif
#endif

#endif
Loading

0 comments on commit 61004ab

Please sign in to comment.