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 /tools
/build /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 openpilotgcs-build-desktop
flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.mode1v3 flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.mode1v3
flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.pbxuser flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.pbxuser

View File

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

View File

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

View File

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

View File

@ -45,14 +45,14 @@ using namespace std;
* print usage info * print usage info
*/ */
void usage() { 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 << "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-flight build flight code" << endl;
cout << "\t-java build java code" << endl; cout << "\t-java build java code" << endl;
cout << "\t-python build python code" << endl; cout << "\t-python build python code" << endl;
cout << "\t-matlab build matlab 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 << "Misc: "<< endl;
cout << "\t-none build no language - just parse xml's" << endl; cout << "\t-none build no language - just parse xml's" << endl;
cout << "\t-h this help" << endl; cout << "\t-h this help" << endl;
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
bool do_flight=(arguments_stringlist.removeAll("-flight")>0); bool do_flight=(arguments_stringlist.removeAll("-flight")>0);
bool do_java=(arguments_stringlist.removeAll("-java")>0); bool do_java=(arguments_stringlist.removeAll("-java")>0);
bool do_python=(arguments_stringlist.removeAll("-python")>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_none=(arguments_stringlist.removeAll("-none")>0); //
bool do_all=((do_gcs||do_flight||do_java||do_python||do_matlab)==false); 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) { if (do_matlab|do_all) {
cout << "generating matlab code" << endl ; cout << "generating matlab code" << endl ;
UAVObjectGeneratorMatlab matlabgen; UAVObjectGeneratorMatlab matlabgen;
matlabgen.generate(parser,basepath); matlabgen.generate(parser,basepath,outputpath);
} }
return RETURN_OK; return RETURN_OK;