1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

UAVObjects-matlab: Move generated files into build dir

Also note that the command line option to the uavobjectgenerator
binary for matlab has changed from "mathlab" to "matlab".

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2523 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
stac 2011-01-22 17:38:30 +00:00 committed by stac
parent f7a3cfc475
commit b3b98347ec
5 changed files with 15 additions and 14 deletions

4
.gitignore vendored
View File

@ -65,10 +65,6 @@
/tools
/build
#ignore autogenerated files - they should really go into special dirs to be ignored more easy
ground/src/plugins/uavobjects/OPLogConvert.m
openpilotgcs-build-desktop
flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.mode1v3
flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.pbxuser

View File

@ -214,7 +214,7 @@ uavobject-synthetics:
mkdir -p $(BUILD_DIR)/$@
.PHONY:uavobjects
uavobjects: uavobjects_gcs uavobjects_flight uavobjects_python
uavobjects: uavobjects_gcs uavobjects_flight uavobjects_python uavobjects_matlab
uavobjects_gcs: uavobject-synthetics uavobjgenerator
mkdir -p $(BUILD_DIR)/uavobject-synthetics/gcs
@ -228,6 +228,10 @@ uavobjects_python: uavobject-synthetics uavobjgenerator
mkdir -p $(BUILD_DIR)/uavobject-synthetics/python
$(UAVOBJGENERATOR) -python "$(ROOT_DIR)/"
uavobjects_matlab: uavobject-synthetics uavobjgenerator
mkdir -p $(BUILD_DIR)/uavobject-synthetics/matlab
$(UAVOBJGENERATOR) -matlab "$(ROOT_DIR)/"
uavobjects_test: uavobject-synthetics uavobjgenerator
$(UAVOBJGENERATOR) -v -none "$(ROOT_DIR)/"

View File

@ -28,12 +28,13 @@
using namespace std;
bool UAVObjectGeneratorMatlab::generate(UAVObjectParser* parser,QString basepath) {
bool UAVObjectGeneratorMatlab::generate(UAVObjectParser* parser,QString basepath,QString outputpath) {
fieldTypeStrMatlab << "int8" << "int16" << "int32"
<< "uint8" << "uint16" << "uint32" << "float32" << "uint8";
QDir matlabTemplatePath = QDir( basepath + QString("ground/src/plugins/uavobjects"));
QDir matlabOutputPath = QDir( outputpath + QString("matlab"));
QString matlabCodeTemplate = readFile( matlabTemplatePath.absoluteFilePath( "uavobjecttemplate.m") );
@ -52,7 +53,7 @@ bool UAVObjectGeneratorMatlab::generate(UAVObjectParser* parser,QString basepath
matlabCodeTemplate.replace( QString("$(SAVEOBJECTSCODE)"), matlabSaveObjectsCode);
matlabCodeTemplate.replace( QString("$(FUNCTIONSCODE)"), matlabFunctionsCode);
bool res = writeFile( matlabTemplatePath.absolutePath() + "/OPLogConvert.m", matlabCodeTemplate );
bool res = writeFile( matlabOutputPath.absolutePath() + "/OPLogConvert.m", matlabCodeTemplate );
if (!res) {
cout << "Error: Could not write output files" << endl;
return false;

View File

@ -32,7 +32,7 @@
class UAVObjectGeneratorMatlab
{
public:
bool generate(UAVObjectParser* gen,QString basepath);
bool generate(UAVObjectParser* gen,QString basepath,QString outputpath);
private:
bool process_object(ObjectInfo* info);

View File

@ -45,19 +45,19 @@ using namespace std;
* print usage info
*/
void usage() {
cout << "Usage: uavobjectgenerator [-gcs] [-flight] [-java] [-python] [-mathlab] [-none] [-v] [base_path]" << endl;
cout << "Usage: uavobjectgenerator [-gcs] [-flight] [-java] [-python] [-matlab] [-none] [-v] [base_path]" << endl;
cout << "Languages: "<< endl;
cout << "\t-gcs build grounstation code" << endl;
cout << "\t-gcs build groundstation code" << endl;
cout << "\t-flight build flight code" << endl;
cout << "\t-java build java code" << endl;
cout << "\t-python build python code" << endl;
cout << "\t-matlab build matlab code" << endl;
cout << "\tIf no language is specified ( and not -none ) -> all are build." << endl;
cout << "\tIf no language is specified ( and not -none ) -> all are built." << endl;
cout << "Misc: "<< endl;
cout << "\t-none build no language - just parse xml's" << endl;
cout << "\t-h this help" << endl;
cout << "\t-v verbose" << endl;
cout << " \tbase_path base path to gcs and flight directories (as in svn)." << endl;
cout << "\tbase_path base path to gcs and flight directories (as in svn)." << endl;
}
/**
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
bool do_flight=(arguments_stringlist.removeAll("-flight")>0);
bool do_java=(arguments_stringlist.removeAll("-java")>0);
bool do_python=(arguments_stringlist.removeAll("-python")>0);
bool do_matlab=(arguments_stringlist.removeAll("-mathlab")>0);
bool do_matlab=(arguments_stringlist.removeAll("-matlab")>0);
bool do_none=(arguments_stringlist.removeAll("-none")>0); //
bool do_all=((do_gcs||do_flight||do_java||do_python||do_matlab)==false);
@ -197,7 +197,7 @@ int main(int argc, char *argv[])
if (do_matlab|do_all) {
cout << "generating matlab code" << endl ;
UAVObjectGeneratorMatlab matlabgen;
matlabgen.generate(parser,basepath);
matlabgen.generate(parser,basepath,outputpath);
}
return RETURN_OK;