mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-1853 Ground build tidy: Remove hardcoded prefix from uavobjgenerator output
This commit is contained in:
parent
9d31ca939c
commit
5a2806c3c0
11
Makefile
11
Makefile
@ -176,15 +176,14 @@ uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
|
||||
UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
|
||||
UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
|
||||
|
||||
DIRS += $(UAVOBJ_OUT_DIR)
|
||||
|
||||
uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator
|
||||
$(V1) ( cd $(UAVOBJ_OUT_DIR) && \
|
||||
uavobjects_%: uavobjgenerator
|
||||
@$(MKDIR) -p $(UAVOBJ_OUT_DIR)/$*
|
||||
$(V1) ( cd $(UAVOBJ_OUT_DIR)/$* && \
|
||||
$(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
|
||||
)
|
||||
|
||||
uavobjects_test: $(UAVOBJ_OUT_DIR) uavobjgenerator
|
||||
$(V1) $(UAVOBJGENERATOR) -v -none $(UAVOBJ_XML_DIR) $(ROOT_DIR)
|
||||
uavobjects_test: uavobjgenerator
|
||||
$(V1) $(UAVOBJGENERATOR) -v $(UAVOBJ_XML_DIR) $(ROOT_DIR)
|
||||
|
||||
uavobjects_clean:
|
||||
@$(ECHO) " CLEAN $(call toprel, $(UAVOBJ_OUT_DIR))"
|
||||
|
@ -36,7 +36,7 @@ bool UAVObjectGeneratorFlight::generate(UAVObjectParser *parser, QString templat
|
||||
QString flightObjInit, objInc, objFileNames, objNames;
|
||||
qint32 sizeCalc;
|
||||
flightCodePath = QDir(templatepath + QString(FLIGHT_CODE_DIR));
|
||||
flightOutputPath = QDir(outputpath + QString("flight"));
|
||||
flightOutputPath = QDir(outputpath);
|
||||
flightOutputPath.mkpath(flightOutputPath.absolutePath());
|
||||
|
||||
flightCodeTemplate = readFile(flightCodePath.absoluteFilePath("uavobject.c.template"));
|
||||
|
@ -36,7 +36,7 @@ bool UAVObjectGeneratorGCS::generate(UAVObjectParser *parser, QString templatepa
|
||||
<< "UINT8" << "UINT16" << "UINT32" << "FLOAT32" << "ENUM";
|
||||
|
||||
gcsCodePath = QDir(templatepath + QString(GCS_CODE_DIR));
|
||||
gcsOutputPath = QDir(outputpath + QString("gcs"));
|
||||
gcsOutputPath = QDir(outputpath);
|
||||
gcsOutputPath.mkpath(gcsOutputPath.absolutePath());
|
||||
|
||||
gcsCodeTemplate = readFile(gcsCodePath.absoluteFilePath("uavobject.cpp.template"));
|
||||
|
@ -37,7 +37,7 @@ bool UAVObjectGeneratorJava::generate(UAVObjectParser *parser, QString templatep
|
||||
<< "UINT8" << "UINT16" << "UINT32" << "FLOAT32" << "ENUM";
|
||||
|
||||
javaCodePath = QDir(templatepath + QString(JAVA_TEMPLATE_DIR));
|
||||
javaOutputPath = QDir(outputpath + QString("java"));
|
||||
javaOutputPath = QDir(outputpath);
|
||||
javaOutputPath.mkpath(javaOutputPath.absolutePath());
|
||||
|
||||
javaCodeTemplate = readFile(javaCodePath.absoluteFilePath("uavobject.java.template"));
|
||||
|
@ -36,7 +36,7 @@ bool UAVObjectGeneratorMatlab::generate(UAVObjectParser *parser, QString templat
|
||||
<< "1" << "2" << "4" << "4" << "1";
|
||||
|
||||
QDir matlabTemplatePath = QDir(templatepath + QString(MATLAB_CODE_DIR));
|
||||
QDir matlabOutputPath = QDir(outputpath + QString("matlab"));
|
||||
QDir matlabOutputPath = QDir(outputpath);
|
||||
matlabOutputPath.mkpath(matlabOutputPath.absolutePath());
|
||||
|
||||
QString matlabCodeTemplate = readFile(matlabTemplatePath.absoluteFilePath("uavobject.m.template"));
|
||||
|
@ -31,7 +31,7 @@ bool UAVObjectGeneratorPython::generate(UAVObjectParser *parser, QString templat
|
||||
{
|
||||
// Load template and setup output directory
|
||||
pythonCodePath = QDir(templatepath + QString("flight/modules/FlightPlan/lib"));
|
||||
pythonOutputPath = QDir(outputpath + QString("python"));
|
||||
pythonOutputPath = QDir(outputpath);
|
||||
pythonOutputPath.mkpath(pythonOutputPath.absolutePath());
|
||||
pythonCodeTemplate = readFile(pythonCodePath.absoluteFilePath("uavobject.pyt.template"));
|
||||
if (pythonCodeTemplate.isEmpty()) {
|
||||
|
@ -37,7 +37,7 @@ bool UAVObjectGeneratorWireshark::generate(UAVObjectParser *parser, QString temp
|
||||
|
||||
wiresharkCodePath = QDir(templatepath + QString("ground/openpilotgcs/src/plugins/uavobjects/wireshark"));
|
||||
|
||||
wiresharkOutputPath = QDir(outputpath + QString("wireshark"));
|
||||
wiresharkOutputPath = QDir(outputpath);
|
||||
wiresharkOutputPath.mkpath(wiresharkOutputPath.absolutePath());
|
||||
|
||||
wiresharkCodeTemplate = readFile(wiresharkCodePath.absoluteFilePath("op-uavobjects/packet-op-uavobjects.c.template"));
|
||||
|
@ -47,7 +47,7 @@ using namespace std;
|
||||
*/
|
||||
void usage()
|
||||
{
|
||||
cout << "Usage: uavobjectgenerator [-gcs] [-flight] [-java] [-python] [-matlab] [-wireshark] [-none] [-v] xml_path template_base [UAVObj1] ... [UAVObjN]" << endl;
|
||||
cout << "Usage: uavobjectgenerator [language] [-v] xml_path template_base [UAVObj1] ... [UAVObjN]" << endl;
|
||||
cout << "Languages: " << endl;
|
||||
cout << "\t-gcs build groundstation code" << endl;
|
||||
cout << "\t-flight build flight code" << endl;
|
||||
@ -55,9 +55,8 @@ void usage()
|
||||
cout << "\t-python build python code" << endl;
|
||||
cout << "\t-matlab build matlab code" << endl;
|
||||
cout << "\t-wireshark build wireshark plugin" << endl;
|
||||
cout << "\tIf no language is specified ( and not -none ) -> all are built." << endl;
|
||||
cout << "\tIf no language is specified none are built - just parse xmls." << 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 << "\tinput_path path to UAVObject definition (.xml) files." << endl;
|
||||
@ -109,9 +108,7 @@ int main(int argc, char *argv[])
|
||||
bool do_python = (arguments_stringlist.removeAll("-python") > 0);
|
||||
bool do_matlab = (arguments_stringlist.removeAll("-matlab") > 0);
|
||||
bool do_wireshark = (arguments_stringlist.removeAll("-wireshark") > 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_allObjects = true;
|
||||
|
||||
if (arguments_stringlist.length() >= 2) {
|
||||
@ -205,47 +202,33 @@ int main(int argc, char *argv[])
|
||||
cout << "used units: " << parser->all_units.join(",").toStdString() << endl;
|
||||
}
|
||||
|
||||
if (do_none) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
// generate flight code if wanted
|
||||
if (do_flight | do_all) {
|
||||
if (do_flight) {
|
||||
// generate flight code if wanted
|
||||
cout << "generating flight code" << endl;
|
||||
UAVObjectGeneratorFlight flightgen;
|
||||
flightgen.generate(parser, templatepath, outputpath);
|
||||
}
|
||||
|
||||
// generate gcs code if wanted
|
||||
if (do_gcs | do_all) {
|
||||
} else if (do_gcs) {
|
||||
// generate gcs code if wanted
|
||||
cout << "generating gcs code" << endl;
|
||||
UAVObjectGeneratorGCS gcsgen;
|
||||
gcsgen.generate(parser, templatepath, outputpath);
|
||||
}
|
||||
|
||||
// generate java code if wanted
|
||||
if (do_java | do_all) {
|
||||
} else if (do_java) {
|
||||
// generate java code if wanted
|
||||
cout << "generating java code" << endl;
|
||||
UAVObjectGeneratorJava javagen;
|
||||
javagen.generate(parser, templatepath, outputpath);
|
||||
}
|
||||
|
||||
// generate python code if wanted
|
||||
if (do_python | do_all) {
|
||||
} else if (do_python) {
|
||||
// generate python code if wanted
|
||||
cout << "generating python code" << endl;
|
||||
UAVObjectGeneratorPython pygen;
|
||||
pygen.generate(parser, templatepath, outputpath);
|
||||
}
|
||||
|
||||
// generate matlab code if wanted
|
||||
if (do_matlab | do_all) {
|
||||
} else if (do_matlab) {
|
||||
// generate matlab code if wanted
|
||||
cout << "generating matlab code" << endl;
|
||||
UAVObjectGeneratorMatlab matlabgen;
|
||||
matlabgen.generate(parser, templatepath, outputpath);
|
||||
}
|
||||
|
||||
// generate wireshark plugin if wanted
|
||||
if (do_wireshark | do_all) {
|
||||
} else if (do_wireshark) {
|
||||
// generate wireshark plugin if wanted
|
||||
cout << "generating wireshark code" << endl;
|
||||
UAVObjectGeneratorWireshark wiresharkgen;
|
||||
wiresharkgen.generate(parser, templatepath, outputpath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user