diff --git a/README b/README index 7ca3d3cc3185d5eb6ca33cc803abc933dac97030..f9d3e48ade43ffca40b79db52ef545ee1e181306 100644 --- a/README +++ b/README @@ -2,4 +2,11 @@ PIXHAWK Open Source Groundstation http://pixhawk.ethz.ch +To build on Mac OS X (10.5 or later): +1) Install http://www.libsdl.org/release/SDL-1.2.14.dmg +2) Install Qt 4.6.2 with Cocoa http://get.qt.nokia.com/qt/source/qt-mac-cocoa-opensource-4.6.2.dmg +3) Run qmake +4) Run "xcodebuild -configuration Release" or open "opengroundcontrol.xcodeproj" in Xcode and build. + + diff --git a/images/icons/macx.icns b/images/icons/macx.icns new file mode 100644 index 0000000000000000000000000000000000000000..6111a01e1ce0cd693109ecf9e1cb5d20c21960c8 Binary files /dev/null and b/images/icons/macx.icns differ diff --git a/mavground.pri b/mavground.pri index 8a648b497f466f73b7426f25edf8c2df3fd37dfc..1de77b21eb4547fa9f08727e958d6558241e195c 100644 --- a/mavground.pri +++ b/mavground.pri @@ -1,166 +1,163 @@ -#------------------------------------------------- -# -# MAVGround - Micro Air Vehicle Groundstation -# -# Please see our website at -# -# Original Author: -# Lorenz Meier -# -# Contributing Authors (in alphabetical order): -# -# (c) 2009 PIXHAWK Team -# -# This file is part of the mav groundstation project -# MAVGround is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# MAVGround is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with MAVGround. If not, see . -# -#------------------------------------------------- - -QT += network opengl svg xml - -TEMPLATE = app -TARGET = opengroundcontrol - -BASEDIR = . -BUILDDIR = build -LANGUAGE = C++ - -#CONFIG += static debug -#CONFIG += static release console -CONFIG += static debug_and_release console -QMAKE_CFLAGS += -j8 - -OBJECTS_DIR = $$BUILDDIR/obj -MOC_DIR = $$BUILDDIR/moc -UI_HEADERS_DIR = src/ui/generated - - -# Add external libraries -INCLUDEPATH += $$BASEDIR/lib/flite/include \ - $$BASEDIR/lib/flite/lang - -#$$BASEDIR/lib/qextserialport/include -# $$BASEDIR/lib/openjaus/libjaus/include \ -# $$BASEDIR/lib/openjaus/libopenJaus/include - -message(Qt version> $$[QMAKESPEC]) - - - -# MAC OS X -macx { - - message(Building for Mac OS X) - - CONFIG += x86_64 cocoa - CONFIG -= static - - DESTDIR = $$BASEDIR/bin/mac - INCLUDEPATH += -framework SDL \ - /Users/hugo/Projects/PixHawkGroundControl/MAVLink/src - - LIBS += -framework IOKit \ - -framework SDL \ - -framework CoreFoundation \ - -framework ApplicationServices \ - -lm - - DEFINES += _TTY_POSIX_ - - #ICON = $$BASEDIR/img/icons/empty.png -} - -# GNU/Linux -linux-g++ { - - message(Building for GNU/Linux) - - QT += phonon - - debug { - DESTDIR = $$BASEDIR - } - - release { - DESTDIR = $$BASEDIR - } - INCLUDEPATH += /usr/include/SDL - # /usr/include/qwt-qt4 - - #-L$$BASEDIR/lib/qwt/linux \ - - - DEFINES += _TTY_POSIX_ - - HARDWARE_PLATFORM = $$system(uname -a) - contains( HARDWARE_PLATFORM, x86_64 ) { - # 64-bit Linux - LIBS += \ - -L$$BASEDIR/lib/flite/linux64 \ - -lm \ - -lflite_cmu_us_awb \ - -lflite_cmu_us_rms \ - -lflite_cmu_us_slt \ - -lflite_usenglish \ - -lflite_cmulex \ - -lflite \ - -lSDL \ - -lSDLmain - } else { - # 32-bit Linux - LIBS += \ - -L$$BASEDIR/lib/flite/linux32 \ - -lm \ - -lflite_cmu_us_awb \ - -lflite_cmu_us_rms \ - -lflite_cmu_us_slt \ - -lflite_usenglish \ - -lflite_cmulex \ - -lflite \ - -lSDL \ - -lSDLmain - } -} - - -# Windows (32bit) -win32 { - - message(Building for Windows Platform (32/64bit)) - - # Special settings for debug - #CONFIG += CONSOLE - LIBS += -L$$BASEDIR\lib\sdl\win32 \ - -lmingw32 -lSDLmain -lSDL -mwindows - - INCLUDEPATH += $$BASEDIR/lib/sdl/include/SDL - - #LIBS += -L$$BASEDIR\lib\qextserialport\win32 \ - # -lqextserialport \ - # -lsetupapi - # -L$$BASEDIR/lib/openjaus/libjaus/lib/win32 \ - # -ljaus \ - # -L$$BASEDIR/lib/openjaus/libopenJaus/lib/win32 \ - # -lopenjaus - - DEFINES += _TTY_WIN_ - - debug { - DESTDIR = $$BASEDIR/bin - } - - release { - DESTDIR = $$BASEDIR/bin - } - -} - +#------------------------------------------------- +# +# MAVGround - Micro Air Vehicle Groundstation +# +# Please see our website at +# +# Original Author: +# Lorenz Meier +# +# Contributing Authors (in alphabetical order): +# +# (c) 2009 PIXHAWK Team +# +# This file is part of the mav groundstation project +# MAVGround is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# MAVGround is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with MAVGround. If not, see . +# +#------------------------------------------------- + +QT += network opengl svg xml + +TEMPLATE = app +TARGET = opengroundcontrol + +BASEDIR = . +BUILDDIR = build +LANGUAGE = C++ + +#CONFIG += static debug +#CONFIG += static release console +CONFIG += static debug_and_release console +QMAKE_CFLAGS += -j8 + +OBJECTS_DIR = $$BUILDDIR/obj +MOC_DIR = $$BUILDDIR/moc +UI_HEADERS_DIR = src/ui/generated + + +# Add external libraries +INCLUDEPATH += $$BASEDIR/lib/flite/include \ + $$BASEDIR/lib/flite/lang + +#$$BASEDIR/lib/qextserialport/include +# $$BASEDIR/lib/openjaus/libjaus/include \ +# $$BASEDIR/lib/openjaus/libopenJaus/include + +message(Qt version $$[QT_VERSION]) + + + +# MAC OS X +macx { + message(Building for Mac OS X) + + CONFIG += x86_64 + CONFIG -= x86 static + + QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5 + + DESTDIR = $$BASEDIR/bin/mac + INCLUDEPATH += -framework SDL \ + $$BASEDIR/MAVLink/src + + LIBS += -framework IOKit \ + -framework SDL \ + -framework CoreFoundation \ + -framework ApplicationServices \ + -lm + + DEFINES += _TTY_POSIX_ + + ICON = $$BASEDIR/images/icons/macx.icns +} + +# GNU/Linux +linux-g++ { + + message(Building for GNU/Linux) + + QT += phonon + + debug { + DESTDIR = $$BASEDIR + } + + release { + DESTDIR = $$BASEDIR + } + INCLUDEPATH += /usr/include/SDL + + DEFINES += _TTY_POSIX_ + + HARDWARE_PLATFORM = $$system(uname -a) + contains( HARDWARE_PLATFORM, x86_64 ) { + # 64-bit Linux + LIBS += \ + -L$$BASEDIR/lib/flite/linux64 \ + -lm \ + -lflite_cmu_us_awb \ + -lflite_cmu_us_rms \ + -lflite_cmu_us_slt \ + -lflite_usenglish \ + -lflite_cmulex \ + -lflite \ + -lSDL \ + -lSDLmain + } else { + # 32-bit Linux + LIBS += \ + -L$$BASEDIR/lib/flite/linux32 \ + -lm \ + -lflite_cmu_us_awb \ + -lflite_cmu_us_rms \ + -lflite_cmu_us_slt \ + -lflite_usenglish \ + -lflite_cmulex \ + -lflite \ + -lSDL \ + -lSDLmain + } +} + + +# Windows (32bit) +win32 { + + message(Building for Windows Platform (32/64bit)) + + # Special settings for debug + #CONFIG += CONSOLE + LIBS += -L$$BASEDIR\lib\sdl\win32 \ + -lmingw32 -lSDLmain -lSDL -mwindows + + INCLUDEPATH += $$BASEDIR/lib/sdl/include/SDL + + #LIBS += -L$$BASEDIR\lib\qextserialport\win32 \ + # -lqextserialport \ + # -lsetupapi + # -L$$BASEDIR/lib/openjaus/libjaus/lib/win32 \ + # -ljaus \ + # -L$$BASEDIR/lib/openjaus/libopenJaus/lib/win32 \ + # -lopenjaus + + DEFINES += _TTY_WIN_ + + debug { + DESTDIR = $$BASEDIR/bin + } + + release { + DESTDIR = $$BASEDIR/bin + } + +} + diff --git a/src/AudioOutput.cc b/src/AudioOutput.cc index 7f0630b1a889e181163569f374a512ea0cb7cf96..8d30cea29e956d92f71ddfcd2520dd99afb76751 100644 --- a/src/AudioOutput.cc +++ b/src/AudioOutput.cc @@ -1,11 +1,11 @@ #include "AudioOutput.h" -#ifndef Q_OS_MAC +#ifdef Q_OS_MAC + #include +#else #include #include #include -#else - #include #endif #include @@ -25,9 +25,10 @@ extern "C" { }; #endif -AudioOutput::AudioOutput(QString voice, QObject* parent) : QObject(parent), -voice(NULL), -voiceIndex(0) +AudioOutput::AudioOutput(QString voice, QObject* parent) + : QObject(parent), + voice(NULL), + voiceIndex(0) { #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) flite_init(); @@ -72,6 +73,7 @@ bool AudioOutput::say(QString text, int severity) #if defined(Q_OS_WIN32) qDebug() << "Synthesized: " << text << ", NO OUTPUT SUPPORT ON WINDOWS!"; #elif defined(Q_OS_MAC) + // FIXME, copy string, set callback to free the copy SpeakString((const unsigned char*)text.toAscii().data()); qDebug() << "Synthesized: " << text; #else @@ -137,13 +139,11 @@ extern "C" { #endif /* __cplusplus */ QStringList AudioOutput::listVoices(void) { - - + QStringList l; +#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) cst_voice *voice; const cst_val *v; - QStringList l; -#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) /* printf("Voices available: "); for (v=flite_voice_list; v; v=val_cdr(v)) @@ -157,8 +157,7 @@ extern "C" { printf("\n"); */ #endif - return l; - + return l; } #ifdef __cplusplus } diff --git a/src/AudioOutput.h b/src/AudioOutput.h index 982cb76f828a04d58982b04ecc9cdd0830a173a2..d29b6af772af96af3dc3341813656184ce412608 100644 --- a/src/AudioOutput.h +++ b/src/AudioOutput.h @@ -3,7 +3,14 @@ #include #include -#include + +/* Foward declarations of speech/voice structure */ +#ifdef Q_OS_MAC + struct SpeechChannelRecord; + typedef SpeechChannelRecord *SpeechChannel; +#else + struct cst_voice; +#endif class AudioOutput : public QObject { @@ -28,10 +35,14 @@ public: void selectMaleVoice(); /** @brief Select neutral voice */ void selectNeutralVoice(); - protected: - cst_voice* voice; - int voiceIndex; +protected: +#ifdef Q_OS_MAC + SpeechChannel *voice; +#else + cst_voice *voice; +#endif + int voiceIndex; }; #endif // AUDIOOUTPUT_H diff --git a/src/Core.cc b/src/Core.cc index 9cef49fa25f2594f8e90001bdd3bbcc94421a566..c111501fbdf44fbd46e661834748386242bb0357 100644 --- a/src/Core.cc +++ b/src/Core.cc @@ -69,7 +69,7 @@ MGCore::MGCore(int &argc, char* argv[]) : QApplication(argc, argv) QFontDatabase fontDatabase = QFontDatabase(); const QString fontFileName = ":/general/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app const QString fontFamilyName = "Bitstream Vera Sans"; - if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toAscii().data()); + if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toStdString().c_str()); fontDatabase.addApplicationFont(fontFileName); setFont(fontDatabase.font(fontFamilyName, "Roman", 12));