Dependency checking for matlab.h

release/4.3a0
Andrew Melim 2012-06-30 01:33:41 +00:00
parent 3c0ea754df
commit 02df40bd73
4 changed files with 9 additions and 5 deletions

View File

@ -152,7 +152,8 @@ void Class::makefile_fragment(FileWriter& file) const {
} }
BOOST_FOREACH(const string& file_base, file_names) { BOOST_FOREACH(const string& file_base, file_names) {
file.oss << file_base << ".$(MEXENDING): " << file_base << ".cpp" << endl; file.oss << file_base << ".$(MEXENDING): " << file_base << ".cpp";
file.oss << " $(PATH_TO_WRAP)/matlab.h" << endl;
file.oss << "\t$(MEX) $(mex_flags) " << file_base << ".cpp -output " << file_base << endl; file.oss << "\t$(MEX) $(mex_flags) " << file_base << ".cpp -output " << file_base << endl;
} }

View File

@ -287,7 +287,7 @@ void verifyReturnTypes(const vector<string>& validtypes, const vector<T>& vt) {
/* ************************************************************************* */ /* ************************************************************************* */
void Module::matlab_code(const string& mexCommand, const string& toolboxPath, void Module::matlab_code(const string& mexCommand, const string& toolboxPath,
const string& mexExt, const string& mexFlags) const { const string& mexExt, const string& headerPath,const string& mexFlags) const {
fs::create_directories(toolboxPath); fs::create_directories(toolboxPath);
@ -308,6 +308,7 @@ void Module::matlab_code(const string& mexCommand, const string& toolboxPath,
makeModuleMakefile.oss << "\nMEX = " << mexCommand << "\n"; makeModuleMakefile.oss << "\nMEX = " << mexCommand << "\n";
makeModuleMakefile.oss << "MEXENDING = " << mexExt << "\n"; makeModuleMakefile.oss << "MEXENDING = " << mexExt << "\n";
makeModuleMakefile.oss << "PATH_TO_WRAP = " << headerPath << "\n";
makeModuleMakefile.oss << "mex_flags = " << mexFlags << "\n\n"; makeModuleMakefile.oss << "mex_flags = " << mexFlags << "\n\n";
// Dependency check list // Dependency check list

View File

@ -44,6 +44,7 @@ struct Module {
const std::string& mexCommand, const std::string& mexCommand,
const std::string& path, const std::string& path,
const std::string& mexExt, const std::string& mexExt,
const std::string& headerPath,
const std::string& mexFlags) const; const std::string& mexFlags) const;
}; };

View File

@ -38,14 +38,15 @@ void generate_matlab_toolbox(
const string& interfacePath, const string& interfacePath,
const string& moduleName, const string& moduleName,
const string& toolboxPath, const string& toolboxPath,
const string& mexFlags) const string& headerPath,
const string& mexFlags)
{ {
// Parse interface file into class object // Parse interface file into class object
// This recursively creates Class objects, Method objects, etc... // This recursively creates Class objects, Method objects, etc...
wrap::Module module(interfacePath, moduleName, false); wrap::Module module(interfacePath, moduleName, false);
// Then emit MATLAB code // Then emit MATLAB code
module.matlab_code(mexCommand,toolboxPath,mexExt,mexFlags); module.matlab_code(mexCommand,toolboxPath,mexExt,headerPath,mexFlags);
} }
/** Displays usage information */ /** Displays usage information */
@ -73,6 +74,6 @@ int main(int argc, const char* argv[]) {
usage(); usage();
} }
else else
generate_matlab_toolbox(argv[1],argv[2],argv[3],argv[4],argv[5],argc==6 ? " " : argv[6]); generate_matlab_toolbox(argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],argc==7 ? " " : argv[7]);
return 0; return 0;
} }