From f0c3a0ac2876c984900572d7123f89cdb985347e Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 25 May 2017 13:39:47 -0700 Subject: [PATCH 1/8] Fix SendQueue not updating lastReceiverResponse when recv handshake ack --- libraries/networking/src/udt/SendQueue.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/networking/src/udt/SendQueue.cpp b/libraries/networking/src/udt/SendQueue.cpp index c14ae0a39c..0c029751aa 100644 --- a/libraries/networking/src/udt/SendQueue.cpp +++ b/libraries/networking/src/udt/SendQueue.cpp @@ -241,6 +241,9 @@ void SendQueue::handshakeACK(SequenceNumber initialSequenceNumber) { std::lock_guard locker { _handshakeMutex }; _hasReceivedHandshakeACK = true; } + + _lastReceiverResponse = QDateTime::currentMSecsSinceEpoch(); + // Notify on the handshake ACK condition _handshakeACKCondition.notify_one(); } From 32b5ac50204239e6c693107f6fcaf7f464b3a936 Mon Sep 17 00:00:00 2001 From: seefo Date: Thu, 25 May 2017 16:10:53 -0700 Subject: [PATCH 2/8] Moved audio asset processing to a separate thread --- libraries/audio/src/Sound.cpp | 37 ++++++++++++++++++++++++----------- libraries/audio/src/Sound.h | 29 +++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/libraries/audio/src/Sound.cpp b/libraries/audio/src/Sound.cpp index d6607424db..b48ea1fed7 100644 --- a/libraries/audio/src/Sound.cpp +++ b/libraries/audio/src/Sound.cpp @@ -13,6 +13,8 @@ #include +#include +#include #include #include #include @@ -53,9 +55,25 @@ Sound::Sound(const QUrl& url, bool isStereo, bool isAmbisonic) : } void Sound::downloadFinished(const QByteArray& data) { + SoundProcessor* soundProcessor = new SoundProcessor(_url, data, this); + QThreadPool::globalInstance()->start(soundProcessor); +} + +void Sound::setReady(bool isReady) { + if (isReady) { + finishedLoading(true); + _isReady = true; + emit ready(); + qCDebug(audio) << "Setting ready state for audio asset" << _url; + } +} + +void SoundProcessor::run() { // replace our byte array with the downloaded data - QByteArray rawAudioByteArray = QByteArray(data); - QString fileName = getURL().fileName().toLower(); + QByteArray rawAudioByteArray = QByteArray(_data); + QString fileName = _url.fileName().toLower(); + + //Sound* sound = dynamic_cast(_sound); static const QString WAV_EXTENSION = ".wav"; static const QString RAW_EXTENSION = ".raw"; @@ -63,28 +81,25 @@ void Sound::downloadFinished(const QByteArray& data) { QByteArray outputAudioByteArray; - int sampleRate = interpretAsWav(rawAudioByteArray, outputAudioByteArray); + int sampleRate = _sound->interpretAsWav(rawAudioByteArray, outputAudioByteArray); if (sampleRate != 0) { - downSample(outputAudioByteArray, sampleRate); + _sound->downSample(outputAudioByteArray, sampleRate); } } else if (fileName.endsWith(RAW_EXTENSION)) { // check if this was a stereo raw file // since it's raw the only way for us to know that is if the file was called .stereo.raw if (fileName.toLower().endsWith("stereo.raw")) { - _isStereo = true; - qCDebug(audio) << "Processing sound of" << rawAudioByteArray.size() << "bytes from" << getURL() << "as stereo audio file."; + _sound->setStereo(true); + qCDebug(audio) << "Processing sound of" << rawAudioByteArray.size() << "bytes from" << _url << "as stereo audio file."; } // Process as 48khz RAW file - downSample(rawAudioByteArray, 48000); + _sound->downSample(rawAudioByteArray, 48000); } else { qCDebug(audio) << "Unknown sound file type"; } - finishedLoading(true); - - _isReady = true; - emit ready(); + _sound->setReady(true); } void Sound::downSample(const QByteArray& rawAudioByteArray, int sampleRate) { diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h index 37d5b40e95..6ec099b071 100644 --- a/libraries/audio/src/Sound.h +++ b/libraries/audio/src/Sound.h @@ -12,6 +12,7 @@ #ifndef hifi_Sound_h #define hifi_Sound_h +#include #include #include #include @@ -28,10 +29,15 @@ public: bool isAmbisonic() const { return _isAmbisonic; } bool isReady() const { return _isReady; } float getDuration() const { return _duration; } - const QByteArray& getByteArray() const { return _byteArray; } + void setStereo(bool stereo) { _isStereo = stereo; } + void setReady(bool ready); + + void downSample(const QByteArray& rawAudioByteArray, int sampleRate); + int interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray); + signals: void ready(); @@ -42,12 +48,27 @@ private: bool _isReady; float _duration; // In seconds - void downSample(const QByteArray& rawAudioByteArray, int sampleRate); - int interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray); - virtual void downloadFinished(const QByteArray& data) override; }; +class SoundProcessor : public QObject, public QRunnable { + Q_OBJECT + +public: + SoundProcessor(const QUrl& url, const QByteArray& data, Sound* sound) + : _url(url), _data(data), _sound(sound) + { + } + + virtual void run() override; + +private: + QUrl _url; + QByteArray _data; + Sound* _sound; + +}; + typedef QSharedPointer SharedSoundPointer; class SoundScriptingInterface : public QObject { From 90d5b2a6d45671b64dd3fdcfd887880573aff3b0 Mon Sep 17 00:00:00 2001 From: seefo Date: Fri, 26 May 2017 10:26:32 -0700 Subject: [PATCH 3/8] Removed SoundProcessor's dependence on Sound objects --- libraries/audio/src/Sound.cpp | 62 +++++++++++++++++++++-------------- libraries/audio/src/Sound.h | 26 +++++++++------ 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/libraries/audio/src/Sound.cpp b/libraries/audio/src/Sound.cpp index b48ea1fed7..5ac9f8f53d 100644 --- a/libraries/audio/src/Sound.cpp +++ b/libraries/audio/src/Sound.cpp @@ -51,67 +51,81 @@ Sound::Sound(const QUrl& url, bool isStereo, bool isAmbisonic) : _isAmbisonic(isAmbisonic), _isReady(false) { - } void Sound::downloadFinished(const QByteArray& data) { - SoundProcessor* soundProcessor = new SoundProcessor(_url, data, this); + // this is a QRunnable, will delete itself after it has finished running + SoundProcessor* soundProcessor = new SoundProcessor(_url, data, _isStereo, _isAmbisonic); + connect(soundProcessor, SIGNAL(onSuccess(QByteArray, bool, bool, float)), SLOT(soundProcessSuccess(QByteArray, bool, bool, float))); + connect(soundProcessor, SIGNAL(onError(int, QString)), SLOT(soundProcessError(int, QString))); QThreadPool::globalInstance()->start(soundProcessor); } -void Sound::setReady(bool isReady) { - if (isReady) { - finishedLoading(true); - _isReady = true; - emit ready(); - qCDebug(audio) << "Setting ready state for audio asset" << _url; - } +void Sound::soundProcessSuccess(QByteArray data, bool stereo, bool ambisonic, float duration) { + + qCDebug(audio) << "Setting ready state for sound file" << _url.toDisplayString(); + + _byteArray = data; + _isStereo = stereo; + _isAmbisonic = ambisonic; + _duration = duration; + _isReady = true; + finishedLoading(true); + + emit ready(); +} + +void Sound::soundProcessError(int error, QString str) { + qCCritical(audio) << "Failed to process sound file" << _url.toDisplayString() << "code =" << error << str; + emit failed(QNetworkReply::UnknownContentError); + finishedLoading(false); } void SoundProcessor::run() { + + qCDebug(audio) << "Processing sound file" << _url.toDisplayString(); + // replace our byte array with the downloaded data QByteArray rawAudioByteArray = QByteArray(_data); QString fileName = _url.fileName().toLower(); - //Sound* sound = dynamic_cast(_sound); - static const QString WAV_EXTENSION = ".wav"; static const QString RAW_EXTENSION = ".raw"; if (fileName.endsWith(WAV_EXTENSION)) { QByteArray outputAudioByteArray; - int sampleRate = _sound->interpretAsWav(rawAudioByteArray, outputAudioByteArray); + int sampleRate = interpretAsWav(rawAudioByteArray, outputAudioByteArray); if (sampleRate != 0) { - _sound->downSample(outputAudioByteArray, sampleRate); + downSample(outputAudioByteArray, sampleRate); } } else if (fileName.endsWith(RAW_EXTENSION)) { // check if this was a stereo raw file // since it's raw the only way for us to know that is if the file was called .stereo.raw if (fileName.toLower().endsWith("stereo.raw")) { - _sound->setStereo(true); + _isStereo = true; qCDebug(audio) << "Processing sound of" << rawAudioByteArray.size() << "bytes from" << _url << "as stereo audio file."; } // Process as 48khz RAW file - _sound->downSample(rawAudioByteArray, 48000); + downSample(rawAudioByteArray, 48000); } else { qCDebug(audio) << "Unknown sound file type"; + emit onError(300, "Failed to load sound file, reason: unknown sound file type"); + return; } - _sound->setReady(true); + emit onSuccess(_data, _isStereo, _isAmbisonic, _duration); } -void Sound::downSample(const QByteArray& rawAudioByteArray, int sampleRate) { +void SoundProcessor::downSample(const QByteArray& rawAudioByteArray, int sampleRate) { // we want to convert it to the format that the audio-mixer wants // which is signed, 16-bit, 24Khz if (sampleRate == AudioConstants::SAMPLE_RATE) { - // no resampling needed - _byteArray = rawAudioByteArray; - + _data = rawAudioByteArray; } else { int numChannels = _isAmbisonic ? AudioConstants::AMBISONIC : (_isStereo ? AudioConstants::STEREO : AudioConstants::MONO); @@ -121,15 +135,15 @@ void Sound::downSample(const QByteArray& rawAudioByteArray, int sampleRate) { int numSourceFrames = rawAudioByteArray.size() / (numChannels * sizeof(AudioConstants::AudioSample)); int maxDestinationFrames = resampler.getMaxOutput(numSourceFrames); int maxDestinationBytes = maxDestinationFrames * numChannels * sizeof(AudioConstants::AudioSample); - _byteArray.resize(maxDestinationBytes); + _data.resize(maxDestinationBytes); int numDestinationFrames = resampler.render((int16_t*)rawAudioByteArray.data(), - (int16_t*)_byteArray.data(), + (int16_t*)_data.data(), numSourceFrames); // truncate to actual output int numDestinationBytes = numDestinationFrames * numChannels * sizeof(AudioConstants::AudioSample); - _byteArray.resize(numDestinationBytes); + _data.resize(numDestinationBytes); } } @@ -178,7 +192,7 @@ struct WAVEFormat { }; // returns wavfile sample rate, used for resampling -int Sound::interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray) { +int SoundProcessor::interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray) { // Create a data stream to analyze the data QDataStream waveStream(const_cast(&inputAudioByteArray), QIODevice::ReadOnly); diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h index 6ec099b071..43a4eb7685 100644 --- a/libraries/audio/src/Sound.h +++ b/libraries/audio/src/Sound.h @@ -32,14 +32,12 @@ public: const QByteArray& getByteArray() const { return _byteArray; } - void setStereo(bool stereo) { _isStereo = stereo; } - void setReady(bool ready); - - void downSample(const QByteArray& rawAudioByteArray, int sampleRate); - int interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray); - signals: void ready(); + +protected slots: + void soundProcessSuccess(QByteArray data, bool stereo, bool ambisonic, float duration); + void soundProcessError(int error, QString str); private: QByteArray _byteArray; @@ -55,18 +53,26 @@ class SoundProcessor : public QObject, public QRunnable { Q_OBJECT public: - SoundProcessor(const QUrl& url, const QByteArray& data, Sound* sound) - : _url(url), _data(data), _sound(sound) + SoundProcessor(const QUrl& url, const QByteArray& data, const bool stereo, const bool ambisonic) + : _url(url), _data(data), _isStereo(stereo), _isAmbisonic(ambisonic) { } virtual void run() override; + void downSample(const QByteArray& rawAudioByteArray, int sampleRate); + int interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& outputAudioByteArray); + +signals: + void onSuccess(QByteArray data, bool stereo, bool ambisonic, float duration); + void onError(int error, QString str); + private: QUrl _url; QByteArray _data; - Sound* _sound; - + bool _isStereo; + bool _isAmbisonic; + float _duration; }; typedef QSharedPointer SharedSoundPointer; From cc57d28cccf1080b723317ee4bcbd81b46308ef4 Mon Sep 17 00:00:00 2001 From: seefo Date: Fri, 26 May 2017 11:39:47 -0700 Subject: [PATCH 4/8] Made requested changes to PR10554 --- libraries/audio/src/Sound.cpp | 4 ++-- libraries/audio/src/Sound.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/audio/src/Sound.cpp b/libraries/audio/src/Sound.cpp index 5ac9f8f53d..476a8d4d88 100644 --- a/libraries/audio/src/Sound.cpp +++ b/libraries/audio/src/Sound.cpp @@ -56,8 +56,8 @@ Sound::Sound(const QUrl& url, bool isStereo, bool isAmbisonic) : void Sound::downloadFinished(const QByteArray& data) { // this is a QRunnable, will delete itself after it has finished running SoundProcessor* soundProcessor = new SoundProcessor(_url, data, _isStereo, _isAmbisonic); - connect(soundProcessor, SIGNAL(onSuccess(QByteArray, bool, bool, float)), SLOT(soundProcessSuccess(QByteArray, bool, bool, float))); - connect(soundProcessor, SIGNAL(onError(int, QString)), SLOT(soundProcessError(int, QString))); + connect(soundProcessor, &SoundProcessor::onSuccess, this, &Sound::soundProcessSuccess); + connect(soundProcessor, &SoundProcessor::onError, this, &Sound::soundProcessError); QThreadPool::globalInstance()->start(soundProcessor); } diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h index 43a4eb7685..69dbf5a913 100644 --- a/libraries/audio/src/Sound.h +++ b/libraries/audio/src/Sound.h @@ -53,7 +53,7 @@ class SoundProcessor : public QObject, public QRunnable { Q_OBJECT public: - SoundProcessor(const QUrl& url, const QByteArray& data, const bool stereo, const bool ambisonic) + SoundProcessor(const QUrl& url, const QByteArray& data, bool stereo, bool ambisonic) : _url(url), _data(data), _isStereo(stereo), _isAmbisonic(ambisonic) { } From ccc7cb638de6fac18a945894434bfe1ba907eba7 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 26 May 2017 14:18:29 -0700 Subject: [PATCH 5/8] Fix "retain avatar info" --- interface/src/Application.cpp | 8 ++++---- interface/src/CrashHandler.cpp | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f7628ee240..8430b0443a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -436,6 +436,10 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { const char* portStr = getCmdOption(argc, constArgv, "--listenPort"); const int listenPort = portStr ? atoi(portStr) : INVALID_PORT; + static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset"; + bool suppressPrompt = cmdOptionExists(argc, const_cast(argv), SUPPRESS_SETTINGS_RESET); + bool previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt); + Setting::init(); if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) { @@ -456,10 +460,6 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { QCoreApplication::addLibraryPath(audioDLLPath); #endif - static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset"; - bool suppressPrompt = cmdOptionExists(argc, const_cast(argv), SUPPRESS_SETTINGS_RESET); - bool previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt); - DependencyManager::registerInheritance(); DependencyManager::registerInheritance(); DependencyManager::registerInheritance(); diff --git a/interface/src/CrashHandler.cpp b/interface/src/CrashHandler.cpp index 8081dd3ffc..19e887eb6e 100644 --- a/interface/src/CrashHandler.cpp +++ b/interface/src/CrashHandler.cpp @@ -24,12 +24,15 @@ #include "Application.h" #include "Menu.h" -#include #include +#include +#include + bool CrashHandler::checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt) { - Settings settings; + QSettings::setDefaultFormat(JSON_FORMAT); + QSettings settings; settings.beginGroup("Developer"); QVariant displayCrashOptions = settings.value(MenuOption::DisplayCrashOptions); QVariant askToResetSettingsOption = settings.value(MenuOption::AskToResetSettings); @@ -106,7 +109,7 @@ void CrashHandler::handleCrash(CrashHandler::Action action) { return; } - Settings settings; + QSettings settings; const QString ADDRESS_MANAGER_GROUP = "AddressManager"; const QString ADDRESS_KEY = "address"; const QString AVATAR_GROUP = "Avatar"; From 133951617704427025d83fa2095440698b2ab007 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Tue, 30 May 2017 20:56:45 +0200 Subject: [PATCH 6/8] OpenSSL installer update --- BUILD_WIN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 841cfba3b3..14709b7e92 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -24,7 +24,7 @@ Go to "Control Panel > System > Advanced System Settings > Environment Variables ###Step 5. Installing OpenSSL -Download and install the [Win64 OpenSSL v1.0.2k Installer](https://slproweb.com/download/Win64OpenSSL-1_0_2k.exe). +Download and install the [Win64 OpenSSL v1.0.2L Installer](https://slproweb.com/download/Win64OpenSSL-1_0_2L.exe). ###Step 6. Running CMake to Generate Build Files From 1ea3b2b7f43599bbbb38124e6484cdffda2d60d0 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Tue, 30 May 2017 21:01:42 +0200 Subject: [PATCH 7/8] let headers be headers --- BUILD_WIN.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 14709b7e92..311dfd9267 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -1,32 +1,32 @@ This is a stand-alone guide for creating your first High Fidelity build for Windows 64-bit. -###Step 1. Installing Visual Studio 2013 +### Step 1. Installing Visual Studio 2013 If you don't already have the Community or Professional edition of Visual Studio 2013, download and install [Visual Studio Community 2013](https://www.visualstudio.com/en-us/news/releasenotes/vs2013-community-vs). You do not need to install any of the optional components when going through the installer. Note: Newer versions of Visual Studio are not yet compatible. -###Step 2. Installing CMake +### Step 2. Installing CMake Download and install the [CMake 3.8.0 win64-x64 Installer](https://cmake.org/files/v3.8/cmake-3.8.0-win64-x64.msi). Make sure "Add CMake to system PATH for all users" is checked when going through the installer. -###Step 3. Installing Qt +### Step 3. Installing Qt Download and install the [Qt 5.6.2 for Windows 64-bit (VS 2013)](http://download.qt.io/official_releases/qt/5.6/5.6.2/qt-opensource-windows-x86-msvc2013_64-5.6.2.exe). Keep the default components checked when going through the installer. -###Step 4. Setting Qt Environment Variable +### Step 4. Setting Qt Environment Variable Go to "Control Panel > System > Advanced System Settings > Environment Variables > New..." (or search “Environment Variables” in Start Search). * Set "Variable name": QT_CMAKE_PREFIX_PATH * Set "Variable value": `%QT_DIR%\5.6\msvc2013_64\lib\cmake` -###Step 5. Installing OpenSSL +### Step 5. Installing OpenSSL Download and install the [Win64 OpenSSL v1.0.2L Installer](https://slproweb.com/download/Win64OpenSSL-1_0_2L.exe). -###Step 6. Running CMake to Generate Build Files +### Step 6. Running CMake to Generate Build Files Run Command Prompt from Start and run the following commands: cd "%HIFI_DIR%" @@ -36,7 +36,7 @@ Run Command Prompt from Start and run the following commands: Where %HIFI_DIR% is the directory for the highfidelity repository. -###Step 7. Making a Build +### Step 7. Making a Build Open '%HIFI_DIR%\build\hifi.sln' using Visual Studio. @@ -44,7 +44,7 @@ Change the Solution Configuration (next to the green play button) from "Debug" t Run Build > Build Solution. -###Step 8. Testing Interface +### Step 8. Testing Interface Create another environment variable (see Step #4) * Set "Variable name": _NO_DEBUG_HEAP @@ -56,7 +56,7 @@ Now, you should have a full build of High Fidelity and be able to run the Interf Note: You can also run Interface by launching it from command line or File Explorer from %HIFI_DIR%\build\interface\Release\interface.exe -###Troubleshooting +### Troubleshooting For any problems after Step #6, first try this: * Delete your locally cloned copy of the highfidelity repository @@ -64,18 +64,18 @@ For any problems after Step #6, first try this: * Redownload the [repository](https://github.com/highfidelity/hifi) * Restart directions from Step #6 -####CMake gives you the same error message repeatedly after the build fails +#### CMake gives you the same error message repeatedly after the build fails Remove `CMakeCache.txt` found in the '%HIFI_DIR%\build' directory -####nmake cannot be found +#### nmake cannot be found Make sure nmake.exe is located at the following path: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin If not, add the directory where nmake is located to the PATH environment variable. -####Qt is throwing an error +#### Qt is throwing an error Make sure you have the correct version (5.6.2) installed and 'QT_CMAKE_PREFIX_PATH' environment variable is set correctly. From 68ad8fa9816ca4829fbdc78cce247a9397eb9d5a Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Tue, 30 May 2017 21:12:51 +0200 Subject: [PATCH 8/8] visual headers --- BUILD.md | 25 +++++++++++++++---------- BUILD_ANDROID.md | 18 +++++++++--------- BUILD_LINUX.md | 3 ++- BUILD_OSX.md | 11 +++++++---- INSTALL.md | 8 ++++---- 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/BUILD.md b/BUILD.md index fc2359b057..c45b7cb636 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,4 +1,4 @@ -###Dependencies +### Dependencies * [cmake](https://cmake.org/download/) ~> 3.3.2 * [Qt](https://www.qt.io/download-open-source) ~> 5.6.2 @@ -6,7 +6,7 @@ * IMPORTANT: Use the latest available version of OpenSSL to avoid security vulnerabilities. * [VHACD](https://github.com/virneo/v-hacd)(clone this repository)(Optional) -####CMake External Project Dependencies +#### CMake External Project Dependencies * [boostconfig](https://github.com/boostorg/config) ~> 1.58 * [Bullet Physics Engine](https://github.com/bulletphysics/bullet3/releases) ~> 2.83 @@ -30,16 +30,19 @@ These are not placed in your normal build tree when doing an out of source build If you would like to use a specific install of a dependency instead of the version that would be grabbed as a CMake ExternalProject, you can pass -DUSE_LOCAL_$NAME=0 (where $NAME is the name of the subfolder in [cmake/externals](cmake/externals)) when you run CMake to tell it not to get that dependency as an external project. -###OS Specific Build Guides +### OS Specific Build Guides + * [BUILD_OSX.md](BUILD_OSX.md) - additional instructions for OS X. * [BUILD_LINUX.md](BUILD_LINUX.md) - additional instructions for Linux. * [BUILD_WIN.md](BUILD_WIN.md) - additional instructions for Windows. * [BUILD_ANDROID.md](BUILD_ANDROID.md) - additional instructions for Android -###CMake +### CMake + Hifi uses CMake to generate build files and project files for your platform. -####Qt +#### Qt + In order for CMake to find the Qt5 find modules, you will need to set a QT_CMAKE_PREFIX_PATH environment variable pointing to your Qt installation. This can either be entered directly into your shell session before you build or in your shell profile (e.g.: ~/.bash_profile, ~/.bashrc, ~/.zshrc - this depends on your shell and environment). @@ -50,7 +53,8 @@ The path it needs to be set to will depend on where and how Qt5 was installed. e export QT_CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.6.2/lib/cmake export QT_CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake -####Generating build files +#### Generating build files + Create a build directory in the root of your checkout and then run the CMake build from there. This will keep the rest of the directory clean. mkdir build @@ -59,14 +63,15 @@ Create a build directory in the root of your checkout and then run the CMake bui If cmake gives you the same error message repeatedly after the build fails (e.g. you had a typo in the QT_CMAKE_PREFIX_PATH that you fixed but the `.cmake` files still cannot be found), try removing `CMakeCache.txt`. -####Variables +#### Variables + Any variables that need to be set for CMake to find dependencies can be set as ENV variables in your shell profile, or passed directly to CMake with a `-D` flag appended to the `cmake ..` command. For example, to pass the QT_CMAKE_PREFIX_PATH variable during build file generation: cmake .. -DQT_CMAKE_PREFIX_PATH=/usr/local/qt/5.6.2/lib/cmake -####Finding Dependencies +#### Finding Dependencies The following applies for dependencies we do not grab via CMake ExternalProject (OpenSSL is an example), or for dependencies you have opted not to grab as a CMake ExternalProject (via -DUSE_LOCAL_$NAME=0). The list of dependencies we grab by default as external projects can be found in [the CMake External Project Dependencies section](#cmake-external-project-dependencies). @@ -78,8 +83,8 @@ In the examples below the variable $NAME would be replaced by the name of the de * $NAME_ROOT_DIR - set this variable in your ENV * HIFI_LIB_DIR - set this variable in your ENV to your High Fidelity lib folder, should contain a folder '$name' -###Optional Components +### Optional Components -####Devices +#### Devices You can support external input/output devices such as Leap Motion, MIDI, and more by adding each individual SDK in the visible building path. Refer to the readme file available in each device folder in [interface/external/](interface/external) for the detailed explanation of the requirements to use the device. diff --git a/BUILD_ANDROID.md b/BUILD_ANDROID.md index 1f144bf3ba..d69d20ee8a 100644 --- a/BUILD_ANDROID.md +++ b/BUILD_ANDROID.md @@ -1,6 +1,6 @@ Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only Android specific instructions are found in this file. -###Android Dependencies +### Android Dependencies You will need the following tools to build our Android targets. @@ -17,23 +17,23 @@ You will need the following tools to build our Android targets. You will also need to cross-compile the dependencies required for all platforms for Android, and help CMake find these compiled libraries on your machine. -####Scribe +#### Scribe High Fidelity has a shader pre-processing tool called `scribe` that various libraries will call on during the build process. You must compile scribe using your native toolchain (following the build instructions for your platform) and then pass a CMake variable or set an ENV variable `SCRIBE_PATH` that is a path to the scribe executable. CMake will fatally error if it does not find the scribe executable while using the android toolchain. -####Optional Components +#### Optional Components * [Oculus Mobile SDK](https://developer.oculus.com/downloads/#sdk=mobile) ~> 0.4.2 -####ANDROID_LIB_DIR +#### ANDROID_LIB_DIR Since you won't be installing Android dependencies to system paths on your development machine, CMake will need a little help tracking down your Android dependencies. This is most easily accomplished by installing all Android dependencies in the same folder. You can place this folder wherever you like on your machine. In this build guide and across our CMakeLists files this folder is referred to as `ANDROID_LIB_DIR`. You can set `ANDROID_LIB_DIR` in your environment or by passing when you run CMake. -####Qt +#### Qt Install Qt 5.5.1 for Android for your host environment from the [Qt downloads page](http://www.qt.io/download/). Install Qt to ``$ANDROID_LIB_DIR/Qt``. This is required so that our root CMakeLists file can help CMake find your Android Qt installation. @@ -41,7 +41,7 @@ The component required for the Android build is the `Android armv7` component. If you would like to install Qt to a different location, or attempt to build with a different Qt version, you can pass `ANDROID_QT_CMAKE_PREFIX_PATH` to CMake. Point to the `cmake` folder inside `$VERSION_NUMBER/android_armv7/lib`. Otherwise, our root CMakeLists will set it to `$ANDROID_LIB_DIR/Qt/5.5/android_armv7/lib/cmake`. -####OpenSSL +#### OpenSSL Cross-compilation of OpenSSL has been tested from an OS X machine running 10.10 compiling OpenSSL 1.0.2. It is likely that the steps below will work for other OpenSSL versions than 1.0.2. @@ -76,7 +76,7 @@ This should generate libcrypto and libssl in the root of the OpenSSL directory. If you have been building other components it is possible that the OpenSSL compile will fail based on the values other cross-compilations (tbb, bullet) have set. Ensure that you are in a new terminal window to avoid compilation errors from previously set environment variables. -####Oculus Mobile SDK +#### Oculus Mobile SDK The Oculus Mobile SDK is optional, for Gear VR support. It is not required to compile gvr-interface. @@ -91,7 +91,7 @@ ndk-build This will create the liboculus.a archive that our FindLibOVR module will look for when cmake is run. -#####Hybrid testing +##### Hybrid testing Currently the 'vr_dual' mode that would allow us to run a hybrid app has limited support in the Oculus Mobile SDK. The best way to have an application we can launch without having to connect to the GearVR is to put the Gear VR Service into developer mode. This stops Oculus Home from taking over the device when it is plugged into the Gear VR headset, and allows the application to be launched from the Applications page. @@ -99,7 +99,7 @@ To put the Gear VR Service into developer mode you need an application with an O Once the application is on your device, go to `Settings->Application Manager->Gear VR Service->Manage Storage`. Tap on `VR Service Version` six times. It will scan your device to verify that you have an osig file in an application on your device, and then it will let you enable Developer mode. -###CMake +### CMake We use CMake to generate the makefiles that compile and deploy the Android APKs to your device. In order to create Makefiles for the Android targets, CMake requires that some environment variables are set, and that other variables are passed to it when it is run. diff --git a/BUILD_LINUX.md b/BUILD_LINUX.md index 34ba41894c..d40576a75d 100644 --- a/BUILD_LINUX.md +++ b/BUILD_LINUX.md @@ -1,6 +1,7 @@ Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only Linux specific instructions are found in this file. -###Qt5 Dependencies +### Qt5 Dependencies + Should you choose not to install Qt5 via a package manager that handles dependencies for you, you may be missing some Qt5 dependencies. On Ubuntu, for example, the following additional packages are required: libasound2 libxmu-dev libxi-dev freeglut3-dev libasound2-dev libjack0 libjack-dev libxrandr-dev libudev-dev libssl-dev diff --git a/BUILD_OSX.md b/BUILD_OSX.md index afd3fa040c..3365627b8c 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -1,12 +1,13 @@ Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only OS X specific instructions are found in this file. -###Homebrew +### Homebrew + [Homebrew](https://brew.sh/) is an excellent package manager for OS X. It makes install of some High Fidelity dependencies very simple. brew tap homebrew/versions brew install cmake openssl -###OpenSSL +### OpenSSL Assuming you've installed OpenSSL using the homebrew instructions above, you'll need to set OPENSSL_ROOT_DIR so CMake can find your installations. For OpenSSL installed via homebrew, set OPENSSL_ROOT_DIR: @@ -15,7 +16,8 @@ For OpenSSL installed via homebrew, set OPENSSL_ROOT_DIR: Note that this uses the version from the homebrew formula at the time of this writing, and the version in the path will likely change. -###Qt +### Qt + Download and install the [Qt 5.6.2 for macOS](http://download.qt.io/official_releases/qt/5.6/5.6.2/qt-opensource-mac-x64-clang-5.6.2.dmg). Keep the default components checked when going through the installer. @@ -23,7 +25,8 @@ Keep the default components checked when going through the installer. Once Qt is installed, you need to manually configure the following: * Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt5.6.2/5.6/clang_64/lib/cmake/` directory. -###Xcode +### Xcode + If Xcode is your editor of choice, you can ask CMake to generate Xcode project files instead of Unix Makefiles. cmake .. -GXcode diff --git a/INSTALL.md b/INSTALL.md index 701752f6af..79d7e96977 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,15 +2,15 @@ Follow the [build guide](BUILD.md) to figure out how to build High Fidelity for During generation, CMake should produce an `install` target and a `package` target. -###Install +### Install The `install` target will copy the High Fidelity targets and their dependencies to your `CMAKE_INSTALL_PREFIX`. -###Packaging +### Packaging To produce an installer, run the `package` target. -####Windows +#### Windows To produce an executable installer on Windows, the following are required: @@ -20,6 +20,6 @@ To produce an executable installer on Windows, the following are required: Run the `package` target to create an executable installer using the Nullsoft Scriptable Install System. -####OS X +#### OS X Run the `package` target to create an Apple Disk Image (.dmg).