Adding support for mex extensions in wrap, configure scripts slightly broken
parent
a38b7245be
commit
eec3f0f370
39
configure.ac
39
configure.ac
|
@ -30,8 +30,11 @@ DX_PS_FEATURE(OFF)
|
|||
DX_INIT_DOXYGEN(gtsam)
|
||||
|
||||
# Check for OS
|
||||
AC_CANONICAL_HOST # needs to be called at some point earlier
|
||||
AM_CONDITIONAL([DARWIN], [case $host_os in darwin*) true;; *) false;; esac])
|
||||
# needs to be called at some point earlier
|
||||
AC_CANONICAL_HOST
|
||||
AM_CONDITIONAL([DARWIN], [case $host_os in darwin*) true;; *) false;; esac])
|
||||
AM_CONDITIONAL([LINUX], [case $host_os in linux*) true;; *) false;; esac])
|
||||
AM_CONDITIONAL([IS_64BIT], [case $host_cpu in *x86_64*) true;; *) false;; esac])
|
||||
|
||||
# enable debug variable
|
||||
AC_ARG_ENABLE([debug],
|
||||
|
@ -45,18 +48,19 @@ AC_ARG_ENABLE([debug],
|
|||
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
|
||||
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
# AGC: isn't this redundant?
|
||||
#AC_CANONICAL_HOST # why was this called twice?
|
||||
# We need to determine what os we are on to determine if we need to do
|
||||
# special things because we are on a mac
|
||||
case $host_os in
|
||||
darwin* )
|
||||
# Do something specific for mac
|
||||
ISMAC=true
|
||||
;;
|
||||
*)
|
||||
ISMAC=false
|
||||
;;
|
||||
esac
|
||||
# case $host_os in
|
||||
# darwin* )
|
||||
# # Do something specific for mac
|
||||
# ISMAC=true
|
||||
# ;;
|
||||
# *)
|
||||
# ISMAC=false
|
||||
# ;;
|
||||
# esac
|
||||
|
||||
# enable profiling
|
||||
AC_ARG_ENABLE([profiling],
|
||||
|
@ -156,6 +160,17 @@ AC_ARG_ENABLE([install_wrap],
|
|||
|
||||
AM_CONDITIONAL([ENABLE_INSTALL_WRAP], [test x$install_wrap = xtrue])
|
||||
|
||||
# enable unsafe mode for wrap
|
||||
AC_ARG_ENABLE([unsafe_wrap],
|
||||
[ --enable-unsafe-wrap Enable using unsafe mode in wrap],
|
||||
[case "${enableval}" in
|
||||
yes) unsafe_wrap=true ;;
|
||||
no) unsafe_wrap=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-unsafe-wrap]) ;;
|
||||
esac],[unsafe_wrap=false])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_UNSAFE_WRAP], [test x$unsafe_wrap = xtrue])
|
||||
|
||||
# wrap install path: optional flag to change location of wrap, defaults to install prefix/bin
|
||||
AC_ARG_WITH([wrap],
|
||||
[AS_HELP_STRING([--with-wrap],
|
||||
|
|
|
@ -52,15 +52,38 @@ LDADD = libwrap.la ../CppUnitLite/libCppUnitLite.a
|
|||
# rule to run executable with valgrind
|
||||
%.valgrind: % $(LDADD)
|
||||
valgrind ./$^
|
||||
|
||||
|
||||
# generate local toolbox dir
|
||||
interfacePath = $(top_srcdir)
|
||||
moduleName = gtsam
|
||||
toolboxpath = ../toolbox
|
||||
nameSpace = "gtsam"
|
||||
mexFlags = "${BOOST_CPPFLAGS} -DUNSAFE_WRAP -I${prefix}/include -I${prefix}/include/gtsam -I${prefix}/include/gtsam/base -I${prefix}/include/gtsam/geometry -I${prefix}/include/gtsam/linear -I${prefix}/include/gtsam/nonlinear -I${prefix}/include/gtsam/slam -L${exec_prefix}/lib -lgtsam"
|
||||
mexFlags =
|
||||
mexFlags += "${BOOST_CPPFLAGS} -DUNSAFE_WRAP -I${prefix}/include -I${prefix}/include/gtsam -I${prefix}/include/gtsam/base -I${prefix}/include/gtsam/geometry -I${prefix}/include/gtsam/linear -I${prefix}/include/gtsam/nonlinear -I${prefix}/include/gtsam/slam -L${exec_prefix}/lib -lgtsam"
|
||||
if ENABLE_UNSAFE_WRAP
|
||||
mexFlags += "${BOOST_CPPFLAGS} -DUNSAFE_WRAP -I${prefix}/include -I${prefix}/include/gtsam -I${prefix}/include/gtsam/base -I${prefix}/include/gtsam/geometry -I${prefix}/include/gtsam/linear -I${prefix}/include/gtsam/nonlinear -I${prefix}/include/gtsam/slam -L${exec_prefix}/lib -lgtsam"
|
||||
else
|
||||
mexFlags += "${BOOST_CPPFLAGS} -I${prefix}/include -I${prefix}/include/gtsam -I${prefix}/include/gtsam/base -I${prefix}/include/gtsam/geometry -I${prefix}/include/gtsam/linear -I${prefix}/include/gtsam/nonlinear -I${prefix}/include/gtsam/slam -L${exec_prefix}/lib -lgtsam"
|
||||
endif
|
||||
|
||||
# Find the extension for mex binaries - FIXME: this should be done with mexext with matlab
|
||||
mexextension = mexa64
|
||||
if LINUX
|
||||
if IS_64BIT
|
||||
mexextension += mexa64
|
||||
else
|
||||
mexextension += mexglx
|
||||
endif
|
||||
else # Linux
|
||||
if DARWIN
|
||||
mexextension += mexmaci64
|
||||
else
|
||||
mexextension += mex_bin
|
||||
endif
|
||||
endif # Linux
|
||||
|
||||
all:
|
||||
./wrap ${interfacePath} ${moduleName} ${toolboxpath} ${nameSpace} ${mexFlags}
|
||||
./wrap ${mexextension} ${interfacePath} ${moduleName} ${toolboxpath} ${nameSpace} ${mexFlags}
|
||||
|
||||
wrap-install-bin: all
|
||||
install -d ${wrap} && \
|
||||
|
|
|
@ -200,6 +200,7 @@ Module::Module(const string& interfacePath,
|
|||
/* ************************************************************************* */
|
||||
void Module::matlab_code(const string& toolboxPath,
|
||||
const string& nameSpace,
|
||||
const string& mexExt,
|
||||
const string& mexFlags)
|
||||
{
|
||||
try {
|
||||
|
@ -228,7 +229,7 @@ void Module::matlab_code(const string& toolboxPath,
|
|||
if (verbose_) cerr << "generating " << makeFile << endl;
|
||||
emit_header_comment(make_ofs,"#");
|
||||
make_ofs << "\nMEX = mex\n";
|
||||
make_ofs << "MEXENDING = mexa64\n";
|
||||
make_ofs << "MEXENDING = " << mexExt << "\n";
|
||||
make_ofs << "mex_flags = " << mexFlags << "\n\n";
|
||||
|
||||
// generate proxy classes and wrappers
|
||||
|
|
|
@ -33,13 +33,14 @@ struct Module {
|
|||
bool verbose_; ///< verbose flag
|
||||
|
||||
/// constructor that parses interface file
|
||||
Module(const std::string& interfacePath,
|
||||
Module(const std::string& interfacePath,
|
||||
const std::string& moduleName,
|
||||
bool verbose=true);
|
||||
|
||||
/// MATLAB code generation:
|
||||
void matlab_code(const std::string& path,
|
||||
const std::string& nameSpace,
|
||||
const std::string& mexExt,
|
||||
const std::string& mexFlags);
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ TEST( wrap, matlab_code ) {
|
|||
|
||||
// emit MATLAB code
|
||||
// make_geometry will not compile, use make testwrap to generate real make
|
||||
module.matlab_code("actual", "", "-O5");
|
||||
module.matlab_code("mexa64", "actual", "", "-O5");
|
||||
|
||||
EXPECT(files_equal(path + "/tests/expected/@Point2/Point2.m" , "actual/@Point2/Point2.m" ));
|
||||
EXPECT(files_equal(path + "/tests/expected/@Point2/x.cpp" , "actual/@Point2/x.cpp" ));
|
||||
|
|
|
@ -24,13 +24,15 @@ using namespace std;
|
|||
|
||||
/**
|
||||
* Top-level function to wrap a module
|
||||
* @param mexExt is the extension for mex binaries for this os/cpu
|
||||
* @param interfacePath path to where interface file lives, e.g., borg/gtsam
|
||||
* @param moduleName name of the module to be generated e.g. gtsam
|
||||
* @param toolboxPath path where the toolbox should be generated, e.g. borg/gtsam/build
|
||||
* @param nameSpace e.g. gtsam
|
||||
* @param mexFlags extra arguments for mex script, i.e., include flags etc...
|
||||
*/
|
||||
void generate_matlab_toolbox(const string& interfacePath,
|
||||
void generate_matlab_toolbox(const string& mexExt,
|
||||
const string& interfacePath,
|
||||
const string& moduleName,
|
||||
const string& toolboxPath,
|
||||
const string& nameSpace,
|
||||
|
@ -41,7 +43,7 @@ void generate_matlab_toolbox(const string& interfacePath,
|
|||
wrap::Module module(interfacePath, moduleName, true);
|
||||
|
||||
// Then emit MATLAB code
|
||||
module.matlab_code(toolboxPath,nameSpace,mexFlags);
|
||||
module.matlab_code(toolboxPath,nameSpace,mexExt,mexFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,9 +51,10 @@ void generate_matlab_toolbox(const string& interfacePath,
|
|||
* Typically called from "make all" using appropriate arguments
|
||||
*/
|
||||
int main(int argc, const char* argv[]) {
|
||||
if (argc<5 || argc>6) {
|
||||
if (argc<6 || argc>7) {
|
||||
cerr << "wrap parses an interface file and produces a MATLAB toolbox" << endl;
|
||||
cerr << "usage: wrap interfacePath moduleName toolboxPath" << endl;
|
||||
cerr << " mexExtension : OS/CPU-dependent extension for MEX binaries" << endl;
|
||||
cerr << " interfacePath : *absolute* path to directory of module interface file" << endl;
|
||||
cerr << " moduleName : the name of the module, interface file must be called moduleName.h" << endl;
|
||||
cerr << " toolboxPath : the directory in which to generate the wrappers" << endl;
|
||||
|
@ -59,6 +62,6 @@ int main(int argc, const char* argv[]) {
|
|||
cerr << " [mexFlags] : extra flags for the mex command" << endl;
|
||||
}
|
||||
else
|
||||
generate_matlab_toolbox(argv[1],argv[2],argv[3],argv[4],argc==5 ? " " : argv[5]);
|
||||
generate_matlab_toolbox(argv[1],argv[2],argv[3],argv[4],argv[5],argc==6 ? " " : argv[6]);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue