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

UAVObjects-python: Move generated files into build dir

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

43
.gitignore vendored
View File

@ -68,49 +68,6 @@
#ignore autogenerated files - they should really go into special dirs to be ignored more easy
ground/src/plugins/uavobjects/OPLogConvert.m
ground/src/plugins/uavobjects/actuatorcommand.py
ground/src/plugins/uavobjects/actuatordesired.py
ground/src/plugins/uavobjects/actuatorsettings.py
ground/src/plugins/uavobjects/ahrscalibration.py
ground/src/plugins/uavobjects/ahrssettings.py
ground/src/plugins/uavobjects/ahrsstatus.py
ground/src/plugins/uavobjects/attitudeactual.py
ground/src/plugins/uavobjects/attitudedesired.py
ground/src/plugins/uavobjects/attituderaw.py
ground/src/plugins/uavobjects/baroaltitude.py
ground/src/plugins/uavobjects/batterysettings.py
ground/src/plugins/uavobjects/firmwareiapobj.py
ground/src/plugins/uavobjects/flightbatterystate.py
ground/src/plugins/uavobjects/flightplancontrol.py
ground/src/plugins/uavobjects/flightplansettings.py
ground/src/plugins/uavobjects/flightplanstatus.py
ground/src/plugins/uavobjects/flighttelemetrystats.py
ground/src/plugins/uavobjects/gcstelemetrystats.py
ground/src/plugins/uavobjects/gpsposition.py
ground/src/plugins/uavobjects/gpssatellites.py
ground/src/plugins/uavobjects/gpstime.py
ground/src/plugins/uavobjects/guidancesettings.py
ground/src/plugins/uavobjects/homelocation.py
ground/src/plugins/uavobjects/i2cstats.py
ground/src/plugins/uavobjects/manualcontrolcommand.py
ground/src/plugins/uavobjects/manualcontrolsettings.py
ground/src/plugins/uavobjects/mixersettings.py
ground/src/plugins/uavobjects/mixerstatus.py
ground/src/plugins/uavobjects/objectpersistence.py
ground/src/plugins/uavobjects/pipxtrememodemsettings.py
ground/src/plugins/uavobjects/pipxtrememodemstatus.py
ground/src/plugins/uavobjects/positionactual.py
ground/src/plugins/uavobjects/positiondesired.py
ground/src/plugins/uavobjects/ratedesired.py
ground/src/plugins/uavobjects/stabilizationsettings.py
ground/src/plugins/uavobjects/systemalarms.py
ground/src/plugins/uavobjects/systemsettings.py
ground/src/plugins/uavobjects/systemstats.py
ground/src/plugins/uavobjects/taskinfo.py
ground/src/plugins/uavobjects/telemetrysettings.py
ground/src/plugins/uavobjects/velocityactual.py
ground/src/plugins/uavobjects/velocitydesired.py
ground/src/plugins/uavobjects/watchdogstatus.py
openpilotgcs-build-desktop
flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.mode1v3

View File

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

View File

@ -27,11 +27,12 @@
#include "uavobjectgeneratorpython.h"
using namespace std;
bool UAVObjectGeneratorPython::generate(UAVObjectParser* parser,QString basepath) {
bool UAVObjectGeneratorPython::generate(UAVObjectParser* parser,QString basepath,QString outputpath) {
fieldTypeStrPython << "b" << "h" << "i" << "B" << "H" << "I" << "f" << "b";
pythonCodePath = QDir( basepath + QString("ground/src/plugins/uavobjects"));
pythonOutputPath = QDir( outputpath + QString("python"));
pythonCodeTemplate = readFile( pythonCodePath.absoluteFilePath("uavobjecttemplate.py") );
@ -106,7 +107,7 @@ bool UAVObjectGeneratorPython::process_object(ObjectInfo* info)
outCode.replace(QString("$(DATAFIELDS)"), fields);
// Write the Python code
bool res = writeFileIfDiffrent( pythonCodePath.absolutePath() + "/" + info->namelc + ".py", outCode );
bool res = writeFileIfDiffrent( pythonOutputPath.absolutePath() + "/" + info->namelc + ".py", outCode );
if (!res) {
cout << "Error: Could not write Python output files" << endl;
return false;

View File

@ -32,13 +32,14 @@
class UAVObjectGeneratorPython
{
public:
bool generate(UAVObjectParser* gen,QString basepath);
bool generate(UAVObjectParser* gen,QString basepath,QString outputpath);
private:
bool process_object(ObjectInfo* info);
QString pythonCodeTemplate;
QDir pythonCodePath;
QDir pythonOutputPath;
QStringList fieldTypeStrPython;
};

View File

@ -190,7 +190,7 @@ int main(int argc, char *argv[])
if (do_python|do_all) {
cout << "generating python code" << endl ;
UAVObjectGeneratorPython pygen;
pygen.generate(parser,basepath);
pygen.generate(parser,basepath,outputpath);
}
// generate matlab code if wanted