From bdfbedf971f3e9ef99977652308b9e2b1c213210 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 11 Aug 2010 12:46:59 +0300 Subject: Gcce building support for symbian-sbsv2 It is now possible to use "release-gcce" and "debug-gcce" targets in symbian-sbsv2 mkspec. Exports and cleans should also now work properly for all target platforms under symbian-sbsv2. Task-number: QTBUG-12762 Reviewed-by: Jason Barron --- mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm | 2 +- mkspecs/symbian-sbsv2/flm/qt/qt.xml | 1 + qmake/generators/symbian/symmake_sbsv2.cpp | 176 ++++++++++++++++----- qmake/generators/symbian/symmake_sbsv2.h | 7 + 4 files changed, 145 insertions(+), 41 deletions(-) diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm index e0b6503..47c3f1e 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_store_build.flm @@ -38,7 +38,7 @@ $(STORE_BUILD_TARGET): echo "# make sis target." >> $(CACHE_FILENAME) && \ echo "# Version : " >> $(CACHE_FILENAME) && \ echo "# ==============================================================================" >> $(CACHE_FILENAME) && \ - echo QT_SIS_TARGET ?= $(VISUAL_CFG)-$(PLATFORM_PATH) >> $(CACHE_FILENAME) \ + echo QT_SIS_TARGET ?= $(VISUAL_CFG)-$(VARIANTPLATFORM) >> $(CACHE_FILENAME) $(call endrule,qmake_store_build) endef diff --git a/mkspecs/symbian-sbsv2/flm/qt/qt.xml b/mkspecs/symbian-sbsv2/flm/qt/qt.xml index 0f7db3c..12857a2 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qt.xml +++ b/mkspecs/symbian-sbsv2/flm/qt/qt.xml @@ -37,5 +37,6 @@ + diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 78f6f85..534a080 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -56,6 +56,12 @@ SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { } #define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt" #define FLM_SOURCE_DIR "/mkspecs/symbian-sbsv2/flm/qt" +#define UNDETECTED_GCCE_VERSION "0" +#define PLATFORM_GCCE "gcce" +#define PLATFORM_WINSCW "winscw" +#define PLATFORM_ARMV5 "armv5" +#define BUILD_DEBUG "udeb" +#define BUILD_RELEASE "urel" // Copies Qt FLMs to correct location under epocroot. // This is not done by configure as it is possible to change epocroot after configure. @@ -90,6 +96,67 @@ void SymbianSbsv2MakefileGenerator::exportFlm() } } +QString SymbianSbsv2MakefileGenerator::gcceVersion() +{ + static QString gcceVersionStr; + + if (gcceVersionStr.isEmpty()) { + // First check if QT_GCCE_VERSION has been set, and use that if it is + QByteArray qtGcceVersion = qgetenv("QT_GCCE_VERSION"); + if (!qtGcceVersion.isEmpty()) { + // Check that QT_GCCE_VERSION is in proper format + QString check(qtGcceVersion); + check.replace(QRegExp("^\\d+\\.\\d+\\.\\d+$"),QString()); + if (check.isEmpty()) { + gcceVersionStr = PLATFORM_GCCE + QString(qtGcceVersion).replace(".","_"); + return gcceVersionStr; + } else { + fprintf(stderr, "Warning: Environment variable QT_GCCE_VERSION ('%s') is in incorrect " + "format, expected format is: '1.2.3'. Attempting to autodetect GCCE version.", + qtGcceVersion.constData()); + } + } + // Sbsv2 has separate env variable defined for each gcce version, so try to determine + // which user is likely to want to use by checking version 4.0.0 to 9.9.9 and taking + // the highest found version that actually points to a valid path. + // This is kind of a kludge, but since qmake doesn't bootstrap QProcess, there + // is no Qt API available to get all environment variables. + for (int i = 9; i >= 4; i--) { + for (int j = 9; j >= 0; j--) { + for (int k = 9; k >= 0; k--) { + QByteArray gcceVar = qgetenv(qPrintable(QString("SBS_GCCE%1%2%3BIN").arg(i).arg(j).arg(k))); + if (!gcceVar.isEmpty() && fileInfo(QString::fromLocal8Bit(gcceVar.constData())).exists()) { + gcceVersionStr = QString(PLATFORM_GCCE "%1_%2_%3").arg(i).arg(j).arg(k); + return gcceVersionStr; + } + } + } + } + } + + // Indicate undetected version to avoid rechecking multiple times + if (gcceVersionStr.isEmpty()) + gcceVersionStr = UNDETECTED_GCCE_VERSION; + + return gcceVersionStr; +} + +QString SymbianSbsv2MakefileGenerator::configClause(QString &platform, + QString &build, + QString &winscwClauseTemplate, + QString &gcceClauseTemplate, + QString &genericClauseTemplate) +{ + QString retval; + if (QString::compare(platform, PLATFORM_WINSCW) == 0) + retval = winscwClauseTemplate.arg(build); + else if (QString::compare(platform, PLATFORM_GCCE) == 0) + retval = gcceClauseTemplate.arg(build); + else + retval = genericClauseTemplate.arg(platform).arg(build); + return retval; +} + void SymbianSbsv2MakefileGenerator::writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t) { for (int i = 0; i < depList.size(); ++i) { @@ -118,21 +185,45 @@ void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) { + static QString debugBuild(BUILD_DEBUG); + static QString releaseBuild(BUILD_RELEASE); + QStringList allPlatforms; foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) { allPlatforms << platform.toLower(); } - QStringList debugPlatforms = allPlatforms; - QStringList releasePlatforms = allPlatforms; - releasePlatforms.removeAll("winscw"); // No release for emulator - QString testClause; if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) testClause = QLatin1String(".test"); else testClause = QLatin1String(""); + QString genericClause = " -c %1_%2" + testClause; + QString winscwClause = " -c winscw_%1.mwccinc" + testClause; + QString gcceClause; + if (QString::compare(gcceVersion(), UNDETECTED_GCCE_VERSION) == 0) + allPlatforms.removeAll(PLATFORM_GCCE); + else + gcceClause = " -c arm.v5.%1." + gcceVersion() + ".release_gcce" + testClause; + + QStringList allClauses; + QStringList debugClauses; + QStringList releaseClauses; + + QStringList debugPlatforms = allPlatforms; + QStringList releasePlatforms = allPlatforms; + releasePlatforms.removeAll(PLATFORM_WINSCW); // No release for emulator + + foreach(QString item, debugPlatforms) { + debugClauses << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); + } + foreach(QString item, releasePlatforms) { + releaseClauses << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); + } + allClauses << debugClauses << releaseClauses; + + QTextStream t(&wrapperFile); t << "# ==============================================================================" << endl; @@ -172,9 +263,9 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo } t << endl; t << "first: default" << endl; - if (debugPlatforms.contains("winscw")) + if (debugPlatforms.contains(PLATFORM_WINSCW)) t << "default: debug-winscw"; - else if (debugPlatforms.contains("armv5")) + else if (debugPlatforms.contains(PLATFORM_ARMV5)) t << "default: debug-armv5"; else if (debugPlatforms.size()) t << "default: debug-" << debugPlatforms.first(); @@ -195,52 +286,50 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << "\t$(QMAKE)" << endl; t << endl; - QString winscw("winscw"); + QString currentClause; + t << "debug: " << BLD_INF_FILENAME << endl; t << "\t$(SBS)"; - foreach(QString item, debugPlatforms) { - if(QString::compare(item, winscw) == 0) - t << " -c " << item << "_udeb.mwccinc" << testClause; - else - t << " -c " << item << "_udeb" << testClause; + foreach(QString item, debugClauses) { + t << item; } t << endl; t << "release: " << BLD_INF_FILENAME << endl; t << "\t$(SBS)"; - foreach(QString item, releasePlatforms) { - if(QString::compare(item, winscw) == 0) - t << " -c " << item << "_urel.mwccinc" << testClause; - else - t << " -c " << item << "_urel" << testClause; + foreach(QString item, releaseClauses) { + t << item; } t << endl; // For more specific builds, targets are in this form: build-platform, e.g. release-armv5 foreach(QString item, debugPlatforms) { t << "debug-" << item << ": " << BLD_INF_FILENAME << endl; - if(QString::compare(item, winscw) == 0) - t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl; - else - t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl; + t << "\t$(SBS)"; + t << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); + t << endl; } foreach(QString item, releasePlatforms) { t << "release-" << item << ": " << BLD_INF_FILENAME << endl; - if(QString::compare(item, winscw) == 0) - t << "\t$(SBS) -c " << item << "_urel.mwccinc" << testClause << endl; - else - t << "\t$(SBS) -c " << item << "_urel" << testClause << endl; + t << "\t$(SBS)"; + t << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); + t << endl; } t << endl; t << "export: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) export" << endl; - t << endl; + t << "\t$(SBS) export"; + foreach(QString clause, allClauses) { + t << clause; + } + t << endl << endl; t << "cleanexport: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) cleanexport" << endl; - t << endl; - + t << "\t$(SBS) cleanexport"; + foreach(QString clause, allClauses) { + t << clause; + } + t << endl << endl; } // Add all extra targets including extra compiler targest also to wrapper makefile, @@ -258,30 +347,37 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo generateDistcleanTargets(t); t << "clean: " << BLD_INF_FILENAME << endl; - t << "\t-$(SBS) reallyclean" << endl; - t << endl; + t << "\t-$(SBS) reallyclean"; + foreach(QString clause, allClauses) { + t << clause; + } + t << endl << endl; t << "clean-debug: " << BLD_INF_FILENAME << endl; t << "\t$(SBS) reallyclean"; - foreach(QString item, debugPlatforms) { - t << " -c " << item << "_udeb" << testClause; + foreach(QString clause, debugClauses) { + t << clause; } - t << endl; + t << endl << endl; t << "clean-release: " << BLD_INF_FILENAME << endl; t << "\t$(SBS) reallyclean"; - foreach(QString item, releasePlatforms) { - t << " -c " << item << "_urel" << testClause; + foreach(QString clause, releaseClauses) { + t << clause; } - t << endl; + t << endl << endl; // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5 foreach(QString item, debugPlatforms) { t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean -c " << item << "_udeb" << testClause << endl; + t << "\t$(SBS) reallyclean"; + t << configClause(item, debugBuild, winscwClause, gcceClause, genericClause); + t << endl; } foreach(QString item, releasePlatforms) { t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean -c " << item << "_urel" << testClause << endl; + t << "\t$(SBS) reallyclean"; + t << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause); + t << endl; } t << endl; } diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index 286c91c..6644a03 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -65,6 +65,13 @@ public: private: void exportFlm(); + QString gcceVersion(); + QString configClause(QString &platform, + QString &build, + QString &winscwClauseTemplate, + QString &gcceClauseTemplate, + QString &genericClauseTemplate); + void writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t); QString extraTargetsCache; -- cgit v0.12 From 32a54a21d77310f7bc1f306d175e41040d024a43 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 10 Aug 2010 10:51:06 +0100 Subject: Do not include Spectrum Analyzer demo in static builds This demo includes a 3rd party library which is licensed under the LGPL. As such, the demo application may only link to the library dynamically. Task-number: QTBUG-12713 Reviewed-by: Justin McPherson --- demos/demos.pro | 2 +- demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/demos/demos.pro b/demos/demos.pro index f359bd7..fdc1e4c 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -58,7 +58,7 @@ wince*:SUBDIRS += demos_sqlbrowser contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):!symbian:SUBDIRS += demos_browser contains(QT_CONFIG, declarative):SUBDIRS += demos_declarative -contains(QT_CONFIG, multimedia):SUBDIRS += demos_spectrum +contains(QT_CONFIG, multimedia):!static:SUBDIRS += demos_spectrum # install sources.files = README *.pro diff --git a/demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h b/demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h index 48d614e..b8190a9 100644 --- a/demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h +++ b/demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h @@ -22,6 +22,10 @@ #include +#ifndef QT_DLL +# error This library is licensed under the LGPL and must be dynamically linked +#endif + #if defined(FFTREAL_LIBRARY) # define FFTREAL_EXPORT Q_DECL_EXPORT #else -- cgit v0.12 From 8adeb2742a701080c7e6568a6aca1f27079e1909 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 10 Aug 2010 10:39:07 +0100 Subject: Added documentation for Spectrum Analyzer demo Task-number: QTBUG-12720 Reviewed-by: David Boddie --- doc/src/demos/spectrum.qdoc | 34 ++++++++++++++++++++++++++++++---- doc/src/getting-started/demos.qdoc | 9 +++++++++ doc/src/images/spectrum-demo.png | Bin 0 -> 21771 bytes 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 doc/src/images/spectrum-demo.png diff --git a/doc/src/demos/spectrum.qdoc b/doc/src/demos/spectrum.qdoc index b720ce1..d5a3f85 100644 --- a/doc/src/demos/spectrum.qdoc +++ b/doc/src/demos/spectrum.qdoc @@ -28,8 +28,34 @@ /*! \example demos/spectrum \title Spectrum Analyzer -This application is a demo which uses the QtMultimedia APIs to capture and -play back PCM audio. While either recording or playback is ongoing, the -application performs real-time level and frequency spectrum analysis, -displaying the results in its main window. + + The Spectrum Analyzer demo shows how the \l{QtMultimedia Module} can be + used in Qt applications to capture and then play back an audio stream. + + \image spectrum-demo.png + + Because QtMultimedia allows the application to access the raw audio + stream, the data can either be inspected or modified by the application. + The Spectrum Analyzer demo displays three pieces of information while + audio is being either captured or played back: + + \list + \o Information about the raw audio stream, shown in the uppermost widget: + \list + \o The amount of data currently in the buffer, shown in blue + \o The segment of data which was most recently analysed to compute + the frequency spectrum, shown in green + \o The raw audio waveform, shown in white and scrolling from right to + left + \endlist + \o A representation of the frequency spectrum, shown at the lower left + \o The current RMS level of the audio stream, and the recent 'high + watermark' level, shown at the lower right + \endlist + + Spectrum analysis is performed by calculating the Fast Fourier Transform + (FFT) of a segment of audio data. An open-source library, + \l{http://ldesoras.free.fr/prod.html}{FFTReal}, against which the + application is dynamically linked, is used to compute the transform. */ + diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc index 94b19c3..4003988 100644 --- a/doc/src/getting-started/demos.qdoc +++ b/doc/src/getting-started/demos.qdoc @@ -147,6 +147,15 @@ \note The Phonon demos are currently not available for the MinGW platform. + \section1 Multimedia + + \list + \o \l{demos/spectrum}{Spectrum Analyzer} demonstrates how the \l{QtMultimedia Module} + can be used to capture and play back an audio stream, at the same time allowing the + application to access the raw audio data. This application analyzes the audio stream + in order to display a frequency spectrum. + \endlist + \section1 Animation \list diff --git a/doc/src/images/spectrum-demo.png b/doc/src/images/spectrum-demo.png new file mode 100644 index 0000000..7f4938f Binary files /dev/null and b/doc/src/images/spectrum-demo.png differ -- cgit v0.12