From f39814021c709e1d70b5fb96a845811584efb329 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 10 Jul 2022 12:52:57 +0200 Subject: [PATCH 01/78] FIRE-31687: Place profile overlaps landmark panel in places floater when closing create pick panel --- indra/newview/llpanelplaces.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 75318e44910..fe9d87181f0 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -1122,7 +1122,8 @@ void LLPanelPlaces::togglePickPanel(BOOL visible) if (mPickPanel) { mPickPanel->setVisible(visible); - mPlaceProfile->setVisible(!visible); + // FIRE-31687: Place profile overlaps landmark panel in places floater when closing create pick panel + //mPlaceProfile->setVisible(!visible); updateVerbs(); } From 47c9982dc9f7f7f33b9bf360eea933405985b0c5 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 10 Jul 2022 13:19:39 +0200 Subject: [PATCH 02/78] FIRE-31689: Landmark initially shown in wrong folder while creating --- indra/newview/llfloatercreatelandmark.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloatercreatelandmark.cpp b/indra/newview/llfloatercreatelandmark.cpp index 588f72e85bd..ad5cf428d7a 100644 --- a/indra/newview/llfloatercreatelandmark.cpp +++ b/indra/newview/llfloatercreatelandmark.cpp @@ -143,7 +143,9 @@ void LLFloaterCreateLandmark::setLandmarkInfo(const LLUUID &folder_id) mLandmarkTitleEditor->setText(name); } - LLLandmarkActions::createLandmarkHere(name, "", folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)); + // FIRE-31689: Landmark initially shown in wrong folder while creating + //LLLandmarkActions::createLandmarkHere(name, "", folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)); + LLLandmarkActions::createLandmarkHere(name, "", folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK)); } bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right) From 58bf3e69a98125eacac59d310ec40db7967240ed Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 10 Jul 2022 13:34:52 +0200 Subject: [PATCH 03/78] FIRE-31406: Word-wrap loading text in web content floaters --- indra/newview/skins/default/xui/en/floater_web_content.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml index 4ab56b505cf..29b7b124aa8 100644 --- a/indra/newview/skins/default/xui/en/floater_web_content.xml +++ b/indra/newview/skins/default/xui/en/floater_web_content.xml @@ -198,7 +198,8 @@ left="60" top="60" right="-60" - bottom="-60"> + bottom="-60" + wrap="true"> The web browser plugin seems to be taking a while to open. If the plugin never loads, please visit: From 892e287c461967103f4ea7ff5865cca98efdf9f6 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 11 Jul 2022 09:31:23 +0200 Subject: [PATCH 04/78] FIRE-31800: Fix doubleClick teleport enabled/disabled message is missing --- indra/newview/llviewermenu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 3371b929616..0fecd8ae7e0 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9681,6 +9681,7 @@ void setDoubleClickAction(const std::string& control) bool ignore_mask = true; conflictHandler.registerControl(control, index, click, key, mask, ignore_mask); + report_to_nearby_chat(LLTrans::getString("DoubleClickTeleportEnabled")); } else { @@ -9691,6 +9692,7 @@ void setDoubleClickAction(const std::string& control) if (data.mMouse == click && data.mKey == key && data.mMask == mask) { conflictHandler.clearControl(control, i); + report_to_nearby_chat(LLTrans::getString("DoubleClickTeleportDisabled")); } } } @@ -9698,7 +9700,7 @@ void setDoubleClickAction(const std::string& control) conflictHandler.saveToSettings(); } -bool isDoubleClickActionEnabled(const std::string control) +bool isDoubleClickActionEnabled(const std::string& control) { constexpr LLKeyConflictHandler::ESourceMode mode{ LLKeyConflictHandler::MODE_THIRD_PERSON }; constexpr EMouseClickType click{ EMouseClickType::CLICK_DOUBLELEFT }; From 65a388bbbe7b63d1d2f46dee6e5a01cc7233a2c3 Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Thu, 14 Jul 2022 18:47:41 +0200 Subject: [PATCH 05/78] Revert some of the changes made to prevent calling card duplication, as the method has changed and the viewer is now responsible for creating calling cards after friendship has formed. --- indra/newview/llfriendcard.cpp | 51 --------------------------------- indra/newview/llfriendcard.h | 3 -- indra/newview/llpanelpeople.cpp | 6 ++-- indra/newview/llstartup.cpp | 4 --- 4 files changed, 2 insertions(+), 62 deletions(-) diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 70a43eaaafd..0be748ace9d 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -636,55 +636,4 @@ void LLFriendCardsManager::onFriendListUpdate(U32 changed_mask) } } -// Bypass the calling card sync-crap to create the agent's calling card -void create_agent_calling_card_name_cb(const LLAvatarName& av_name, const LLUUID& calling_cards_folder_id) -{ - create_inventory_item(gAgentID, - gAgentSessionID, - calling_cards_folder_id, - LLTransactionID::tnull, - av_name.getUserName(), - gAgentID.asString(), - LLAssetType::AT_CALLINGCARD, - LLInventoryType::IT_CALLINGCARD, - NO_INV_SUBTYPE, - PERM_MOVE | PERM_TRANSFER, - NULL); -} - -void calling_card_folder_loaded_cb(const LLUUID& calling_cards_folder_id) -{ - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLFindAgentCallingCard collector; - gInventory.collectDescendentsIf(calling_cards_folder_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, collector); - - // Create own calling card if it was not found in Friends/All folder - if (!collector.isAgentCallingCardFound()) - { - LLAvatarNameCache::get(gAgentID, boost::bind(&create_agent_calling_card_name_cb, _2, calling_cards_folder_id)); - } -} - -// static -void LLFriendCardsManager::createAgentCallingCard() -{ - const LLUUID calling_cards_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); - - // This instance will be deleted in LLInitialFriendCardsFetch::done(). - LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(calling_cards_folder_id, boost::bind(&calling_card_folder_loaded_cb, calling_cards_folder_id)); - fetch->startFetch(); - if (fetch->isFinished()) - { - // everything is already here - call done. - fetch->done(); - } - else - { - // it's all on it's way - add an observer, and the inventory - // will call done for us when everything is here. - gInventory.addObserver(fetch); - } -} -// // EOF diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h index 945ac77c8bc..ebd077dc597 100644 --- a/indra/newview/llfriendcard.h +++ b/indra/newview/llfriendcard.h @@ -95,9 +95,6 @@ class LLFriendCardsManager */ void syncFriendCardsFolders(); - // Bypass the calling card sync-crap to create the agent's calling card - static void createAgentCallingCard(); - private: typedef boost::function callback_t; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 225483b1d4f..2372c3efabc 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -359,8 +359,7 @@ class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver // For notification when SIP online status changes. LLVoiceClient::getInstance()->addObserver(this); - // Disconnect LLFriendCardsManager - //mInvObserver = new LLInventoryFriendCardObserver(this); + mInvObserver = new LLInventoryFriendCardObserver(this); } ~LLFriendListUpdater() @@ -413,8 +412,7 @@ class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver private: U32 mMask; - // Disconnect LLFriendCardsManager - //LLInventoryFriendCardObserver* mInvObserver; + LLInventoryFriendCardObserver* mInvObserver; bool mIsActive; /** diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 700de755bc3..46fe01c7c6d 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -248,7 +248,6 @@ #include "lggcontactsets.h" #include "llfloatersearch.h" #include "llfloatersidepanelcontainer.h" -#include "llfriendcard.h" #include "llnotificationmanager.h" #include "llpresetsmanager.h" #include "llprogressview.h" @@ -3059,9 +3058,6 @@ bool idle_startup() // Favorite Wearables FSFloaterWearableFavorites::initCategory(); - // Bypass the calling card sync-crap to create the agent's calling card - LLFriendCardsManager::createAgentCallingCard(); - // Let the map know about the inventory. LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance(); if(floater_world_map) From 2b986153801853abe1d75bd9550f2ce867a4c239 Mon Sep 17 00:00:00 2001 From: PanteraPolnocy Date: Sat, 16 Jul 2022 05:04:32 +0200 Subject: [PATCH 06/78] About floater update --- indra/newview/skins/default/xui/en/floater_about.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml index f477d1c7b7c..8d16d94b769 100644 --- a/indra/newview/skins/default/xui/en/floater_about.xml +++ b/indra/newview/skins/default/xui/en/floater_about.xml @@ -140,7 +140,7 @@ The Firestorm Development Team: top_pad="4" width="450" wrap="true"> -Ansariel Hiller, ArminWeatherHax, Arrehn Oberlander, Beq Janus, Cinder Roxley, Holy Gavenkrantz, Jessica Lyon, Kadah Coba, Kitty Barnett, Liny Odell, LordGregGreg Back, Mobius Ryba, Nicky Dasmijn, PanteraPolnocy, Selo Jacobus, Tankmaster Finesmith, Techwolf Lupindo, Tonya Souther, Tozh Taurog, Vortex Saito, WoLf Loonie, Wolfspirit Magic and Zi Ree. +Ansariel Hiller, ArminWeatherHax, Arrehn Oberlander, Beq Janus, Cinder Roxley, Holy Gavenkrantz, Jessica Lyon, Kadah Coba, Kitty Barnett, Liny Odell, LordGregGreg Back, Mobius Ryba, Nicky Dasmijn, PanteraPolnocy, ScentualLust, Selo Jacobus, Tankmaster Finesmith, Techwolf Lupindo, Tonya Souther, Tozh Taurog, Vortex Saito, WoLf Loonie, Wolfspirit Magic and Zi Ree. Date: Mon, 25 May 2020 19:39:54 -0400 Subject: [PATCH 07/78] OpenAL test build --- .github/workflows/ccpp.yml | 83 + .gitmodules | 6 + fs-build-variables | 1 + indra/cmake/Copy3rdPartyLibs.cmake | 15 +- indra/llcommon/indra_constants.h | 2 +- indra/newview/CMakeLists.txt | 1 + indra/newview/llviewerVR.cpp | 2301 ++++++++++++++++++++++++++++ indra/newview/llviewerVR.h | 220 +++ indra/newview/llviewerdisplay.cpp | 44 +- indra/newview/viewer_manifest.py | 6 + openvr | 1 + 11 files changed, 2673 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ccpp.yml create mode 100644 .gitmodules create mode 160000 fs-build-variables create mode 100644 indra/newview/llviewerVR.cpp create mode 100644 indra/newview/llviewerVR.h create mode 160000 openvr diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml new file mode 100644 index 00000000000..131ac7532ea --- /dev/null +++ b/.github/workflows/ccpp.yml @@ -0,0 +1,83 @@ +name: C/C++ CI + +on: [push, pull_request] +defaults: + run: + shell: bash +jobs: + build: + strategy: + matrix: + os: [windows-latest, ubuntu-16.04] + build_type: [full] + runs-on: ${{matrix.os}} + env: + AUTOBUILD_VSVER: 120 + PreferredToolArchitecture: x64 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set env + if: startsWith(matrix.os, 'windows') + shell: cmd + run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables + - name: Set env apt + if: startsWith(matrix.os, 'ubuntu') + shell: bash + run: | + sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb + echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables + echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 + - name: Download VS2013 Community + if: startsWith(matrix.os, 'windows') + run: choco install visualstudiocommunity2013 + - name: Setup Ninja + if: startsWith(matrix.os, 'ubuntu') + uses: seanmiddleditch/gha-setup-ninja@master + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + architecture: x64 + - name: Get software versions please + run: | + cmake --version + git --version + python --version + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + - name: Get autobuild version + run: autobuild --version + - name: Configure autobuild + if: startsWith(matrix.os, 'windows') + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE + - name: Configure autobuild + if: startsWith(matrix.os, 'ubuntu') + shell: bash + run: | + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - name: Build & Package + if: startsWith(matrix.os, 'windows') + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount /detailedsummary + - name: Build & Package + if: startsWith(matrix.os, 'ubuntu') + shell: bash + run: | + autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'windows') + with: + name: fs-windows-gha-artifact + path: build-vc120-64/newview/Release/*_Setup.exe + - uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'ubuntu') + with: + name: fs-ubuntu-gha-artifact + path: build-linux-x86_64/newview/Phoenix*.tar.* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..721f2982d2d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "openvr"] + path = openvr + url = https://github.com/ValveSoftware/openvr +[submodule "fs-build-variables"] + path = fs-build-variables + url = https://vcs.firestormviewer.org/fs-build-variables diff --git a/fs-build-variables b/fs-build-variables new file mode 160000 index 00000000000..5a8faeb41bc --- /dev/null +++ b/fs-build-variables @@ -0,0 +1 @@ +Subproject commit 5a8faeb41bc540aa49467647d0699c4040bced7a diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 34a7c3f18d3..5acd6df7bfa 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -30,6 +30,8 @@ if(WINDOWS) set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo") set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}/Release") + set(openvr_src_dir ${CMAKE_SOURCE_DIR}/../openvr/bin/win64) + set(openvr_files openvr_api.dll) #******************************* # VIVOX - *NOTE: no debug version set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") @@ -222,8 +224,10 @@ elseif(LINUX) set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}") + set(openvr_src_dir ${CMAKE_SOURCE_DIR}/../openvr/bin/linux64) + set(openvr_files libopenvr_api.so) - set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}/../../lib32/") + set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(vivox_libs libsndfile.so.1 libortp.so @@ -255,8 +259,6 @@ elseif(LINUX) libuuid.so.16.0.22 libfontconfig.so.1.8.0 libfontconfig.so.1 - libaprutil-1.so.0 - libapr-1.so.0 ) else (NOT USESYSTEMLIBS) set(release_files @@ -293,6 +295,13 @@ endif(WINDOWS) ################################################################ # Done building the file lists, now set up the copy commands. ################################################################ +copy_if_different( + ${openvr_src_dir} + "${SHARED_LIB_STAGING_DIR_RELEASE}" + out_targets + ${openvr_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) # Curiously, slvoice_files are only copied to SHARED_LIB_STAGING_DIR_RELEASE. # It's unclear whether this is oversight or intentional, but anyway leave the diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 937f1a55012..6f606523ffa 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -32,7 +32,7 @@ class LLUUID; // Centralize definition of application name -const std::string APP_NAME = "Firestorm"; +const std::string APP_NAME = "FirestormVR"; static const F32 REGION_WIDTH_METERS = 256.f; static const S32 REGION_WIDTH_UNITS = 256; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 94bb0ac4968..62fb75dfce3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2563,6 +2563,7 @@ endif (WINDOWS) if (LINUX) target_link_libraries(${VIEWER_BINARY_NAME} "dl" ) + target_link_libraries(${VIEWER_BINARY_NAME} openvr_api) endif (LINUX) set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH diff --git a/indra/newview/llviewerVR.cpp b/indra/newview/llviewerVR.cpp new file mode 100644 index 00000000000..84809bc909d --- /dev/null +++ b/indra/newview/llviewerVR.cpp @@ -0,0 +1,2301 @@ +#include "llviewerprecompiledheaders.h" +#include "llviewerVR.h" +#include "llviewerwindow.h" +#ifdef _WIN32 +#include "llwindowwin32.h" +#endif +#include "llviewercontrol.h" +#include "llviewercamera.h" +#include "llagentcamera.h" +#include "pipeline.h" +#include "llagent.h" +#ifdef _WIN32 +#include "llkeyboardwin32.h" +#endif +#include "llui.h" + +#include "llfloaterreg.h" +#include +#include +#include +//#include "llrender.h" + +#ifdef _WIN32 +#pragma comment(lib, "../../openvr/lib/win64/openvr_api.lib") +#endif + +#ifndef _WIN32 +#define sprintf_s(buffer, buffer_size, stringbuffer, ...) (sprintf(buffer, stringbuffer, __VA_ARGS__)) +#endif + +//#include +//#include +llviewerVR::llviewerVR() +{ + gHMD = NULL; + gRenderModels = NULL; + leftEyeDesc.m_nResolveTextureId = 0; + rightEyeDesc.m_nResolveTextureId = 0; + hud_textp = NULL; + m_kEditKey = KEY_F4; + m_kDebugKey = KEY_F3; + m_kMenuKey = KEY_F5; + m_kPlusKey = KEY_F6; + m_kMinusKey = KEY_F7; + m_fEyeDistance = 40; + m_fFocusDistance = 10; + m_fTextureShift = 0; + m_fTextureZoom = 0; + m_fFOV = 100; + + /*if (!LLKeyboard::keyFromString("x", &m_kEditKey)) + { + // If the call failed, don't match any key. + //key = KEY_NONE; + }*/ +} +LLPanel* panelp = NULL; +//GLenum err; + +llviewerVR::~llviewerVR() +{ +} + +/*glh::matrix4f ConvertSteamVRMatrixToMatrix4(const vr::HmdMatrix34_t &matPose) +{ +glh::matrix4f matrixObj( +matPose.m[0][0], matPose.m[1][0], matPose.m[2][0], 0.0, +matPose.m[0][1], matPose.m[1][1], matPose.m[2][1], 0.0, +matPose.m[0][2], matPose.m[1][2], matPose.m[2][2], 0.0, +matPose.m[0][3], matPose.m[1][3], matPose.m[2][3], 1.0f +); +return matrixObj; +}*/ +//unused +vr::HmdQuaternion_t llviewerVR::GetRotation(vr::HmdMatrix34_t matrix) { + vr::HmdQuaternion_t q; + + q.w = sqrt(fmax(0, 1 + matrix.m[0][0] + matrix.m[1][1] + matrix.m[2][2])) / 2; + q.x = sqrt(fmax(0, 1 + matrix.m[0][0] - matrix.m[1][1] - matrix.m[2][2])) / 2; + q.y = sqrt(fmax(0, 1 - matrix.m[0][0] + matrix.m[1][1] - matrix.m[2][2])) / 2; + q.z = sqrt(fmax(0, 1 - matrix.m[0][0] - matrix.m[1][1] + matrix.m[2][2])) / 2; + q.x = copysign(q.x, matrix.m[2][1] - matrix.m[1][2]); + q.y = copysign(q.y, matrix.m[0][2] - matrix.m[2][0]); + q.z = copysign(q.z, matrix.m[1][0] - matrix.m[0][1]); + return q; +} + +LLMatrix4 llviewerVR::ConvertGLHMatrix4ToLLMatrix4(glh::matrix4f m) +{ + LLMatrix4 mout; + mout.mMatrix[0][0] = m.element(0, 0); + mout.mMatrix[0][1] = m.element(1, 0); + mout.mMatrix[0][2] = m.element(2, 0); + mout.mMatrix[0][3] = m.element(3, 0); + + mout.mMatrix[1][0] = m.element(0, 1); + mout.mMatrix[1][1] = m.element(1, 1); + mout.mMatrix[1][2] = m.element(2, 1); + mout.mMatrix[1][3] = m.element(3, 1); + + mout.mMatrix[2][0] = m.element(0, 2); + mout.mMatrix[2][1] = m.element(1, 2); + mout.mMatrix[2][2] = m.element(2, 2); + mout.mMatrix[2][3] = m.element(3, 2); + + mout.mMatrix[3][0] = m.element(0, 3); + mout.mMatrix[3][1] = m.element(1, 3); + mout.mMatrix[3][2] = m.element(2, 3); + mout.mMatrix[3][3] = m.element(3, 3); + return mout; +} + +glh::matrix4f llviewerVR::ConvertSteamVRMatrixToMatrix42(const vr::HmdMatrix34_t &matPose) +{ + //vr::HmdQuaternion_t q = GetRotation(matPose); + + //gHMDQuat.set(q.x,q.y,q.z,q.w); + + glh::matrix4f matrixObj( + matPose.m[0][0], matPose.m[1][0], matPose.m[2][0], 0.0, + matPose.m[0][1], matPose.m[1][1], matPose.m[2][1], 0.0, + matPose.m[0][2], matPose.m[1][2], matPose.m[2][2], 0.0, + matPose.m[0][3], matPose.m[1][3], matPose.m[2][3], 1.0 + //0, 0, 0, 1.0f + ); + + //LLMatrix4 mat((F32*)matPose.m); + //gHMDQuat.setQuat(mat); + + + //m_nPos.v[0] = matPose.m[0][3]; + //m_nPos.v[1] = matPose.m[2][3]; + //m_nPos.v[2] = matPose.m[1][3]; + + //gHMDAxes.mV[0] = atan2(matPose.m[1][0], matPose.m[0][0]);// *57.2957795;//yaw + //gHMDAxes.mV[2] = atan2(matPose.m[2][1], matPose.m[2][2]);// *57.2957795;//pitch + + //gHMDAxes.mV[0] = matPose.m[2][0]; + //gHMDAxes.mV[1] = matPose.m[2][1]; + //gHMDAxes.mV[2] = matPose.m[2][2]; + return matrixObj; +} + +glh::matrix4f llviewerVR::GetHMDMatrixProjectionEye(vr::Hmd_Eye nEye) +{ + if (gHMD == NULL) + return glh::matrix4f(); + + vr::HmdMatrix44_t mat = gHMD->GetProjectionMatrix(nEye, m_fNearClip, m_fFarClip); + + return glh::matrix4f( + mat.m[0][0], mat.m[1][0], mat.m[2][0], mat.m[3][0], + mat.m[0][1], mat.m[1][1], mat.m[2][1], mat.m[3][1], + mat.m[0][2], mat.m[1][2], mat.m[2][2], mat.m[3][2], + mat.m[0][3], mat.m[1][3], mat.m[2][3], mat.m[3][3] + ); +} + +glh::matrix4f llviewerVR::GetHMDMatrixPoseEye(vr::Hmd_Eye nEye) +{ + if (gHMD == NULL) + return glh::matrix4f(); + + vr::HmdMatrix34_t matEyeRight = gHMD->GetEyeToHeadTransform(nEye); + return glh::matrix4f( + matEyeRight.m[0][0], matEyeRight.m[1][0], matEyeRight.m[2][0], 0.0, + matEyeRight.m[0][1], matEyeRight.m[1][1], matEyeRight.m[2][1], 0.0, + matEyeRight.m[0][2], matEyeRight.m[1][2], matEyeRight.m[2][2], 0.0, + matEyeRight.m[0][3], matEyeRight.m[1][3], matEyeRight.m[2][3], 1.0f + ); + //glh::matrix4f mt; + //return matrixObj.inverse(); + //gluInvertMatrix(matrixObj.m, mt.m); + //return matrixObj; +} + +//unused Gives the projection matrix for an eye with HMD and IPD offsets. Add positional camera offset???? + +//Copy both matrices at startup????? +glh::matrix4f llviewerVR::GetCurrentViewProjectionMatrix(vr::Hmd_Eye nEye) +{ + if (gHMD == NULL) + return glh::matrix4f(); + return GetHMDMatrixProjectionEye(nEye) * GetHMDMatrixPoseEye(nEye) * m_mat4HMDPose; +} + +//debug func +std::string llviewerVR::MatrixToStr(glh::matrix4f mat, std::string name) +{ + + std::string str(name); + glh::ns_float::vec4 row; + row = mat.get_row(0); + str.append("\nLf Row 0 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" >\n "); + + row = mat.get_row(1); + str.append("Up Row 1 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n "); + + row = mat.get_row(2); + str.append("Fw Row 2 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n "); + + row = mat.get_row(3); + str.append("po Row 3 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n\n "); + + + + + + + return str; +} + +//Debug func +std::string llviewerVR::MatrixToStrLL(glh::matrix4f mat, std::string name) +{ + + std::string str(name); + glh::ns_float::vec4 row; + row = mat.get_row(0); + str.append("\nLf Row 0 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" >\n "); + + row = mat.get_row(1); + str.append("Up Row 1 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + + str.append(" > \n "); + + row = mat.get_row(2); + str.append("Fw Row 2 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n "); + + row = mat.get_row(3); + str.append("po Row 3 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n\n "); + + + + + + + return str; +} + +bool llviewerVR::gluInvertMatrix(const float m[16], float invOut[16]) +{ + float inv[16], det; + int i; + + inv[0] = m[5] * m[10] * m[15] - + m[5] * m[11] * m[14] - + m[9] * m[6] * m[15] + + m[9] * m[7] * m[14] + + m[13] * m[6] * m[11] - + m[13] * m[7] * m[10]; + + inv[4] = -m[4] * m[10] * m[15] + + m[4] * m[11] * m[14] + + m[8] * m[6] * m[15] - + m[8] * m[7] * m[14] - + m[12] * m[6] * m[11] + + m[12] * m[7] * m[10]; + + inv[8] = m[4] * m[9] * m[15] - + m[4] * m[11] * m[13] - + m[8] * m[5] * m[15] + + m[8] * m[7] * m[13] + + m[12] * m[5] * m[11] - + m[12] * m[7] * m[9]; + + inv[12] = -m[4] * m[9] * m[14] + + m[4] * m[10] * m[13] + + m[8] * m[5] * m[14] - + m[8] * m[6] * m[13] - + m[12] * m[5] * m[10] + + m[12] * m[6] * m[9]; + + inv[1] = -m[1] * m[10] * m[15] + + m[1] * m[11] * m[14] + + m[9] * m[2] * m[15] - + m[9] * m[3] * m[14] - + m[13] * m[2] * m[11] + + m[13] * m[3] * m[10]; + + inv[5] = m[0] * m[10] * m[15] - + m[0] * m[11] * m[14] - + m[8] * m[2] * m[15] + + m[8] * m[3] * m[14] + + m[12] * m[2] * m[11] - + m[12] * m[3] * m[10]; + + inv[9] = -m[0] * m[9] * m[15] + + m[0] * m[11] * m[13] + + m[8] * m[1] * m[15] - + m[8] * m[3] * m[13] - + m[12] * m[1] * m[11] + + m[12] * m[3] * m[9]; + + inv[13] = m[0] * m[9] * m[14] - + m[0] * m[10] * m[13] - + m[8] * m[1] * m[14] + + m[8] * m[2] * m[13] + + m[12] * m[1] * m[10] - + m[12] * m[2] * m[9]; + + inv[2] = m[1] * m[6] * m[15] - + m[1] * m[7] * m[14] - + m[5] * m[2] * m[15] + + m[5] * m[3] * m[14] + + m[13] * m[2] * m[7] - + m[13] * m[3] * m[6]; + + inv[6] = -m[0] * m[6] * m[15] + + m[0] * m[7] * m[14] + + m[4] * m[2] * m[15] - + m[4] * m[3] * m[14] - + m[12] * m[2] * m[7] + + m[12] * m[3] * m[6]; + + inv[10] = m[0] * m[5] * m[15] - + m[0] * m[7] * m[13] - + m[4] * m[1] * m[15] + + m[4] * m[3] * m[13] + + m[12] * m[1] * m[7] - + m[12] * m[3] * m[5]; + + inv[14] = -m[0] * m[5] * m[14] + + m[0] * m[6] * m[13] + + m[4] * m[1] * m[14] - + m[4] * m[2] * m[13] - + m[12] * m[1] * m[6] + + m[12] * m[2] * m[5]; + + inv[3] = -m[1] * m[6] * m[11] + + m[1] * m[7] * m[10] + + m[5] * m[2] * m[11] - + m[5] * m[3] * m[10] - + m[9] * m[2] * m[7] + + m[9] * m[3] * m[6]; + + inv[7] = m[0] * m[6] * m[11] - + m[0] * m[7] * m[10] - + m[4] * m[2] * m[11] + + m[4] * m[3] * m[10] + + m[8] * m[2] * m[7] - + m[8] * m[3] * m[6]; + + inv[11] = -m[0] * m[5] * m[11] + + m[0] * m[7] * m[9] + + m[4] * m[1] * m[11] - + m[4] * m[3] * m[9] - + m[8] * m[1] * m[7] + + m[8] * m[3] * m[5]; + + inv[15] = m[0] * m[5] * m[10] - + m[0] * m[6] * m[9] - + m[4] * m[1] * m[10] + + m[4] * m[2] * m[9] + + m[8] * m[1] * m[6] - + m[8] * m[2] * m[5]; + + det = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12]; + + if (det == 0) + return false; + + det = 1.0 / det; + + for (i = 0; i < 16; i++) + invOut[i] = inv[i] * det; + + return true; +} + +void llviewerVR::UpdateHMDMatrixPose() +{ + if (gHMD == NULL) + return; + /// for somebody asking for the default figure out the time from now to photons. + /* float fSecondsSinceLastVsync; + gHMD->GetTimeSinceLastVsync(&fSecondsSinceLastVsync, NULL); + + float fDisplayFrequency = gHMD->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float); + float fFrameDuration = 1.f / fDisplayFrequency; + float fVsyncToPhotons = gHMD->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SecondsFromVsyncToPhotons_Float); + + float fPredictedSecondsFromNow = fFrameDuration - fSecondsSinceLastVsync + fVsyncToPhotons;*/ + + + + + vr::VRCompositor()->WaitGetPoses(gTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, NULL, 0); + + m_iValidPoseCount = 0; + m_strPoseClasses = ""; + for (int nDevice = 0; nDevice < vr::k_unMaxTrackedDeviceCount; ++nDevice) + { + if (gTrackedDevicePose[nDevice].bPoseIsValid) + { + m_iValidPoseCount++; + m_rmat4DevicePose[nDevice] = ConvertSteamVRMatrixToMatrix42(gTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking); + if (m_rDevClassChar[nDevice] == 0) + { + switch (gHMD->GetTrackedDeviceClass(nDevice)) + { + case vr::TrackedDeviceClass_Controller: m_rDevClassChar[nDevice] = 'C'; break; + case vr::TrackedDeviceClass_HMD: m_rDevClassChar[nDevice] = 'H'; break; + case vr::TrackedDeviceClass_Invalid: m_rDevClassChar[nDevice] = 'I'; break; + case vr::TrackedDeviceClass_GenericTracker: m_rDevClassChar[nDevice] = 'G'; break; + case vr::TrackedDeviceClass_TrackingReference: m_rDevClassChar[nDevice] = 'T'; break; + default: m_rDevClassChar[nDevice] = '?'; break; + } + } + m_strPoseClasses += m_rDevClassChar[nDevice]; + } + } + + if (gTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].bPoseIsValid) + { + m_mat4HMDPose = m_rmat4DevicePose[vr::k_unTrackedDeviceIndex_Hmd]; + //gM4HMDPose = ConvertGLHMatrix4ToLLMatrix4(m_mat4HMDPose); + //gM4HMDPose.invert; + //gluInvertMatrix(m_rmat4DevicePose[vr::k_unTrackedDeviceIndex_Hmd].m, m_mat4HMDPose.m); + //m_mat4HMDPose.inverse(); + } +} + +std::string llviewerVR::GetTrackedDeviceString(vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_t unDevice, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *peError ) +{ + uint32_t unRequiredBufferLen = pHmd->GetStringTrackedDeviceProperty(unDevice, prop, NULL, 0, peError); + if (unRequiredBufferLen == 0) + return ""; + + char *pchBuffer = new char[unRequiredBufferLen]; + unRequiredBufferLen = pHmd->GetStringTrackedDeviceProperty(unDevice, prop, pchBuffer, unRequiredBufferLen, peError); + std::string sResult = pchBuffer; + delete[] pchBuffer; + return sResult; +} + +void llviewerVR::SetupCameras() +{ + m_mat4ProjectionLeft = GetHMDMatrixProjectionEye(vr::Eye_Left); + //gM4eyeProjectionLeft = ConvertGLHMatrix4ToLLMatrix4(m_mat4ProjectionLeft); + + m_mat4ProjectionRight = GetHMDMatrixProjectionEye(vr::Eye_Right); + //gM4eyeProjectionRight = ConvertGLHMatrix4ToLLMatrix4(m_mat4ProjectionRight); + + m_mat4eyePosLeft = GetHMDMatrixPoseEye(vr::Eye_Left); + //gM4eyePosLeft = ConvertGLHMatrix4ToLLMatrix4(m_mat4eyePosLeft); + //gM4eyePosLeft.invert(); + + m_mat4eyePosRight = GetHMDMatrixPoseEye(vr::Eye_Right); + //gM4eyePosRight = ConvertGLHMatrix4ToLLMatrix4(m_mat4eyePosRight); + //gM4eyePosRight.invert(); +} + +bool llviewerVR::CreateFrameBuffer(int nWidth, int nHeight, FramebufferDesc &framebufferDesc) +{ + /*glGenFramebuffers(1, &framebufferDesc.m_nRenderFramebufferId); + glBindFramebuffer(GL_FRAMEBUFFER, framebufferDesc.m_nRenderFramebufferId); + + glGenRenderbuffers(1, &framebufferDesc.m_nDepthBufferId); + glBindRenderbuffer(GL_RENDERBUFFER, framebufferDesc.m_nDepthBufferId); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT, nWidth, nHeight); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, framebufferDesc.m_nDepthBufferId); + + glGenTextures(1, &framebufferDesc.m_nRenderTextureId); + glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, framebufferDesc.m_nRenderTextureId); + glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGBA8, nWidth, nHeight, true); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, framebufferDesc.m_nRenderTextureId, 0); + */ + if (framebufferDesc.m_nResolveTextureId) + { + glDeleteTextures(1, &framebufferDesc.m_nResolveTextureId); + //glDeleteFramebuffers(1, &framebufferDesc.mFBO) + } + else + { + glGenFramebuffers(1, &framebufferDesc.mFBO); + + } + glBindFramebuffer(GL_FRAMEBUFFER, framebufferDesc.mFBO); + glGenTextures(1, &framebufferDesc.m_nResolveTextureId); + glBindTexture(GL_TEXTURE_2D, framebufferDesc.m_nResolveTextureId); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebufferDesc.m_nResolveTextureId, 0); + + // check FBO status + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) + { + return false; + } + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + return true; +} + +void llviewerVR::vrStartup(bool is_shutdown) +{ + //static LLCachedControl vrEn(gSavedSettings, "EnableVR"); + //m_bVrEnabled = false;//gPipeline.EnableSteamVR; + + /*hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); + hud_textp->setZCompare(FALSE); + LLColor4 color(1, 1, 1); + hud_textp->setColor(color); + LLVector3 s = LLViewerCamera::getInstance()->getAtAxis(); + + hud_textp->setPositionAgent(gAgent.getPositionAgent() - s); + std::string str("This is the hud test"); + hud_textp->setString(str); + hud_textp->setHidden(FALSE);*/ + + + if (m_bVrEnabled && !is_shutdown) + { + if (gHMD == NULL) + { + gVRInitComplete = FALSE; + vr::EVRInitError eError = vr::VRInitError_None; + gHMD = vr::VR_Init(&eError, vr::VRApplication_Scene); + m_strHudText="Initializing VR driver!"; + //hud_textp->setString(m_strHudText); + + if (eError != vr::VRInitError_None) + { + gHMD = NULL; + char buf[1024]; + sprintf_s(buf, sizeof(buf), "\nERROR Unable to init VR runtime: %s", vr::VR_GetVRInitErrorAsEnglishDescription(eError)); + m_strHudText.append( buf); + //return false; + } + else + { + m_strDriver = "No Driver"; + m_strDisplay = "No Display"; + + m_strDriver = GetTrackedDeviceString(gHMD, vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_TrackingSystemName_String); + m_strDisplay = GetTrackedDeviceString(gHMD, vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SerialNumber_String); + m_strHudText.append("\nDriver = "); + m_strHudText.append(m_strDriver); + m_strHudText.append("\nDisplay = "); + m_strHudText.append(m_strDriver); + m_strHudText.append("\nVR driver! Initialized"); + + } + + eError = vr::VRInitError_None; + if (gHMD != NULL) + gRenderModels = (vr::IVRRenderModels *)vr::VR_GetGenericInterface(vr::IVRRenderModels_Version, &eError); + + if (!gRenderModels) + { + gHMD = NULL; + vr::VR_Shutdown(); + + char buf[1024]; + sprintf_s(buf, sizeof(buf), "\nERROR Unable to get render model interface: %s", vr::VR_GetVRInitErrorAsEnglishDescription(eError)); + m_strHudText.append(buf); + //SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "VR_Init Failed", buf, NULL); + //return false; + } + eError = vr::VRInitError_None; + + if (!vr::VRCompositor()) + { + + char buf[1024]; + sprintf_s(buf, sizeof(buf), "\nERROR No compositor interface: %s", vr::VR_GetVRInitErrorAsEnglishDescription(eError)); + m_strHudText.append(buf); + gHMD = NULL; + vr::VR_Shutdown(); + + } + if (gHMD != NULL && !gVRInitComplete) + { + gVRInitComplete = TRUE; + vr::VRCompositor()->SetTrackingSpace(vr::TrackingUniverseSeated); + gHMD->GetRecommendedRenderTargetSize(&m_nRenderWidth, &m_nRenderHeight); + + //m_nRenderHeight = 1440; + //m_nRenderWidth = 1440; + //if (leftEyeDesc.m_nResolveTextureId == NULL) + CreateFrameBuffer(m_nRenderWidth, m_nRenderHeight, leftEyeDesc); + //if (rightEyeDesc.m_nResolveTextureId == NULL) + CreateFrameBuffer(m_nRenderWidth, m_nRenderHeight, rightEyeDesc); + SetupCameras(); + //vr::VRCompositor()->ForceInterleavedReprojectionOn(true); + //vr::VRCompositor()->SetTrackingSpace(vr::); + //m_tTimer1.start(); + + m_strHudText.append("\nCreating frame buffers."); + + + + + } + if(gVRInitComplete) + m_strHudText.append("\nVR driver ready.\n Press TAB to enter VR mode."); + hud_textp->setString(m_strHudText); + m_strHudText = ""; + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(FALSE); + } + } + else if (gHMD || is_shutdown) + { + m_bVrActive = FALSE; + vr::VR_Shutdown(); + gHMD = NULL; + gVRInitComplete = FALSE; + //m_tTimer1.stop(); + //m_tTimer1.cleanupClass(); + } + +} + +bool llviewerVR::ProcessVRCamera() +{ + + if (hud_textp == NULL) + { + + + hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); + if (hud_textp != NULL) + { + hud_textp->setZCompare(FALSE); + LLColor4 color(1, 1, 1); + hud_textp->setColor(color); + hud_textp->setHidden(FALSE); + hud_textp->setMaxLines(-1); + + m_strHudText.append("Press CTRL+TAB to enable or disable VR mode\n Press TAB to remove this message"); + hud_textp->setString(m_strHudText); + m_strHudText = ""; + } + + } + else + { + m_vdir = LLViewerCamera::getInstance()->getAtAxis(); + m_vpos = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 end = m_vpos + (m_vdir)* 1.0f; + hud_textp->setPositionAgent(end); + } + + + if (gHMD == NULL) + { + return FALSE; + } + if (m_bVrActive)//gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + InitUI(); + //m_fNearClip = LLViewerCamera::getInstance()->getNear(); + //m_fFarClip = LLViewerCamera::getInstance()->getFar(); + LLViewerCamera::getInstance()->setNear(0.001); + + + + if (!leftEyeDesc.IsReady && !rightEyeDesc.IsReady)//Starting rendering with first (left) eye of stereo rendering + { + + + //Set the windows max size and aspect ratio to fit with the HMD. +#ifdef _WIN32 + int scrsize = GetSystemMetrics(SM_CYSCREEN); + if (GetSystemMetrics(SM_CXSCREEN) < scrsize) + scrsize = GetSystemMetrics(SM_CXSCREEN); +#else + int scrsize = 1080; +#endif + LLWindow * WI; + WI = gViewerWindow->getWindow(); + WI->getCursorPosition(&m_MousePos); + + LLCoordWindow m_ScrSize; + LLCoordWindow m_ScrSizeOld; + + WI->getSize(&m_ScrSizeOld); + float mult = (float)m_nRenderWidth / (float)m_nRenderHeight; + if (m_nRenderHeightsetSize(m_ScrSize); + } + //Constrain the cursor to the viewer window. + if (m_MousePos.mX >= m_ScrSize.mX) + m_MousePos.mX = m_ScrSize.mX - 1; + else if (m_MousePos.mX < 1) + m_MousePos.mX = 1; + if (m_MousePos.mY >= m_ScrSize.mY) + m_MousePos.mY = m_ScrSize.mY - 1; + else if (m_MousePos.mY < 1) + m_MousePos.mY = 1; + + m_iHalfWidth = m_ScrSize.mX / 2; + m_iHalfHeight = m_ScrSize.mY / 2; + m_iThirdWidth = m_ScrSize.mX / 3; + m_iThirdHeight = m_ScrSize.mY / 3; + + + //Store current camera values + m_vdir_orig = LLViewerCamera::getInstance()->getAtAxis(); + m_vup_orig = LLViewerCamera::getInstance()->getUpAxis(); + m_vleft_orig = LLViewerCamera::getInstance()->getLeftAxis(); + m_vpos_orig = LLViewerCamera::getInstance()->getOrigin(); + + if (!m_bEditActive)// unlock HMD's rotation input. + { + //convert HMD matrix in to direction vectors that work with SL + glh::ns_float::vec4 row = m_mat4HMDPose.get_row(2); + m_vdir.setVec(row.v[0], -row.v[2], row.v[1]); + + row = m_mat4HMDPose.get_row(1); + m_vup.setVec(row.v[0], -row.v[2], row.v[1]); + + row = m_mat4HMDPose.get_row(0); + m_vleft.setVec(row.v[0], -row.v[2], row.v[1]); + + row = m_mat4HMDPose.get_row(3); + gHmdPos.setVec(row.v[0], -row.v[2], row.v[1]); + + if (gHmdOffsetPos.mV[VZ] == 0) + { + gHmdOffsetPos = gHmdPos; + } + + LLQuaternion qCameraOrig(m_vdir_orig, m_vleft_orig, m_vup_orig); + float r3; + float p3; + float y3; + qCameraOrig.getEulerAngles(&r3, &p3, &y3); + + //convert HMD euler angles to to quat rotation + LLQuaternion qHMDRot(m_vdir, m_vleft, m_vup); + float r1; + float p1; + float y1; + qHMDRot.getEulerAngles(&r1, &p1, &y1); + + //make a quat of the sl camera rotation + LLQuaternion qCameraOffset; + qCameraOffset.setEulerAngles(r3, p3, y3 - (m_fCamRotOffset * DEG_TO_RAD)); + //Offset player camera with the HMD rotation + qHMDRot = qHMDRot*qCameraOffset; + gHMDQuat = qHMDRot; + + + LLMatrix3 m3 = qHMDRot.getMatrix3(); + m_vdir = -m3.getFwdRow(); + m_vup = m3.getUpRow(); + m_vleft = m3.getLeftRow(); + m_vdir.normalize(); + m_vup.normalize(); + m_vleft.normalize(); + + m_vpos = m_vpos_orig + (((gHmdPos - gHmdOffsetPos))* (qCameraOffset)); + } + else //lock HMD's rotation input for inworld object editing purposes. + { + m_vdir = m_vdir_orig; + m_vup = m_vup_orig; + m_vleft = m_vleft_orig; + m_vpos = m_vpos_orig; + } + + + if (m_iMenuIndex) + { + hud_textp->setString(Settings()); + LLVector3 end = m_vpos + m_vdir * 1.0f; + hud_textp->setPositionAgent(end); + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(FALSE); + + + + } + else if (m_bDebugKeyDown) + { + Debug(); + } + else + hud_textp->setHidden(TRUE); + + } + + + LLVector3 new_dir; + if (m_bEditActive)// lock HMD's rotation input for inworls object editing purposes. + { + if (m_fEyeDistance == 0) + LLViewerCamera::getInstance()->lookDir(m_vdir_orig, m_vup_orig); + new_dir = (m_vleft * (m_fEyeDistance / 1000)); + } + else + { + if (m_fEyeDistance == 0) + LLViewerCamera::getInstance()->lookDir(m_vdir, m_vup); + new_dir = (-m_vleft * (m_fEyeDistance / 1000)); + } + + + if (m_fEyeDistance > 0) + { + LLVector3 new_fwd_pos = m_vpos + (m_vdir * m_fFocusDistance); + + if (!leftEyeDesc.IsReady)//change pos for rendering the left eye texture.Move half IPD distance to the left + { + LLViewerCamera::getInstance()->updateCameraLocation(m_vpos + new_dir, m_vup, new_fwd_pos); + } + else if (!rightEyeDesc.IsReady)//change pos for rendering the right eye texture. Move full IPD distance to the right since we were on the left eye position. + { + LLViewerCamera::getInstance()->updateCameraLocation(m_vpos - new_dir, m_vup, new_fwd_pos); + } + } + + + + } + return TRUE; +} + +void llviewerVR::vrDisplay() +{ + if (gHMD != NULL) + { + if (m_bVrActive)//gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + + + if (!leftEyeDesc.IsReady) + { + bx = 0; + by = 0; + tx = gPipeline.mScreen.getWidth(); + ty = gPipeline.mScreen.getHeight(); + + m_iTextureShift = ((tx / 2) / 100)* m_fTextureShift; + + S32 halfx = tx / 2; + S32 halfy = ty / 2; + S32 div8x = tx / 6; + S32 div8y = ty / 6; + + S32 thirdx = tx / 3; + S32 thirdy = ty / 3; + + + if (m_MousePos.mX > tx - div8x && m_MousePos.mY < div8y)//up right + { + m_iZoomIndex = 4; + } + else if (m_MousePos.mX > tx - div8x && m_MousePos.mY > ty - div8y)//down right + { + m_iZoomIndex = 5; + } + else if (m_MousePos.mX < div8x && m_MousePos.mY > ty - div8y)//down left + { + m_iZoomIndex = 6; + } + else if (m_MousePos.mX < div8x && m_MousePos.mY < div8y)//up left + { + m_iZoomIndex = 7; + } + else if (m_MousePos.mX > tx - div8x && m_MousePos.mY > halfy - div8y && m_MousePos.mY < halfy + div8y)//right + { + m_iZoomIndex = 10; + } + else if (m_MousePos.mY > ty - div8y && m_MousePos.mX > halfx - div8x && m_MousePos.mX < halfx + div8x)//down + { + m_iZoomIndex = 9; + } + else if (m_MousePos.mY < div8y && m_MousePos.mX > halfx - div8x && m_MousePos.mX < halfx + div8x)//up + { + m_iZoomIndex = 8; + } + else if (m_MousePos.mX < div8x && m_MousePos.mY > halfy - div8y && m_MousePos.mY < halfy + div8y)//left + { + m_iZoomIndex = 11; + } + else if (m_MousePos.mX > halfx - div8x && m_MousePos.mX < halfx + div8x && m_MousePos.mY > halfy - div8y && m_MousePos.mY < halfy + div8y)//center + { + m_iZoomIndex = 0; + } + + ///Zoom in + if (m_iZoomIndex == 0) + { + bx += m_fTextureZoom; + by += m_fTextureZoom; + tx -= m_fTextureZoom; + ty -= m_fTextureZoom; + } + else if (m_iZoomIndex == 4)//up right + { + bx += thirdx; + by += thirdy; + tx += thirdx; + ty += thirdy; + } + else if (m_iZoomIndex == 5)//down right + { + bx += thirdx; + by -= thirdy; + tx += thirdx; + ty -= thirdy; + } + else if (m_iZoomIndex == 6)//down left + { + bx -= thirdx; + by -= thirdy; + tx -= thirdx; + ty -= thirdy; + } + else if (m_iZoomIndex == 7)//up left + { + bx -= thirdx; + by += thirdy; + tx -= thirdx; + ty += thirdy; + } + else if (m_iZoomIndex == 8)//up + { + by += thirdy; + ty += thirdy; + } + else if (m_iZoomIndex == 9)//down + { + by -= thirdy; + ty -= thirdy; + } + else if (m_iZoomIndex == 11)//left + { + bx -= thirdx; + tx -= thirdx; + } + else if (m_iZoomIndex == 10)//right + { + bx += thirdx; + tx += thirdx; + } + } + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glReadBuffer(GL_BACK); + + //if left camera was active bind left eye buffer for drawing in to + if (!leftEyeDesc.IsReady) + { + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, leftEyeDesc.mFBO); + if (m_iZoomIndex) + glClear(GL_COLOR_BUFFER_BIT); + //leftEyeDesc.IsReady = TRUE; + + glBlitFramebuffer(bx, by, tx, ty, m_iTextureShift, 0, m_nRenderWidth + m_iTextureShift, m_nRenderHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); + + } + if ((leftEyeDesc.IsReady && !rightEyeDesc.IsReady) || m_fEyeDistance == 0)//if right camera was active bind left eye buffer for drawing in to + { + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, rightEyeDesc.mFBO); + if (m_iZoomIndex) + glClear(GL_COLOR_BUFFER_BIT); + rightEyeDesc.IsReady = TRUE; + glBlitFramebuffer(bx, by, tx, ty, -m_iTextureShift, 0, m_nRenderWidth - m_iTextureShift, m_nRenderHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); + } + if (!leftEyeDesc.IsReady) + leftEyeDesc.IsReady = TRUE; + + //Remove bindings of read and draw buffer + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + if (leftEyeDesc.IsReady && (rightEyeDesc.IsReady || m_fEyeDistance == 0)) + { + + rightEyeDesc.IsReady = FALSE; + leftEyeDesc.IsReady = FALSE; + //glFlush(); + + //vr::VRCompositor()->CompositorBringToFront(); could help with no image issues + + + //Update HMD . !!!!! This calls waitGetPoses() which is essential to start the rendering process in the HMD after Submit and gets the current HMD pose(rotation location matrix) + //if you do not call that anywhere no image will be processed. + + + //submit the textures to the HMD + lEyeTexture = { (void*)(uintptr_t)leftEyeDesc.m_nResolveTextureId, vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; + eError = vr::VRCompositor()->Submit(vr::Eye_Left, &lEyeTexture, 0, (vr::EVRSubmitFlags)(vr::Submit_Default )); + + rEyeTexture = { (void*)(uintptr_t)rightEyeDesc.m_nResolveTextureId, vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; + eError = vr::VRCompositor()->Submit(vr::Eye_Right, &rEyeTexture, 0, (vr::EVRSubmitFlags)(vr::Submit_Default)); + + //vr::VRCompositor()->PostPresentHandoff();// Here we tell the HMD that rendering is done and it can render the image in to the HMD + //glFinish(); + + gViewerWindow->getWindow()->swapBuffers(); + + + //glFlush(); + + + + UpdateHMDMatrixPose(); + // + + } + + } + + + + + + } + //else if (vrEnabled) + //{ + //vrStartup(); + //} + +} + +void llviewerVR::ProcessVREvent(const vr::VREvent_t & event)//process vr´events +{ + switch (event.eventType) + { + case vr::VREvent_TrackedDeviceActivated: + { + //SetupRenderModelForTrackedDevice(event.trackedDeviceIndex); + //dprintf("Device %u attached. Setting up render model.\n", event.trackedDeviceIndex); + } + break; + case vr::VREvent_TrackedDeviceDeactivated: + { + //dprintf("Device %u detached.\n", event.trackedDeviceIndex); + } + break; + case vr::VREvent_TrackedDeviceUpdated: + { + //dprintf("Device %u updated.\n", event.trackedDeviceIndex); + } + case vr::VREvent_Quit: + { + m_bVrActive = FALSE; + m_bVrEnabled = FALSE; + gHMD = NULL; + vr::VR_Shutdown(); + vr::VRSystem()->AcknowledgeQuit_Exiting(); + } + break; + } +} + +void llviewerVR::agentYaw(F32 yaw_inc) // move avatar forward backward and rotate +{ + // Cannot steer some vehicles in mouselook if the script grabs the controls + if (gAgentCamera.cameraMouselook() && gSavedSettings.getBOOL("JoystickMouselookYaw")) + { + gAgent.rotate(-yaw_inc, gAgent.getReferenceUpVector()); + + } + else + { + if (yaw_inc < 0) + { + gAgent.setControlFlags(AGENT_CONTROL_YAW_POS); + } + else if (yaw_inc > 0) + { + gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG); + } + + gAgent.yaw(-yaw_inc); + } +} + +bool llviewerVR::HandleInput()// handles controller input for now only the stick. +{ + + if (gHMD == NULL || !m_bVrActive) + return FALSE; + bool bRet = false; + + // Process SteamVR events + vr::VREvent_t event; + while (gHMD->PollNextEvent(&event, sizeof(event))) + { + ProcessVREvent(event); + } + + // Process SteamVR controller state + /*for (vr::TrackedDeviceIndex_t unDevice = 0; unDevice < vr::k_unMaxTrackedDeviceCount; unDevice++) + { + vr::VRControllerState_t state; + if (gHMD->GetControllerState(unDevice, &state, sizeof(state))) + { + m_rbShowTrackedDevice[unDevice] = state.ulButtonPressed == 0; + if (state.unPacketNum != gPacketNum) + { + gPacketNum = state.unPacketNum; + //add intensity slider here. + if (fabs(state.rAxis[2].x) > 0.3)// +x rechts +y fwd + agentYaw(state.rAxis[2].x / 20); + if (state.rAxis[2].y > 0.5)// +x rechts +y fwd + gAgent.moveAt(1, false); + else if (state.rAxis[2].y < -0.5)// +x rechts +y fwd + gAgent.moveAt(-1, false); + gButton = state.ulButtonPressed; + + + + LLWindow * WI; + WI = gViewerWindow->getWindow(); + MASK mask = gKeyboard->currentMask(TRUE); + //S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWindowHeightScaled(); + S32 height = gViewerWindow->getWorldViewHeightScaled(); + LLCoordWindow size; + size.mX = gCtrlscreen[unDevice].mX; + //size.mY = gCtrlscreen[unDevice].mY; + size.mY = height - gCtrlscreen[unDevice].mY; + //gCtrlscreen[unDevice].mY = height - gCtrlscreen[unDevice].mY; + + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip)) && !gRightClick[unDevice]) + { + + gRightClick[unDevice] = TRUE; + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + + WI->setCursorPosition(size); + } + + //LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr(mAppWindowHandle, GWLP_USERDATA); + + gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unDevice], mask, LLMouseHandler::CLICK_RIGHT, TRUE); + + + INPUT Inputs[1] { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN; + //SendInput(1, Inputs, sizeof(INPUT)); + } + else if (gRightClick[unDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip))) + { + gRightClick[unDevice] = FALSE; + + gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unDevice], mask, LLMouseHandler::CLICK_RIGHT, FALSE); + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTUP; + //SendInput(1, Inputs, sizeof(INPUT)); + + + } + + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger)) && !gLeftClick[unDevice]) + { + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + gLeftClick[unDevice] = TRUE; + //LLWindow * WI; + //WI = gViewerWindow->getWindow(); + //S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWorldViewHeightScaled(); + //LLCoordWindow size; + //size.mX = gCtrlscreen[0].mX; + //size.mY = height - gCtrlscreen[0].mY; + WI->setCursorPosition(size); + } + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; + SendInput(1, Inputs, sizeof(INPUT)); + } + else if (gLeftClick[unDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger))) + { + gLeftClick[unDevice] = FALSE; + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTUP; + SendInput(1, Inputs, sizeof(INPUT)); + } + + } + + } + + }*/ + + return bRet; +} + +void llviewerVR::HandleKeyboard() +{ + // Don't attempt to update controllers if input is not available + //gCtrlNum = 0; + + if (gKeyboard->getKeyDown(KEY_TAB) && !m_bVrKeyDown) + { + + m_bVrKeyDown = TRUE; + + + } + else if (!gKeyboard->getKeyDown(KEY_TAB) && m_bVrKeyDown) + { + m_bVrKeyDown = FALSE; + + if (gKeyboard->getKeyDown(KEY_CONTROL)) + { + if (!m_bVrEnabled) + { + m_bVrEnabled = TRUE; + vrStartup(FALSE); + } + else + { + m_bVrActive = FALSE; + m_bVrEnabled = FALSE; + vrStartup(FALSE); + } + + } + else if (gHMD) + { + if (!m_bVrActive) + m_bVrActive = TRUE; + else + m_bVrActive = FALSE; + //LLViewerCamera::getInstance()->setDefaultFOV(1.8); + gHmdOffsetPos.mV[2] = 0; + INISaveRead(false); + if (m_fFOV > 20) + LLViewerCamera::getInstance()->setDefaultFOV(m_fFOV * DEG_TO_RAD); + + /*LLCoordWindow cpos; + cpos.mX = m_nRenderWidth / 2; + cpos.mY = m_nRenderHeight / 2; + LLWindow * WI; + WI = gViewerWindow->getWindow(); + //WI->setCursorPosition(cpos); + + INPUT Inputs[1] ; + Inputs[0].mi.dx = m_nRenderWidth / 2; + Inputs[0].mi.dy = m_nRenderHeight / 2; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_MOVE; + + SendInput(1, Inputs, sizeof(INPUT));*/ + + } + else + { + m_strHudText = ""; + hud_textp->setString(m_strHudText); + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(TRUE); + } + + } + + if (gHMD == NULL) + return; + if (gKeyboard->getKeyDown(m_kEditKey) && !m_bEditKeyDown) + { + m_bEditKeyDown = TRUE; + //m_iClockCount2 = m_tTimer1.getCurrentClockCount(); + } + else if (!gKeyboard->getKeyDown(m_kEditKey) && m_bEditKeyDown) + { + m_bEditKeyDown = FALSE; + //m_iClockCount = m_tTimer1.getCurrentClockCount() - m_iClockCount2; + /*if (m_iClockCount > 5000000) + { + m_iZoomIndex++; + if (m_iZoomIndex > 5) + m_iZoomIndex = 0; + } + else*/ + if (!m_bEditActive) + m_bEditActive = TRUE; + else + m_bEditActive = FALSE; + } + + if (gKeyboard->getKeyDown(m_kDebugKey) && !m_bDebugKeyDown) + { + m_bDebugKeyDown = TRUE; + } + else if (!gKeyboard->getKeyDown(m_kDebugKey) && m_bDebugKeyDown) + { + m_bDebugKeyDown = FALSE; + //m_iZoomIndex++; + if (m_iZoomIndex > 7) + m_iZoomIndex = 0; + } + + if (gKeyboard->getKeyDown(m_kMenuKey) && !m_bMenuKeyDown) + { + m_bMenuKeyDown = TRUE; + } + else if (!gKeyboard->getKeyDown(m_kMenuKey) && m_bMenuKeyDown) + { + m_bMenuKeyDown = FALSE; + if (m_iMenuIndex == 5) + INISaveRead(true); + + m_iMenuIndex++; + if (m_iMenuIndex > 5) + m_iMenuIndex = 0; + } +} + +void llviewerVR::DrawCursors() +{ + if (!m_bVrActive) + return; + gUIProgram.bind(); + //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + //gViewerWindow->setup2DRender(); + gGL.pushMatrix(); + S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); + S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); + + S32 wwidth = gViewerWindow->getWindowWidthScaled(); + S32 wheight = gViewerWindow->getWindowHeightScaled(); + + //translatef moves 0 vector to the pos you specified so oyu can draw fron zero vector there + gGL.translatef((F32)half_width, (F32)half_height, 0.f); + gGL.color4fv(LLColor4::white.mV); + //glClear(GL_DEPTH_BUFFER_BIT); + //glDisable(GL_DEPTH_TEST); + LLWindow * WI; + WI = gViewerWindow->getWindow(); + LLCoordWindow mcpos; + WI->getCursorPosition(&mcpos); + LLCoordGL mpos = gViewerWindow->getCurrentMouse(); + + for (vr::TrackedDeviceIndex_t unTrackedDevice = vr::k_unTrackedDeviceIndex_Hmd + 1; unTrackedDevice < vr::k_unMaxTrackedDeviceCount; ++unTrackedDevice) + { + if (gCtrlscreen[unTrackedDevice].mX > -1) + { + + gl_circle_2d(gCtrlscreen[unTrackedDevice].mX - half_width, gCtrlscreen[unTrackedDevice].mY - half_height + gCursorDiff, half_width / 200, 8, TRUE); + } + + } + + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + LLColor4 cl; + cl = LLColor4::black.mV; + + S32 mx = mpos.mX - half_width; + S32 my = mpos.mY - (half_height); + if (mpos.mX < 0 || mpos.mX > wwidth) + mx = half_width; + if (mpos.mY < 0 || mpos.mY > wheight) + my = half_height; + + gl_triangle_2d(mx, my, mx + 8, my - 15, mx + 15, my - 8, cl, TRUE); + cl = LLColor4::white.mV; + gl_triangle_2d(mx+2, my-2, mx + 9, my - 13, mx + 12, my - 8, cl, TRUE); + } + + //gl_circle_2d(mpos.mX - half_width, mpos.mY - (half_height) /*+ gVR.gCursorDiff)*/, half_width / 200, 8, TRUE); + + //glEnable(GL_DEPTH_TEST); + gGL.popMatrix(); + gUIProgram.unbind(); + stop_glerror(); +} + +void llviewerVR::RenderControllerAxes() +{ + // Don't attempt to update controllers if input is not available + //gCtrlNum = 0; + + HandleKeyboard(); + + if (gHMD == NULL) + return; + HandleInput(); + if (!gHMD->IsInputAvailable() || !m_bVrActive) + return; + + //std::vector vertdataarray; + //m_uiControllerVertcount = 0; + //m_iTrackedControllerCount = 0; + + + for (vr::TrackedDeviceIndex_t unTrackedDevice = vr::k_unTrackedDeviceIndex_Hmd + 1; unTrackedDevice < vr::k_unMaxTrackedDeviceCount; ++unTrackedDevice) + { + gCtrlscreen[unTrackedDevice].set(-1, -1); + if (!gHMD->IsTrackedDeviceConnected(unTrackedDevice)) + continue; + + if (gHMD->GetTrackedDeviceClass(unTrackedDevice) != vr::TrackedDeviceClass_Controller) + continue; + + m_iTrackedControllerCount += 1; + + if (!gTrackedDevicePose[unTrackedDevice].bPoseIsValid) + continue; + + //Count the controllers + + glh::matrix4f mat = m_rmat4DevicePose[unTrackedDevice]; + + //glh::vec4f center; + //mat.mult_matrix_vec(glh::vec4f(0, 0, 0, 1),center) ; + + LLVector3 pos = m_vpos; // LLViewerCamera::getInstance()->getOrigin(); + LLVector3 dir; + LLVector3 up; + LLVector3 left; + + glh::ns_float::vec4 row = mat.get_row(2); + dir.setVec(row.v[0], -row.v[2], row.v[1]); + + row = mat.get_row(1); + up.setVec(row.v[0], -row.v[2], row.v[1]); + + row = mat.get_row(0); + left.setVec(row.v[0], -row.v[2], row.v[1]); + + row = mat.get_row(3); + gCtrlOrigin[unTrackedDevice].setVec(row.v[0], -row.v[2], row.v[1]); + + LLQuaternion q1(dir, left, up); + + //get modified camera rot in euler angles + float r2; + float p2; + float y2; + q1.getEulerAngles(&r2, &p2, &y2); + + LLQuaternion qCameraOrig(m_vdir_orig, m_vleft_orig, m_vup_orig); + float r3; + float p3; + float y3; + qCameraOrig.getEulerAngles(&r3, &p3, &y3); + + + //make a quat of yaw rot of the HMD camera + //LLQuaternion q2; + //q2.setEulerAngles(0, p2, y2 + (m_fCamRotOffset * DEG_TO_RAD)); + LLQuaternion q3; + q3.setEulerAngles(0, 0, y3 - (m_fCamRotOffset * DEG_TO_RAD)); + + //change the controller rotation according to the HMD facing direction + q1 = (q1)*q3; + + //grab the forward vector from the quat matrix + LLMatrix3 m3 = q1.getMatrix3(); + dir = m3.getFwdRow(); + + //up = m3.getUpRow(); + //left = m3.getLeftRow(); + dir.normalize(); + //up.normalize(); + //left.normalize(); + //get position of the controller + gCtrlOrigin[unTrackedDevice] -= gHmdPos; + gCtrlOrigin[unTrackedDevice] = m_vpos + gCtrlOrigin[unTrackedDevice] * q3; + //project 10 meter line in the direction the controller is facing + gCtrlPos[unTrackedDevice] = gCtrlOrigin[unTrackedDevice] - (dir * 10.0f); + + //translate the fwd vector line to screen coords + posToScreen(gCtrlPos[unTrackedDevice], gCtrlscreen[unTrackedDevice], FALSE); + + //adjust the pos so it fits with the actual mouse cursor pos + S32 height = gViewerWindow->getWorldViewHeightScaled(); + gCursorDiff= gViewerWindow->getWindowHeightScaled(); + gCursorDiff = gCursorDiff - height; + gCtrlscreen[unTrackedDevice].mY -= gCursorDiff; + + + + + + //draw the controller lines in world ( make tham nicer ;>) + LLGLSUIDefault gls_ui; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLVector3 v = gCurrentCameraPos; + // Some coordinate axes + glClear(GL_DEPTH_BUFFER_BIT); + glDisable(GL_DEPTH_TEST); + gGL.pushMatrix(); + gGL.translatef(v.mV[VX], v.mV[VY], v.mV[VZ]); + gGL.begin(LLRender::LINES); + gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red + gGL.vertex3f(gCtrlOrigin[unTrackedDevice].mV[VX], gCtrlOrigin[unTrackedDevice].mV[VY], gCtrlOrigin[unTrackedDevice].mV[VZ]); + gGL.vertex3f(gCtrlPos[unTrackedDevice].mV[VX], gCtrlPos[unTrackedDevice].mV[VY], gCtrlPos[unTrackedDevice].mV[VZ]); + gGL.end(); + gGL.popMatrix(); + glEnable(GL_DEPTH_TEST); + + //EVRControllerAxisType + //read the input from the available controllers + vr::VRControllerState_t state; + if (gHMD->GetControllerState(unTrackedDevice, &state, sizeof(state))) + { + m_rbShowTrackedDevice[unTrackedDevice] = state.ulButtonPressed == 0; + if (1)// state.unPacketNum != gPacketNum) + { + //if(LLFloaterCamera::inFreeCameraMode()) + gPacketNum = state.unPacketNum; + //Get the joystick hat state of the controller and move the avatar.. (Figure out how to map it tpo vive and oculus) + //add movement intensity slider here. + if (fabs(state.rAxis[2].x) > 0.5 && gHMD->GetControllerRoleForTrackedDeviceIndex(unTrackedDevice))// +x rechts +y fwd + { + if (LLFloaterCamera::inFreeCameraMode()) + { + m_fCamRotOffset += 0.5; + if (m_fCamRotOffset > 360) + m_fCamRotOffset = 0; + + } + else + { + m_fCamRotOffset = 90; + agentYaw(state.rAxis[2].x / 40); + + } + + } + else if (state.rAxis[2].y > 0.5)// +y forward + { + if (LLFloaterCamera::inFreeCameraMode()) + { + + m_fCamPosOffset += 0.2; + } + else + { + gAgent.moveAt(1, false); + m_fCamPosOffset = 0; + } + + } + + else if (state.rAxis[2].y < -0.5)// -y back + { + if (LLFloaterCamera::inFreeCameraMode()) + { + + m_fCamPosOffset -= 0.2; + } + else + { + gAgent.moveAt(-1, false); + m_fCamPosOffset = 0; + } + + } + + + + gButton = state.ulButtonPressed; + LLWindow * WI; + WI = gViewerWindow->getWindow(); + //MASK mask = gKeyboard->currentMask(TRUE); + + + S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWindowHeightScaled(); + S32 height = gViewerWindow->getWorldViewHeightScaled(); + LLCoordWindow cpos; + cpos.mX = gCtrlscreen[unTrackedDevice].mX; + //size.mY = gCtrlscreen[unDevice].mY; + cpos.mY = height - gCtrlscreen[unTrackedDevice].mY; + //gCtrlscreen[unDevice].mY = height - gCtrlscreen[unDevice].mY; + + //LLCoordWindow * mcpos; + //WI->getCursorPosition(mcpos); + + //Emulate mouse clicks with the controllers trigger and grip buttons + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip)) && !gRightClick[unTrackedDevice]) + { + + gRightClick[unTrackedDevice] = TRUE; + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + + WI->setCursorPosition(cpos); + } + + //LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr(mAppWindowHandle, GWLP_USERDATA); + + //gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unTrackedDevice], mask, LLMouseHandler::CLICK_RIGHT, TRUE); + + +#ifdef _WIN32 + INPUT Inputs[1] { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + else if (gRightClick[unTrackedDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip))) + { + gRightClick[unTrackedDevice] = FALSE; + + //gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unTrackedDevice], mask, LLMouseHandler::CLICK_RIGHT, FALSE); +#ifdef _WIN32 + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTUP; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger)) && !gLeftClick[unTrackedDevice]) + { + gLeftClick[unTrackedDevice] = TRUE; + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + + //LLWindow * WI; + //WI = gViewerWindow->getWindow(); + //S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWorldViewHeightScaled(); + //LLCoordWindow size; + //size.mX = gCtrlscreen[0].mX; + //size.mY = height - gCtrlscreen[0].mY; + WI->setCursorPosition(cpos); + } +#ifdef _WIN32 + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + else if (gLeftClick[unTrackedDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger))) + { + gLeftClick[unTrackedDevice] = FALSE; +#ifdef _WIN32 + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTUP; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + + if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK && gLeftClick[unTrackedDevice] && cpos.mX>-1 && cpos.mX < width && cpos.mY >-1 && cpos.mY < height) + { + + WI->setCursorPosition(cpos); + } + + } + + } + } + +} + +BOOL llviewerVR::posToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const +{ + //BOOL in_front = TRUE; + GLdouble x, y, z; // object's window coords, GL-style + + /*LLVector3 dir_to_point = pos_agent - LLViewerCamera::getInstance()->getOrigin(); + dir_to_point /= dir_to_point.magVec(); + + if (dir_to_point * LLCoordFrame::getAtAxis() < 0.f) + { + if (clamp) + { + return FALSE; + } + else + { + in_front = FALSE; + } + } + */ + LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); + + //LLRect world_view_rect = gViewerWindow->handleAnyMouseClick; + + S32 viewport[4]; + viewport[0] = world_view_rect.mLeft; + viewport[1] = world_view_rect.mBottom; + viewport[2] = world_view_rect.getWidth(); + viewport[3] = world_view_rect.getHeight(); + + F64 mdlv[16]; + F64 proj[16]; + + for (U32 i = 0; i < 16; i++) + { + mdlv[i] = (F64)gGLModelView[i]; + proj[i] = (F64)gGLProjection[i]; + } + + if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ], + mdlv, proj, (GLint*)viewport, + &x, &y, &z)) + { + // convert screen coordinates to virtual UI coordinates + x /= gViewerWindow->getDisplayScale().mV[VX]; + y /= gViewerWindow->getDisplayScale().mV[VY]; + + // should now have the x,y coords of grab_point in screen space + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); + + // convert to pixel coordinates + S32 int_x = lltrunc(x); + S32 int_y = lltrunc(y); + + out_point.mX = int_x; + out_point.mY = int_y; + + BOOL valid = TRUE; + return valid; + /* + if (clamp) + { + if (int_x < world_rect.mLeft) + { + out_point.mX = world_rect.mLeft; + valid = FALSE; + } + else if (int_x > world_rect.mRight) + { + out_point.mX = world_rect.mRight; + valid = FALSE; + } + else + { + out_point.mX = int_x; + } + + if (int_y < world_rect.mBottom) + { + out_point.mY = world_rect.mBottom; + valid = FALSE; + } + else if (int_y > world_rect.mTop) + { + out_point.mY = world_rect.mTop; + valid = FALSE; + } + else + { + out_point.mY = int_y; + } + return valid; + } + else + { + out_point.mX = int_x; + out_point.mY = int_y; + + if (int_x < world_rect.mLeft) + { + valid = FALSE; + } + else if (int_x > world_rect.mRight) + { + valid = FALSE; + } + if (int_y < world_rect.mBottom) + { + valid = FALSE; + } + else if (int_y > world_rect.mTop) + { + valid = FALSE; + } + + return in_front && valid; + }*/ + } + else + { + return FALSE; + } +} + +void llviewerVR::buttonCallbackLeft() +{ + if (m_pCamStack) + { + + m_fCamRotOffset -= 5; + if (m_fCamRotOffset > 360) + m_fCamRotOffset = 0; + + } +} + +void llviewerVR::buttonCallbackRight() +{ + if (m_pCamStack) + { + m_fCamRotOffset += 5; + if (m_fCamRotOffset > 360) + m_fCamRotOffset = 0; + + LLRect rc; + rc.setCenterAndSize(80, 80, 160, 80); + m_pCamStack->setRect(rc); + if (m_pCamera_floater) + { + rc = m_pCamera_floater->getRect(); + rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), 200, 120); + //m_pCamera_floater->setRect(rc); + m_pCamera_floater->handleReshape(rc, TRUE); + } + + + } +} + +std::string llviewerVR::Settings() +{ + std::string str; + std::wstring wstr; + std::string sep1 = "\n\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88 "; + std::string sep2 = " \xe2\x96\x88\xe2\x96\x88\xe2\x96\x88"; + + + //str = INISaveRead(false); + //str.append("\n"); + if (m_iMenuIndex == 1) + { + m_fEyeDistance=Modify(m_fEyeDistance, 1.0, 0, 200); + str.append(sep1); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append(sep2); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append("\nTexture Shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + str.append("\n \nDistance between left and right camera.\nUsually the same as the IPD of your HMD.\nIf objects appear too small or too big try other values. "); + } + else if (m_iMenuIndex == 2) + { + m_fFocusDistance=Modify(m_fFocusDistance, 0.25, 0.5, 10); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append(sep1); + str.append("Focus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append(sep2); + str.append("\nTexture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + + str.append("\n \nFocus distance of the cameras in meters"); + } + else if (m_iMenuIndex == 3) + { + m_fTextureShift = Modify(m_fTextureShift, 0.5, -100, 100); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append(sep1); + str.append("Texture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append(sep2); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + str.append("\n \nApplies a texture shift in case your HMD's focus point is not in the center of the texture."); + } + else if (m_iMenuIndex == 4) + { + m_fTextureZoom = Modify(m_fTextureZoom, 1, -200, 200); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append("\nTexture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append(sep1); + str.append("Texture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append(sep2); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + str.append("\n \nZooms the view in or out. It may help with wide FOV HMD's like Pimax.\n Zoom in reduces quality. Zoom out increases quality\nWhen this value is changed FOV must also be adjusted."); + } + else if (m_iMenuIndex == 5) + { + m_fFOV = Modify(m_fFOV, 0.5, 50, 175); + LLViewerCamera::getInstance()->setDefaultFOV(m_fFOV * DEG_TO_RAD); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append("\nTexture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append(sep1); + str.append("FOV = "); + str.append(std::to_string(m_fFOV)); + str.append(sep2); + str.append("\n \nField of view in degree adjustment. Usually 100 degree is good.\n It should be adjusted when texture zoom is changed."); + } + return str; +} + +F32 llviewerVR::Modify(F32 val, F32 step, F32 min, F32 max) +{ + if (gKeyboard->getKeyDown(m_kPlusKey) && (!m_bPlusKeyDown || gKeyboard->getKeyElapsedTime(m_kPlusKey) >1)) + { + m_bPlusKeyDown = TRUE; + val += step; + if (val > max) + val = max; + return val; + } + else if (!gKeyboard->getKeyDown(m_kPlusKey) && m_bPlusKeyDown) + { + m_bPlusKeyDown = FALSE; + /*val += step; + if (val > max) + val = max; + return val;*/ + + } + if (gKeyboard->getKeyDown(m_kMinusKey) && !m_bMinusKeyDown) + { + m_bMinusKeyDown = TRUE; + } + else if (!gKeyboard->getKeyDown(m_kMinusKey) && m_bMinusKeyDown) + { + m_bMinusKeyDown = FALSE; + val -= step; + if (val < min) + val = min; + return val; + } + return val; +} + +std::string llviewerVR::INISaveRead(bool save) +{ + std::string path = getenv("APPDATA"); + path.append("\\Firestorm_x64\\vrconfig.ini"); + std::string ret; + ret.append(path); + ret.append("\n"); + std::string line; + std::fstream file; + if (!save) + { + file.open(path, std::ios_base::in); + + if (file.is_open()) + { + while (getline(file, line, ',')) + { + if (line == "EyeDistance") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fEyeDistance = std::stof(line); + } + else if (line == "FocusDistance") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fFocusDistance = std::stof(line); + } + else if (line == "TextureShift") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fTextureShift = std::stof(line); + } + else if (line == "TextureZoom") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fTextureZoom = std::stof(line); + } + else if (line == "FieldOfView") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fFOV = std::stof(line); + } + + } + file.close(); + } + else + ret.append("\n file not open!!!\n"); + } + else + { + file.open(path, std::ios_base::out); + std::string s; + s.append("EyeDistance"); + s.append(","); + s.append(std::to_string(m_fEyeDistance)); + s.append(","); + + s.append("FocusDistance"); + s.append(","); + s.append(std::to_string(m_fFocusDistance)); + s.append(","); + + s.append("TextureShift"); + s.append(","); + s.append(std::to_string(m_fTextureShift)); + s.append(","); + + s.append("TextureZoom"); + s.append(","); + s.append(std::to_string(m_fTextureZoom)); + s.append(","); + + s.append("FieldOfView"); + s.append(","); + s.append(std::to_string(m_fFOV)); + + if (file.is_open()) + { + file << s.c_str(); + file.close(); + } + + } + return ret; + +} + +void llviewerVR::Debug() +{ + LLWindow * WI; + WI = gViewerWindow->getWindow(); + LLCoordWindow mpos; + WI->getCursorPosition(&mpos); + LLCoordGL mcpos = gViewerWindow->getCurrentMouse(); + LLVector3 voffset = gHmdPos - gHmdOffsetPos; + std::string str; + str.append(" Cam Pos \n< "); + str.append(std::to_string(m_vpos.mV[VX])); + str.append(" , "); + str.append(std::to_string(m_vpos.mV[VY])); + str.append(" , "); + str.append(std::to_string(m_vpos.mV[VZ])); + str.append(" > "); + str.append("\n HMD Pos offset - hmd \n< "); + str.append(std::to_string(voffset.mV[VX])); + str.append(" , "); + str.append(std::to_string(voffset.mV[VY])); + str.append(" , "); + str.append(std::to_string(voffset.mV[VZ])); + str.append(" > "); + str.append("\n HMD Pos offset \n< "); + str.append(std::to_string(gHmdOffsetPos.mV[VX])); + str.append(" , "); + str.append(std::to_string(gHmdOffsetPos.mV[VY])); + str.append(" , "); + str.append(std::to_string(gHmdOffsetPos.mV[VZ])); + str.append(" > "); + str.append("\n HMD Pos \n< "); + str.append(std::to_string(gHmdPos.mV[VX])); + str.append(" , "); + str.append(std::to_string(gHmdPos.mV[VY])); + str.append(" , "); + str.append(std::to_string(gHmdPos.mV[VZ])); + str.append(" > "); + /* + str.append("\nPointe Pos\n< "); + str.append(std::to_string(gCtrlPos[0].mV[VX])); + str.append(" , "); + str.append(std::to_string(gCtrlPos[0].mV[VY])); + str.append(" , "); + str.append(std::to_string(gCtrlPos[0].mV[VZ])); + str.append(" > "); + + str.append("\nPoint Origin\n< "); + str.append(std::to_string(gCtrlOrigin[0].mV[VX])); + str.append(" , "); + str.append(std::to_string(gCtrlOrigin[0].mV[VY])); + str.append(" , "); + str.append(std::to_string(gCtrlOrigin[0].mV[VZ])); + str.append(" > ");*/ + + str.append("\n Zoom Index"); + str.append(std::to_string(m_iZoomIndex)); + + str.append("\n MCoord X="); + str.append(std::to_string(mpos.mX)); + str.append(" Y="); + str.append(std::to_string(mpos.mY)); + + str.append("\n MCoord X="); + str.append(std::to_string(mcpos.mX)); + str.append(" Y="); + str.append(std::to_string(mcpos.mY)); + str.append("\n Mview X="); + str.append(std::to_string(m_MousePos.mX)); + str.append(" Y="); + str.append(std::to_string(m_MousePos.mY)); + + str.append("\n Coord1 X="); + str.append(std::to_string(gCtrlscreen[1].mX)); + str.append(" Y="); + str.append(std::to_string(gCtrlscreen[1].mY)); + str.append("\n Rheight="); + str.append(std::to_string(m_nRenderHeight)); + str.append("\n Rwidth="); + str.append(std::to_string(m_nRenderWidth)); + str.append("\n Button="); + str.append(std::to_string(gButton)); + + str.append("\n Cam Rot Offset in DEG ="); + str.append(std::to_string(m_fCamRotOffset)); + + str.append("\nL+R Camera Distance in mm\n"); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nCurrent FOV \n"); + str.append(std::to_string(LLViewerCamera::getInstance()->getDefaultFOV())); + //str.append("\n LastGL ERR="); + //str.append(std::to_string(err)); + + + hud_textp->setString(str); + LLVector3 end = m_vpos + (m_vdir)* 1.0f; + hud_textp->setPositionAgent(end); + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(FALSE); +} + +void llviewerVR::InitUI() +{ + if (!m_pCamButtonLeft) + { + /*LLPanel* panelp = NULL; + panelp=LLPanel::createFactoryPanel("vr_controlls"); + + panelp->setRect(rc); + LLColor4 color(1, 1, 1); + panelp->setOrigin(700, 700); + panelp->setColor(color); + panelp->setVisible(TRUE); + panelp->setEnabled(TRUE);*/ + LLRect rc; + rc.setCenterAndSize(500, 500, 200, 200); + + + m_pCamera_floater = LLFloaterReg::findTypedInstance("camera"); + if (m_pCamera_floater) + { + LLStringExplicit lb("keks"); + //LLRect rc; + //LLButton *m_pButton1; + LLButton *m_pButton; + for (int i = 0; i < 2; i++) + { + + LLButton::Params p; + if (i == 0) + { + p.name("rot_left"); + p.label("<<"); + } + else + { + p.name("rot_right"); + p.label(">>"); + } + + + m_pButton = LLUICtrlFactory::create(p); + + + m_pCamera_floater->addChild(m_pButton); + //panelp->addChild(m_pButton); + if (i == 0) + rc.setCenterAndSize(20, 20, 30, 20); + else + rc.setCenterAndSize(50, 20, 30, 20); + m_pButton->setRect(rc); + m_pButton->setVisible(TRUE); + m_pButton->setEnabled(TRUE); + if (i == 0) + m_pCamButtonLeft = m_pButton; + else + m_pCamButtonRight = m_pButton; + } + m_pCamButtonLeft->setCommitCallback(boost::bind(&llviewerVR::buttonCallbackLeft, this)); + m_pCamButtonRight->setCommitCallback(boost::bind(&llviewerVR::buttonCallbackRight, this)); + + /*m_pButton1 = m_pCamera_floater->findChild("rot_left"); + //lb.assign("<"); + if (m_pButton1) + { + m_pButton1->setLabel(LLStringExplicit("<")); + m_pButton1->setCommitCallback(boost::bind(&llviewerVR::buttonsCallback, this)); + }*/ + + + m_pCamStack = m_pCamera_floater->findChild("camera_view_layout_stack"); + + + //m_pCamera_floater->getChildList(); + //m_pButton1-> + } + } +} \ No newline at end of file diff --git a/indra/newview/llviewerVR.h b/indra/newview/llviewerVR.h new file mode 100644 index 00000000000..fdbd12e0d5f --- /dev/null +++ b/indra/newview/llviewerVR.h @@ -0,0 +1,220 @@ +#pragma once + +#include "../../openvr/headers/openvr.h" +#include "llhudtext.h" +#include "llgl.h" +#include "string.h" +#include "llfloater.h" +#include "llfloatercamera.h" +//#include "control.h" +//#include "llviewercamera.h" +//#include "llagentcamera.h" +//#include "pipeline.h" +//#include "llagent.h" +//#include "llviewerwindow.h" + + +class llviewerVR +{ +public: + vr::IVRSystem *gHMD = 0; + vr::IVRCompositor* gCompositor = 0; + vr::IVRRenderModels * gRenderModels = 0; + std::string gStrDriver; + std::string gStrDisplay; + vr::TrackedDevicePose_t gTrackedDevicePose[vr::k_unMaxTrackedDeviceCount]; + vr::VRCompositorError eError = vr::VRCompositorError_None; + vr::Texture_t lEyeTexture; + vr::Texture_t rEyeTexture; + + U32 bx = 0; + U32 by = 0; + U32 tx = 0; + U32 ty = 0; + + KEY m_kEditKey; + KEY m_kDebugKey; + KEY m_kMenuKey; + KEY m_kPlusKey; + KEY m_kMinusKey; + + bool m_bVrEnabled = 0; + + bool m_bVrActive = 0; + bool m_bVrKeyDown = 0; + + bool m_bEditKeyDown = 0; + bool m_bEditActive = 0; + + bool m_bDebugKeyDown = 0; + + bool m_bMenuKeyDown = 0; + bool m_bPlusKeyDown = 0; + bool m_bMinusKeyDown = 0; + + + bool isRenderingLeftEye = 0; + bool gVRInitComplete = 0; + + + S32 m_iTextureShift = 0; + + struct FramebufferDesc + { + GLuint m_nDepthBufferId; + GLuint m_nRenderTextureId; + GLuint m_nRenderFramebufferId; + GLuint m_nResolveTextureId; + GLuint mFBO; + GLuint IsReady; + }; + FramebufferDesc leftEyeDesc; + FramebufferDesc rightEyeDesc; + U32 m_nRenderWidth; + U32 m_nRenderHeight; + S32 m_iTrackedControllerCount; + S32 m_iTrackedControllerCount_Last; + S32 m_iValidPoseCount; + S32 m_iValidPoseCount_Last; + S32 m_iZoomIndex = 0; + U64 m_iClockCount; + U64 m_iClockCount2; + LLTimer m_tTimer1; + F32 m_fCamRotOffset = 90; + F32 m_fCamPosOffset = 0; + + LLVector3 m_vdir_orig; + LLVector3 m_vup_orig; + LLVector3 m_vleft_orig; + LLVector3 m_vpos_orig; + + LLVector3 m_vdir; + LLVector3 m_vup; + LLVector3 m_vleft; + LLVector3 m_vpos; + LLButton *m_pCamButtonLeft = 0; + LLButton *m_pCamButtonRight = 0; + LLButton *m_pCamButtonChat = 0; + LLButton *m_pCamButtonPref = 0; + LLFloaterCamera *m_pCamera_floater = 0; + LLView *m_pCamStack = 0; + + + + LLCoordWindow m_MousePos; + LLCoordWindow m_ScrSize; + S32 m_iHalfWidth; + S32 m_iHalfHeight; + S32 m_iThirdWidth; + S32 m_iThirdHeight; + + S32 m_iMenuIndex; + F32 m_fEyeDistance; + F32 m_fFocusDistance; + F32 m_fTextureShift; + F32 m_fFOV; + F32 m_fTextureZoom; + + //controller axes +// int m_iTrackedControllerCount; +// int m_iTrackedControllerCount_Last; + unsigned int m_uiControllerVertcount; + //vr::TrackedDevicePose_t m_rTrackedDevicePose[vr::k_unMaxTrackedDeviceCount]; + + float m_fNearClip; + float m_fFarClip; + + std::string m_strPoseClasses; + std::string m_strDriver; + std::string m_strDisplay; + + glh::matrix4f m_mat4HMDPose; + glh::matrix4f m_rmat4DevicePose[vr::k_unMaxTrackedDeviceCount]; + glh::matrix4f m_mat4eyePosLeft; + glh::matrix4f m_mat4eyePosRight; + + glh::matrix4f m_mat4ProjectionCenter; + glh::matrix4f m_mat4ProjectionLeft; + glh::matrix4f m_mat4ProjectionRight; + char m_rDevClassChar[vr::k_unMaxTrackedDeviceCount]; + + + glh::matrix4f ConvertSteamVRMatrixToMatrix4(const vr::HmdMatrix34_t &matPose); + glh::matrix4f GetHMDMatrixProjectionEye(vr::Hmd_Eye nEye); + glh::matrix4f GetHMDMatrixPoseEye(vr::Hmd_Eye nEye); + glh::matrix4f GetCurrentViewProjectionMatrix(vr::Hmd_Eye nEye); + + glh::matrix4f ConvertSteamVRMatrixToMatrix42(const vr::HmdMatrix34_t &matPose); + + vr::HmdQuaternion_t GetRotation(vr::HmdMatrix34_t matrix); + LLMatrix4 ConvertGLHMatrix4ToLLMatrix4(glh::matrix4f m); + + + std::string MatrixToStr(glh::matrix4f mat, std::string name); + std::string MatrixToStrLL(glh::matrix4f mat, std::string name); + bool gluInvertMatrix(const float m[16], float invOut[16]); + glh::ns_float::vec3 m_nPos; + + + LLVector3 gHMDAxes; + LLVector3 gCurrentCameraPos; + vr::HmdVector3_t gHMDFwd; + LLQuaternion gHMDQuat; + LLQuaternion gCtrlQuat[2]; + LLVector3 gHmdPos; + LLVector3 gHmdOffsetPos; + + LLVector3 gCtrlPos[vr::k_unMaxTrackedDeviceCount]; + LLVector3 gCtrlOrigin[vr::k_unMaxTrackedDeviceCount]; + //uint32_t gCtrlNum; + LLCoordGL gCtrlscreen[vr::k_unMaxTrackedDeviceCount]; + + LLMatrix4 gM4HMDPose; + LLMatrix4 gM4eyePosLeft; + LLMatrix4 gM4eyeProjectionLeft; + LLMatrix4 gM4eyePosRight; + LLMatrix4 gM4eyeProjectionRight; + LLHUDText *hud_textp; + std::string m_strHudText; + bool m_bHudTextUpdated=FALSE; + + bool gRightClick[vr::k_unMaxTrackedDeviceCount]; + bool gLeftClick[vr::k_unMaxTrackedDeviceCount]; + bool gLeftTouchpad = FALSE; + S32 gCursorDiff; + uint64_t gPreviousButtonMask; + + uint64_t gButton; + + bool m_rbShowTrackedDevice[vr::k_unMaxTrackedDeviceCount]; + uint32_t gPacketNum = 0; + + void UpdateHMDMatrixPose(); + //std::string GetTrackedDeviceString(vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_t unDevice, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *peError = NULL); + void SetupCameras(); + bool CreateFrameBuffer(int nWidth, int nHeight, FramebufferDesc &framebufferDesc); + void vrStartup(bool is_shutdown); + void vrDisplay(); + bool HandleInput(); + void DrawCursors(); + void ProcessVREvent(const vr::VREvent_t & event); + void agentYaw(F32 yaw_inc); + bool ProcessVRCamera(); + std::string GetTrackedDeviceString(vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_t unDevice, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *peError = NULL); + void RenderControllerAxes(); + BOOL posToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const; + void buttonCallbackLeft(); + void buttonCallbackRight(); + std::string Settings(); + F32 Modify(F32 val, F32 step, F32 min, F32 max); + std::string INISaveRead(bool save = false); + void HandleKeyboard(); + void Debug(); + void InitUI(); + + + llviewerVR(); + + ~llviewerVR(); +}; + diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index fe78e0df516..60d87906420 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -87,6 +87,11 @@ #include "fsdata.h" #include "fsperfstats.h" // performance stats support +//################################### P373R ###################################### +#include "llviewerVR.cpp" +llviewerVR gVR; +//################################### END P373R ################################## + extern LLPointer gStartTexture; extern bool gShiftFrame; @@ -758,6 +763,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) //upkeep gl name pools LLGLNamePool::upkeepPools(); + //################################### P373R ###################################### + sec: + gVR.ProcessVRCamera(); + //################################### END P373R ################################## stop_glerror(); display_update_camera(); @@ -1158,7 +1167,29 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!for_snapshot) { render_ui(); - swap(); + //################################### P373R ###################################### + gVR.vrDisplay(); + + //################################### END P373R ###################################### + //swap(); + //################################### P373R ###################################### + if (gVR.leftEyeDesc.IsReady && !gVR.rightEyeDesc.IsReady && gVR.m_fEyeDistance > 0) + { + goto sec; + + + } + if (!gVR.leftEyeDesc.IsReady && !gVR.rightEyeDesc.IsReady) + { + //gVR.HandleInput(); + + } + if (!gVR.m_bVrActive) + swap(); + + //################################### END P373R ################################## + //swap(); + } @@ -1591,7 +1622,9 @@ void render_ui_3d() { gUIProgram.bind(); } - + //################################### P373R ###################################### + gVR.RenderControllerAxes(); + //################################### END P373R ################################## // Coordinate axes // gSavedSettings replacement //if (gSavedSettings.getBOOL("ShowAxes")) @@ -1731,7 +1764,9 @@ void render_ui_2d() { gViewerWindow->draw(); } - + //################################### P373R ###################################### + gVR.DrawCursors(); + //################################### END P373R ################################## // reset current origin for font rendering, in case of tiling render @@ -1824,6 +1859,9 @@ void render_disconnected_background() void display_cleanup() { + //################################### P373R ###################################### + gVR.vrStartup(TRUE); + //################################### END P373R ###################################### gDisconnectedImagep = NULL; } diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 2b813923104..9990faaaf2b 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -597,6 +597,9 @@ def construct(self): 'llplugin', 'slplugin', self.args['configuration']), "slplugin.exe") + with self.prefix(src=os.path.join(pkgdir, os.pardir, os.pardir, 'openvr', 'bin', 'win64')): + self.path("openvr_api.dll") + # Get shared libs from the shared libs staging directory with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'sharedlibs', self.args['configuration'])): @@ -1880,6 +1883,9 @@ def construct(self): self.path("launch_url.sh") self.path("install.sh") + with self.prefix(src=os.path.join(pkgdir, os.pardir, os.pardir, 'openvr', 'bin', 'linux64')): + self.path("libopenvr_api.so") + with self.prefix(dst="bin"): self.path( os.path.join(os.pardir,'build_data.json'), "build_data.json" ) self.path("firestorm-bin","do-not-directly-run-firestorm-bin") diff --git a/openvr b/openvr new file mode 160000 index 00000000000..d9cffe2ff87 --- /dev/null +++ b/openvr @@ -0,0 +1 @@ +Subproject commit d9cffe2ff87bf0bac69b56bcf6fb60652a9d4009 From 444469a0660f4baf5e57d3e310ffc9c86208ad99 Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 May 2020 12:42:02 -0400 Subject: [PATCH 08/78] separate windows and ubuntu github actions --- .github/workflows/CompileUbuntu.yml | 45 +++++++++++++++ .github/workflows/CompileWindows.yml | 52 +++++++++++++++++ .github/workflows/ccpp.yml | 83 ---------------------------- 3 files changed, 97 insertions(+), 83 deletions(-) create mode 100644 .github/workflows/CompileUbuntu.yml create mode 100644 .github/workflows/CompileWindows.yml delete mode 100644 .github/workflows/ccpp.yml diff --git a/.github/workflows/CompileUbuntu.yml b/.github/workflows/CompileUbuntu.yml new file mode 100644 index 00000000000..2287c6e81b3 --- /dev/null +++ b/.github/workflows/CompileUbuntu.yml @@ -0,0 +1,45 @@ +name: CompileUbuntu + +on: [pull_request] + +jobs: + ubuntu_autobuild: + runs-on: ubuntu-16.04 + env: + AUTOBUILD_VSVER: 120 + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set env apt + run: | + sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb + echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables + echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@master + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + architecture: x64 + - name: Get software versions please + run: | + cmake --version + git --version + python --version + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + - name: Configure autobuild + run: | + autobuild --version + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - name: Build & Package + run: | + autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: fs-ubuntu-gha-artifact + path: build-linux-x86_64/newview/Phoenix*.tar.* diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml new file mode 100644 index 00000000000..53c76f27f55 --- /dev/null +++ b/.github/workflows/CompileWindows.yml @@ -0,0 +1,52 @@ +name: CompileWindows + +on: [pull_request] + +defaults: + run: + shell: bash + +jobs: + windows_build: + runs-on: windows-latest + env: + AUTOBUILD_VSVER: 120 + PreferredToolArchitecture: x64 + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set env + shell: cmd + run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables + - name: Download VS2013 Community + run: choco install visualstudiocommunity2013 + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + architecture: x64 + - name: Get software versions please + run: | + cmake --version + git --version + python --version + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + - name: Configure autobuild + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + autobuild --version + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE + - name: Build & Package + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: fs-windows-gha-artifact + path: build-vc120-64/newview/Release/*_Setup.exe diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml deleted file mode 100644 index 131ac7532ea..00000000000 --- a/.github/workflows/ccpp.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: C/C++ CI - -on: [push, pull_request] -defaults: - run: - shell: bash -jobs: - build: - strategy: - matrix: - os: [windows-latest, ubuntu-16.04] - build_type: [full] - runs-on: ${{matrix.os}} - env: - AUTOBUILD_VSVER: 120 - PreferredToolArchitecture: x64 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Set env - if: startsWith(matrix.os, 'windows') - shell: cmd - run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables - - name: Set env apt - if: startsWith(matrix.os, 'ubuntu') - shell: bash - run: | - sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb - echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables - echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 - - name: Download VS2013 Community - if: startsWith(matrix.os, 'windows') - run: choco install visualstudiocommunity2013 - - name: Setup Ninja - if: startsWith(matrix.os, 'ubuntu') - uses: seanmiddleditch/gha-setup-ninja@master - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: 2.7 - architecture: x64 - - name: Get software versions please - run: | - cmake --version - git --version - python --version - - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - - name: Get autobuild version - run: autobuild --version - - name: Configure autobuild - if: startsWith(matrix.os, 'windows') - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE - - name: Configure autobuild - if: startsWith(matrix.os, 'ubuntu') - shell: bash - run: | - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - name: Build & Package - if: startsWith(matrix.os, 'windows') - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount /detailedsummary - - name: Build & Package - if: startsWith(matrix.os, 'ubuntu') - shell: bash - run: | - autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'windows') - with: - name: fs-windows-gha-artifact - path: build-vc120-64/newview/Release/*_Setup.exe - - uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'ubuntu') - with: - name: fs-ubuntu-gha-artifact - path: build-linux-x86_64/newview/Phoenix*.tar.* From 0ff9c19731c31925294dc27d80893e56ae7fd591 Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 May 2020 20:47:10 -0400 Subject: [PATCH 09/78] use hardlinks while packaging to keep within gha disk limits --- .github/workflows/CompileUbuntu.yml | 16 +++++++++++----- indra/newview/viewer_manifest.py | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CompileUbuntu.yml b/.github/workflows/CompileUbuntu.yml index 2287c6e81b3..34a91f8800c 100644 --- a/.github/workflows/CompileUbuntu.yml +++ b/.github/workflows/CompileUbuntu.yml @@ -7,11 +7,13 @@ jobs: runs-on: ubuntu-16.04 env: AUTOBUILD_VSVER: 120 - + XZ_DEFAULTS: -T0 steps: - uses: actions/checkout@v2 with: submodules: true + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v2 - name: Set env apt run: | sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb @@ -24,20 +26,24 @@ jobs: with: python-version: 2.7 architecture: x64 + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - name: Get software versions please run: | cmake --version git --version python --version - - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - - name: Configure autobuild - run: | autobuild --version + cat /proc/cpuinfo + - run: df -h + - name: Configure + run: | autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - run: df -h - name: Build & Package run: | autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - run: df -h - name: Upload Artifact uses: actions/upload-artifact@v2 with: diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 9990faaaf2b..f38649c6f7d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1852,6 +1852,26 @@ class Darwin_x86_64_Manifest(DarwinManifest): class LinuxManifest(ViewerManifest): build_data_json_platform = 'lnx' + def ccopyfile(self, src, dst): + if re.match(".*firestorm-bin.*", src+dst): + print("not hardlinking firestorm-bin...", src) + super(LinuxManifest, self).ccopyfile(src, dst) + return + copy2 = shutil.copy2 + try: + shutil.copy2 = os.link + super(LinuxManifest, self).ccopyfile(src, dst) + finally: + shutil.copy2 = copy2 + + def ccopytree(self, src, dst): + copy2 = shutil.copy2 + try: + shutil.copy2 = os.link + super(LinuxManifest, self).ccopytree(src, dst) + finally: + shutil.copy2 = copy2 + def construct(self): # HACK! Force parent to always copy XML/... even when not having configured with --package. # This allows build result to be started without always having to --package and thus waiting for the length tar ball generation --package incurs From b47093bffd81c3bc616b45203bf611b1ad970b31 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sun, 2 Aug 2020 17:12:41 -0400 Subject: [PATCH 10/78] update fs-build-variables submodule --- fs-build-variables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs-build-variables b/fs-build-variables index 5a8faeb41bc..42d48cbd78a 160000 --- a/fs-build-variables +++ b/fs-build-variables @@ -1 +1 @@ -Subproject commit 5a8faeb41bc540aa49467647d0699c4040bced7a +Subproject commit 42d48cbd78aafb8fac1c79d2ff711dc01f261546 From c2f5bd5a5086b7ac1417da8b9332014c0a852b1f Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 3 Aug 2020 11:06:14 -0400 Subject: [PATCH 11/78] update gha viewer revision --- .github/workflows/CompileWindows.yml | 18 +++++++++++++++--- scripts/configure_firestorm.sh | 6 ++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 53c76f27f55..f5479c8e07d 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -12,14 +12,26 @@ jobs: env: AUTOBUILD_VSVER: 120 PreferredToolArchitecture: x64 + VIEWER_CHANNEL: FirestormVR-GHA + VIEWER_VERSION_REVISION: 60799 steps: - uses: actions/checkout@v2 with: submodules: true + - name: Set VIEWER_VERSION_GITHASH + shell: bash + run: | + majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` + minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` + patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` + echo ::set-env name=VIEWER_VERSION_STR::${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} + echo ::set-env name=VIEWER_VERSION_GITHASH::$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) - name: Set env shell: cmd - run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables + run: | + echo ::set-env name=AUTOBUILD_ID::- + echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables - name: Download VS2013 Community run: choco install visualstudiocommunity2013 - name: Setup python @@ -39,7 +51,7 @@ jobs: run: | call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{env.VIEWER_CHANNEL}} -DLL_TESTS:BOOL=FALSE - name: Build & Package shell: cmd run: | @@ -48,5 +60,5 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: fs-windows-gha-artifact + name: windows-${{env.VIEWER_CHANNEL}}-${{env.VIEWER_VERSION_STR}}-${{env.VIEWER_VERSION_GITHASH}} path: build-vc120-64/newview/Release/*_Setup.exe diff --git a/scripts/configure_firestorm.sh b/scripts/configure_firestorm.sh index b76993bd557..d10f8fd54dc 100755 --- a/scripts/configure_firestorm.sh +++ b/scripts/configure_firestorm.sh @@ -428,7 +428,9 @@ fi if [ \( $WANTS_VERSION -eq $TRUE \) -o \( $WANTS_CONFIG -eq $TRUE \) ] ; then echo "Versioning..." pushd .. - if [ -d .git ] + if [ "$VIEWER_VERSION_REVISION" -gt 0 ] ; then + buildVer=$VIEWER_VERSION_REVISION + elif [ -d .git ] then buildVer=`git rev-list --count HEAD` else @@ -439,7 +441,7 @@ if [ \( $WANTS_VERSION -eq $TRUE \) -o \( $WANTS_CONFIG -eq $TRUE \) ] ; then majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` - gitHash=`git describe --always --exclude '*'` + gitHash=${VIEWER_VERSION_GITHASH:-`git describe --always --exclude '*'`} echo "Channel : ${CHANNEL}" echo "Version : ${majorVer}.${minorVer}.${patchVer}.${buildVer} [${gitHash}]" GITHASH=-DVIEWER_VERSION_GITHASH=\"${gitHash}\" From 67070096b72bb9d4c942da0eb3282bd5ec73efec Mon Sep 17 00:00:00 2001 From: humbletim Date: Wed, 2 Sep 2020 13:19:40 -0400 Subject: [PATCH 12/78] fix vrconfig.ini path --- indra/newview/llviewerVR.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerVR.cpp b/indra/newview/llviewerVR.cpp index 84809bc909d..66993561edd 100644 --- a/indra/newview/llviewerVR.cpp +++ b/indra/newview/llviewerVR.cpp @@ -2032,7 +2032,7 @@ F32 llviewerVR::Modify(F32 val, F32 step, F32 min, F32 max) std::string llviewerVR::INISaveRead(bool save) { std::string path = getenv("APPDATA"); - path.append("\\Firestorm_x64\\vrconfig.ini"); + path.append("\\FirestormVR_x64\\vrconfig.ini"); std::string ret; ret.append(path); ret.append("\n"); From 85785d8009412f683253ad70e451265d4e82b299 Mon Sep 17 00:00:00 2001 From: humbletim Date: Wed, 9 Dec 2020 13:46:36 -0500 Subject: [PATCH 13/78] vs2019 updates switch to local fs-build-variables clone use local autobuild-1.1 repo fix shell; autobuild cache --- .github/workflows/CompileUbuntu.yml | 51 ------------------ .github/workflows/CompileWindows.yml | 77 +++++++++++++++++++++------- .gitmodules | 2 +- indra/cmake/00-Common.cmake | 20 ++++++++ indra/newview/CMakeLists.txt | 4 +- indra/newview/fs_viewer_manifest.py | 2 + scripts/configure_firestorm.sh | 2 +- 7 files changed, 84 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/CompileUbuntu.yml diff --git a/.github/workflows/CompileUbuntu.yml b/.github/workflows/CompileUbuntu.yml deleted file mode 100644 index 34a91f8800c..00000000000 --- a/.github/workflows/CompileUbuntu.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: CompileUbuntu - -on: [pull_request] - -jobs: - ubuntu_autobuild: - runs-on: ubuntu-16.04 - env: - AUTOBUILD_VSVER: 120 - XZ_DEFAULTS: -T0 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - # - name: Setup tmate session - # uses: mxschmitt/action-tmate@v2 - - name: Set env apt - run: | - sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb - echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables - echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 - - name: Setup Ninja - uses: seanmiddleditch/gha-setup-ninja@master - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 2.7 - architecture: x64 - - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - - name: Get software versions please - run: | - cmake --version - git --version - python --version - autobuild --version - cat /proc/cpuinfo - - run: df -h - - name: Configure - run: | - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - run: df -h - - name: Build & Package - run: | - autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - run: df -h - - name: Upload Artifact - uses: actions/upload-artifact@v2 - with: - name: fs-ubuntu-gha-artifact - path: build-linux-x86_64/newview/Phoenix*.tar.* diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index f5479c8e07d..1221258b3b0 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -10,55 +10,94 @@ jobs: windows_build: runs-on: windows-latest env: - AUTOBUILD_VSVER: 120 + FSVS_TARGET: 'Visual Studio 16 2019' + AUTOBUILD_VSVER: 164 PreferredToolArchitecture: x64 VIEWER_CHANNEL: FirestormVR-GHA - VIEWER_VERSION_REVISION: 60799 - + VIEWER_VERSION_REVISION: 64531 steps: - uses: actions/checkout@v2 with: submodules: true + - name: Set env + shell: cmd + run: | + echo %cd% + df -h + mkdir c:\cache + mkdir c:\cache\autobuild + + mkdir build-vc${{ env.AUTOBUILD_VSVER }}-64 + cd build-vc${{ env.AUTOBUILD_VSVER }}-64 + mkdir c:\cache\packages + mklink /j packages c:\cache\packages + + mkdir c:\build + mkdir c:\build\newview + mklink /j newview c:\build\newview + cd .. + + dir build-vc${{ env.AUTOBUILD_VSVER }}-64 + dir + echo AUTOBUILD_ID=->> %GITHUB_ENV% + echo AUTOBUILD_INSTALLABLE_CACHE=c:\cache\autobuild>> %GITHUB_ENV% + echo AUTOBUILD_VARIABLES_FILE=%cd%\fs-build-variables\variables>> %GITHUB_ENV% - name: Set VIEWER_VERSION_GITHASH shell: bash run: | majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` - echo ::set-env name=VIEWER_VERSION_STR::${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} - echo ::set-env name=VIEWER_VERSION_GITHASH::$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) - - name: Set env - shell: cmd - run: | - echo ::set-env name=AUTOBUILD_ID::- - echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables - - name: Download VS2013 Community - run: choco install visualstudiocommunity2013 + echo VIEWER_VERSION_STR=${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} >> $GITHUB_ENV + echo VIEWER_VERSION_GITHASH=$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) >> $GITHUB_ENV + df -h + - name: Setup vsdevenv + uses: seanmiddleditch/gha-setup-vsdevenv@master + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.0.2 - name: Setup python uses: actions/setup-python@v2 with: python-version: 2.7 architecture: x64 - name: Get software versions please + shell: cmd run: | + echo AUTOBUILD_INSTALLABLE_CACHE='%AUTOBUILD_INSTALLABLE_CACHE%' cmake --version git --version python --version + cl.exe + MSBuild.exe -version + echo " " + df -h - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild + + - name: cache -- autobuild downloaded installables + id: cacheddownloads + uses: actions/cache@v2 + with: + path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} + key: ${{ runner.os }}-cacheddownloads-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} + - name: cache -- packages cache + id: cachedpackages + uses: actions/cache@v2 + with: + path: c:\cache\packages + key: ${{ runner.os }}-cachedpackages-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} + - name: Configure autobuild shell: cmd run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{env.VIEWER_CHANNEL}} -DLL_TESTS:BOOL=FALSE + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build & Package shell: cmd run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount + msbuild build-vc${{ env.AUTOBUILD_VSVER }}-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: windows-${{env.VIEWER_CHANNEL}}-${{env.VIEWER_VERSION_STR}}-${{env.VIEWER_VERSION_GITHASH}} - path: build-vc120-64/newview/Release/*_Setup.exe + name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} + path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/Release/*_Setup.exe diff --git a/.gitmodules b/.gitmodules index 721f2982d2d..1acdc604bf9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/ValveSoftware/openvr [submodule "fs-build-variables"] path = fs-build-variables - url = https://vcs.firestormviewer.org/fs-build-variables + url = https://github.com/humbletim/fs-build-variables diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 17ac5b61e45..70143b6d9fc 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -300,4 +300,24 @@ else (USESYSTEMLIBS) ) endif (USESYSTEMLIBS) +if (NOT GENERATE_DEBUG_SYMBOLS) + message(WARNING "DISENGAGING DEBUG SYMBOL GENERATION (removing /Z[oiI7]..)") + #string(REGEX REPLACE "/Z[oiI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/DEBUG(:[A-Z]+)?|/OPT:REF|/FORCE:MULTIPLE " "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + string(REGEX REPLACE "/DEBUG(:[A-Z]+)?|/OPT:REF|/FORCE:MULTIPLE " "" CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}") + string(REGEX REPLACE "/DEBUG(:[A-Z]+)?|/OPT:REF|/FORCE:MULTIPLE " "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") + set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") + + message(STATUS + "== CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}\n" + "== CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}\n" + "== CMAKE_CXX_LINKER_FLAGS ${CMAKE_CXX_LINKER_FLAGS}\n" + "== CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}]\n" + ) +endif() + endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 62fb75dfce3..6e2fcb6908e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2788,7 +2788,7 @@ endif (INSTALL) if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIEWER_SYMBOL_FILE) if (USE_BUGSPLAT) # BugSplat symbol-file generation - if (WINDOWS) + if (NO) #WINDOWS) # Just pack up a tarball containing only the .pdb file for the # executable. Because we intend to use cygwin tar, we must render # VIEWER_SYMBOL_FILE in cygwin path syntax. @@ -2814,7 +2814,7 @@ if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIE ) add_custom_target(generate_symbols DEPENDS "${VIEWER_SYMBOL_FILE}" ${VIEWER_BINARY_NAME}) add_dependencies(generate_symbols ${VIEWER_BINARY_NAME}) - endif (WINDOWS) + endif() if (DARWIN) # Have to run dsymutil first, then pack up the resulting .dSYM directory add_custom_command(OUTPUT "${VIEWER_APP_DSYM}" diff --git a/indra/newview/fs_viewer_manifest.py b/indra/newview/fs_viewer_manifest.py index c41620b5be5..891b0db8477 100644 --- a/indra/newview/fs_viewer_manifest.py +++ b/indra/newview/fs_viewer_manifest.py @@ -86,6 +86,7 @@ def fs_linux_tar_excludes(self): return "--exclude=%s/bin/.debug" % installer_name def fs_save_windows_symbols(self): + return self.fs_save_symbols("windows") pdbName = "firestorm-bin.pdb" @@ -139,6 +140,7 @@ def fs_save_osx_symbols( self ): self.fs_save_symbols("darwin") def fs_save_symbols(self, osname): + return if (os.path.exists("%s/firestorm-symbols-%s-%d.tar.bz2" % (self.args['configuration'].lower(), osname, self.address_size))): diff --git a/scripts/configure_firestorm.sh b/scripts/configure_firestorm.sh index d10f8fd54dc..72e289f182a 100755 --- a/scripts/configure_firestorm.sh +++ b/scripts/configure_firestorm.sh @@ -578,7 +578,7 @@ if [ $WANTS_CONFIG -eq $TRUE ] ; then fi fi - cmake -G "$TARGET" ../indra $CHANNEL ${GITHASH} $FMODSTUDIO $OPENAL $KDU $OPENSIM $SINGLEGRID $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $TRACY_PROFILER $TESTBUILD $PACKAGE \ + cmake -G "${FSVS_TARGET:-$TARGET}" ../indra $CHANNEL ${GITHASH} $FMODSTUDIO $OPENAL $KDU $OPENSIM $SINGLEGRID $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $TRACY_PROFILER $TESTBUILD $PACKAGE \ $UNATTENDED -DLL_TESTS:BOOL=OFF -DADDRESS_SIZE:STRING=$AUTOBUILD_ADDRSIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE $CACHE_OPT \ $CRASH_REPORTING -DVIEWER_SYMBOL_FILE:STRING="${VIEWER_SYMBOL_FILE:-}" -DROOT_PROJECT_NAME:STRING=Firestorm $LL_ARGS_PASSTHRU ${VSCODE_FLAGS:-} | tee $LOG From 8a66640d74522a8b80b3675dd0175c428cfe679b Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 26 Mar 2022 15:51:00 -0400 Subject: [PATCH 14/78] + gha workflow_dispatch options --- .github/workflows/CompileWindows.yml | 50 ++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 1221258b3b0..5f1c5a00ac0 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -1,6 +1,17 @@ name: CompileWindows -on: [pull_request] +on: + # pull_request: + workflow_dispatch: + inputs: + buildsys: + description: 'ninja or msbuild' + required: true + default: msbuild + llpackage: + description: 'build/package/upload firestorm installer (if false only autobuild configure and caching is performed)' + required: true + default: false defaults: run: @@ -8,13 +19,13 @@ defaults: jobs: windows_build: - runs-on: windows-latest + runs-on: windows-2019 env: FSVS_TARGET: 'Visual Studio 16 2019' AUTOBUILD_VSVER: 164 PreferredToolArchitecture: x64 VIEWER_CHANNEL: FirestormVR-GHA - VIEWER_VERSION_REVISION: 64531 + VIEWER_VERSION_REVISION: 65659 steps: - uses: actions/checkout@v2 with: @@ -54,7 +65,11 @@ jobs: - name: Setup vsdevenv uses: seanmiddleditch/gha-setup-vsdevenv@master - name: Setup MSBuild + if: ${{ github.event.inputs.buildsys == 'msbuild' }} uses: microsoft/setup-msbuild@v1.0.2 + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@master + if: ${{ github.event.inputs.buildsys == 'ninja' }} - name: Setup python uses: actions/setup-python@v2 with: @@ -68,7 +83,7 @@ jobs: git --version python --version cl.exe - MSBuild.exe -version + ${{ github.event.inputs.buildsys }}.exe -version echo " " df -h - name: Install autobuild through PIP @@ -87,17 +102,38 @@ jobs: path: c:\cache\packages key: ${{ runner.os }}-cachedpackages-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} - - name: Configure autobuild + - name: Configure autobuild (msbuild) + if: ${{ github.event.inputs.buildsys == 'msbuild' }} shell: cmd run: | autobuild --version autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - - name: Build & Package + - name: Build & Package (msbuild) + if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} shell: cmd run: | msbuild build-vc${{ env.AUTOBUILD_VSVER }}-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount - - name: Upload Artifact + - name: Upload Artifact (msbuild) + if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 with: name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/Release/*_Setup.exe + + - name: Configure autobuild (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' }} + shell: bash + run: | + autobuild --version + autobuild configure -A 64 -c ReleaseFS_open -- --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + - name: Build & Package (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + shell: bash + run: | + ninja -C build-vc${{ env.AUTOBUILD_VSVER }}-64 llpackage + - name: Upload Artifact (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + uses: actions/upload-artifact@v2 + with: + name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} + path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/*_Setup.exe From bf6d1552754b9f362171a1e646a6ad061db6d346 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 26 Mar 2022 16:55:21 -0400 Subject: [PATCH 15/78] AUTOBUILD_LOGLEVEL: --verbose --- .github/workflows/CompileWindows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 5f1c5a00ac0..1212a2bc5a3 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -23,6 +23,7 @@ jobs: env: FSVS_TARGET: 'Visual Studio 16 2019' AUTOBUILD_VSVER: 164 + AUTOBUILD_LOGLEVEL: '--verbose' PreferredToolArchitecture: x64 VIEWER_CHANNEL: FirestormVR-GHA VIEWER_VERSION_REVISION: 65659 From 61ab74459138b823bfbdbaa99aa810fc4c2d05d5 Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 28 Mar 2022 04:31:33 -0400 Subject: [PATCH 16/78] 3p-inline + switch to ninja --- .github/3p/CompileWindows.autobuild-setup.sh | 32 +++++ .github/3p/_assert_defined.sh | 9 ++ .github/3p/_autobuild-json2xml.jq | 39 ++++++ .github/3p/_autobuild_prop_as_json.sh | 19 +++ .github/3p/_dsp_sourcefiles.sh | 17 +++ .../3p/build-cmds/3p-discord-rpc.build-cmd.sh | 29 ++++ .../3p/build-cmds/3p-freetype.build-cmd.sh | 41 ++++++ .github/3p/build-cmds/3p-glod.build-cmd.sh | 42 ++++++ .../3p/build-cmds/3p-gntp-growl.build-cmd.sh | 20 +++ .../build-cmds/3p-ndPhysicsStub.build-cmd.sh | 35 +++++ .../3p/build-cmds/3p-openjpeg2.build-cmd.sh | 25 ++++ .../3p/build-cmds/3p-openvr.autobuild.json | 24 ++++ .github/3p/build-cmds/3p-openvr.build-cmd.sh | 16 +++ .github/3p/inline-build.sh | 100 ++++++++++++++ .github/3p/use-alternate.sh | 42 ++++++ .github/fsenv.sh | 89 +++++++++++++ .github/workflows/CompileWindows.yml | 126 ++++++++++-------- indra/cmake/00-Common.cmake | 18 ++- indra/cmake/Copy3rdPartyLibs.cmake | 14 +- indra/cmake/OPENAL.cmake | 4 +- indra/newview/CMakeLists.txt | 71 +++++----- indra/newview/llviewerVR.cpp | 4 +- indra/newview/viewer_manifest.py | 11 +- scripts/configure_firestorm.sh | 7 +- 24 files changed, 716 insertions(+), 118 deletions(-) create mode 100644 .github/3p/CompileWindows.autobuild-setup.sh create mode 100644 .github/3p/_assert_defined.sh create mode 100644 .github/3p/_autobuild-json2xml.jq create mode 100644 .github/3p/_autobuild_prop_as_json.sh create mode 100644 .github/3p/_dsp_sourcefiles.sh create mode 100644 .github/3p/build-cmds/3p-discord-rpc.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-freetype.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-glod.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-gntp-growl.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-openjpeg2.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-openvr.autobuild.json create mode 100644 .github/3p/build-cmds/3p-openvr.build-cmd.sh create mode 100644 .github/3p/inline-build.sh create mode 100644 .github/3p/use-alternate.sh create mode 100644 .github/fsenv.sh diff --git a/.github/3p/CompileWindows.autobuild-setup.sh b/.github/3p/CompileWindows.autobuild-setup.sh new file mode 100644 index 00000000000..55d39e98bbe --- /dev/null +++ b/.github/3p/CompileWindows.autobuild-setup.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# github actions helper for compiling specific prebuilts inline +# -- humbletim 2022.03.27 + +set -eu +. .github/3p/_assert_defined.sh + +assert_defined AUTOBUILD_INSTALLABLE_CACHE AUTOBUILD_CONFIG_FILE \ + INLINE_FS3P_GITURL INLINE_FS3P_DEPS \ + ALTERNATE_FS3P_DEPS + +for x in $INLINE_FS3P_DEPS ; do + echo "[[ $x ]]" + time .github/3p/inline-build.sh 3p-inline $INLINE_FS3P_GITURL/3p-$x + echo +done + +for x in $ALTERNATE_FS3P_DEPS ; do + echo "[[ $x ]]" + time .github/3p/use-alternate.sh $x + echo +done + +# changes to autobuild.xml from autobuild tooling "randomly" reorder entries +# create a sorted hash+url list to use for change detection and cache keys +( + echo "import json; print(json.dumps((" ; autobuild installables print ; echo "), indent=4))" +) | python | jq -r ".[]|(.platforms.windows64//.platforms.common)|select(.)|.archive.hash+\"\t\"+.archive.url" \ + | sort -u | tee autobuild.xml.sorted.txt >&2 + +echo -n "// " >&2 +md5sum autobuild.xml.sorted.txt >&2 diff --git a/.github/3p/_assert_defined.sh b/.github/3p/_assert_defined.sh new file mode 100644 index 00000000000..13b02c39346 --- /dev/null +++ b/.github/3p/_assert_defined.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +function assert_defined() { + local x= + for x in $* ; do + test -n "${!x:-}" || { echo "environment variable '$x' missing" ; exit 1 ; } + if [[ -n "${DEBUG:-}" ]] ; then echo $x=${!x} >&2 ; fi + done +} diff --git a/.github/3p/_autobuild-json2xml.jq b/.github/3p/_autobuild-json2xml.jq new file mode 100644 index 00000000000..0957f8097e6 --- /dev/null +++ b/.github/3p/_autobuild-json2xml.jq @@ -0,0 +1,39 @@ +# jq helper for converting human-friendly autobuild.json into gory autobuild.xml + + +def _pad(level): + " " + | .[0:(if (level|type == "number" and level > 0) then level*2 else 0 end)]; + +def _wrap(level; name; stuff): + "<"+name+">"+( + if (level < 0 or (stuff|length == 0)) then stuff else "\n"+(stuff)+"\n"+_pad(level) end + )+""; + +def _llsd(level; value): + value as $value | + ( + if $value|type == "object" then + _wrap(level-1; "map"; ( + [ + ( $value | to_entries[] ) + | (""+_pad(level)+""+.key+"" + _llsd(level+1; .value) ) + ] | join("\n") + )) + elif $value|type == "array" then + _wrap(level-1; "array"; [$value[]|_pad(level)+_llsd(level; .)]|join("\n")) + elif $value|type == "string" then + _wrap(-1; "string"; $value) + else + _wrap(-1; "UNKNOWN"; $value|tostring) + end + ); + +def llsd: + "\n"+ + "\n" + + _pad(1) + _llsd(2; .) + "\n" + ""; + + + diff --git a/.github/3p/_autobuild_prop_as_json.sh b/.github/3p/_autobuild_prop_as_json.sh new file mode 100644 index 00000000000..b4af8bdab44 --- /dev/null +++ b/.github/3p/_autobuild_prop_as_json.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# example usage: +# autobuild_prop_as_json "glod" ".archive.url" +function autobuild_prop_as_json() { + ( + echo 'import json; print(json.dumps((' + autobuild installables print $1 + echo '), indent=4))' + ) | python | jq -r "(.platforms.windows64//.platforms.common)|$2" +} + +function autobuild_jq() { + ( + echo 'import json; print(json.dumps((' + autobuild installables print + echo '), indent=4))' + ) | python | jq -r "$@" +} diff --git a/.github/3p/_dsp_sourcefiles.sh b/.github/3p/_dsp_sourcefiles.sh new file mode 100644 index 00000000000..211b452acf1 --- /dev/null +++ b/.github/3p/_dsp_sourcefiles.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# helper function for extracting C SOURCE files from old school .dsp projects +# -- humbletim 2022.03.27 +# +# usage: _dsp_sourcefiles [optional per-source prefix -- eg: -Tp] +# example: +# SRCS=$(_dsp_sourcefiles project.dsp -Tp) +# cl.exe /c $SRCS +function _dsp_sourcefiles() { + local dspfile=$1 Tp=${2:-} + local reldir=${Tp}$(dirname $dspfile)/ + test -f $dspfile + echo "_dsp_sources($dspfile,$reldir)" >&2 + cat $dspfile | \ + grep -Ei '^SOURCE=.*\.(c|cxx|cpp|c+\+|cc)\s*$' | \ + sed -e "s@SOURCE=@${reldir}@;" -e 's@\\@/@g; s@/\./@/@g;' +} diff --git a/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh b/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh new file mode 100644 index 00000000000..c5e920f47b6 --- /dev/null +++ b/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +DISCORD_SOURCE_DIR="discord-rpc-3.4.0" + +# workaround older(?) autobuild runtime issue from Git+Windows MINGW bash prompt +USERPROFILEAppDataLocalMicrosoftWindowsApps= + +mkdir -p build +mkdir -p stage/lib/release +mkdir -p stage/LICENSES +mkdir -p stage/include/discord-rpc + +wdflags=$(echo " + warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern C' function under -EHc. + warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified +" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + +cmake -S $DISCORD_SOURCE_DIR -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="`echo $wdflags`" +ninja -C build + +cp -av build/src/discord-rpc.{lib,dll} stage/lib/release/ +cp -av $DISCORD_SOURCE_DIR/LICENSE stage/LICENSES/discord-rpc.txt +cp -av $DISCORD_SOURCE_DIR/include/*.h stage/include/discord-rpc/ +cp -av VERSION.txt stage/ diff --git a/.github/3p/build-cmds/3p-freetype.build-cmd.sh b/.github/3p/build-cmds/3p-freetype.build-cmd.sh new file mode 100644 index 00000000000..857e0102919 --- /dev/null +++ b/.github/3p/build-cmds/3p-freetype.build-cmd.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +. $_3P_UTILSDIR/_dsp_sourcefiles.sh + +cd "$(dirname "$0")" + +FREETYPELIB_SOURCE_DIR="freetype-2.3.9" +FREETYPE_VERSION=${FREETYPELIB_SOURCE_DIR#*-} + +top="$(pwd)" +stage="$(pwd)/stage" +mkdir -p $stage/lib/release +mkdir -p $stage/include/freetype2/ +mkdir -p $stage/LICENSES +mkdir -p $stage/docs/freetype + +pushd $FREETYPELIB_SOURCE_DIR + SRCS=$(_dsp_sourcefiles builds/win32/visualc/freetype.dsp) + + # tidy up some warnings + wdflags=$(echo " + warning C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size + warning C4311: 'type cast': pointer truncation from 'void *' to 'unsigned long' + " | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + + set -x + # -I$stage/packages/include/zlib-ng + cl -O2 -Iinclude -DNDEBUG -DFT2_BUILD_LIBRARY -D_MBCS -D_LIB -c $SRCS $wdflags + lib *.obj -out:$stage/lib/release/freetype.lib + set +x + + cp -av include/ft2build.h $stage/include/ + cp -av include/freetype $stage/include/freetype2/ + cp -av docs/LICENSE.TXT $stage/LICENSES/freetype.txt +popd + +cp -av README.Linden $stage/docs/freetype/ +echo "${FREETYPE_VERSION}.${AUTOBUILD_BUILD_ID}" | tee ${stage}/VERSION.txt diff --git a/.github/3p/build-cmds/3p-glod.build-cmd.sh b/.github/3p/build-cmds/3p-glod.build-cmd.sh new file mode 100644 index 00000000000..54c135f8674 --- /dev/null +++ b/.github/3p/build-cmds/3p-glod.build-cmd.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +. $_3P_UTILSDIR/_dsp_sourcefiles.sh + +cd "$(dirname "$0")" + +mkdir -p stage/include/glod +mkdir -p stage/LICENSES +mkdir -p stage/lib/release + +GLOD_VERSION=$(grep -E '^GLOD [0-9]' README | head -1 | awk '{ print $2 }') +echo "${GLOD_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +DSPFILES=" + src/api/glodlib.dsp + src/mt/mt.dsp + src/ply/ply.dsp + src/vds/vdslib_glod.dsp + src/xbs/xbs.dsp +" +SRCS=$( + for dsp in $DSPFILES ; do + _dsp_sourcefiles "$dsp" -Tp + done +) +echo SRCS=$SRCS >&2 + +# tidy up some warnings +wdflags=$(echo " + warning C4838: conversion from '__int64' to 'int' requires a narrowing conversion + warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int' + warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type 'Tri *' +" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + +cl -O2 -DNDEBUG -EHsc -DGLOD -D_MBCS -DGLOD_EXPORTS -Iinclude -Isrc/include -Isrc/mt -Isrc/xbs -Isrc/vds $wdflags $SRCS -LD -Feglod.dll + +cp -av glod.{lib,dll} stage/lib/release/ +cp -av include/glod.h stage/include/glod/ +cp -av LICENSE stage/LICENSES/GLOD.txt diff --git a/.github/3p/build-cmds/3p-gntp-growl.build-cmd.sh b/.github/3p/build-cmds/3p-gntp-growl.build-cmd.sh new file mode 100644 index 00000000000..3d34e0824c1 --- /dev/null +++ b/.github/3p/build-cmds/3p-gntp-growl.build-cmd.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +mkdir -p stage/lib/release stage/lib/debug +mkdir -p stage/include/Growl +mkdir -p stage/LICENSES +echo "1.0" > stage/VERSION.txt + +cmake -S gntp-send -G Ninja -B build -DCMAKE_BUILD_TYPE=Release +ninja -C build growl growl++ + +cp -av build/*.{dll,lib} stage/lib/release/ +cp -av build/*.{dll,lib} stage/lib/debug/ +cp -av gntp-send/headers/{growl++.hpp,growl.h} stage/include/Growl/ +cp -av gntp-send/LICENSE stage/LICENSES/gntp-growl.txt + diff --git a/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh b/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh new file mode 100644 index 00000000000..abe06e97f66 --- /dev/null +++ b/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +mkdir -p stage/lib/release stage/include stage/LICENSES + +echo "1.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +wdflags=$(echo " + warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits + warning C4244: '=': conversion from 'const double' to 'float', possible loss of data + warning C4267: 'argument': conversion from 'size_t' to 'const T', possible loss of data + warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. + warning C4477: 'sprintf' : format string '%lu' requires an argument of type 'unsigned long' +" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + +# hacd="src/hacdGraph.cpp src/hacdHACD.cpp src/hacdICHull.cpp src/hacdManifoldMesh.cpp src/hacdMeshDecimator.cpp src/hacdMicroAllocator.cpp src/hacdRaycastMesh.cpp" +# nd_hacdConvexDecomposition="LLConvexDecomposition.cpp nd_hacdConvexDecomposition.cpp nd_hacdStructs.cpp nd_hacdUtils.cpp nd_EnterExitTracer.cpp nd_StructTracer.cpp" +# nd_Pathing="llpathinglib.cpp llphysicsextensions.cpp" +cxxflags="-D_WINDOWS -DNOMINMAX -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0 -W3 -GR -EHsc -MD -O2 -Ob2 -DNDEBUG" + +cmake -Wno-dev -S . -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE="`echo $cxxflags $wdflags`" +ninja -C build + +cp -av build/Source/*/*.lib stage/lib/release/ +cp -av ndPhysicsStub.txt stage/LICENSES/ +cp -av Source/lib/LLConvexDecomposition.h stage/include/llconvexdecomposition.h +cp -av \ + Source/Pathing/llpathinglib.h \ + Source/Pathing/llphysicsextensions.h \ + Source/lib/ndConvexDecomposition.h \ + "stage/include/" diff --git a/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh b/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh new file mode 100644 index 00000000000..4eac92bd22c --- /dev/null +++ b/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +OPENJPEG_VERSION="2.4.0" + +mkdir -p build stage/lib/release stage/lib/debug stage/include/openjpeg stage/LICENSES + +echo "${OPENJPEG_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +wdflags=$(echo " + warning C4267: '=': conversion from 'size_t' to 'OPJ_UINT32', possible loss of data +" | awk '{ print $2 }' | sed -e 's@C@/wd@; s@:$@@;') + +cmake -Wno-dev -S src -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=" `echo $wdflags`" +ninja -C build openjp2 + +cp -av build/LICENSE.txt stage/LICENSES/openjpeg.txt +cp -av src/src/lib/openjp2/{openjpeg.h,opj_stdint.h,event.h} stage/include/openjpeg/ +cp -av build/src/lib/openjp2/opj_config.h stage/include/openjpeg/ +cp -av build/bin/openjp2{.dll,.lib} stage/lib/release/ +cp -av build/bin/openjp2{.dll,.lib} stage/lib/debug/ diff --git a/.github/3p/build-cmds/3p-openvr.autobuild.json b/.github/3p/build-cmds/3p-openvr.autobuild.json new file mode 100644 index 00000000000..2b0ca07c028 --- /dev/null +++ b/.github/3p/build-cmds/3p-openvr.autobuild.json @@ -0,0 +1,24 @@ +{ + "type": "autobuild", + "version": "1.3", + "package_description": { + "name": "openvr", + "copyright": "Copyright (c) 2015, Valve Corporation", + "description": "OpenVR is an API and runtime that allows access to VR hardware from multiple vendors...", + "license": "BSD-3-Clause", "license_file": "LICENSES/openvr.txt", + "platforms": { + "common": { + "configurations": {"default":{"build":{"command":"bash","options":["-c","../build-cmd.sh"]},"name":"default"}}, + "manifest": [ "include/openvr.h" ], + "name": "common" + }, + "windows64": { + "build_directory": "stage", + "configurations": {"default":{"build":{},"default":"true","name":"default"}}, + "manifest": [ "lib/release/openvr_api.lib", "lib/release/openvr_api.dll" ], + "name": "windows64" + } + }, + "version_file": "VERSION.txt" + } +} \ No newline at end of file diff --git a/.github/3p/build-cmds/3p-openvr.build-cmd.sh b/.github/3p/build-cmds/3p-openvr.build-cmd.sh new file mode 100644 index 00000000000..435211b39de --- /dev/null +++ b/.github/3p/build-cmds/3p-openvr.build-cmd.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +OPENVR_VERSION="v1.6.10" + +mkdir -p build stage/lib/release stage/include stage/LICENSES + +echo "${OPENVR_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +cp -av LICENSE stage/LICENSES/openvr.txt +cp -av headers/openvr.h stage/include +cp -av bin/win64/openvr_api.dll lib/win64/openvr_api.lib stage/lib/release/ diff --git a/.github/3p/inline-build.sh b/.github/3p/inline-build.sh new file mode 100644 index 00000000000..cf8be7a10e5 --- /dev/null +++ b/.github/3p/inline-build.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# github actions helper for compiling patched prebuilt deps inline +# -- humbletim 2022.03.27 + +# usage: +# .github/3p/inline-build.sh +# or .github/3p/inline-build.sh [autobuild_package_name] + +set -eu +. .github/3p/_assert_defined.sh +. .github/3p/_autobuild_prop_as_json.sh + +BUILDDIR=$1 +REPO=${2%=*} +COMMIT=${2#*=} +if [[ -n "$COMMIT" || "$COMMIT" == "$REPO" ]] ; then + COMMIT=${3:-master} +fi +NAME=${4:-$(basename $REPO)} +srcdir=$BUILDDIR/$NAME +buildcmd=$(dirname $0)/build-cmds/${NAME}.build-cmd.sh +assert_defined REPO COMMIT NAME + +assert_defined AUTOBUILD_PLATFORM AUTOBUILD_ADDRSIZE AUTOBUILD_VSVER AUTOBUILD_CONFIG_FILE + +function process_results_env() { + if [[ -f $srcdir/_results.env ]] ; then + . $srcdir/_results.env + assert_defined autobuild_package_name autobuild_package_filename autobuild_package_md5 + test -f $autobuild_package_filename || { echo "_results.env references missing autobuild_package_filename=$autobuild_package_filename" ; return 2 ; } + + local before=$(autobuild_prop_as_json $autobuild_package_name .archive) + test ! -f installables.log || rm -f installables.log + if [[ "$before" == "null" ]] ; then + echo -n "=== ADDING NEW PACKAGE $NAME " + { autobuild installables -a "file:///$autobuild_package_filename" add $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ + || { echo "FAILED TO ADD PACKAGE $NAME"; cat installables.log ; exit 5 ; } + echo ...done + else + echo -n "=== UPDATING PACKAGE $NAME " + { autobuild installables -a "file:///$autobuild_package_filename" edit $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ + || { echo "FAILED TO UPDATE PACKAGE $NAME"; cat installables.log ; exit 5 ; } + echo ...done + fi + local after=$(autobuild_prop_as_json $autobuild_package_name .archive) + if [[ "$before" != "$after" ]] ; then + echo "resulting autobuild.xml entry: $after" + fi + return 0 + else + echo "(skipping preflight process_results_env ($srcdir/_results.env not found))" >&2 + return 1 + fi +} + +# check for preexisting _results.env + autobuild archive +# (ie: if populated from github actions cache) +process_results_env && exit 0 || true + +test -e $buildcmd || { + echo "local build-cmd.sh override not found: $buildcmd" + echo "need to create/adapt a new build-cmd.sh override; see:" + echo " git clone $REPO $srcdir" + exit 2 +} + +# fetch dependency repo and commit point +test -e $srcdir/.git || ( + git clone -q $REPO $srcdir + cd $srcdir + git -c advice.detachedHead=false checkout -f $COMMIT 2>&1 +) + +# patch build-cmd.sh +cp -av $buildcmd $srcdir/build-cmd.sh +buildjson=$(dirname $0)/build-cmds/${NAME}.autobuild.json +if [[ -f $buildjson && ! -f $srcdir/autobuild.xml ]] ; then + echo "generating $NAME autobuild.xml from $buildjson" >&2 + jq -r "include \"$(dirname $0)/_autobuild-json2xml\" ; llsd" $buildjson \ + > $srcdir/autobuild.xml +fi + +( + cd $srcdir + unset AUTOBUILD_CONFIGURATION + export AUTOBUILD_CONFIG_FILE=$srcdir/autobuild.xml + export AUTOBUILD_BUILD_ID=$(git rev-parse --short HEAD) + success= + test ! -f build.log || rm -vf build.log + test ! -f package.log || rm -vf package.log + autobuild install + echo -n "==== BUILDING $NAME ==== " + { autobuild build 2>&1 ; } >> build.log || { echo "XXXXX BUILDING $NAME FAILED" ; cat build.log ; exit 3 ; } + echo "... done" + echo -n "==== PACKAGING $NAME ==== " + { autobuild package --results-file _results.env 2>&1 ; } >> package.log || { echo "XXXXX PACKAGING $NAME FAILED" ; cat package.log ; exit 4 ; } + echo "... done" +) + +process_results_env diff --git a/.github/3p/use-alternate.sh b/.github/3p/use-alternate.sh new file mode 100644 index 00000000000..a3588fdcb25 --- /dev/null +++ b/.github/3p/use-alternate.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# github actions helper that patches autobuild.xml to use an alternate source +# -- humbletim 2022.03.27 + +# note: autobuild props are derived from the url's tar.bz2 filename +# usage: +# .github/3p/use-alternate.sh +# or .github/3p/use-alternate.sh "=" + +set -eu +. .github/3p/_assert_defined.sh +. .github/3p/_autobuild_prop_as_json.sh + +assert_defined AUTOBUILD_CONFIG_FILE AUTOBUILD_PLATFORM + +autobuild_package_filename=${1%=*} +autobuild_package_md5=${1#*=} +if [[ -z $autobuild_package_md5 ]] ; then + autobuild_package_md5=${2} +fi + +# extract ---.tar.bz2 +filename=$(basename $autobuild_package_filename) +regex='^([-a-z][a-z0-9]+)-([.0-9]+)-(common|windows|windows64|darwin|darwin64|linux|linux64)-(.*)(\.tar\.(bz2|gz|xz)|\.zip)$' +if [[ $filename =~ $regex ]] ; then + autobuild_package_name=${BASH_REMATCH[1]} + autobuild_package_version=${BASH_REMATCH[2]} + autobuild_package_platform=${BASH_REMATCH[3]} + autobuild_package_id=${BASH_REMATCH[4]} +fi + +assert_defined autobuild_package_name autobuild_package_filename autobuild_package_md5 + +# snapshot autobuild.xml before/after state to detect modifications +before=$(autobuild_prop_as_json $autobuild_package_name .archive) + +autobuild installables edit $autobuild_package_name hash=$autobuild_package_md5 url=$autobuild_package_filename + +after=$(autobuild_prop_as_json $autobuild_package_name .archive) +if [[ "$before" != "$after" ]] ; then + echo "UPDATED autobuild.xml: $after" +fi diff --git a/.github/fsenv.sh b/.github/fsenv.sh new file mode 100644 index 00000000000..9a33e7025e8 --- /dev/null +++ b/.github/fsenv.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# github actions helper to initialize environment variables for building firestorm +# -- humbletim 2022.03.27 + +set -eu + +# function wrapper to avoid leaking variables when "sourced" into other scripts +function _fsenv() { + + # setenv [default-value] + # exports the named variable and emits a key="value" to stdout + # (a no-op when the variable doesn't exist and no default is specified) + function setenv() { + if [[ ! ${!1+x} ]] ; then + if [[ $# -lt 2 ]] ; then return 0 ; fi + eval "export ${1}=\"$2\"" + fi + echo "${1}=\"${!1}\"" + } + + setenv _3P_UTILSDIR "$(cd $(dirname $0)/3p && pwd)" + + ############################################################################ + # workaround for github actions receiving 403: Forbidden errors when trying to + # download prebuilts from 3p.firestormviewer.org + + # 3p- deps are resolved relative to this URL + setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries + + # format: packagerepo=gitcommit + setenv INLINE_FS3P_DEPS " + discord-rpc=a21e3dc + ndPhysicsStub=aad4d9e + freetype=a8975b6 + openjpeg2=d23ab9af + gntp-growl=7ed68be + glod=eecf86f + " + + # TODO: figure out where firestorm source code for 3p-dictionaries lives... + # but for now substituting the "official" LL prebuilt seems to work. + + # format: url=md5 + setenv ALTERNATE_FS3P_DEPS " + http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55025/511964/dictionaries-1.538984-common-538984.tar.bz2=d778c6a3475bc35ee8b9615dfc38b4a9 + " + # unused + # http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55025/511964/dictionaries-1.538984-common-538984.tar.bz2=d778c6a3475bc35ee8b9615dfc38b4a9 + # https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/78593/744010/freetype-2.4.4.557047-windows64-557047.tar.bz2=69307aaba16ac71531c9c4d930ace993 + # http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55004/511885/glod-1.0pre3.538980-windows64-538980.tar.bz2=6302ee1903ab419e76565d9eb6acd274 + # http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54974/511767/openjpeg-1.5.1.538970-windows64-538970.tar.bz2=5b5c80807fa8161f3480be3d89fe9516 + # https://bitbucket.org/kokua/3p-ndPhysicsStub/downloads/ndPhysicsStub-1.0-windows64-203290044.tar.bz2=bd172f8cf47ce5ba53a4d4128b2580d5 + ############################################################################ + + ### AUTOBUILD_ environment variables + if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then + case `uname -s` in + MINGW*) local GITHUB_WORKSPACE=$(pwd -W) ;; + *) local GITHUB_WORKSPACE=$PWD ;; + esac + fi + setenv AUTOBUILD_VARIABLES_FILE ${GITHUB_WORKSPACE}/fs-build-variables/variables + setenv AUTOBUILD_CONFIG_FILE ${GITHUB_WORKSPACE}/autobuild.xml + setenv AUTOBUILD_INSTALLABLE_CACHE ${GITHUB_WORKSPACE}/autobuild-cache + + setenv AUTOBUILD_LOGLEVEL --verbose + setenv AUTOBUILD_PLATFORM windows64 + setenv AUTOBUILD_ADDRSIZE 64 + setenv AUTOBUILD_VSVER 164 + setenv AUTOBUILD_CONFIGURATION ReleaseFS_open + setenv AUTOBUILD_BUILD_ID 0 + + ### environment variables specific to github actions / windows builds + # setenv VIEWER_CHANNEL=FirestormVR-GHA + setenv PreferredToolArchitecture x64 + setenv VIEWER_VERSION_REVISION dev + setenv FSBUILD_DIR build-vc${AUTOBUILD_VSVER}-${AUTOBUILD_ADDRSIZE} + setenv FSVS_TARGET Ninja # 'Visual Studio 16 2019' + + setenv VIEWER_VERSION_STR `echo $(cat indra/newview/VIEWER_VERSION.txt)`.${AUTOBUILD_BUILD_ID} + setenv VIEWER_VERSION_GITHASH $(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short 2>/dev/null || git rev-parse --short HEAD) + setenv VIEWER_CHANNEL + unset _fsenv +} +_fsenv +# exec wrapped command line (if any) +if [[ -n $# ]] ; then + "$@" +fi diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 1212a2bc5a3..738ccad74a2 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -7,11 +7,11 @@ on: buildsys: description: 'ninja or msbuild' required: true - default: msbuild + default: ninja llpackage: description: 'build/package/upload firestorm installer (if false only autobuild configure and caching is performed)' required: true - default: false + default: 'false' defaults: run: @@ -21,48 +21,34 @@ jobs: windows_build: runs-on: windows-2019 env: - FSVS_TARGET: 'Visual Studio 16 2019' - AUTOBUILD_VSVER: 164 - AUTOBUILD_LOGLEVEL: '--verbose' - PreferredToolArchitecture: x64 - VIEWER_CHANNEL: FirestormVR-GHA - VIEWER_VERSION_REVISION: 65659 + VIEWER_CHANNEL: FirestormVR-GHA + AUTOBUILD_BUILD_ID: 65659 + AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - uses: actions/checkout@v2 with: submodules: true - - name: Set env + - name: Preset ENV + shell: bash + run: .github/fsenv.sh | tee -a $GITHUB_ENV + - name: Prep build dirs shell: cmd run: | - echo %cd% + echo cd=%cd% + echo FSBUILD_DIR=%FSBUILD_DIR% df -h - mkdir c:\cache + mkdir %FSBUILD_DIR% mkdir c:\cache\autobuild - - mkdir build-vc${{ env.AUTOBUILD_VSVER }}-64 - cd build-vc${{ env.AUTOBUILD_VSVER }}-64 mkdir c:\cache\packages - mklink /j packages c:\cache\packages - - mkdir c:\build mkdir c:\build\newview - mklink /j newview c:\build\newview + mkdir 3p-inline + cd %FSBUILD_DIR% + mklink /j packages c:\cache\packages + mklink /j newview c:\build\newview cd .. - - dir build-vc${{ env.AUTOBUILD_VSVER }}-64 + dir %FSBUILD_DIR% dir - echo AUTOBUILD_ID=->> %GITHUB_ENV% echo AUTOBUILD_INSTALLABLE_CACHE=c:\cache\autobuild>> %GITHUB_ENV% - echo AUTOBUILD_VARIABLES_FILE=%cd%\fs-build-variables\variables>> %GITHUB_ENV% - - name: Set VIEWER_VERSION_GITHASH - shell: bash - run: | - majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` - minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` - patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` - echo VIEWER_VERSION_STR=${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} >> $GITHUB_ENV - echo VIEWER_VERSION_GITHASH=$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) >> $GITHUB_ENV - df -h - name: Setup vsdevenv uses: seanmiddleditch/gha-setup-vsdevenv@master - name: Setup MSBuild @@ -70,7 +56,7 @@ jobs: uses: microsoft/setup-msbuild@v1.0.2 - name: Setup Ninja uses: seanmiddleditch/gha-setup-ninja@master - if: ${{ github.event.inputs.buildsys == 'ninja' }} + # if: ${{ github.event.inputs.buildsys == 'ninja' }} - name: Setup python uses: actions/setup-python@v2 with: @@ -85,56 +71,80 @@ jobs: python --version cl.exe ${{ github.event.inputs.buildsys }}.exe -version + ninja --version echo " " df -h - name: Install autobuild through PIP run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild - - name: cache -- autobuild downloaded installables - id: cacheddownloads + - name: generate sorted 3p-inline manifest + shell: bash + run: for x in $INLINE_FS3P_DEPS ; do echo $x ; done | sort -u | tee 3p-inline.sorted.txt + - name: cache -- 3p-inline + id: cached-3p-inline + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-3p-inline-${{ hashFiles('3p-inline.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + path: | + 3p-inline/*/_results.env + 3p-inline/*/*.tar.bz2 + - name: Patch and build local 3p packages + # if: steps.cached-3p-inline.outputs.cache-hit != 'true' + shell: bash + run: | + .github/3p/CompileWindows.autobuild-setup.sh + test -f autobuild.xml.sorted.txt + + - name: cache -- autobuild downloads + id: cached-downloads uses: actions/cache@v2 with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} - key: ${{ runner.os }}-cacheddownloads-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} - - name: cache -- packages cache - id: cachedpackages + key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + + - name: cache -- buildir packages + id: cached-buildir-packages uses: actions/cache@v2 with: path: c:\cache\packages - key: ${{ runner.os }}-cachedpackages-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + + - name: Configure autobuild (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' }} + shell: bash + run: | + autobuild --version + autobuild configure -- --no-vstools --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + - name: Build & Package (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + shell: bash + run: | + ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj llpackage + - name: Upload Artifact (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + uses: actions/upload-artifact@v2 + with: + name: ${{ join([ runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH ], '-') }} + path: | + ${{ env.FSBUILD_DIR }}/newview/*_Setup.exe + autobuild.xml.sorted.txt + 3p-inline.sorted.txt - name: Configure autobuild (msbuild) if: ${{ github.event.inputs.buildsys == 'msbuild' }} shell: cmd run: | autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + autobuild configure -- --package --no-vstools --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build & Package (msbuild) if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} shell: cmd run: | - msbuild build-vc${{ env.AUTOBUILD_VSVER }}-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount + msbuild ${{ env.FSBUILD_DIR }}/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount - name: Upload Artifact (msbuild) if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 with: name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} - path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/Release/*_Setup.exe + path: ${{ env.FSBUILD_DIR }}/newview/Release/*_Setup.exe - - name: Configure autobuild (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' }} - shell: bash - run: | - autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - - name: Build & Package (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} - shell: bash - run: | - ninja -C build-vc${{ env.AUTOBUILD_VSVER }}-64 llpackage - - name: Upload Artifact (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} - uses: actions/upload-artifact@v2 - with: - name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} - path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/*_Setup.exe diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 70143b6d9fc..e5c46e3e3ff 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -301,7 +301,9 @@ else (USESYSTEMLIBS) endif (USESYSTEMLIBS) if (NOT GENERATE_DEBUG_SYMBOLS) - message(WARNING "DISENGAGING DEBUG SYMBOL GENERATION (removing /Z[oiI7]..)") + if (DEFINED ENV{CMAKE_DEBUG}) + message(WARNING "DISENGAGING DEBUG SYMBOL GENERATION (removing /Z[oiI7]..)") + endif() #string(REGEX REPLACE "/Z[oiI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -312,12 +314,14 @@ if (NOT GENERATE_DEBUG_SYMBOLS) set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") - message(STATUS - "== CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}\n" - "== CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}\n" - "== CMAKE_CXX_LINKER_FLAGS ${CMAKE_CXX_LINKER_FLAGS}\n" - "== CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}]\n" - ) + if (DEFINED ENV{CMAKE_DEBUG}) + message(STATUS + "== CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}\n" + "== CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}\n" + "== CMAKE_CXX_LINKER_FLAGS ${CMAKE_CXX_LINKER_FLAGS}\n" + "== CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}]\n" + ) + endif() endif() endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 5acd6df7bfa..37442668e52 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -94,6 +94,7 @@ if(WINDOWS) endif (USE_BUGSPLAT) set(release_files ${release_files} growl++.dll growl.dll ) + set(release_files ${release_files} openvr_api.dll ) if (FMODSTUDIO) set(debug_files ${debug_files} fmodL.dll) set(release_files ${release_files} fmod.dll) @@ -224,8 +225,7 @@ elseif(LINUX) set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}") - set(openvr_src_dir ${CMAKE_SOURCE_DIR}/../openvr/bin/linux64) - set(openvr_files libopenvr_api.so) + set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(vivox_libs @@ -254,6 +254,7 @@ elseif(LINUX) #libGLOD.so libhunspell-1.3.so.0.0.0 libopenal.so + libopenvr_api.so #libopenjpeg.so libuuid.so.16 libuuid.so.16.0.22 @@ -263,6 +264,7 @@ elseif(LINUX) else (NOT USESYSTEMLIBS) set(release_files libGLOD.so + libopenvr_api.so ) endif (NOT USESYSTEMLIBS) @@ -295,13 +297,7 @@ endif(WINDOWS) ################################################################ # Done building the file lists, now set up the copy commands. ################################################################ -copy_if_different( - ${openvr_src_dir} - "${SHARED_LIB_STAGING_DIR_RELEASE}" - out_targets - ${openvr_files} - ) -set(third_party_targets ${third_party_targets} ${out_targets}) + # Curiously, slvoice_files are only copied to SHARED_LIB_STAGING_DIR_RELEASE. # It's unclear whether this is oversight or intentional, but anyway leave the diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index fe52d1a9c95..3e0cbdb9ef6 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -10,7 +10,9 @@ else (LINUX) endif (LINUX) if (OPENAL) - message( WARNING "Using OpenAL is discouraged due to no maintenance of the viewers openal integration, possible memory leaks and no support for streaming audio. Switch to fmodstudio if possible" ) + if (NOT DEFINED ENV{FSVS_TARGET}) + message( WARNING "Using OpenAL is discouraged due to no maintenance of the viewers openal integration, possible memory leaks and no support for streaming audio. Switch to fmodstudio if possible" ) + endif() set(OPENAL_LIB_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/AL") if (USESYSTEMLIBS) include(FindPkgConfig) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 6e2fcb6908e..96a224cc20e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1,6 +1,7 @@ # -*- cmake -*- project(viewer) +set(CMAKE_CFG_INTDIR .) include(00-Common) # DON'T move Linking.cmake to its place in the alphabetized list below: it @@ -61,6 +62,8 @@ include(ColladaDom) include(jemalloc) include(Discord) +use_prebuilt_binary(openvr) + # if using ndPhysicsstub this variable will be unset, we don't need to build any stub code viewer side in that case if( LLPHYSICSEXTENSIONS_SRC_DIR ) # @@ -2265,34 +2268,34 @@ if (WINDOWS) # stores a list in the variable myfile in which each item is a line from the input file." # And of course it's straightforward to read a text file in Python. - set(COPY_INPUT_DEPENDENCIES + set(xCOPY_INPUT_DEPENDENCIES # The following commented dependencies are determined at variably at build time. Can't do this here. ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll + # ${SHARED_LIB_STAGING_DIR}/Release/llcommon.dll + ${SHARED_LIB_STAGING_DIR}/Release/libapr-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/libaprutil-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/libapriconv-1.dll ${SHARED_LIB_STAGING_DIR}/Release/glod.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll - ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll +# ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll +# ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll ${SHARED_LIB_STAGING_DIR}/Release/libcollada14dom22.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll + # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll + # ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll # Only copy OpenJPEG dll if needed #${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll #${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll #${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll # ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll + # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll + # ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/Release/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt + # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll + ${SHARED_LIB_STAGING_DIR}/Release/SLVoice.exe + ${SHARED_LIB_STAGING_DIR}/Release/libsndfile-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/vivoxoal.dll + ${SHARED_LIB_STAGING_DIR}/Release/ca-bundle.crt ${GOOGLE_PERF_TOOLS_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt @@ -2305,12 +2308,12 @@ if (WINDOWS) ) if (NOT USE_BUGSPLAT) - LIST(APPEND COPY_INPUT_DEPENDENCIES windows-crash-logger) +# LIST(APPEND COPY_INPUT_DEPENDENCIES windows-crash-logger) endif (NOT USE_BUGSPLAT) # Only copy OpenJPEG dll if needed if (NOT USE_KDU) - list(APPEND COPY_INPUT_DEPENDENCIES + list(APPEND xCOPY_INPUT_DEPENDENCIES ${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll ${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll @@ -2319,16 +2322,16 @@ if (WINDOWS) # if (ADDRESS_SIZE EQUAL 64) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk_x64.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp_x64.dll + list(APPEND xCOPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk_x64.dll + ${SHARED_LIB_STAGING_DIR}/Release/ortp_x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll ) else (ADDRESS_SIZE EQUAL 64) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll + list(APPEND xCOPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk.dll + ${SHARED_LIB_STAGING_DIR}/Release/ortp.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll ) @@ -2343,9 +2346,9 @@ if (WINDOWS) endif (FMODSTUDIO) if (OPENAL) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/OpenAL32.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/alut.dll + list(APPEND xCOPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/OpenAL32.dll + ${SHARED_LIB_STAGING_DIR}/Release/alut.dll ) endif (OPENAL) @@ -2363,7 +2366,7 @@ if (WINDOWS) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2424,7 +2427,7 @@ if (WINDOWS) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2440,7 +2443,7 @@ if (WINDOWS) add_custom_target(llpackage ALL DEPENDS ${CMAKE_CFG_INTDIR}/touched.bat - windows-setup-build-all + #windows-setup-build-all ) # temporarily disable packaging of event_host until hg subrepos get # sorted out on the parabuild cluster... @@ -2610,7 +2613,7 @@ if (LINUX) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2636,7 +2639,7 @@ if (LINUX) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2731,7 +2734,7 @@ if (DARWIN) --buildtype=${CMAKE_BUILD_TYPE} --bundleid=${MACOSX_BUNDLE_GUI_IDENTIFIER} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${VIEWER_APP_BUNDLE} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2766,7 +2769,7 @@ if (DARWIN) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${VIEWER_APP_BUNDLE} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} diff --git a/indra/newview/llviewerVR.cpp b/indra/newview/llviewerVR.cpp index 66993561edd..d50808c4477 100644 --- a/indra/newview/llviewerVR.cpp +++ b/indra/newview/llviewerVR.cpp @@ -21,7 +21,7 @@ //#include "llrender.h" #ifdef _WIN32 -#pragma comment(lib, "../../openvr/lib/win64/openvr_api.lib") +#pragma comment(lib, "openvr_api") #endif #ifndef _WIN32 @@ -2298,4 +2298,4 @@ void llviewerVR::InitUI() //m_pButton1-> } } -} \ No newline at end of file +} diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f38649c6f7d..10d399c8769 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -575,7 +575,7 @@ def construct(self): if self.is_packaging_viewer(): # Find firestorm-bin.exe in the 'configuration' dir, then rename it to the result of final_exe. - self.path(src='%s/firestorm-bin.exe' % self.args['configuration'], dst=self.final_exe()) + self.path(src='%s/firestorm-bin.exe' % '.' or self.args['configuration'], dst=self.final_exe()) # Remove VMP #with self.prefix(src=os.path.join(pkgdir, "VMP")): @@ -596,14 +596,17 @@ def construct(self): self.path2basename(os.path.join(os.pardir, 'llplugin', 'slplugin', self.args['configuration']), "slplugin.exe") - - with self.prefix(src=os.path.join(pkgdir, os.pardir, os.pardir, 'openvr', 'bin', 'win64')): - self.path("openvr_api.dll") + + with self.prefix(src=os.path.join(relpkgdir)): + self.path("discord-rpc.dll") # Get shared libs from the shared libs staging directory with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'sharedlibs', self.args['configuration'])): + # OpenVR + self.path("openvr_api.dll") + # Mesh 3rd party libs needed for auto LOD and collada reading try: self.path("glod.dll") diff --git a/scripts/configure_firestorm.sh b/scripts/configure_firestorm.sh index 72e289f182a..22b9d07adde 100755 --- a/scripts/configure_firestorm.sh +++ b/scripts/configure_firestorm.sh @@ -428,12 +428,13 @@ fi if [ \( $WANTS_VERSION -eq $TRUE \) -o \( $WANTS_CONFIG -eq $TRUE \) ] ; then echo "Versioning..." pushd .. - if [ "$VIEWER_VERSION_REVISION" -gt 0 ] ; then - buildVer=$VIEWER_VERSION_REVISION + buildVer=${AUTOBUILD_BUILD_ID:-${VIEWER_VERSION_REVISION:-}} + if [ -n $buildVer ] ; then + true elif [ -d .git ] then buildVer=`git rev-list --count HEAD` - else + elif which hg ; then buildVer=`hg summary | head -1 | cut -d " " -f 2 | cut -d : -f 1 | grep "[0-9]*"` fi export revision=${buildVer} From a12dee1c1e3486d05630b628d64ef321d7e19b44 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:11:47 -0400 Subject: [PATCH 17/78] remove openvr (as git submodule) --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1acdc604bf9..077cb4bd29d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "openvr"] - path = openvr - url = https://github.com/ValveSoftware/openvr [submodule "fs-build-variables"] path = fs-build-variables url = https://github.com/humbletim/fs-build-variables From e290cc977e0c28367b25db63ef47fa8a4823c502 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:27:16 -0400 Subject: [PATCH 18/78] cleanup COPY_INPUT_DEPENDENCIES workaround --- indra/newview/CMakeLists.txt | 62 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 96a224cc20e..d921d3bf376 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2268,34 +2268,34 @@ if (WINDOWS) # stores a list in the variable myfile in which each item is a line from the input file." # And of course it's straightforward to read a text file in Python. - set(xCOPY_INPUT_DEPENDENCIES + set(COPY_INPUT_DEPENDENCIES # The following commented dependencies are determined at variably at build time. Can't do this here. ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg - # ${SHARED_LIB_STAGING_DIR}/Release/llcommon.dll - ${SHARED_LIB_STAGING_DIR}/Release/libapr-1.dll - ${SHARED_LIB_STAGING_DIR}/Release/libaprutil-1.dll - ${SHARED_LIB_STAGING_DIR}/Release/libapriconv-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll ${SHARED_LIB_STAGING_DIR}/Release/glod.dll -# ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll -# ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll + ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll ${SHARED_LIB_STAGING_DIR}/Release/libcollada14dom22.dll - # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll - # ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll + ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll # Only copy OpenJPEG dll if needed #${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll #${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll #${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll # ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll - # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll - # ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/Release/uriparser.dll - # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/Release/SLVoice.exe - ${SHARED_LIB_STAGING_DIR}/Release/libsndfile-1.dll - ${SHARED_LIB_STAGING_DIR}/Release/vivoxoal.dll - ${SHARED_LIB_STAGING_DIR}/Release/ca-bundle.crt + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt ${GOOGLE_PERF_TOOLS_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt @@ -2308,12 +2308,12 @@ if (WINDOWS) ) if (NOT USE_BUGSPLAT) -# LIST(APPEND COPY_INPUT_DEPENDENCIES windows-crash-logger) + LIST(APPEND COPY_INPUT_DEPENDENCIES windows-crash-logger) endif (NOT USE_BUGSPLAT) # Only copy OpenJPEG dll if needed if (NOT USE_KDU) - list(APPEND xCOPY_INPUT_DEPENDENCIES + list(APPEND COPY_INPUT_DEPENDENCIES ${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll ${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll @@ -2322,16 +2322,16 @@ if (WINDOWS) # if (ADDRESS_SIZE EQUAL 64) - list(APPEND xCOPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk_x64.dll - ${SHARED_LIB_STAGING_DIR}/Release/ortp_x64.dll + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk_x64.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp_x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll ) else (ADDRESS_SIZE EQUAL 64) - list(APPEND xCOPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk.dll - ${SHARED_LIB_STAGING_DIR}/Release/ortp.dll + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll ) @@ -2346,9 +2346,9 @@ if (WINDOWS) endif (FMODSTUDIO) if (OPENAL) - list(APPEND xCOPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/Release/OpenAL32.dll - ${SHARED_LIB_STAGING_DIR}/Release/alut.dll + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/OpenAL32.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/alut.dll ) endif (OPENAL) @@ -2376,7 +2376,7 @@ if (WINDOWS) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py stage_third_party_libs - ${COPY_INPUT_DEPENDENCIES} + # ${COPY_INPUT_DEPENDENCIES} COMMENT "Performing viewer_manifest copy" ) @@ -2438,7 +2438,7 @@ if (WINDOWS) ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt - ${COPY_INPUT_DEPENDENCIES} + # ${COPY_INPUT_DEPENDENCIES} ) add_custom_target(llpackage ALL DEPENDS @@ -2791,7 +2791,7 @@ endif (INSTALL) if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIEWER_SYMBOL_FILE) if (USE_BUGSPLAT) # BugSplat symbol-file generation - if (NO) #WINDOWS) + if (WINDOWS) # Just pack up a tarball containing only the .pdb file for the # executable. Because we intend to use cygwin tar, we must render # VIEWER_SYMBOL_FILE in cygwin path syntax. @@ -2817,7 +2817,7 @@ if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIE ) add_custom_target(generate_symbols DEPENDS "${VIEWER_SYMBOL_FILE}" ${VIEWER_BINARY_NAME}) add_dependencies(generate_symbols ${VIEWER_BINARY_NAME}) - endif() + endif (WINDOWS) if (DARWIN) # Have to run dsymutil first, then pack up the resulting .dSYM directory add_custom_command(OUTPUT "${VIEWER_APP_DSYM}" From 970c4942c4807aaba36ba1d7314d97888f60ced0 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:32:59 -0400 Subject: [PATCH 19/78] fix openvr.h path --- indra/newview/llviewerVR.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerVR.h b/indra/newview/llviewerVR.h index fdbd12e0d5f..0d221b248c3 100644 --- a/indra/newview/llviewerVR.h +++ b/indra/newview/llviewerVR.h @@ -1,6 +1,6 @@ #pragma once -#include "../../openvr/headers/openvr.h" +#include #include "llhudtext.h" #include "llgl.h" #include "string.h" From a02a03d2aa124d09e882e88104acefe78e5e04be Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:34:25 -0400 Subject: [PATCH 20/78] remove openvr folder --- openvr | 1 - 1 file changed, 1 deletion(-) delete mode 160000 openvr diff --git a/openvr b/openvr deleted file mode 160000 index d9cffe2ff87..00000000000 --- a/openvr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d9cffe2ff87bf0bac69b56bcf6fb60652a9d4009 From a6efd6676e84bce0bec8a11a7920a1c84e4f0242 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:45:29 -0400 Subject: [PATCH 21/78] use format instead of join --- .github/workflows/CompileWindows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 738ccad74a2..15044602797 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -124,7 +124,7 @@ jobs: if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 with: - name: ${{ join([ runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH ], '-') }} + name: ${{ format('{0}-{1}-{2}-{3}-{4}', runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH) }} path: | ${{ env.FSBUILD_DIR }}/newview/*_Setup.exe autobuild.xml.sorted.txt From 0296f0fb4431e8cd64a897c96524655cc5ba6c8c Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 05:02:07 -0400 Subject: [PATCH 22/78] fix multiline gha env vars --- .github/fsenv.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 9a33e7025e8..91bcade0782 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -15,7 +15,14 @@ function _fsenv() { if [[ $# -lt 2 ]] ; then return 0 ; fi eval "export ${1}=\"$2\"" fi - echo "${1}=\"${!1}\"" + if [[ ${!1} == *$'\n'* ]] ; then + # bash and github action multiline env vars compat + echo "${1}< Date: Tue, 29 Mar 2022 05:10:01 -0400 Subject: [PATCH 23/78] remove extra quotes from gha env --- .github/fsenv.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 91bcade0782..76f4b5cbf73 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -21,10 +21,11 @@ function _fsenv() { echo "${!1}" echo "EOF" else - echo "${1}=\"${!1}\"" + echo "${1}=${!1}" fi } + setenv GHA_TEST_WITH_SPACES "testing 1 2 3...tab\t." setenv _3P_UTILSDIR "$(cd $(dirname $0)/3p && pwd)" ############################################################################ From d340356e64314ce5129be326aade9b0c19083ad0 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 05:22:24 -0400 Subject: [PATCH 24/78] use local 3p-* repos --- .github/fsenv.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 76f4b5cbf73..f8cc8c384f2 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -33,7 +33,9 @@ function _fsenv() { # download prebuilts from 3p.firestormviewer.org # 3p- deps are resolved relative to this URL - setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries + setenv INLINE_FS3P_GITURL https://github.com/holostorm + ### :/ also 403's with vcs.firestormviewer.org... + ### setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries # format: packagerepo=gitcommit setenv INLINE_FS3P_DEPS " From bd1351cf2d8a984219b5e5153224ad442f3819d8 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 05:48:27 -0400 Subject: [PATCH 25/78] + sideload 3p-openvr --- .github/3p/_autobuild-json2xml.jq | 2 +- .github/workflows/CompileWindows.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/3p/_autobuild-json2xml.jq b/.github/3p/_autobuild-json2xml.jq index 0957f8097e6..95522032a12 100644 --- a/.github/3p/_autobuild-json2xml.jq +++ b/.github/3p/_autobuild-json2xml.jq @@ -32,7 +32,7 @@ def _llsd(level; value): def llsd: "\n"+ "\n" + - _pad(1) + _llsd(2; .) + "\n" + _pad(1) + _llsd(2; .) + "\n" + ""; diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 15044602797..3b012084fa8 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -92,6 +92,8 @@ jobs: # if: steps.cached-3p-inline.outputs.cache-hit != 'true' shell: bash run: | + # sideload "3p-openvr" + .github/3p/inline-build.sh 3p-inline/ https://github.com/ValveSoftware/openvr d9cffe2 3p-openvr .github/3p/CompileWindows.autobuild-setup.sh test -f autobuild.xml.sorted.txt @@ -101,6 +103,7 @@ jobs: with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + restore-keys: Windows-downloads-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: cache -- buildir packages id: cached-buildir-packages @@ -108,6 +111,7 @@ jobs: with: path: c:\cache\packages key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From 6106dd74d7755e6533ccfc90f0b9e05d6a1d35c7 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 06:42:22 -0400 Subject: [PATCH 26/78] ninja fix for viewer_manifest.py --- indra/newview/viewer_manifest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 10d399c8769..19112fd0e3c 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -594,7 +594,7 @@ def construct(self): # Plugin host application self.path2basename(os.path.join(os.pardir, - 'llplugin', 'slplugin', self.args['configuration']), + 'llplugin', 'slplugin', '.' or self.args['configuration']), "slplugin.exe") with self.prefix(src=os.path.join(relpkgdir)): @@ -697,11 +697,11 @@ def construct(self): # Media plugins - CEF with self.prefix(dst="llplugin"): with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins')): - with self.prefix(src=os.path.join('cef', self.args['configuration'])): + with self.prefix(src=os.path.join('cef', '.' or self.args['configuration'])): self.path("media_plugin_cef.dll") # Media plugins - LibVLC - with self.prefix(src=os.path.join('libvlc', self.args['configuration'])): + with self.prefix(src=os.path.join('libvlc', '.' or self.args['configuration'])): self.path("media_plugin_libvlc.dll") # Media plugins - Example (useful for debugging - not shipped with release viewer) From fdfcd4f08212c366e6bd874d7176f26644af4f7e Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 06:42:57 -0400 Subject: [PATCH 27/78] optimize cached reconfigure --- .github/workflows/CompileWindows.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 3b012084fa8..4ca8f0bc300 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -113,6 +113,12 @@ jobs: key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA + - name: Reset cached packages sentinels + if: steps.cached-buildir-packages.outputs.cache-hit == 'true' + shell: bash + run: | + touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` + - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} shell: bash From 2179da7deb5fd41ba1888c24f47176dd93c96c7b Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:12:34 -0400 Subject: [PATCH 28/78] update 3p-inline strategy; ensure ninja build ordering --- .github/3p/CompileWindows.autobuild-setup.sh | 2 +- .github/3p/inline-build.sh | 21 +++++++++++++------- .github/fsenv.sh | 15 +++++++------- .github/workflows/CompileWindows.yml | 7 ++++--- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.github/3p/CompileWindows.autobuild-setup.sh b/.github/3p/CompileWindows.autobuild-setup.sh index 55d39e98bbe..15efdcf1653 100644 --- a/.github/3p/CompileWindows.autobuild-setup.sh +++ b/.github/3p/CompileWindows.autobuild-setup.sh @@ -11,7 +11,7 @@ assert_defined AUTOBUILD_INSTALLABLE_CACHE AUTOBUILD_CONFIG_FILE \ for x in $INLINE_FS3P_DEPS ; do echo "[[ $x ]]" - time .github/3p/inline-build.sh 3p-inline $INLINE_FS3P_GITURL/3p-$x + time .github/3p/inline-build.sh 3p-inline "$INLINE_FS3P_GITURL/$x" echo done diff --git a/.github/3p/inline-build.sh b/.github/3p/inline-build.sh index cf8be7a10e5..82abec63ff3 100644 --- a/.github/3p/inline-build.sh +++ b/.github/3p/inline-build.sh @@ -3,7 +3,7 @@ # -- humbletim 2022.03.27 # usage: -# .github/3p/inline-build.sh +# .github/3p/inline-build.sh # or .github/3p/inline-build.sh [autobuild_package_name] set -eu @@ -11,15 +11,22 @@ set -eu . .github/3p/_autobuild_prop_as_json.sh BUILDDIR=$1 -REPO=${2%=*} -COMMIT=${2#*=} -if [[ -n "$COMMIT" || "$COMMIT" == "$REPO" ]] ; then +regex='^([^@]+)@([^#]+)#?([-/_a-zA-Z0-9]*)?$' +if [[ "$2" =~ $regex ]] ; then + REPO=${BASH_REMATCH[1]} + COMMIT=${BASH_REMATCH[2]} + NAME=${BASH_REMATCH[3]} + NAME=${NAME:-${3:-$(basename $REPO)}} +else + REPO=$2 COMMIT=${3:-master} + NAME=${4:-$(basename $REPO)} fi -NAME=${4:-$(basename $REPO)} + srcdir=$BUILDDIR/$NAME buildcmd=$(dirname $0)/build-cmds/${NAME}.build-cmd.sh -assert_defined REPO COMMIT NAME +echo +DEBUG=1 assert_defined REPO COMMIT NAME assert_defined AUTOBUILD_PLATFORM AUTOBUILD_ADDRSIZE AUTOBUILD_VSVER AUTOBUILD_CONFIG_FILE @@ -35,7 +42,7 @@ function process_results_env() { echo -n "=== ADDING NEW PACKAGE $NAME " { autobuild installables -a "file:///$autobuild_package_filename" add $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ || { echo "FAILED TO ADD PACKAGE $NAME"; cat installables.log ; exit 5 ; } - echo ...done + echo ...done else echo -n "=== UPDATING PACKAGE $NAME " { autobuild installables -a "file:///$autobuild_package_filename" edit $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ diff --git a/.github/fsenv.sh b/.github/fsenv.sh index f8cc8c384f2..cc4467956f7 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -33,18 +33,19 @@ function _fsenv() { # download prebuilts from 3p.firestormviewer.org # 3p- deps are resolved relative to this URL - setenv INLINE_FS3P_GITURL https://github.com/holostorm + setenv INLINE_FS3P_GITURL https://github.com ### :/ also 403's with vcs.firestormviewer.org... ### setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries # format: packagerepo=gitcommit setenv INLINE_FS3P_DEPS " - discord-rpc=a21e3dc - ndPhysicsStub=aad4d9e - freetype=a8975b6 - openjpeg2=d23ab9af - gntp-growl=7ed68be - glod=eecf86f + holostorm/3p-discord-rpc@a21e3dc#3p-discord-rpc + holostorm/3p-ndPhysicsStub@aad4d9e + holostorm/3p-freetype@a8975b6 + holostorm/3p-openjpeg2@d23ab9af + holostorm/3p-gntp-growl@7ed68be + holostorm/3p-glod@eecf86f + ValveSoftware/openvr@d9cffe2#3p-openvr " # TODO: figure out where firestorm source code for 3p-dictionaries lives... diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 4ca8f0bc300..c4b4b11af68 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -92,8 +92,6 @@ jobs: # if: steps.cached-3p-inline.outputs.cache-hit != 'true' shell: bash run: | - # sideload "3p-openvr" - .github/3p/inline-build.sh 3p-inline/ https://github.com/ValveSoftware/openvr d9cffe2 3p-openvr .github/3p/CompileWindows.autobuild-setup.sh test -f autobuild.xml.sorted.txt @@ -129,7 +127,10 @@ jobs: if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} shell: bash run: | - ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj llpackage + ninja -C ${{ env.FSBUILD_DIR }} SLPlugin media_plugin_cef media_plugin_libvlc + ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj + ninja -C ${{ env.FSBUILD_DIR }} firestorm-bin + ninja -C ${{ env.FSBUILD_DIR }} llpackage - name: Upload Artifact (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 From f03a7cf4e0e120575e7aa3f99746ba33211fbc61 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:19:58 -0400 Subject: [PATCH 29/78] always attempt to update cached sentinels --- .github/workflows/CompileWindows.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index c4b4b11af68..96de2344e99 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -112,10 +112,11 @@ jobs: restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: Reset cached packages sentinels - if: steps.cached-buildir-packages.outputs.cache-hit == 'true' + # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash run: | - touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` + touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true + ls -l ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From 5b12cd36ac5dac1ac4ecdcf2a8fe4a12598abfef Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:33:39 -0400 Subject: [PATCH 30/78] always attempt to update cached sentinels --- .github/workflows/CompileWindows.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 96de2344e99..ff4c71bab0a 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -115,8 +115,9 @@ jobs: # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash run: | - touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true - ls -l ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true + touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true + sleep 2 && touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true + ls -l autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From b60983792e665c864b9d27890b18983faa24c6a4 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:39:25 -0400 Subject: [PATCH 31/78] split ninja build steps --- .github/workflows/CompileWindows.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index ff4c71bab0a..dffb2246668 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -125,13 +125,21 @@ jobs: run: | autobuild --version autobuild configure -- --no-vstools --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - - name: Build & Package (ninja) + - name: Build plugins (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} - shell: bash run: | ninja -C ${{ env.FSBUILD_DIR }} SLPlugin media_plugin_cef media_plugin_libvlc + - name: Build precompiled header (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + run: | ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj + - name: Build firestorm-bin (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + run: | ninja -C ${{ env.FSBUILD_DIR }} firestorm-bin + - name: Package (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + run: | ninja -C ${{ env.FSBUILD_DIR }} llpackage - name: Upload Artifact (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} From 0538051e6a96012faa71f53066d408d3e99d49d7 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 10:31:11 -0400 Subject: [PATCH 32/78] fix cosmetic revision (65658 not 65659) --- .github/workflows/CompileWindows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index dffb2246668..4664d9a51a2 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -22,7 +22,7 @@ jobs: runs-on: windows-2019 env: VIEWER_CHANNEL: FirestormVR-GHA - AUTOBUILD_BUILD_ID: 65659 + AUTOBUILD_BUILD_ID: 65658 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - uses: actions/checkout@v2 @@ -115,9 +115,9 @@ jobs: # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash run: | - touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true + sleep 2 && touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true sleep 2 && touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true - ls -l autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true + ls -lrt autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From 748c79f55317c42e088b5d7209a7ca2a099e4200 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 10:35:56 -0400 Subject: [PATCH 33/78] remove temporary restore-keys --- .github/workflows/CompileWindows.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 4664d9a51a2..46cf0270e43 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -101,7 +101,6 @@ jobs: with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} - restore-keys: Windows-downloads-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: cache -- buildir packages id: cached-buildir-packages @@ -109,7 +108,6 @@ jobs: with: path: c:\cache\packages key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} - restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: Reset cached packages sentinels # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' From 439a9f1d331e9e37312bfc251e8db5b800fd532c Mon Sep 17 00:00:00 2001 From: humbletim Date: Wed, 30 Mar 2022 02:24:41 -0400 Subject: [PATCH 34/78] dedupe Firestorm-FirestormVR-.. within channel/titlebar --- .github/workflows/CompileWindows.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 46cf0270e43..2a9885ece75 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -21,7 +21,7 @@ jobs: windows_build: runs-on: windows-2019 env: - VIEWER_CHANNEL: FirestormVR-GHA + VIEWER_CHANNEL: VR-GHA AUTOBUILD_BUILD_ID: 65658 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: @@ -84,7 +84,7 @@ jobs: id: cached-3p-inline uses: actions/cache@v2 with: - key: ${{ runner.os }}-3p-inline-${{ hashFiles('3p-inline.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-3p-inline-${{ hashFiles('3p-inline.sorted.txt') }}-FirestormVR-GHA path: | 3p-inline/*/_results.env 3p-inline/*/*.tar.bz2 @@ -100,14 +100,14 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} - key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA - name: cache -- buildir packages id: cached-buildir-packages uses: actions/cache@v2 with: path: c:\cache\packages - key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA - name: Reset cached packages sentinels # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' From 29d6779adfb55ac7860f401df68e5696686f3c1d Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 Jul 2022 01:50:20 -0400 Subject: [PATCH 35/78] bump to python3; simplify local commands --- .github/fsenv.sh | 1 + .github/workflows/CompileWindows.yml | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index cc4467956f7..fcf26581d13 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -83,6 +83,7 @@ function _fsenv() { ### environment variables specific to github actions / windows builds # setenv VIEWER_CHANNEL=FirestormVR-GHA + setenv PYTHONUTF8 1 setenv PreferredToolArchitecture x64 setenv VIEWER_VERSION_REVISION dev setenv FSBUILD_DIR build-vc${AUTOBUILD_VSVER}-${AUTOBUILD_ADDRSIZE} diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 2a9885ece75..276e91f6b90 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -22,7 +22,7 @@ jobs: runs-on: windows-2019 env: VIEWER_CHANNEL: VR-GHA - AUTOBUILD_BUILD_ID: 65658 + AUTOBUILD_BUILD_ID: 66221 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - uses: actions/checkout@v2 @@ -60,7 +60,7 @@ jobs: - name: Setup python uses: actions/setup-python@v2 with: - python-version: 2.7 + python-version: 3.8 architecture: x64 - name: Get software versions please shell: cmd @@ -75,7 +75,8 @@ jobs: echo " " df -h - name: Install autobuild through PIP - run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild + run: pip install git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild' + # run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild - name: generate sorted 3p-inline manifest shell: bash @@ -112,33 +113,38 @@ jobs: - name: Reset cached packages sentinels # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash + working-directory: ${{ env.FSBUILD_DIR }} run: | - sleep 2 && touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true - sleep 2 && touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true - ls -lrt autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true + sleep 2 && touch ./packages/cmake_tracking/sentinel_installed || true + sleep 2 && touch `ls ./packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true + ls -lrt ../autobuild.xml ./packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} shell: bash run: | autobuild --version - autobuild configure -- --no-vstools --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + autobuild configure -- --no-vstools --ninja --package --openal --chan ${VIEWER_CHANNEL} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build plugins (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} SLPlugin media_plugin_cef media_plugin_libvlc + ninja SLPlugin media_plugin_cef media_plugin_libvlc - name: Build precompiled header (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj + ninja newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj - name: Build firestorm-bin (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} firestorm-bin + ninja firestorm-bin - name: Package (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} llpackage + ninja llpackage - name: Upload Artifact (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 From 01a81d1c8d020818d9dc69eea328795b24bf17f4 Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 Jul 2022 01:57:06 -0400 Subject: [PATCH 36/78] fix yaml typo --- .github/workflows/CompileWindows.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 276e91f6b90..762f6679fda 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -75,9 +75,7 @@ jobs: echo " " df -h - name: Install autobuild through PIP - run: pip install git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild' - # run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild - + run: pip install 'git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild' - name: generate sorted 3p-inline manifest shell: bash run: for x in $INLINE_FS3P_DEPS ; do echo $x ; done | sort -u | tee 3p-inline.sorted.txt From b59793715bc146ae0710543c272b9b28ebe73a50 Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 Jul 2022 09:51:31 -0400 Subject: [PATCH 37/78] fix env exports + #dev markers --- .github/fsenv.sh | 36 ++++++++++++++++-------- .github/workflows/CompileWindows.yml | 42 ++++++++++++++++------------ 2 files changed, 48 insertions(+), 30 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index fcf26581d13..a888eaaecbe 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -9,24 +9,33 @@ function _fsenv() { # setenv [default-value] # exports the named variable and emits a key="value" to stdout - # (a no-op when the variable doesn't exist and no default is specified) + # (a no-op when both the variable doesn't exist and no default is specified) function setenv() { if [[ ! ${!1+x} ]] ; then if [[ $# -lt 2 ]] ; then return 0 ; fi - eval "export ${1}=\"$2\"" + # var not present assign to default and export + printf -v "${1}" "%s" "${2}" fi - if [[ ${!1} == *$'\n'* ]] ; then - # bash and github action multiline env vars compat - echo "${1}< Date: Thu, 28 Jul 2022 14:18:04 -0400 Subject: [PATCH 38/78] add fs_reset_sentinels.sh --- .github/fs_reset_sentinels.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/fs_reset_sentinels.sh diff --git a/.github/fs_reset_sentinels.sh b/.github/fs_reset_sentinels.sh new file mode 100644 index 00000000000..57c08b03b40 --- /dev/null +++ b/.github/fs_reset_sentinels.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu +test -d "${1}" || { echo "$0 expected builddir as first and only script argument" ; exit 1; } +sleep 2 && touch ${1}/packages/cmake_tracking/sentinel_installed || true +sleep 2 && touch `ls ${1}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true From e9e577cbb533fd281c608d1bac33534d4efb3642 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 6 Aug 2022 19:52:25 -0400 Subject: [PATCH 39/78] linux/clang fixes --- .github/fs_reset_sentinels.sh | 2 +- .github/fsenv.sh | 22 +++++++++++++++++----- indra/cmake/00-Common.cmake | 3 ++- indra/cmake/Copy3rdPartyLibs.cmake | 2 +- indra/newview/viewer_manifest.py | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/fs_reset_sentinels.sh b/.github/fs_reset_sentinels.sh index 57c08b03b40..186e6505d58 100644 --- a/.github/fs_reset_sentinels.sh +++ b/.github/fs_reset_sentinels.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -eu test -d "${1}" || { echo "$0 expected builddir as first and only script argument" ; exit 1; } +set -eu sleep 2 && touch ${1}/packages/cmake_tracking/sentinel_installed || true sleep 2 && touch `ls ${1}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true diff --git a/.github/fsenv.sh b/.github/fsenv.sh index a888eaaecbe..dedfe2c9986 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -16,6 +16,7 @@ function _fsenv() { # var not present assign to default and export printf -v "${1}" "%s" "${2}" fi + eval "export ${1}" emitvar "$@" } @@ -87,7 +88,7 @@ function _fsenv() { setenv AUTOBUILD_INSTALLABLE_CACHE ${GITHUB_WORKSPACE}/autobuild-cache setenv AUTOBUILD_LOGLEVEL --verbose - setenv AUTOBUILD_PLATFORM windows64 + setenv AUTOBUILD_PLATFORM ${os}64 setenv AUTOBUILD_ADDRSIZE 64 setenv AUTOBUILD_VSVER 164 setenv AUTOBUILD_CONFIGURATION ReleaseFS_open @@ -98,7 +99,11 @@ function _fsenv() { setenv PYTHONUTF8 1 setenv PreferredToolArchitecture x64 setenv VIEWER_VERSION_REVISION dev - setenv FSBUILD_DIR build-vc${AUTOBUILD_VSVER}-${AUTOBUILD_ADDRSIZE} + if [[ $os == windows ]] ; then + setenv FSBUILD_DIR build-vc${AUTOBUILD_VSVER}-${AUTOBUILD_ADDRSIZE} + else + setenv FSBUILD_DIR build-linux-x86_64 + fi setenv FSVS_TARGET Ninja # 'Visual Studio 16 2019' setenv VIEWER_VERSION_STR `echo $(cat indra/newview/VIEWER_VERSION.txt)`.${AUTOBUILD_BUILD_ID} @@ -106,8 +111,15 @@ function _fsenv() { setenv VIEWER_CHANNEL unset _fsenv } -_fsenv -# exec wrapped command line (if any) -if [[ -n $# ]] ; then + +if (return 0 2>/dev/null) ; then + # fsenv.sh was sourced ; export only + _fsenv > /dev/null +elif [[ -n $# ]] ; then + # fsenv.sh was passed subcommands ; export and execute + _fsenv > /dev/null "$@" +else + # fsenv.sh was called without arguments ; export and echo to stdout + _fsenv fi diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index e5c46e3e3ff..bbc21b998e1 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -254,6 +254,7 @@ endif (DARWIN) if (LINUX OR DARWIN) if (CMAKE_CXX_COMPILER MATCHES ".*clang") set(CMAKE_COMPILER_IS_CLANGXX 1) + add_link_options("-fuse-ld=lld") endif (CMAKE_CXX_COMPILER MATCHES ".*clang") if (CMAKE_COMPILER_IS_GNUCXX) @@ -300,7 +301,7 @@ else (USESYSTEMLIBS) ) endif (USESYSTEMLIBS) -if (NOT GENERATE_DEBUG_SYMBOLS) +if (WINDOWS AND NOT GENERATE_DEBUG_SYMBOLS) if (DEFINED ENV{CMAKE_DEBUG}) message(WARNING "DISENGAGING DEBUG SYMBOL GENERATION (removing /Z[oiI7]..)") endif() diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 37442668e52..761db4e2cad 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -227,7 +227,7 @@ elseif(LINUX) set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}") - set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") + set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}/../../lib32") set(vivox_libs libsndfile.so.1 libortp.so diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 19112fd0e3c..8bdadf40684 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1906,7 +1906,7 @@ def construct(self): self.path("launch_url.sh") self.path("install.sh") - with self.prefix(src=os.path.join(pkgdir, os.pardir, os.pardir, 'openvr', 'bin', 'linux64')): + with self.prefix(src=os.path.join(pkgdir, 'lib', 'release'), dst="lib"): self.path("libopenvr_api.so") with self.prefix(dst="bin"): From 6f4f3652cf50b608cdc28da427946af2ff8a9f8d Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 8 Aug 2022 15:27:28 -0400 Subject: [PATCH 40/78] draft changes for initial linux 3p-inline deps --- .github/3p/CompileWindows.autobuild-setup.sh | 4 +- .github/3p/_autobuild_prop_as_json.sh | 2 +- .../3p/build-cmds/3p-discord-rpc.build-cmd.sh | 21 ++- .../3p/build-cmds/3p-freetype.build-cmd.sh | 24 +++- .github/3p/build-cmds/3p-glod.build-cmd.sh | 58 ++++---- .../build-cmds/3p-ndPhysicsStub.build-cmd.sh | 38 +++-- .../3p/build-cmds/3p-openjpeg2.build-cmd.sh | 20 ++- .../3p/build-cmds/3p-openvr.autobuild.json | 8 +- .github/3p/build-cmds/3p-openvr.build-cmd.sh | 8 +- .github/3p/inline-build.sh | 1 + .github/fsenv.sh | 24 ++-- .github/workflows/CompileUbuntu.yml | 135 ++++++++++++++++++ 12 files changed, 277 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/CompileUbuntu.yml diff --git a/.github/3p/CompileWindows.autobuild-setup.sh b/.github/3p/CompileWindows.autobuild-setup.sh index 15efdcf1653..8a274997d29 100644 --- a/.github/3p/CompileWindows.autobuild-setup.sh +++ b/.github/3p/CompileWindows.autobuild-setup.sh @@ -11,12 +11,14 @@ assert_defined AUTOBUILD_INSTALLABLE_CACHE AUTOBUILD_CONFIG_FILE \ for x in $INLINE_FS3P_DEPS ; do echo "[[ $x ]]" + echo .github/fsenv.sh .github/3p/inline-build.sh 3p-inline "$INLINE_FS3P_GITURL/$x" time .github/3p/inline-build.sh 3p-inline "$INLINE_FS3P_GITURL/$x" echo done for x in $ALTERNATE_FS3P_DEPS ; do echo "[[ $x ]]" + echo .github/fsenv.sh .github/3p/use-alternate.sh $x time .github/3p/use-alternate.sh $x echo done @@ -25,7 +27,7 @@ done # create a sorted hash+url list to use for change detection and cache keys ( echo "import json; print(json.dumps((" ; autobuild installables print ; echo "), indent=4))" -) | python | jq -r ".[]|(.platforms.windows64//.platforms.common)|select(.)|.archive.hash+\"\t\"+.archive.url" \ +) | ${PYTHON_EXECUTABLE:-python3} | jq -r ".[]|(.platforms.${AUTOBUILD_PLATFORM}//.platforms.common)|select(.)|.archive.hash+\"\t\"+.archive.url" \ | sort -u | tee autobuild.xml.sorted.txt >&2 echo -n "// " >&2 diff --git a/.github/3p/_autobuild_prop_as_json.sh b/.github/3p/_autobuild_prop_as_json.sh index b4af8bdab44..3df0b991191 100644 --- a/.github/3p/_autobuild_prop_as_json.sh +++ b/.github/3p/_autobuild_prop_as_json.sh @@ -7,7 +7,7 @@ function autobuild_prop_as_json() { echo 'import json; print(json.dumps((' autobuild installables print $1 echo '), indent=4))' - ) | python | jq -r "(.platforms.windows64//.platforms.common)|$2" + ) | python | jq -r "(.platforms.$AUTOBUILD_PLATFORM//.platforms.common)|$2" } function autobuild_jq() { diff --git a/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh b/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh index c5e920f47b6..cc0e134b1b6 100644 --- a/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh +++ b/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh @@ -15,15 +15,26 @@ mkdir -p stage/lib/release mkdir -p stage/LICENSES mkdir -p stage/include/discord-rpc -wdflags=$(echo " - warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern C' function under -EHc. - warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified -" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') +wdflags= + +if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + wdflags=$(echo " + warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern C' function under -EHc. + warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified + " | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') +fi cmake -S $DISCORD_SOURCE_DIR -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="`echo $wdflags`" ninja -C build -cp -av build/src/discord-rpc.{lib,dll} stage/lib/release/ +if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + cp -av build/src/discord-rpc.{lib,dll} stage/lib/release/ +fi + +if [[ $AUTOBUILD_PLATFORM == linux* ]] ; then + cp -av build/src/libdiscord-rpc.so stage/lib/release/ +fi + cp -av $DISCORD_SOURCE_DIR/LICENSE stage/LICENSES/discord-rpc.txt cp -av $DISCORD_SOURCE_DIR/include/*.h stage/include/discord-rpc/ cp -av VERSION.txt stage/ diff --git a/.github/3p/build-cmds/3p-freetype.build-cmd.sh b/.github/3p/build-cmds/3p-freetype.build-cmd.sh index 857e0102919..9336ce3185d 100644 --- a/.github/3p/build-cmds/3p-freetype.build-cmd.sh +++ b/.github/3p/build-cmds/3p-freetype.build-cmd.sh @@ -17,14 +17,28 @@ mkdir -p $stage/include/freetype2/ mkdir -p $stage/LICENSES mkdir -p $stage/docs/freetype +if [[ $AUTOBUILD_PLATFORM == linux* ]] ; then + function cl() { + $CXX -fPIC "$@" + } + function lib() { + local args="${@/-out:/-shared -o }" + args="${args/freetype.lib/libfreetype.so}" + args="${args/.obj/.o}" + ld ${args} + } +fi pushd $FREETYPELIB_SOURCE_DIR SRCS=$(_dsp_sourcefiles builds/win32/visualc/freetype.dsp) - # tidy up some warnings - wdflags=$(echo " - warning C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size - warning C4311: 'type cast': pointer truncation from 'void *' to 'unsigned long' - " | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + wdflags= + if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + # tidy up some warnings + wdflags=$(echo " + warning C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size + warning C4311: 'type cast': pointer truncation from 'void *' to 'unsigned long' + " | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + fi set -x # -I$stage/packages/include/zlib-ng diff --git a/.github/3p/build-cmds/3p-glod.build-cmd.sh b/.github/3p/build-cmds/3p-glod.build-cmd.sh index 54c135f8674..4ab642d81f0 100644 --- a/.github/3p/build-cmds/3p-glod.build-cmd.sh +++ b/.github/3p/build-cmds/3p-glod.build-cmd.sh @@ -14,29 +14,39 @@ mkdir -p stage/lib/release GLOD_VERSION=$(grep -E '^GLOD [0-9]' README | head -1 | awk '{ print $2 }') echo "${GLOD_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt -DSPFILES=" - src/api/glodlib.dsp - src/mt/mt.dsp - src/ply/ply.dsp - src/vds/vdslib_glod.dsp - src/xbs/xbs.dsp -" -SRCS=$( - for dsp in $DSPFILES ; do - _dsp_sourcefiles "$dsp" -Tp - done -) -echo SRCS=$SRCS >&2 - -# tidy up some warnings -wdflags=$(echo " - warning C4838: conversion from '__int64' to 'int' requires a narrowing conversion - warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int' - warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type 'Tri *' -" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') - -cl -O2 -DNDEBUG -EHsc -DGLOD -D_MBCS -DGLOD_EXPORTS -Iinclude -Isrc/include -Isrc/mt -Isrc/xbs -Isrc/vds $wdflags $SRCS -LD -Feglod.dll - -cp -av glod.{lib,dll} stage/lib/release/ +if [[ $AUTOBUILD_PLATFORM == linux* ]] ; then + mkdir lib || true + make release -j + cp -av lib/*.a stage/lib/release/ +fi + +if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + + DSPFILES=" + src/api/glodlib.dsp + src/mt/mt.dsp + src/ply/ply.dsp + src/vds/vdslib_glod.dsp + src/xbs/xbs.dsp + " + SRCS=$( + for dsp in $DSPFILES ; do + _dsp_sourcefiles "$dsp" -Tp + done + ) + echo SRCS=$SRCS >&2 + + # tidy up some warnings + wdflags=$(echo " + warning C4838: conversion from '__int64' to 'int' requires a narrowing conversion + warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int' + warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type 'Tri *' + " | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + + cl -O2 -DNDEBUG -EHsc -DGLOD -D_MBCS -DGLOD_EXPORTS -Iinclude -Isrc/include -Isrc/mt -Isrc/xbs -Isrc/vds $wdflags $SRCS -LD -Feglod.dll + + cp -av glod.{lib,dll} stage/lib/release/ +fi + cp -av include/glod.h stage/include/glod/ cp -av LICENSE stage/LICENSES/GLOD.txt diff --git a/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh b/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh index abe06e97f66..868a74bcfed 100644 --- a/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh +++ b/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh @@ -9,23 +9,35 @@ mkdir -p stage/lib/release stage/include stage/LICENSES echo "1.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt -wdflags=$(echo " - warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits - warning C4244: '=': conversion from 'const double' to 'float', possible loss of data - warning C4267: 'argument': conversion from 'size_t' to 'const T', possible loss of data - warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. - warning C4477: 'sprintf' : format string '%lu' requires an argument of type 'unsigned long' -" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') - -# hacd="src/hacdGraph.cpp src/hacdHACD.cpp src/hacdICHull.cpp src/hacdManifoldMesh.cpp src/hacdMeshDecimator.cpp src/hacdMicroAllocator.cpp src/hacdRaycastMesh.cpp" -# nd_hacdConvexDecomposition="LLConvexDecomposition.cpp nd_hacdConvexDecomposition.cpp nd_hacdStructs.cpp nd_hacdUtils.cpp nd_EnterExitTracer.cpp nd_StructTracer.cpp" -# nd_Pathing="llpathinglib.cpp llphysicsextensions.cpp" -cxxflags="-D_WINDOWS -DNOMINMAX -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0 -W3 -GR -EHsc -MD -O2 -Ob2 -DNDEBUG" +wdflags= +cxxflags= +if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + wdflags=$(echo " + warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits + warning C4244: '=': conversion from 'const double' to 'float', possible loss of data + warning C4267: 'argument': conversion from 'size_t' to 'const T', possible loss of data + warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. + warning C4477: 'sprintf' : format string '%lu' requires an argument of type 'unsigned long' + " | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + + # hacd="src/hacdGraph.cpp src/hacdHACD.cpp src/hacdICHull.cpp src/hacdManifoldMesh.cpp src/hacdMeshDecimator.cpp src/hacdMicroAllocator.cpp src/hacdRaycastMesh.cpp" + # nd_hacdConvexDecomposition="LLConvexDecomposition.cpp nd_hacdConvexDecomposition.cpp nd_hacdStructs.cpp nd_hacdUtils.cpp nd_EnterExitTracer.cpp nd_StructTracer.cpp" + # nd_Pathing="llpathinglib.cpp llphysicsextensions.cpp" + cxxflags="-D_WINDOWS -DNOMINMAX -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0 -W3 -GR -EHsc -MD -O2 -Ob2 -DNDEBUG" +fi + cmake -Wno-dev -S . -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE="`echo $cxxflags $wdflags`" ninja -C build -cp -av build/Source/*/*.lib stage/lib/release/ +if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + cp -av build/Source/*/*.lib stage/lib/release/ +fi + +if [[ $AUTOBUILD_PLATFORM == linux* ]] ; then + cp -av build/Source/*/*.a stage/lib/release/ +fi + cp -av ndPhysicsStub.txt stage/LICENSES/ cp -av Source/lib/LLConvexDecomposition.h stage/include/llconvexdecomposition.h cp -av \ diff --git a/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh b/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh index 4eac92bd22c..f3ba64ecd9c 100644 --- a/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh +++ b/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh @@ -11,9 +11,12 @@ mkdir -p build stage/lib/release stage/lib/debug stage/include/openjpeg stage/LI echo "${OPENJPEG_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt -wdflags=$(echo " - warning C4267: '=': conversion from 'size_t' to 'OPJ_UINT32', possible loss of data -" | awk '{ print $2 }' | sed -e 's@C@/wd@; s@:$@@;') +wdflags= +if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + wdflags=$(echo " + warning C4267: '=': conversion from 'size_t' to 'OPJ_UINT32', possible loss of data + " | awk '{ print $2 }' | sed -e 's@C@/wd@; s@:$@@;') +fi cmake -Wno-dev -S src -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=" `echo $wdflags`" ninja -C build openjp2 @@ -21,5 +24,12 @@ ninja -C build openjp2 cp -av build/LICENSE.txt stage/LICENSES/openjpeg.txt cp -av src/src/lib/openjp2/{openjpeg.h,opj_stdint.h,event.h} stage/include/openjpeg/ cp -av build/src/lib/openjp2/opj_config.h stage/include/openjpeg/ -cp -av build/bin/openjp2{.dll,.lib} stage/lib/release/ -cp -av build/bin/openjp2{.dll,.lib} stage/lib/debug/ +if [[ $AUTOBUILD_PLATFORM == windows* ]] ; then + cp -av build/bin/openjp2{.dll,.lib} stage/lib/release/ + cp -av build/bin/openjp2{.dll,.lib} stage/lib/debug/ +fi +if [[ $AUTOBUILD_PLATFORM == linux* ]] ; then + cp -avL build/bin/libopenjp2.so stage/lib/release/ + cp -avL build/bin/libopenjp2.so stage/lib/debug/ +fi + diff --git a/.github/3p/build-cmds/3p-openvr.autobuild.json b/.github/3p/build-cmds/3p-openvr.autobuild.json index 2b0ca07c028..ad74aaf1f4a 100644 --- a/.github/3p/build-cmds/3p-openvr.autobuild.json +++ b/.github/3p/build-cmds/3p-openvr.autobuild.json @@ -17,8 +17,14 @@ "configurations": {"default":{"build":{},"default":"true","name":"default"}}, "manifest": [ "lib/release/openvr_api.lib", "lib/release/openvr_api.dll" ], "name": "windows64" + }, + "linux64": { + "build_directory": "stage", + "configurations": {"default":{"build":{},"default":"true","name":"default"}}, + "manifest": [ "lib/release/libopenvr_api.so" ], + "name": "linux64" } }, "version_file": "VERSION.txt" } -} \ No newline at end of file +} diff --git a/.github/3p/build-cmds/3p-openvr.build-cmd.sh b/.github/3p/build-cmds/3p-openvr.build-cmd.sh index 435211b39de..b4b056e000d 100644 --- a/.github/3p/build-cmds/3p-openvr.build-cmd.sh +++ b/.github/3p/build-cmds/3p-openvr.build-cmd.sh @@ -13,4 +13,10 @@ echo "${OPENVR_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt cp -av LICENSE stage/LICENSES/openvr.txt cp -av headers/openvr.h stage/include -cp -av bin/win64/openvr_api.dll lib/win64/openvr_api.lib stage/lib/release/ + +if [[ $AUTOBUILD_PLATFORM == windows64 ]] ; then + cp -av bin/win64/openvr_api.dll lib/win64/openvr_api.lib stage/lib/release/ +fi +if [[ $AUTOBUILD_PLATFORM == linux64 ]] ; then + cp -av bin/linux64/libopenvr_api.so stage/lib/release/ +fi diff --git a/.github/3p/inline-build.sh b/.github/3p/inline-build.sh index 82abec63ff3..bd17739f8c1 100644 --- a/.github/3p/inline-build.sh +++ b/.github/3p/inline-build.sh @@ -80,6 +80,7 @@ test -e $srcdir/.git || ( # patch build-cmd.sh cp -av $buildcmd $srcdir/build-cmd.sh +chmod a+x $srcdir/build-cmd.sh buildjson=$(dirname $0)/build-cmds/${NAME}.autobuild.json if [[ -f $buildjson && ! -f $srcdir/autobuild.xml ]] ; then echo "generating $NAME autobuild.xml from $buildjson" >&2 diff --git a/.github/fsenv.sh b/.github/fsenv.sh index dedfe2c9986..a45923f5147 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -38,6 +38,14 @@ function _fsenv() { setenv GHA_TEST_WITH_SPACES "testing \"1\" 2 3...tab\t." + if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then + case `uname -s` in + MINGW*) local os=windows GITHUB_WORKSPACE=$(pwd -W) ;; + *) local os=linux GITHUB_WORKSPACE=$PWD ;; + esac + fi + setenv _3P_UTILSDIR ${GITHUB_WORKSPACE}/.github/3p + ############################################################################ # workaround for github actions receiving 403: Forbidden errors when trying to # download prebuilts from 3p.firestormviewer.org @@ -48,12 +56,16 @@ function _fsenv() { ### setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries # format: packagerepo@gitcommit[#alias] + local growl= + if [[ $os == 'windows' ]] ; then + growl="holostorm/3p-gntp-growl@7ed68be" + fi setenv INLINE_FS3P_DEPS " holostorm/3p-discord-rpc@a21e3dc#3p-discord-rpc holostorm/3p-ndPhysicsStub@aad4d9e - holostorm/3p-freetype@a8975b6 + holostorm/3p-freetype@577c3bdc holostorm/3p-openjpeg2@d23ab9af - holostorm/3p-gntp-growl@7ed68be + $growl holostorm/3p-glod@eecf86f ValveSoftware/openvr@d9cffe2#3p-openvr " @@ -73,14 +85,6 @@ function _fsenv() { # https://bitbucket.org/kokua/3p-ndPhysicsStub/downloads/ndPhysicsStub-1.0-windows64-203290044.tar.bz2=bd172f8cf47ce5ba53a4d4128b2580d5 ############################################################################ - if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then - case `uname -s` in - MINGW*) local GITHUB_WORKSPACE=$(pwd -W) ;; - *) local GITHUB_WORKSPACE=$PWD ;; - esac - fi - setenv _3P_UTILSDIR ${GITHUB_WORKSPACE}/.github/3p - ### AUTOBUILD_ environment variables setenv AUTOBUILD_VARIABLES_FILE ${GITHUB_WORKSPACE}/fs-build-variables/variables diff --git a/.github/workflows/CompileUbuntu.yml b/.github/workflows/CompileUbuntu.yml new file mode 100644 index 00000000000..d75fb3fa4d9 --- /dev/null +++ b/.github/workflows/CompileUbuntu.yml @@ -0,0 +1,135 @@ +name: CompileUbuntu + +on: + # pull_request: + workflow_dispatch: + inputs: + llpackage: + description: 'build/package/upload firestorm installer (if false only autobuild configure and caching is performed)' + required: true + default: 'false' + +defaults: + run: + shell: bash + +jobs: + linux_build: + runs-on: ubuntu-latest + container: ubuntu:16.04 + env: + VIEWER_CHANNEL: VR-GHA + AUTOBUILD_BUILD_ID: 66221 + AUTOBUILD_CONFIGURATION: ReleaseFS_open + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Preset ENV + shell: bash + run: | + .github/fsenv.sh | tee -a $GITHUB_ENV + if [[ ! ${GITHUB_ACTIONS+x} ]] ; then #dev + set -ea && source <( .github/fsenv.sh ) && set +ea && test -n "$VIEWER_CHANNEL" -a -n "$FSBUILD_DIR" -a -n "$AUTOBUILD_VSVER" #dev + fi #dev + - name: Prep build dirs + shell: bash + run: | + df -h + mkdir $FSBUILD_DIR + - name: apt-get install + shell: bash + run: | + sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@master + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + architecture: x64 + - name: Workaround Firestorm Python.cmake + run: | + export PYTHON_EXECUTABLE=$(which python) #dev + echo PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} | tee -a $GITHUB_ENV + - name: Get software versions please + shell: bash + run: | + echo AUTOBUILD_INSTALLABLE_CACHE=$AUTOBUILD_INSTALLABLE_CACHE + echo PYTHON_EXECUTABLE=$PYTHON_EXECUTABLE + cmake --version + git --version + python --version + ninja --version + echo " " + df -h + - name: Install autobuild through PIP + run: | + which autobuild || pip install 'git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild' #dev + - name: generate sorted 3p-inline manifest + shell: bash + run: | + for x in $INLINE_FS3P_DEPS ; do echo $x ; done | sort -u | tee 3p-inline.sorted.txt + - name: cache -- 3p-inline + id: cached-3p-inline + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-3p-inline-${{ hashFiles('3p-inline.sorted.txt') }}-FirestormVR-GHA + path: | + 3p-inline/*/_results.env + 3p-inline/*/*.tar.bz2 + - name: Patch and build local 3p packages + # if: steps.cached-3p-inline.outputs.cache-hit != 'true' + shell: bash + run: | + .github/3p/CompileWindows.autobuild-setup.sh #dev + test -f autobuild.xml.sorted.txt + + - name: cache -- autobuild downloads + id: cached-downloads + uses: actions/cache@v2 + with: + path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} + key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA + + - name: cache -- buildir packages + id: cached-buildir-packages + uses: actions/cache@v2 + with: + path: ${{ env.FSBUILD_DIR }}/packages + key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA + + - name: Reset cached packages sentinels + # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' + shell: bash + run: | + .github/fs_reset_sentinels.sh ${FSBUILD_DIR} #dev + ls -lrt autobuild.xml ${FSBUILD_DIR}/packages/cmake_tracking/*_installed || true + + - name: Configure autobuild (ninja) + shell: bash + run: | + autobuild --version + test -n "${VIEWER_CHANNEL}" && test -n "${PYTHON_EXECUTABLE}" #dev + autobuild configure -- --no-vstools --ninja --package --openal --chan "${VIEWER_CHANNEL}" -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON #dev + - name: Build plugins (ninja) + if: ${{ github.event.inputs.llpackage == 'true' }} + run: | + ninja -C ${FSBUILD_DIR} SLPlugin media_plugin_cef #dev + - name: Build firestorm-bin (ninja) + if: ${{ github.event.inputs.llpackage == 'true' }} + run: | + ninja -C ${FSBUILD_DIR} firestorm-bin #dev + - name: Package (ninja) + if: ${{ github.event.inputs.llpackage == 'true' }} + run: | + ninja -C ${FSBUILD_DIR} llpackage #dev + - name: Upload Artifact (ninja) + if: ${{ github.event.inputs.llpackage == 'true' }} + uses: actions/upload-artifact@v2 + with: + name: ${{ format('{0}-{1}-{2}-{3}-{4}', runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH) }} + path: | + ${{ env.FSBUILD_DIR }}/newview/Phoenix*.tar.xz + autobuild.xml.sorted.txt + 3p-inline.sorted.txt From ae88b3bee7a16a40ea7c5b30aa980590c6888881 Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 25 May 2020 19:39:54 -0400 Subject: [PATCH 41/78] OpenAL test build --- .github/workflows/ccpp.yml | 83 + .gitmodules | 6 + fs-build-variables | 1 + indra/cmake/Copy3rdPartyLibs.cmake | 15 +- indra/llcommon/indra_constants.h | 2 +- indra/newview/CMakeLists.txt | 1 + indra/newview/llviewerVR.cpp | 2301 ++++++++++++++++++++++++++++ indra/newview/llviewerVR.h | 220 +++ indra/newview/llviewerdisplay.cpp | 46 +- indra/newview/viewer_manifest.py | 6 + openvr | 1 + 11 files changed, 2676 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ccpp.yml create mode 100644 .gitmodules create mode 160000 fs-build-variables create mode 100644 indra/newview/llviewerVR.cpp create mode 100644 indra/newview/llviewerVR.h create mode 160000 openvr diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml new file mode 100644 index 00000000000..131ac7532ea --- /dev/null +++ b/.github/workflows/ccpp.yml @@ -0,0 +1,83 @@ +name: C/C++ CI + +on: [push, pull_request] +defaults: + run: + shell: bash +jobs: + build: + strategy: + matrix: + os: [windows-latest, ubuntu-16.04] + build_type: [full] + runs-on: ${{matrix.os}} + env: + AUTOBUILD_VSVER: 120 + PreferredToolArchitecture: x64 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set env + if: startsWith(matrix.os, 'windows') + shell: cmd + run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables + - name: Set env apt + if: startsWith(matrix.os, 'ubuntu') + shell: bash + run: | + sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb + echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables + echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 + - name: Download VS2013 Community + if: startsWith(matrix.os, 'windows') + run: choco install visualstudiocommunity2013 + - name: Setup Ninja + if: startsWith(matrix.os, 'ubuntu') + uses: seanmiddleditch/gha-setup-ninja@master + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + architecture: x64 + - name: Get software versions please + run: | + cmake --version + git --version + python --version + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + - name: Get autobuild version + run: autobuild --version + - name: Configure autobuild + if: startsWith(matrix.os, 'windows') + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE + - name: Configure autobuild + if: startsWith(matrix.os, 'ubuntu') + shell: bash + run: | + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - name: Build & Package + if: startsWith(matrix.os, 'windows') + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount /detailedsummary + - name: Build & Package + if: startsWith(matrix.os, 'ubuntu') + shell: bash + run: | + autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'windows') + with: + name: fs-windows-gha-artifact + path: build-vc120-64/newview/Release/*_Setup.exe + - uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'ubuntu') + with: + name: fs-ubuntu-gha-artifact + path: build-linux-x86_64/newview/Phoenix*.tar.* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..721f2982d2d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "openvr"] + path = openvr + url = https://github.com/ValveSoftware/openvr +[submodule "fs-build-variables"] + path = fs-build-variables + url = https://vcs.firestormviewer.org/fs-build-variables diff --git a/fs-build-variables b/fs-build-variables new file mode 160000 index 00000000000..5a8faeb41bc --- /dev/null +++ b/fs-build-variables @@ -0,0 +1 @@ +Subproject commit 5a8faeb41bc540aa49467647d0699c4040bced7a diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index bdeac63e5a3..c628a4a36dc 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -30,6 +30,8 @@ if(WINDOWS) set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo") set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}/Release") + set(openvr_src_dir ${CMAKE_SOURCE_DIR}/../openvr/bin/win64) + set(openvr_files openvr_api.dll) #******************************* # VIVOX - *NOTE: no debug version set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") @@ -223,8 +225,10 @@ elseif(LINUX) set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}") + set(openvr_src_dir ${CMAKE_SOURCE_DIR}/../openvr/bin/linux64) + set(openvr_files libopenvr_api.so) - set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}/../../lib32/") + set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(vivox_libs libsndfile.so.1 libortp.so @@ -255,8 +259,6 @@ elseif(LINUX) libuuid.so.16.0.22 libfontconfig.so.1.8.0 libfontconfig.so.1 - libaprutil-1.so.0 - libapr-1.so.0 ) else (NOT USESYSTEMLIBS) set(release_files @@ -293,6 +295,13 @@ endif(WINDOWS) ################################################################ # Done building the file lists, now set up the copy commands. ################################################################ +copy_if_different( + ${openvr_src_dir} + "${SHARED_LIB_STAGING_DIR_RELEASE}" + out_targets + ${openvr_files} + ) +set(third_party_targets ${third_party_targets} ${out_targets}) # Curiously, slvoice_files are only copied to SHARED_LIB_STAGING_DIR_RELEASE. # It's unclear whether this is oversight or intentional, but anyway leave the diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 937f1a55012..6f606523ffa 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -32,7 +32,7 @@ class LLUUID; // Centralize definition of application name -const std::string APP_NAME = "Firestorm"; +const std::string APP_NAME = "FirestormVR"; static const F32 REGION_WIDTH_METERS = 256.f; static const S32 REGION_WIDTH_UNITS = 256; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 7b27730bbaf..3285a180f26 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2555,6 +2555,7 @@ endif (WINDOWS) if (LINUX) target_link_libraries(${VIEWER_BINARY_NAME} "dl" ) + target_link_libraries(${VIEWER_BINARY_NAME} openvr_api) endif (LINUX) set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH diff --git a/indra/newview/llviewerVR.cpp b/indra/newview/llviewerVR.cpp new file mode 100644 index 00000000000..84809bc909d --- /dev/null +++ b/indra/newview/llviewerVR.cpp @@ -0,0 +1,2301 @@ +#include "llviewerprecompiledheaders.h" +#include "llviewerVR.h" +#include "llviewerwindow.h" +#ifdef _WIN32 +#include "llwindowwin32.h" +#endif +#include "llviewercontrol.h" +#include "llviewercamera.h" +#include "llagentcamera.h" +#include "pipeline.h" +#include "llagent.h" +#ifdef _WIN32 +#include "llkeyboardwin32.h" +#endif +#include "llui.h" + +#include "llfloaterreg.h" +#include +#include +#include +//#include "llrender.h" + +#ifdef _WIN32 +#pragma comment(lib, "../../openvr/lib/win64/openvr_api.lib") +#endif + +#ifndef _WIN32 +#define sprintf_s(buffer, buffer_size, stringbuffer, ...) (sprintf(buffer, stringbuffer, __VA_ARGS__)) +#endif + +//#include +//#include +llviewerVR::llviewerVR() +{ + gHMD = NULL; + gRenderModels = NULL; + leftEyeDesc.m_nResolveTextureId = 0; + rightEyeDesc.m_nResolveTextureId = 0; + hud_textp = NULL; + m_kEditKey = KEY_F4; + m_kDebugKey = KEY_F3; + m_kMenuKey = KEY_F5; + m_kPlusKey = KEY_F6; + m_kMinusKey = KEY_F7; + m_fEyeDistance = 40; + m_fFocusDistance = 10; + m_fTextureShift = 0; + m_fTextureZoom = 0; + m_fFOV = 100; + + /*if (!LLKeyboard::keyFromString("x", &m_kEditKey)) + { + // If the call failed, don't match any key. + //key = KEY_NONE; + }*/ +} +LLPanel* panelp = NULL; +//GLenum err; + +llviewerVR::~llviewerVR() +{ +} + +/*glh::matrix4f ConvertSteamVRMatrixToMatrix4(const vr::HmdMatrix34_t &matPose) +{ +glh::matrix4f matrixObj( +matPose.m[0][0], matPose.m[1][0], matPose.m[2][0], 0.0, +matPose.m[0][1], matPose.m[1][1], matPose.m[2][1], 0.0, +matPose.m[0][2], matPose.m[1][2], matPose.m[2][2], 0.0, +matPose.m[0][3], matPose.m[1][3], matPose.m[2][3], 1.0f +); +return matrixObj; +}*/ +//unused +vr::HmdQuaternion_t llviewerVR::GetRotation(vr::HmdMatrix34_t matrix) { + vr::HmdQuaternion_t q; + + q.w = sqrt(fmax(0, 1 + matrix.m[0][0] + matrix.m[1][1] + matrix.m[2][2])) / 2; + q.x = sqrt(fmax(0, 1 + matrix.m[0][0] - matrix.m[1][1] - matrix.m[2][2])) / 2; + q.y = sqrt(fmax(0, 1 - matrix.m[0][0] + matrix.m[1][1] - matrix.m[2][2])) / 2; + q.z = sqrt(fmax(0, 1 - matrix.m[0][0] - matrix.m[1][1] + matrix.m[2][2])) / 2; + q.x = copysign(q.x, matrix.m[2][1] - matrix.m[1][2]); + q.y = copysign(q.y, matrix.m[0][2] - matrix.m[2][0]); + q.z = copysign(q.z, matrix.m[1][0] - matrix.m[0][1]); + return q; +} + +LLMatrix4 llviewerVR::ConvertGLHMatrix4ToLLMatrix4(glh::matrix4f m) +{ + LLMatrix4 mout; + mout.mMatrix[0][0] = m.element(0, 0); + mout.mMatrix[0][1] = m.element(1, 0); + mout.mMatrix[0][2] = m.element(2, 0); + mout.mMatrix[0][3] = m.element(3, 0); + + mout.mMatrix[1][0] = m.element(0, 1); + mout.mMatrix[1][1] = m.element(1, 1); + mout.mMatrix[1][2] = m.element(2, 1); + mout.mMatrix[1][3] = m.element(3, 1); + + mout.mMatrix[2][0] = m.element(0, 2); + mout.mMatrix[2][1] = m.element(1, 2); + mout.mMatrix[2][2] = m.element(2, 2); + mout.mMatrix[2][3] = m.element(3, 2); + + mout.mMatrix[3][0] = m.element(0, 3); + mout.mMatrix[3][1] = m.element(1, 3); + mout.mMatrix[3][2] = m.element(2, 3); + mout.mMatrix[3][3] = m.element(3, 3); + return mout; +} + +glh::matrix4f llviewerVR::ConvertSteamVRMatrixToMatrix42(const vr::HmdMatrix34_t &matPose) +{ + //vr::HmdQuaternion_t q = GetRotation(matPose); + + //gHMDQuat.set(q.x,q.y,q.z,q.w); + + glh::matrix4f matrixObj( + matPose.m[0][0], matPose.m[1][0], matPose.m[2][0], 0.0, + matPose.m[0][1], matPose.m[1][1], matPose.m[2][1], 0.0, + matPose.m[0][2], matPose.m[1][2], matPose.m[2][2], 0.0, + matPose.m[0][3], matPose.m[1][3], matPose.m[2][3], 1.0 + //0, 0, 0, 1.0f + ); + + //LLMatrix4 mat((F32*)matPose.m); + //gHMDQuat.setQuat(mat); + + + //m_nPos.v[0] = matPose.m[0][3]; + //m_nPos.v[1] = matPose.m[2][3]; + //m_nPos.v[2] = matPose.m[1][3]; + + //gHMDAxes.mV[0] = atan2(matPose.m[1][0], matPose.m[0][0]);// *57.2957795;//yaw + //gHMDAxes.mV[2] = atan2(matPose.m[2][1], matPose.m[2][2]);// *57.2957795;//pitch + + //gHMDAxes.mV[0] = matPose.m[2][0]; + //gHMDAxes.mV[1] = matPose.m[2][1]; + //gHMDAxes.mV[2] = matPose.m[2][2]; + return matrixObj; +} + +glh::matrix4f llviewerVR::GetHMDMatrixProjectionEye(vr::Hmd_Eye nEye) +{ + if (gHMD == NULL) + return glh::matrix4f(); + + vr::HmdMatrix44_t mat = gHMD->GetProjectionMatrix(nEye, m_fNearClip, m_fFarClip); + + return glh::matrix4f( + mat.m[0][0], mat.m[1][0], mat.m[2][0], mat.m[3][0], + mat.m[0][1], mat.m[1][1], mat.m[2][1], mat.m[3][1], + mat.m[0][2], mat.m[1][2], mat.m[2][2], mat.m[3][2], + mat.m[0][3], mat.m[1][3], mat.m[2][3], mat.m[3][3] + ); +} + +glh::matrix4f llviewerVR::GetHMDMatrixPoseEye(vr::Hmd_Eye nEye) +{ + if (gHMD == NULL) + return glh::matrix4f(); + + vr::HmdMatrix34_t matEyeRight = gHMD->GetEyeToHeadTransform(nEye); + return glh::matrix4f( + matEyeRight.m[0][0], matEyeRight.m[1][0], matEyeRight.m[2][0], 0.0, + matEyeRight.m[0][1], matEyeRight.m[1][1], matEyeRight.m[2][1], 0.0, + matEyeRight.m[0][2], matEyeRight.m[1][2], matEyeRight.m[2][2], 0.0, + matEyeRight.m[0][3], matEyeRight.m[1][3], matEyeRight.m[2][3], 1.0f + ); + //glh::matrix4f mt; + //return matrixObj.inverse(); + //gluInvertMatrix(matrixObj.m, mt.m); + //return matrixObj; +} + +//unused Gives the projection matrix for an eye with HMD and IPD offsets. Add positional camera offset???? + +//Copy both matrices at startup????? +glh::matrix4f llviewerVR::GetCurrentViewProjectionMatrix(vr::Hmd_Eye nEye) +{ + if (gHMD == NULL) + return glh::matrix4f(); + return GetHMDMatrixProjectionEye(nEye) * GetHMDMatrixPoseEye(nEye) * m_mat4HMDPose; +} + +//debug func +std::string llviewerVR::MatrixToStr(glh::matrix4f mat, std::string name) +{ + + std::string str(name); + glh::ns_float::vec4 row; + row = mat.get_row(0); + str.append("\nLf Row 0 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" >\n "); + + row = mat.get_row(1); + str.append("Up Row 1 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n "); + + row = mat.get_row(2); + str.append("Fw Row 2 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n "); + + row = mat.get_row(3); + str.append("po Row 3 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(-row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n\n "); + + + + + + + return str; +} + +//Debug func +std::string llviewerVR::MatrixToStrLL(glh::matrix4f mat, std::string name) +{ + + std::string str(name); + glh::ns_float::vec4 row; + row = mat.get_row(0); + str.append("\nLf Row 0 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" >\n "); + + row = mat.get_row(1); + str.append("Up Row 1 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + + str.append(" > \n "); + + row = mat.get_row(2); + str.append("Fw Row 2 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n "); + + row = mat.get_row(3); + str.append("po Row 3 =< "); + str.append(std::to_string(row.v[0])); + str.append(" , "); + str.append(std::to_string(row.v[1])); + str.append(" , "); + str.append(std::to_string(row.v[2])); + str.append(" , "); + str.append(std::to_string(row.v[3])); + str.append(" > \n\n "); + + + + + + + return str; +} + +bool llviewerVR::gluInvertMatrix(const float m[16], float invOut[16]) +{ + float inv[16], det; + int i; + + inv[0] = m[5] * m[10] * m[15] - + m[5] * m[11] * m[14] - + m[9] * m[6] * m[15] + + m[9] * m[7] * m[14] + + m[13] * m[6] * m[11] - + m[13] * m[7] * m[10]; + + inv[4] = -m[4] * m[10] * m[15] + + m[4] * m[11] * m[14] + + m[8] * m[6] * m[15] - + m[8] * m[7] * m[14] - + m[12] * m[6] * m[11] + + m[12] * m[7] * m[10]; + + inv[8] = m[4] * m[9] * m[15] - + m[4] * m[11] * m[13] - + m[8] * m[5] * m[15] + + m[8] * m[7] * m[13] + + m[12] * m[5] * m[11] - + m[12] * m[7] * m[9]; + + inv[12] = -m[4] * m[9] * m[14] + + m[4] * m[10] * m[13] + + m[8] * m[5] * m[14] - + m[8] * m[6] * m[13] - + m[12] * m[5] * m[10] + + m[12] * m[6] * m[9]; + + inv[1] = -m[1] * m[10] * m[15] + + m[1] * m[11] * m[14] + + m[9] * m[2] * m[15] - + m[9] * m[3] * m[14] - + m[13] * m[2] * m[11] + + m[13] * m[3] * m[10]; + + inv[5] = m[0] * m[10] * m[15] - + m[0] * m[11] * m[14] - + m[8] * m[2] * m[15] + + m[8] * m[3] * m[14] + + m[12] * m[2] * m[11] - + m[12] * m[3] * m[10]; + + inv[9] = -m[0] * m[9] * m[15] + + m[0] * m[11] * m[13] + + m[8] * m[1] * m[15] - + m[8] * m[3] * m[13] - + m[12] * m[1] * m[11] + + m[12] * m[3] * m[9]; + + inv[13] = m[0] * m[9] * m[14] - + m[0] * m[10] * m[13] - + m[8] * m[1] * m[14] + + m[8] * m[2] * m[13] + + m[12] * m[1] * m[10] - + m[12] * m[2] * m[9]; + + inv[2] = m[1] * m[6] * m[15] - + m[1] * m[7] * m[14] - + m[5] * m[2] * m[15] + + m[5] * m[3] * m[14] + + m[13] * m[2] * m[7] - + m[13] * m[3] * m[6]; + + inv[6] = -m[0] * m[6] * m[15] + + m[0] * m[7] * m[14] + + m[4] * m[2] * m[15] - + m[4] * m[3] * m[14] - + m[12] * m[2] * m[7] + + m[12] * m[3] * m[6]; + + inv[10] = m[0] * m[5] * m[15] - + m[0] * m[7] * m[13] - + m[4] * m[1] * m[15] + + m[4] * m[3] * m[13] + + m[12] * m[1] * m[7] - + m[12] * m[3] * m[5]; + + inv[14] = -m[0] * m[5] * m[14] + + m[0] * m[6] * m[13] + + m[4] * m[1] * m[14] - + m[4] * m[2] * m[13] - + m[12] * m[1] * m[6] + + m[12] * m[2] * m[5]; + + inv[3] = -m[1] * m[6] * m[11] + + m[1] * m[7] * m[10] + + m[5] * m[2] * m[11] - + m[5] * m[3] * m[10] - + m[9] * m[2] * m[7] + + m[9] * m[3] * m[6]; + + inv[7] = m[0] * m[6] * m[11] - + m[0] * m[7] * m[10] - + m[4] * m[2] * m[11] + + m[4] * m[3] * m[10] + + m[8] * m[2] * m[7] - + m[8] * m[3] * m[6]; + + inv[11] = -m[0] * m[5] * m[11] + + m[0] * m[7] * m[9] + + m[4] * m[1] * m[11] - + m[4] * m[3] * m[9] - + m[8] * m[1] * m[7] + + m[8] * m[3] * m[5]; + + inv[15] = m[0] * m[5] * m[10] - + m[0] * m[6] * m[9] - + m[4] * m[1] * m[10] + + m[4] * m[2] * m[9] + + m[8] * m[1] * m[6] - + m[8] * m[2] * m[5]; + + det = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12]; + + if (det == 0) + return false; + + det = 1.0 / det; + + for (i = 0; i < 16; i++) + invOut[i] = inv[i] * det; + + return true; +} + +void llviewerVR::UpdateHMDMatrixPose() +{ + if (gHMD == NULL) + return; + /// for somebody asking for the default figure out the time from now to photons. + /* float fSecondsSinceLastVsync; + gHMD->GetTimeSinceLastVsync(&fSecondsSinceLastVsync, NULL); + + float fDisplayFrequency = gHMD->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float); + float fFrameDuration = 1.f / fDisplayFrequency; + float fVsyncToPhotons = gHMD->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SecondsFromVsyncToPhotons_Float); + + float fPredictedSecondsFromNow = fFrameDuration - fSecondsSinceLastVsync + fVsyncToPhotons;*/ + + + + + vr::VRCompositor()->WaitGetPoses(gTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, NULL, 0); + + m_iValidPoseCount = 0; + m_strPoseClasses = ""; + for (int nDevice = 0; nDevice < vr::k_unMaxTrackedDeviceCount; ++nDevice) + { + if (gTrackedDevicePose[nDevice].bPoseIsValid) + { + m_iValidPoseCount++; + m_rmat4DevicePose[nDevice] = ConvertSteamVRMatrixToMatrix42(gTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking); + if (m_rDevClassChar[nDevice] == 0) + { + switch (gHMD->GetTrackedDeviceClass(nDevice)) + { + case vr::TrackedDeviceClass_Controller: m_rDevClassChar[nDevice] = 'C'; break; + case vr::TrackedDeviceClass_HMD: m_rDevClassChar[nDevice] = 'H'; break; + case vr::TrackedDeviceClass_Invalid: m_rDevClassChar[nDevice] = 'I'; break; + case vr::TrackedDeviceClass_GenericTracker: m_rDevClassChar[nDevice] = 'G'; break; + case vr::TrackedDeviceClass_TrackingReference: m_rDevClassChar[nDevice] = 'T'; break; + default: m_rDevClassChar[nDevice] = '?'; break; + } + } + m_strPoseClasses += m_rDevClassChar[nDevice]; + } + } + + if (gTrackedDevicePose[vr::k_unTrackedDeviceIndex_Hmd].bPoseIsValid) + { + m_mat4HMDPose = m_rmat4DevicePose[vr::k_unTrackedDeviceIndex_Hmd]; + //gM4HMDPose = ConvertGLHMatrix4ToLLMatrix4(m_mat4HMDPose); + //gM4HMDPose.invert; + //gluInvertMatrix(m_rmat4DevicePose[vr::k_unTrackedDeviceIndex_Hmd].m, m_mat4HMDPose.m); + //m_mat4HMDPose.inverse(); + } +} + +std::string llviewerVR::GetTrackedDeviceString(vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_t unDevice, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *peError ) +{ + uint32_t unRequiredBufferLen = pHmd->GetStringTrackedDeviceProperty(unDevice, prop, NULL, 0, peError); + if (unRequiredBufferLen == 0) + return ""; + + char *pchBuffer = new char[unRequiredBufferLen]; + unRequiredBufferLen = pHmd->GetStringTrackedDeviceProperty(unDevice, prop, pchBuffer, unRequiredBufferLen, peError); + std::string sResult = pchBuffer; + delete[] pchBuffer; + return sResult; +} + +void llviewerVR::SetupCameras() +{ + m_mat4ProjectionLeft = GetHMDMatrixProjectionEye(vr::Eye_Left); + //gM4eyeProjectionLeft = ConvertGLHMatrix4ToLLMatrix4(m_mat4ProjectionLeft); + + m_mat4ProjectionRight = GetHMDMatrixProjectionEye(vr::Eye_Right); + //gM4eyeProjectionRight = ConvertGLHMatrix4ToLLMatrix4(m_mat4ProjectionRight); + + m_mat4eyePosLeft = GetHMDMatrixPoseEye(vr::Eye_Left); + //gM4eyePosLeft = ConvertGLHMatrix4ToLLMatrix4(m_mat4eyePosLeft); + //gM4eyePosLeft.invert(); + + m_mat4eyePosRight = GetHMDMatrixPoseEye(vr::Eye_Right); + //gM4eyePosRight = ConvertGLHMatrix4ToLLMatrix4(m_mat4eyePosRight); + //gM4eyePosRight.invert(); +} + +bool llviewerVR::CreateFrameBuffer(int nWidth, int nHeight, FramebufferDesc &framebufferDesc) +{ + /*glGenFramebuffers(1, &framebufferDesc.m_nRenderFramebufferId); + glBindFramebuffer(GL_FRAMEBUFFER, framebufferDesc.m_nRenderFramebufferId); + + glGenRenderbuffers(1, &framebufferDesc.m_nDepthBufferId); + glBindRenderbuffer(GL_RENDERBUFFER, framebufferDesc.m_nDepthBufferId); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT, nWidth, nHeight); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, framebufferDesc.m_nDepthBufferId); + + glGenTextures(1, &framebufferDesc.m_nRenderTextureId); + glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, framebufferDesc.m_nRenderTextureId); + glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGBA8, nWidth, nHeight, true); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, framebufferDesc.m_nRenderTextureId, 0); + */ + if (framebufferDesc.m_nResolveTextureId) + { + glDeleteTextures(1, &framebufferDesc.m_nResolveTextureId); + //glDeleteFramebuffers(1, &framebufferDesc.mFBO) + } + else + { + glGenFramebuffers(1, &framebufferDesc.mFBO); + + } + glBindFramebuffer(GL_FRAMEBUFFER, framebufferDesc.mFBO); + glGenTextures(1, &framebufferDesc.m_nResolveTextureId); + glBindTexture(GL_TEXTURE_2D, framebufferDesc.m_nResolveTextureId); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebufferDesc.m_nResolveTextureId, 0); + + // check FBO status + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) + { + return false; + } + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + return true; +} + +void llviewerVR::vrStartup(bool is_shutdown) +{ + //static LLCachedControl vrEn(gSavedSettings, "EnableVR"); + //m_bVrEnabled = false;//gPipeline.EnableSteamVR; + + /*hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); + hud_textp->setZCompare(FALSE); + LLColor4 color(1, 1, 1); + hud_textp->setColor(color); + LLVector3 s = LLViewerCamera::getInstance()->getAtAxis(); + + hud_textp->setPositionAgent(gAgent.getPositionAgent() - s); + std::string str("This is the hud test"); + hud_textp->setString(str); + hud_textp->setHidden(FALSE);*/ + + + if (m_bVrEnabled && !is_shutdown) + { + if (gHMD == NULL) + { + gVRInitComplete = FALSE; + vr::EVRInitError eError = vr::VRInitError_None; + gHMD = vr::VR_Init(&eError, vr::VRApplication_Scene); + m_strHudText="Initializing VR driver!"; + //hud_textp->setString(m_strHudText); + + if (eError != vr::VRInitError_None) + { + gHMD = NULL; + char buf[1024]; + sprintf_s(buf, sizeof(buf), "\nERROR Unable to init VR runtime: %s", vr::VR_GetVRInitErrorAsEnglishDescription(eError)); + m_strHudText.append( buf); + //return false; + } + else + { + m_strDriver = "No Driver"; + m_strDisplay = "No Display"; + + m_strDriver = GetTrackedDeviceString(gHMD, vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_TrackingSystemName_String); + m_strDisplay = GetTrackedDeviceString(gHMD, vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SerialNumber_String); + m_strHudText.append("\nDriver = "); + m_strHudText.append(m_strDriver); + m_strHudText.append("\nDisplay = "); + m_strHudText.append(m_strDriver); + m_strHudText.append("\nVR driver! Initialized"); + + } + + eError = vr::VRInitError_None; + if (gHMD != NULL) + gRenderModels = (vr::IVRRenderModels *)vr::VR_GetGenericInterface(vr::IVRRenderModels_Version, &eError); + + if (!gRenderModels) + { + gHMD = NULL; + vr::VR_Shutdown(); + + char buf[1024]; + sprintf_s(buf, sizeof(buf), "\nERROR Unable to get render model interface: %s", vr::VR_GetVRInitErrorAsEnglishDescription(eError)); + m_strHudText.append(buf); + //SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "VR_Init Failed", buf, NULL); + //return false; + } + eError = vr::VRInitError_None; + + if (!vr::VRCompositor()) + { + + char buf[1024]; + sprintf_s(buf, sizeof(buf), "\nERROR No compositor interface: %s", vr::VR_GetVRInitErrorAsEnglishDescription(eError)); + m_strHudText.append(buf); + gHMD = NULL; + vr::VR_Shutdown(); + + } + if (gHMD != NULL && !gVRInitComplete) + { + gVRInitComplete = TRUE; + vr::VRCompositor()->SetTrackingSpace(vr::TrackingUniverseSeated); + gHMD->GetRecommendedRenderTargetSize(&m_nRenderWidth, &m_nRenderHeight); + + //m_nRenderHeight = 1440; + //m_nRenderWidth = 1440; + //if (leftEyeDesc.m_nResolveTextureId == NULL) + CreateFrameBuffer(m_nRenderWidth, m_nRenderHeight, leftEyeDesc); + //if (rightEyeDesc.m_nResolveTextureId == NULL) + CreateFrameBuffer(m_nRenderWidth, m_nRenderHeight, rightEyeDesc); + SetupCameras(); + //vr::VRCompositor()->ForceInterleavedReprojectionOn(true); + //vr::VRCompositor()->SetTrackingSpace(vr::); + //m_tTimer1.start(); + + m_strHudText.append("\nCreating frame buffers."); + + + + + } + if(gVRInitComplete) + m_strHudText.append("\nVR driver ready.\n Press TAB to enter VR mode."); + hud_textp->setString(m_strHudText); + m_strHudText = ""; + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(FALSE); + } + } + else if (gHMD || is_shutdown) + { + m_bVrActive = FALSE; + vr::VR_Shutdown(); + gHMD = NULL; + gVRInitComplete = FALSE; + //m_tTimer1.stop(); + //m_tTimer1.cleanupClass(); + } + +} + +bool llviewerVR::ProcessVRCamera() +{ + + if (hud_textp == NULL) + { + + + hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); + if (hud_textp != NULL) + { + hud_textp->setZCompare(FALSE); + LLColor4 color(1, 1, 1); + hud_textp->setColor(color); + hud_textp->setHidden(FALSE); + hud_textp->setMaxLines(-1); + + m_strHudText.append("Press CTRL+TAB to enable or disable VR mode\n Press TAB to remove this message"); + hud_textp->setString(m_strHudText); + m_strHudText = ""; + } + + } + else + { + m_vdir = LLViewerCamera::getInstance()->getAtAxis(); + m_vpos = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 end = m_vpos + (m_vdir)* 1.0f; + hud_textp->setPositionAgent(end); + } + + + if (gHMD == NULL) + { + return FALSE; + } + if (m_bVrActive)//gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + InitUI(); + //m_fNearClip = LLViewerCamera::getInstance()->getNear(); + //m_fFarClip = LLViewerCamera::getInstance()->getFar(); + LLViewerCamera::getInstance()->setNear(0.001); + + + + if (!leftEyeDesc.IsReady && !rightEyeDesc.IsReady)//Starting rendering with first (left) eye of stereo rendering + { + + + //Set the windows max size and aspect ratio to fit with the HMD. +#ifdef _WIN32 + int scrsize = GetSystemMetrics(SM_CYSCREEN); + if (GetSystemMetrics(SM_CXSCREEN) < scrsize) + scrsize = GetSystemMetrics(SM_CXSCREEN); +#else + int scrsize = 1080; +#endif + LLWindow * WI; + WI = gViewerWindow->getWindow(); + WI->getCursorPosition(&m_MousePos); + + LLCoordWindow m_ScrSize; + LLCoordWindow m_ScrSizeOld; + + WI->getSize(&m_ScrSizeOld); + float mult = (float)m_nRenderWidth / (float)m_nRenderHeight; + if (m_nRenderHeightsetSize(m_ScrSize); + } + //Constrain the cursor to the viewer window. + if (m_MousePos.mX >= m_ScrSize.mX) + m_MousePos.mX = m_ScrSize.mX - 1; + else if (m_MousePos.mX < 1) + m_MousePos.mX = 1; + if (m_MousePos.mY >= m_ScrSize.mY) + m_MousePos.mY = m_ScrSize.mY - 1; + else if (m_MousePos.mY < 1) + m_MousePos.mY = 1; + + m_iHalfWidth = m_ScrSize.mX / 2; + m_iHalfHeight = m_ScrSize.mY / 2; + m_iThirdWidth = m_ScrSize.mX / 3; + m_iThirdHeight = m_ScrSize.mY / 3; + + + //Store current camera values + m_vdir_orig = LLViewerCamera::getInstance()->getAtAxis(); + m_vup_orig = LLViewerCamera::getInstance()->getUpAxis(); + m_vleft_orig = LLViewerCamera::getInstance()->getLeftAxis(); + m_vpos_orig = LLViewerCamera::getInstance()->getOrigin(); + + if (!m_bEditActive)// unlock HMD's rotation input. + { + //convert HMD matrix in to direction vectors that work with SL + glh::ns_float::vec4 row = m_mat4HMDPose.get_row(2); + m_vdir.setVec(row.v[0], -row.v[2], row.v[1]); + + row = m_mat4HMDPose.get_row(1); + m_vup.setVec(row.v[0], -row.v[2], row.v[1]); + + row = m_mat4HMDPose.get_row(0); + m_vleft.setVec(row.v[0], -row.v[2], row.v[1]); + + row = m_mat4HMDPose.get_row(3); + gHmdPos.setVec(row.v[0], -row.v[2], row.v[1]); + + if (gHmdOffsetPos.mV[VZ] == 0) + { + gHmdOffsetPos = gHmdPos; + } + + LLQuaternion qCameraOrig(m_vdir_orig, m_vleft_orig, m_vup_orig); + float r3; + float p3; + float y3; + qCameraOrig.getEulerAngles(&r3, &p3, &y3); + + //convert HMD euler angles to to quat rotation + LLQuaternion qHMDRot(m_vdir, m_vleft, m_vup); + float r1; + float p1; + float y1; + qHMDRot.getEulerAngles(&r1, &p1, &y1); + + //make a quat of the sl camera rotation + LLQuaternion qCameraOffset; + qCameraOffset.setEulerAngles(r3, p3, y3 - (m_fCamRotOffset * DEG_TO_RAD)); + //Offset player camera with the HMD rotation + qHMDRot = qHMDRot*qCameraOffset; + gHMDQuat = qHMDRot; + + + LLMatrix3 m3 = qHMDRot.getMatrix3(); + m_vdir = -m3.getFwdRow(); + m_vup = m3.getUpRow(); + m_vleft = m3.getLeftRow(); + m_vdir.normalize(); + m_vup.normalize(); + m_vleft.normalize(); + + m_vpos = m_vpos_orig + (((gHmdPos - gHmdOffsetPos))* (qCameraOffset)); + } + else //lock HMD's rotation input for inworld object editing purposes. + { + m_vdir = m_vdir_orig; + m_vup = m_vup_orig; + m_vleft = m_vleft_orig; + m_vpos = m_vpos_orig; + } + + + if (m_iMenuIndex) + { + hud_textp->setString(Settings()); + LLVector3 end = m_vpos + m_vdir * 1.0f; + hud_textp->setPositionAgent(end); + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(FALSE); + + + + } + else if (m_bDebugKeyDown) + { + Debug(); + } + else + hud_textp->setHidden(TRUE); + + } + + + LLVector3 new_dir; + if (m_bEditActive)// lock HMD's rotation input for inworls object editing purposes. + { + if (m_fEyeDistance == 0) + LLViewerCamera::getInstance()->lookDir(m_vdir_orig, m_vup_orig); + new_dir = (m_vleft * (m_fEyeDistance / 1000)); + } + else + { + if (m_fEyeDistance == 0) + LLViewerCamera::getInstance()->lookDir(m_vdir, m_vup); + new_dir = (-m_vleft * (m_fEyeDistance / 1000)); + } + + + if (m_fEyeDistance > 0) + { + LLVector3 new_fwd_pos = m_vpos + (m_vdir * m_fFocusDistance); + + if (!leftEyeDesc.IsReady)//change pos for rendering the left eye texture.Move half IPD distance to the left + { + LLViewerCamera::getInstance()->updateCameraLocation(m_vpos + new_dir, m_vup, new_fwd_pos); + } + else if (!rightEyeDesc.IsReady)//change pos for rendering the right eye texture. Move full IPD distance to the right since we were on the left eye position. + { + LLViewerCamera::getInstance()->updateCameraLocation(m_vpos - new_dir, m_vup, new_fwd_pos); + } + } + + + + } + return TRUE; +} + +void llviewerVR::vrDisplay() +{ + if (gHMD != NULL) + { + if (m_bVrActive)//gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + + + if (!leftEyeDesc.IsReady) + { + bx = 0; + by = 0; + tx = gPipeline.mScreen.getWidth(); + ty = gPipeline.mScreen.getHeight(); + + m_iTextureShift = ((tx / 2) / 100)* m_fTextureShift; + + S32 halfx = tx / 2; + S32 halfy = ty / 2; + S32 div8x = tx / 6; + S32 div8y = ty / 6; + + S32 thirdx = tx / 3; + S32 thirdy = ty / 3; + + + if (m_MousePos.mX > tx - div8x && m_MousePos.mY < div8y)//up right + { + m_iZoomIndex = 4; + } + else if (m_MousePos.mX > tx - div8x && m_MousePos.mY > ty - div8y)//down right + { + m_iZoomIndex = 5; + } + else if (m_MousePos.mX < div8x && m_MousePos.mY > ty - div8y)//down left + { + m_iZoomIndex = 6; + } + else if (m_MousePos.mX < div8x && m_MousePos.mY < div8y)//up left + { + m_iZoomIndex = 7; + } + else if (m_MousePos.mX > tx - div8x && m_MousePos.mY > halfy - div8y && m_MousePos.mY < halfy + div8y)//right + { + m_iZoomIndex = 10; + } + else if (m_MousePos.mY > ty - div8y && m_MousePos.mX > halfx - div8x && m_MousePos.mX < halfx + div8x)//down + { + m_iZoomIndex = 9; + } + else if (m_MousePos.mY < div8y && m_MousePos.mX > halfx - div8x && m_MousePos.mX < halfx + div8x)//up + { + m_iZoomIndex = 8; + } + else if (m_MousePos.mX < div8x && m_MousePos.mY > halfy - div8y && m_MousePos.mY < halfy + div8y)//left + { + m_iZoomIndex = 11; + } + else if (m_MousePos.mX > halfx - div8x && m_MousePos.mX < halfx + div8x && m_MousePos.mY > halfy - div8y && m_MousePos.mY < halfy + div8y)//center + { + m_iZoomIndex = 0; + } + + ///Zoom in + if (m_iZoomIndex == 0) + { + bx += m_fTextureZoom; + by += m_fTextureZoom; + tx -= m_fTextureZoom; + ty -= m_fTextureZoom; + } + else if (m_iZoomIndex == 4)//up right + { + bx += thirdx; + by += thirdy; + tx += thirdx; + ty += thirdy; + } + else if (m_iZoomIndex == 5)//down right + { + bx += thirdx; + by -= thirdy; + tx += thirdx; + ty -= thirdy; + } + else if (m_iZoomIndex == 6)//down left + { + bx -= thirdx; + by -= thirdy; + tx -= thirdx; + ty -= thirdy; + } + else if (m_iZoomIndex == 7)//up left + { + bx -= thirdx; + by += thirdy; + tx -= thirdx; + ty += thirdy; + } + else if (m_iZoomIndex == 8)//up + { + by += thirdy; + ty += thirdy; + } + else if (m_iZoomIndex == 9)//down + { + by -= thirdy; + ty -= thirdy; + } + else if (m_iZoomIndex == 11)//left + { + bx -= thirdx; + tx -= thirdx; + } + else if (m_iZoomIndex == 10)//right + { + bx += thirdx; + tx += thirdx; + } + } + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glReadBuffer(GL_BACK); + + //if left camera was active bind left eye buffer for drawing in to + if (!leftEyeDesc.IsReady) + { + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, leftEyeDesc.mFBO); + if (m_iZoomIndex) + glClear(GL_COLOR_BUFFER_BIT); + //leftEyeDesc.IsReady = TRUE; + + glBlitFramebuffer(bx, by, tx, ty, m_iTextureShift, 0, m_nRenderWidth + m_iTextureShift, m_nRenderHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); + + } + if ((leftEyeDesc.IsReady && !rightEyeDesc.IsReady) || m_fEyeDistance == 0)//if right camera was active bind left eye buffer for drawing in to + { + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, rightEyeDesc.mFBO); + if (m_iZoomIndex) + glClear(GL_COLOR_BUFFER_BIT); + rightEyeDesc.IsReady = TRUE; + glBlitFramebuffer(bx, by, tx, ty, -m_iTextureShift, 0, m_nRenderWidth - m_iTextureShift, m_nRenderHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); + } + if (!leftEyeDesc.IsReady) + leftEyeDesc.IsReady = TRUE; + + //Remove bindings of read and draw buffer + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + if (leftEyeDesc.IsReady && (rightEyeDesc.IsReady || m_fEyeDistance == 0)) + { + + rightEyeDesc.IsReady = FALSE; + leftEyeDesc.IsReady = FALSE; + //glFlush(); + + //vr::VRCompositor()->CompositorBringToFront(); could help with no image issues + + + //Update HMD . !!!!! This calls waitGetPoses() which is essential to start the rendering process in the HMD after Submit and gets the current HMD pose(rotation location matrix) + //if you do not call that anywhere no image will be processed. + + + //submit the textures to the HMD + lEyeTexture = { (void*)(uintptr_t)leftEyeDesc.m_nResolveTextureId, vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; + eError = vr::VRCompositor()->Submit(vr::Eye_Left, &lEyeTexture, 0, (vr::EVRSubmitFlags)(vr::Submit_Default )); + + rEyeTexture = { (void*)(uintptr_t)rightEyeDesc.m_nResolveTextureId, vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; + eError = vr::VRCompositor()->Submit(vr::Eye_Right, &rEyeTexture, 0, (vr::EVRSubmitFlags)(vr::Submit_Default)); + + //vr::VRCompositor()->PostPresentHandoff();// Here we tell the HMD that rendering is done and it can render the image in to the HMD + //glFinish(); + + gViewerWindow->getWindow()->swapBuffers(); + + + //glFlush(); + + + + UpdateHMDMatrixPose(); + // + + } + + } + + + + + + } + //else if (vrEnabled) + //{ + //vrStartup(); + //} + +} + +void llviewerVR::ProcessVREvent(const vr::VREvent_t & event)//process vr´events +{ + switch (event.eventType) + { + case vr::VREvent_TrackedDeviceActivated: + { + //SetupRenderModelForTrackedDevice(event.trackedDeviceIndex); + //dprintf("Device %u attached. Setting up render model.\n", event.trackedDeviceIndex); + } + break; + case vr::VREvent_TrackedDeviceDeactivated: + { + //dprintf("Device %u detached.\n", event.trackedDeviceIndex); + } + break; + case vr::VREvent_TrackedDeviceUpdated: + { + //dprintf("Device %u updated.\n", event.trackedDeviceIndex); + } + case vr::VREvent_Quit: + { + m_bVrActive = FALSE; + m_bVrEnabled = FALSE; + gHMD = NULL; + vr::VR_Shutdown(); + vr::VRSystem()->AcknowledgeQuit_Exiting(); + } + break; + } +} + +void llviewerVR::agentYaw(F32 yaw_inc) // move avatar forward backward and rotate +{ + // Cannot steer some vehicles in mouselook if the script grabs the controls + if (gAgentCamera.cameraMouselook() && gSavedSettings.getBOOL("JoystickMouselookYaw")) + { + gAgent.rotate(-yaw_inc, gAgent.getReferenceUpVector()); + + } + else + { + if (yaw_inc < 0) + { + gAgent.setControlFlags(AGENT_CONTROL_YAW_POS); + } + else if (yaw_inc > 0) + { + gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG); + } + + gAgent.yaw(-yaw_inc); + } +} + +bool llviewerVR::HandleInput()// handles controller input for now only the stick. +{ + + if (gHMD == NULL || !m_bVrActive) + return FALSE; + bool bRet = false; + + // Process SteamVR events + vr::VREvent_t event; + while (gHMD->PollNextEvent(&event, sizeof(event))) + { + ProcessVREvent(event); + } + + // Process SteamVR controller state + /*for (vr::TrackedDeviceIndex_t unDevice = 0; unDevice < vr::k_unMaxTrackedDeviceCount; unDevice++) + { + vr::VRControllerState_t state; + if (gHMD->GetControllerState(unDevice, &state, sizeof(state))) + { + m_rbShowTrackedDevice[unDevice] = state.ulButtonPressed == 0; + if (state.unPacketNum != gPacketNum) + { + gPacketNum = state.unPacketNum; + //add intensity slider here. + if (fabs(state.rAxis[2].x) > 0.3)// +x rechts +y fwd + agentYaw(state.rAxis[2].x / 20); + if (state.rAxis[2].y > 0.5)// +x rechts +y fwd + gAgent.moveAt(1, false); + else if (state.rAxis[2].y < -0.5)// +x rechts +y fwd + gAgent.moveAt(-1, false); + gButton = state.ulButtonPressed; + + + + LLWindow * WI; + WI = gViewerWindow->getWindow(); + MASK mask = gKeyboard->currentMask(TRUE); + //S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWindowHeightScaled(); + S32 height = gViewerWindow->getWorldViewHeightScaled(); + LLCoordWindow size; + size.mX = gCtrlscreen[unDevice].mX; + //size.mY = gCtrlscreen[unDevice].mY; + size.mY = height - gCtrlscreen[unDevice].mY; + //gCtrlscreen[unDevice].mY = height - gCtrlscreen[unDevice].mY; + + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip)) && !gRightClick[unDevice]) + { + + gRightClick[unDevice] = TRUE; + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + + WI->setCursorPosition(size); + } + + //LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr(mAppWindowHandle, GWLP_USERDATA); + + gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unDevice], mask, LLMouseHandler::CLICK_RIGHT, TRUE); + + + INPUT Inputs[1] { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN; + //SendInput(1, Inputs, sizeof(INPUT)); + } + else if (gRightClick[unDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip))) + { + gRightClick[unDevice] = FALSE; + + gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unDevice], mask, LLMouseHandler::CLICK_RIGHT, FALSE); + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTUP; + //SendInput(1, Inputs, sizeof(INPUT)); + + + } + + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger)) && !gLeftClick[unDevice]) + { + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + gLeftClick[unDevice] = TRUE; + //LLWindow * WI; + //WI = gViewerWindow->getWindow(); + //S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWorldViewHeightScaled(); + //LLCoordWindow size; + //size.mX = gCtrlscreen[0].mX; + //size.mY = height - gCtrlscreen[0].mY; + WI->setCursorPosition(size); + } + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; + SendInput(1, Inputs, sizeof(INPUT)); + } + else if (gLeftClick[unDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger))) + { + gLeftClick[unDevice] = FALSE; + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTUP; + SendInput(1, Inputs, sizeof(INPUT)); + } + + } + + } + + }*/ + + return bRet; +} + +void llviewerVR::HandleKeyboard() +{ + // Don't attempt to update controllers if input is not available + //gCtrlNum = 0; + + if (gKeyboard->getKeyDown(KEY_TAB) && !m_bVrKeyDown) + { + + m_bVrKeyDown = TRUE; + + + } + else if (!gKeyboard->getKeyDown(KEY_TAB) && m_bVrKeyDown) + { + m_bVrKeyDown = FALSE; + + if (gKeyboard->getKeyDown(KEY_CONTROL)) + { + if (!m_bVrEnabled) + { + m_bVrEnabled = TRUE; + vrStartup(FALSE); + } + else + { + m_bVrActive = FALSE; + m_bVrEnabled = FALSE; + vrStartup(FALSE); + } + + } + else if (gHMD) + { + if (!m_bVrActive) + m_bVrActive = TRUE; + else + m_bVrActive = FALSE; + //LLViewerCamera::getInstance()->setDefaultFOV(1.8); + gHmdOffsetPos.mV[2] = 0; + INISaveRead(false); + if (m_fFOV > 20) + LLViewerCamera::getInstance()->setDefaultFOV(m_fFOV * DEG_TO_RAD); + + /*LLCoordWindow cpos; + cpos.mX = m_nRenderWidth / 2; + cpos.mY = m_nRenderHeight / 2; + LLWindow * WI; + WI = gViewerWindow->getWindow(); + //WI->setCursorPosition(cpos); + + INPUT Inputs[1] ; + Inputs[0].mi.dx = m_nRenderWidth / 2; + Inputs[0].mi.dy = m_nRenderHeight / 2; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_MOVE; + + SendInput(1, Inputs, sizeof(INPUT));*/ + + } + else + { + m_strHudText = ""; + hud_textp->setString(m_strHudText); + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(TRUE); + } + + } + + if (gHMD == NULL) + return; + if (gKeyboard->getKeyDown(m_kEditKey) && !m_bEditKeyDown) + { + m_bEditKeyDown = TRUE; + //m_iClockCount2 = m_tTimer1.getCurrentClockCount(); + } + else if (!gKeyboard->getKeyDown(m_kEditKey) && m_bEditKeyDown) + { + m_bEditKeyDown = FALSE; + //m_iClockCount = m_tTimer1.getCurrentClockCount() - m_iClockCount2; + /*if (m_iClockCount > 5000000) + { + m_iZoomIndex++; + if (m_iZoomIndex > 5) + m_iZoomIndex = 0; + } + else*/ + if (!m_bEditActive) + m_bEditActive = TRUE; + else + m_bEditActive = FALSE; + } + + if (gKeyboard->getKeyDown(m_kDebugKey) && !m_bDebugKeyDown) + { + m_bDebugKeyDown = TRUE; + } + else if (!gKeyboard->getKeyDown(m_kDebugKey) && m_bDebugKeyDown) + { + m_bDebugKeyDown = FALSE; + //m_iZoomIndex++; + if (m_iZoomIndex > 7) + m_iZoomIndex = 0; + } + + if (gKeyboard->getKeyDown(m_kMenuKey) && !m_bMenuKeyDown) + { + m_bMenuKeyDown = TRUE; + } + else if (!gKeyboard->getKeyDown(m_kMenuKey) && m_bMenuKeyDown) + { + m_bMenuKeyDown = FALSE; + if (m_iMenuIndex == 5) + INISaveRead(true); + + m_iMenuIndex++; + if (m_iMenuIndex > 5) + m_iMenuIndex = 0; + } +} + +void llviewerVR::DrawCursors() +{ + if (!m_bVrActive) + return; + gUIProgram.bind(); + //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + //gViewerWindow->setup2DRender(); + gGL.pushMatrix(); + S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); + S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); + + S32 wwidth = gViewerWindow->getWindowWidthScaled(); + S32 wheight = gViewerWindow->getWindowHeightScaled(); + + //translatef moves 0 vector to the pos you specified so oyu can draw fron zero vector there + gGL.translatef((F32)half_width, (F32)half_height, 0.f); + gGL.color4fv(LLColor4::white.mV); + //glClear(GL_DEPTH_BUFFER_BIT); + //glDisable(GL_DEPTH_TEST); + LLWindow * WI; + WI = gViewerWindow->getWindow(); + LLCoordWindow mcpos; + WI->getCursorPosition(&mcpos); + LLCoordGL mpos = gViewerWindow->getCurrentMouse(); + + for (vr::TrackedDeviceIndex_t unTrackedDevice = vr::k_unTrackedDeviceIndex_Hmd + 1; unTrackedDevice < vr::k_unMaxTrackedDeviceCount; ++unTrackedDevice) + { + if (gCtrlscreen[unTrackedDevice].mX > -1) + { + + gl_circle_2d(gCtrlscreen[unTrackedDevice].mX - half_width, gCtrlscreen[unTrackedDevice].mY - half_height + gCursorDiff, half_width / 200, 8, TRUE); + } + + } + + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + LLColor4 cl; + cl = LLColor4::black.mV; + + S32 mx = mpos.mX - half_width; + S32 my = mpos.mY - (half_height); + if (mpos.mX < 0 || mpos.mX > wwidth) + mx = half_width; + if (mpos.mY < 0 || mpos.mY > wheight) + my = half_height; + + gl_triangle_2d(mx, my, mx + 8, my - 15, mx + 15, my - 8, cl, TRUE); + cl = LLColor4::white.mV; + gl_triangle_2d(mx+2, my-2, mx + 9, my - 13, mx + 12, my - 8, cl, TRUE); + } + + //gl_circle_2d(mpos.mX - half_width, mpos.mY - (half_height) /*+ gVR.gCursorDiff)*/, half_width / 200, 8, TRUE); + + //glEnable(GL_DEPTH_TEST); + gGL.popMatrix(); + gUIProgram.unbind(); + stop_glerror(); +} + +void llviewerVR::RenderControllerAxes() +{ + // Don't attempt to update controllers if input is not available + //gCtrlNum = 0; + + HandleKeyboard(); + + if (gHMD == NULL) + return; + HandleInput(); + if (!gHMD->IsInputAvailable() || !m_bVrActive) + return; + + //std::vector vertdataarray; + //m_uiControllerVertcount = 0; + //m_iTrackedControllerCount = 0; + + + for (vr::TrackedDeviceIndex_t unTrackedDevice = vr::k_unTrackedDeviceIndex_Hmd + 1; unTrackedDevice < vr::k_unMaxTrackedDeviceCount; ++unTrackedDevice) + { + gCtrlscreen[unTrackedDevice].set(-1, -1); + if (!gHMD->IsTrackedDeviceConnected(unTrackedDevice)) + continue; + + if (gHMD->GetTrackedDeviceClass(unTrackedDevice) != vr::TrackedDeviceClass_Controller) + continue; + + m_iTrackedControllerCount += 1; + + if (!gTrackedDevicePose[unTrackedDevice].bPoseIsValid) + continue; + + //Count the controllers + + glh::matrix4f mat = m_rmat4DevicePose[unTrackedDevice]; + + //glh::vec4f center; + //mat.mult_matrix_vec(glh::vec4f(0, 0, 0, 1),center) ; + + LLVector3 pos = m_vpos; // LLViewerCamera::getInstance()->getOrigin(); + LLVector3 dir; + LLVector3 up; + LLVector3 left; + + glh::ns_float::vec4 row = mat.get_row(2); + dir.setVec(row.v[0], -row.v[2], row.v[1]); + + row = mat.get_row(1); + up.setVec(row.v[0], -row.v[2], row.v[1]); + + row = mat.get_row(0); + left.setVec(row.v[0], -row.v[2], row.v[1]); + + row = mat.get_row(3); + gCtrlOrigin[unTrackedDevice].setVec(row.v[0], -row.v[2], row.v[1]); + + LLQuaternion q1(dir, left, up); + + //get modified camera rot in euler angles + float r2; + float p2; + float y2; + q1.getEulerAngles(&r2, &p2, &y2); + + LLQuaternion qCameraOrig(m_vdir_orig, m_vleft_orig, m_vup_orig); + float r3; + float p3; + float y3; + qCameraOrig.getEulerAngles(&r3, &p3, &y3); + + + //make a quat of yaw rot of the HMD camera + //LLQuaternion q2; + //q2.setEulerAngles(0, p2, y2 + (m_fCamRotOffset * DEG_TO_RAD)); + LLQuaternion q3; + q3.setEulerAngles(0, 0, y3 - (m_fCamRotOffset * DEG_TO_RAD)); + + //change the controller rotation according to the HMD facing direction + q1 = (q1)*q3; + + //grab the forward vector from the quat matrix + LLMatrix3 m3 = q1.getMatrix3(); + dir = m3.getFwdRow(); + + //up = m3.getUpRow(); + //left = m3.getLeftRow(); + dir.normalize(); + //up.normalize(); + //left.normalize(); + //get position of the controller + gCtrlOrigin[unTrackedDevice] -= gHmdPos; + gCtrlOrigin[unTrackedDevice] = m_vpos + gCtrlOrigin[unTrackedDevice] * q3; + //project 10 meter line in the direction the controller is facing + gCtrlPos[unTrackedDevice] = gCtrlOrigin[unTrackedDevice] - (dir * 10.0f); + + //translate the fwd vector line to screen coords + posToScreen(gCtrlPos[unTrackedDevice], gCtrlscreen[unTrackedDevice], FALSE); + + //adjust the pos so it fits with the actual mouse cursor pos + S32 height = gViewerWindow->getWorldViewHeightScaled(); + gCursorDiff= gViewerWindow->getWindowHeightScaled(); + gCursorDiff = gCursorDiff - height; + gCtrlscreen[unTrackedDevice].mY -= gCursorDiff; + + + + + + //draw the controller lines in world ( make tham nicer ;>) + LLGLSUIDefault gls_ui; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLVector3 v = gCurrentCameraPos; + // Some coordinate axes + glClear(GL_DEPTH_BUFFER_BIT); + glDisable(GL_DEPTH_TEST); + gGL.pushMatrix(); + gGL.translatef(v.mV[VX], v.mV[VY], v.mV[VZ]); + gGL.begin(LLRender::LINES); + gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red + gGL.vertex3f(gCtrlOrigin[unTrackedDevice].mV[VX], gCtrlOrigin[unTrackedDevice].mV[VY], gCtrlOrigin[unTrackedDevice].mV[VZ]); + gGL.vertex3f(gCtrlPos[unTrackedDevice].mV[VX], gCtrlPos[unTrackedDevice].mV[VY], gCtrlPos[unTrackedDevice].mV[VZ]); + gGL.end(); + gGL.popMatrix(); + glEnable(GL_DEPTH_TEST); + + //EVRControllerAxisType + //read the input from the available controllers + vr::VRControllerState_t state; + if (gHMD->GetControllerState(unTrackedDevice, &state, sizeof(state))) + { + m_rbShowTrackedDevice[unTrackedDevice] = state.ulButtonPressed == 0; + if (1)// state.unPacketNum != gPacketNum) + { + //if(LLFloaterCamera::inFreeCameraMode()) + gPacketNum = state.unPacketNum; + //Get the joystick hat state of the controller and move the avatar.. (Figure out how to map it tpo vive and oculus) + //add movement intensity slider here. + if (fabs(state.rAxis[2].x) > 0.5 && gHMD->GetControllerRoleForTrackedDeviceIndex(unTrackedDevice))// +x rechts +y fwd + { + if (LLFloaterCamera::inFreeCameraMode()) + { + m_fCamRotOffset += 0.5; + if (m_fCamRotOffset > 360) + m_fCamRotOffset = 0; + + } + else + { + m_fCamRotOffset = 90; + agentYaw(state.rAxis[2].x / 40); + + } + + } + else if (state.rAxis[2].y > 0.5)// +y forward + { + if (LLFloaterCamera::inFreeCameraMode()) + { + + m_fCamPosOffset += 0.2; + } + else + { + gAgent.moveAt(1, false); + m_fCamPosOffset = 0; + } + + } + + else if (state.rAxis[2].y < -0.5)// -y back + { + if (LLFloaterCamera::inFreeCameraMode()) + { + + m_fCamPosOffset -= 0.2; + } + else + { + gAgent.moveAt(-1, false); + m_fCamPosOffset = 0; + } + + } + + + + gButton = state.ulButtonPressed; + LLWindow * WI; + WI = gViewerWindow->getWindow(); + //MASK mask = gKeyboard->currentMask(TRUE); + + + S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWindowHeightScaled(); + S32 height = gViewerWindow->getWorldViewHeightScaled(); + LLCoordWindow cpos; + cpos.mX = gCtrlscreen[unTrackedDevice].mX; + //size.mY = gCtrlscreen[unDevice].mY; + cpos.mY = height - gCtrlscreen[unTrackedDevice].mY; + //gCtrlscreen[unDevice].mY = height - gCtrlscreen[unDevice].mY; + + //LLCoordWindow * mcpos; + //WI->getCursorPosition(mcpos); + + //Emulate mouse clicks with the controllers trigger and grip buttons + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip)) && !gRightClick[unTrackedDevice]) + { + + gRightClick[unTrackedDevice] = TRUE; + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + + WI->setCursorPosition(cpos); + } + + //LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr(mAppWindowHandle, GWLP_USERDATA); + + //gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unTrackedDevice], mask, LLMouseHandler::CLICK_RIGHT, TRUE); + + +#ifdef _WIN32 + INPUT Inputs[1] { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTDOWN; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + else if (gRightClick[unTrackedDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_Grip))) + { + gRightClick[unTrackedDevice] = FALSE; + + //gViewerWindow->handleAnyMouseClick(WI, gCtrlscreen[unTrackedDevice], mask, LLMouseHandler::CLICK_RIGHT, FALSE); +#ifdef _WIN32 + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_RIGHTUP; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + + + if ((state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger)) && !gLeftClick[unTrackedDevice]) + { + gLeftClick[unTrackedDevice] = TRUE; + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) + { + + //LLWindow * WI; + //WI = gViewerWindow->getWindow(); + //S32 width = gViewerWindow->getWorldViewWidthScaled(); + //S32 height = gViewerWindow->getWorldViewHeightScaled(); + //LLCoordWindow size; + //size.mX = gCtrlscreen[0].mX; + //size.mY = height - gCtrlscreen[0].mY; + WI->setCursorPosition(cpos); + } +#ifdef _WIN32 + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + else if (gLeftClick[unTrackedDevice] && !(state.ulButtonPressed & vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger))) + { + gLeftClick[unTrackedDevice] = FALSE; +#ifdef _WIN32 + INPUT Inputs[1] = { 0 }; + Inputs[0].type = INPUT_MOUSE; + Inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTUP; + SendInput(1, Inputs, sizeof(INPUT)); +#else +#endif + } + + if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK && gLeftClick[unTrackedDevice] && cpos.mX>-1 && cpos.mX < width && cpos.mY >-1 && cpos.mY < height) + { + + WI->setCursorPosition(cpos); + } + + } + + } + } + +} + +BOOL llviewerVR::posToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const +{ + //BOOL in_front = TRUE; + GLdouble x, y, z; // object's window coords, GL-style + + /*LLVector3 dir_to_point = pos_agent - LLViewerCamera::getInstance()->getOrigin(); + dir_to_point /= dir_to_point.magVec(); + + if (dir_to_point * LLCoordFrame::getAtAxis() < 0.f) + { + if (clamp) + { + return FALSE; + } + else + { + in_front = FALSE; + } + } + */ + LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw(); + + //LLRect world_view_rect = gViewerWindow->handleAnyMouseClick; + + S32 viewport[4]; + viewport[0] = world_view_rect.mLeft; + viewport[1] = world_view_rect.mBottom; + viewport[2] = world_view_rect.getWidth(); + viewport[3] = world_view_rect.getHeight(); + + F64 mdlv[16]; + F64 proj[16]; + + for (U32 i = 0; i < 16; i++) + { + mdlv[i] = (F64)gGLModelView[i]; + proj[i] = (F64)gGLProjection[i]; + } + + if (GL_TRUE == gluProject(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ], + mdlv, proj, (GLint*)viewport, + &x, &y, &z)) + { + // convert screen coordinates to virtual UI coordinates + x /= gViewerWindow->getDisplayScale().mV[VX]; + y /= gViewerWindow->getDisplayScale().mV[VY]; + + // should now have the x,y coords of grab_point in screen space + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); + + // convert to pixel coordinates + S32 int_x = lltrunc(x); + S32 int_y = lltrunc(y); + + out_point.mX = int_x; + out_point.mY = int_y; + + BOOL valid = TRUE; + return valid; + /* + if (clamp) + { + if (int_x < world_rect.mLeft) + { + out_point.mX = world_rect.mLeft; + valid = FALSE; + } + else if (int_x > world_rect.mRight) + { + out_point.mX = world_rect.mRight; + valid = FALSE; + } + else + { + out_point.mX = int_x; + } + + if (int_y < world_rect.mBottom) + { + out_point.mY = world_rect.mBottom; + valid = FALSE; + } + else if (int_y > world_rect.mTop) + { + out_point.mY = world_rect.mTop; + valid = FALSE; + } + else + { + out_point.mY = int_y; + } + return valid; + } + else + { + out_point.mX = int_x; + out_point.mY = int_y; + + if (int_x < world_rect.mLeft) + { + valid = FALSE; + } + else if (int_x > world_rect.mRight) + { + valid = FALSE; + } + if (int_y < world_rect.mBottom) + { + valid = FALSE; + } + else if (int_y > world_rect.mTop) + { + valid = FALSE; + } + + return in_front && valid; + }*/ + } + else + { + return FALSE; + } +} + +void llviewerVR::buttonCallbackLeft() +{ + if (m_pCamStack) + { + + m_fCamRotOffset -= 5; + if (m_fCamRotOffset > 360) + m_fCamRotOffset = 0; + + } +} + +void llviewerVR::buttonCallbackRight() +{ + if (m_pCamStack) + { + m_fCamRotOffset += 5; + if (m_fCamRotOffset > 360) + m_fCamRotOffset = 0; + + LLRect rc; + rc.setCenterAndSize(80, 80, 160, 80); + m_pCamStack->setRect(rc); + if (m_pCamera_floater) + { + rc = m_pCamera_floater->getRect(); + rc.setCenterAndSize(rc.getCenterX(), rc.getCenterY(), 200, 120); + //m_pCamera_floater->setRect(rc); + m_pCamera_floater->handleReshape(rc, TRUE); + } + + + } +} + +std::string llviewerVR::Settings() +{ + std::string str; + std::wstring wstr; + std::string sep1 = "\n\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88 "; + std::string sep2 = " \xe2\x96\x88\xe2\x96\x88\xe2\x96\x88"; + + + //str = INISaveRead(false); + //str.append("\n"); + if (m_iMenuIndex == 1) + { + m_fEyeDistance=Modify(m_fEyeDistance, 1.0, 0, 200); + str.append(sep1); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append(sep2); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append("\nTexture Shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + str.append("\n \nDistance between left and right camera.\nUsually the same as the IPD of your HMD.\nIf objects appear too small or too big try other values. "); + } + else if (m_iMenuIndex == 2) + { + m_fFocusDistance=Modify(m_fFocusDistance, 0.25, 0.5, 10); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append(sep1); + str.append("Focus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append(sep2); + str.append("\nTexture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + + str.append("\n \nFocus distance of the cameras in meters"); + } + else if (m_iMenuIndex == 3) + { + m_fTextureShift = Modify(m_fTextureShift, 0.5, -100, 100); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append(sep1); + str.append("Texture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append(sep2); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + str.append("\n \nApplies a texture shift in case your HMD's focus point is not in the center of the texture."); + } + else if (m_iMenuIndex == 4) + { + m_fTextureZoom = Modify(m_fTextureZoom, 1, -200, 200); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append("\nTexture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append(sep1); + str.append("Texture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append(sep2); + str.append("\nFOV = "); + str.append(std::to_string(m_fFOV)); + str.append("\n \nZooms the view in or out. It may help with wide FOV HMD's like Pimax.\n Zoom in reduces quality. Zoom out increases quality\nWhen this value is changed FOV must also be adjusted."); + } + else if (m_iMenuIndex == 5) + { + m_fFOV = Modify(m_fFOV, 0.5, 50, 175); + LLViewerCamera::getInstance()->setDefaultFOV(m_fFOV * DEG_TO_RAD); + str.append("IPD = "); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nFocus Distance = "); + str.append(std::to_string(m_fFocusDistance)); + str.append("\nTexture shift = "); + str.append(std::to_string(m_fTextureShift)); + str.append("\nTexture Zoom = "); + str.append(std::to_string(m_fTextureZoom)); + str.append(sep1); + str.append("FOV = "); + str.append(std::to_string(m_fFOV)); + str.append(sep2); + str.append("\n \nField of view in degree adjustment. Usually 100 degree is good.\n It should be adjusted when texture zoom is changed."); + } + return str; +} + +F32 llviewerVR::Modify(F32 val, F32 step, F32 min, F32 max) +{ + if (gKeyboard->getKeyDown(m_kPlusKey) && (!m_bPlusKeyDown || gKeyboard->getKeyElapsedTime(m_kPlusKey) >1)) + { + m_bPlusKeyDown = TRUE; + val += step; + if (val > max) + val = max; + return val; + } + else if (!gKeyboard->getKeyDown(m_kPlusKey) && m_bPlusKeyDown) + { + m_bPlusKeyDown = FALSE; + /*val += step; + if (val > max) + val = max; + return val;*/ + + } + if (gKeyboard->getKeyDown(m_kMinusKey) && !m_bMinusKeyDown) + { + m_bMinusKeyDown = TRUE; + } + else if (!gKeyboard->getKeyDown(m_kMinusKey) && m_bMinusKeyDown) + { + m_bMinusKeyDown = FALSE; + val -= step; + if (val < min) + val = min; + return val; + } + return val; +} + +std::string llviewerVR::INISaveRead(bool save) +{ + std::string path = getenv("APPDATA"); + path.append("\\Firestorm_x64\\vrconfig.ini"); + std::string ret; + ret.append(path); + ret.append("\n"); + std::string line; + std::fstream file; + if (!save) + { + file.open(path, std::ios_base::in); + + if (file.is_open()) + { + while (getline(file, line, ',')) + { + if (line == "EyeDistance") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fEyeDistance = std::stof(line); + } + else if (line == "FocusDistance") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fFocusDistance = std::stof(line); + } + else if (line == "TextureShift") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fTextureShift = std::stof(line); + } + else if (line == "TextureZoom") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fTextureZoom = std::stof(line); + } + else if (line == "FieldOfView") + { + //ret.append(line.append("|")); + getline(file, line, ','); + m_fFOV = std::stof(line); + } + + } + file.close(); + } + else + ret.append("\n file not open!!!\n"); + } + else + { + file.open(path, std::ios_base::out); + std::string s; + s.append("EyeDistance"); + s.append(","); + s.append(std::to_string(m_fEyeDistance)); + s.append(","); + + s.append("FocusDistance"); + s.append(","); + s.append(std::to_string(m_fFocusDistance)); + s.append(","); + + s.append("TextureShift"); + s.append(","); + s.append(std::to_string(m_fTextureShift)); + s.append(","); + + s.append("TextureZoom"); + s.append(","); + s.append(std::to_string(m_fTextureZoom)); + s.append(","); + + s.append("FieldOfView"); + s.append(","); + s.append(std::to_string(m_fFOV)); + + if (file.is_open()) + { + file << s.c_str(); + file.close(); + } + + } + return ret; + +} + +void llviewerVR::Debug() +{ + LLWindow * WI; + WI = gViewerWindow->getWindow(); + LLCoordWindow mpos; + WI->getCursorPosition(&mpos); + LLCoordGL mcpos = gViewerWindow->getCurrentMouse(); + LLVector3 voffset = gHmdPos - gHmdOffsetPos; + std::string str; + str.append(" Cam Pos \n< "); + str.append(std::to_string(m_vpos.mV[VX])); + str.append(" , "); + str.append(std::to_string(m_vpos.mV[VY])); + str.append(" , "); + str.append(std::to_string(m_vpos.mV[VZ])); + str.append(" > "); + str.append("\n HMD Pos offset - hmd \n< "); + str.append(std::to_string(voffset.mV[VX])); + str.append(" , "); + str.append(std::to_string(voffset.mV[VY])); + str.append(" , "); + str.append(std::to_string(voffset.mV[VZ])); + str.append(" > "); + str.append("\n HMD Pos offset \n< "); + str.append(std::to_string(gHmdOffsetPos.mV[VX])); + str.append(" , "); + str.append(std::to_string(gHmdOffsetPos.mV[VY])); + str.append(" , "); + str.append(std::to_string(gHmdOffsetPos.mV[VZ])); + str.append(" > "); + str.append("\n HMD Pos \n< "); + str.append(std::to_string(gHmdPos.mV[VX])); + str.append(" , "); + str.append(std::to_string(gHmdPos.mV[VY])); + str.append(" , "); + str.append(std::to_string(gHmdPos.mV[VZ])); + str.append(" > "); + /* + str.append("\nPointe Pos\n< "); + str.append(std::to_string(gCtrlPos[0].mV[VX])); + str.append(" , "); + str.append(std::to_string(gCtrlPos[0].mV[VY])); + str.append(" , "); + str.append(std::to_string(gCtrlPos[0].mV[VZ])); + str.append(" > "); + + str.append("\nPoint Origin\n< "); + str.append(std::to_string(gCtrlOrigin[0].mV[VX])); + str.append(" , "); + str.append(std::to_string(gCtrlOrigin[0].mV[VY])); + str.append(" , "); + str.append(std::to_string(gCtrlOrigin[0].mV[VZ])); + str.append(" > ");*/ + + str.append("\n Zoom Index"); + str.append(std::to_string(m_iZoomIndex)); + + str.append("\n MCoord X="); + str.append(std::to_string(mpos.mX)); + str.append(" Y="); + str.append(std::to_string(mpos.mY)); + + str.append("\n MCoord X="); + str.append(std::to_string(mcpos.mX)); + str.append(" Y="); + str.append(std::to_string(mcpos.mY)); + str.append("\n Mview X="); + str.append(std::to_string(m_MousePos.mX)); + str.append(" Y="); + str.append(std::to_string(m_MousePos.mY)); + + str.append("\n Coord1 X="); + str.append(std::to_string(gCtrlscreen[1].mX)); + str.append(" Y="); + str.append(std::to_string(gCtrlscreen[1].mY)); + str.append("\n Rheight="); + str.append(std::to_string(m_nRenderHeight)); + str.append("\n Rwidth="); + str.append(std::to_string(m_nRenderWidth)); + str.append("\n Button="); + str.append(std::to_string(gButton)); + + str.append("\n Cam Rot Offset in DEG ="); + str.append(std::to_string(m_fCamRotOffset)); + + str.append("\nL+R Camera Distance in mm\n"); + str.append(std::to_string(m_fEyeDistance)); + str.append("\nCurrent FOV \n"); + str.append(std::to_string(LLViewerCamera::getInstance()->getDefaultFOV())); + //str.append("\n LastGL ERR="); + //str.append(std::to_string(err)); + + + hud_textp->setString(str); + LLVector3 end = m_vpos + (m_vdir)* 1.0f; + hud_textp->setPositionAgent(end); + hud_textp->setDoFade(FALSE); + hud_textp->setHidden(FALSE); +} + +void llviewerVR::InitUI() +{ + if (!m_pCamButtonLeft) + { + /*LLPanel* panelp = NULL; + panelp=LLPanel::createFactoryPanel("vr_controlls"); + + panelp->setRect(rc); + LLColor4 color(1, 1, 1); + panelp->setOrigin(700, 700); + panelp->setColor(color); + panelp->setVisible(TRUE); + panelp->setEnabled(TRUE);*/ + LLRect rc; + rc.setCenterAndSize(500, 500, 200, 200); + + + m_pCamera_floater = LLFloaterReg::findTypedInstance("camera"); + if (m_pCamera_floater) + { + LLStringExplicit lb("keks"); + //LLRect rc; + //LLButton *m_pButton1; + LLButton *m_pButton; + for (int i = 0; i < 2; i++) + { + + LLButton::Params p; + if (i == 0) + { + p.name("rot_left"); + p.label("<<"); + } + else + { + p.name("rot_right"); + p.label(">>"); + } + + + m_pButton = LLUICtrlFactory::create(p); + + + m_pCamera_floater->addChild(m_pButton); + //panelp->addChild(m_pButton); + if (i == 0) + rc.setCenterAndSize(20, 20, 30, 20); + else + rc.setCenterAndSize(50, 20, 30, 20); + m_pButton->setRect(rc); + m_pButton->setVisible(TRUE); + m_pButton->setEnabled(TRUE); + if (i == 0) + m_pCamButtonLeft = m_pButton; + else + m_pCamButtonRight = m_pButton; + } + m_pCamButtonLeft->setCommitCallback(boost::bind(&llviewerVR::buttonCallbackLeft, this)); + m_pCamButtonRight->setCommitCallback(boost::bind(&llviewerVR::buttonCallbackRight, this)); + + /*m_pButton1 = m_pCamera_floater->findChild("rot_left"); + //lb.assign("<"); + if (m_pButton1) + { + m_pButton1->setLabel(LLStringExplicit("<")); + m_pButton1->setCommitCallback(boost::bind(&llviewerVR::buttonsCallback, this)); + }*/ + + + m_pCamStack = m_pCamera_floater->findChild("camera_view_layout_stack"); + + + //m_pCamera_floater->getChildList(); + //m_pButton1-> + } + } +} \ No newline at end of file diff --git a/indra/newview/llviewerVR.h b/indra/newview/llviewerVR.h new file mode 100644 index 00000000000..fdbd12e0d5f --- /dev/null +++ b/indra/newview/llviewerVR.h @@ -0,0 +1,220 @@ +#pragma once + +#include "../../openvr/headers/openvr.h" +#include "llhudtext.h" +#include "llgl.h" +#include "string.h" +#include "llfloater.h" +#include "llfloatercamera.h" +//#include "control.h" +//#include "llviewercamera.h" +//#include "llagentcamera.h" +//#include "pipeline.h" +//#include "llagent.h" +//#include "llviewerwindow.h" + + +class llviewerVR +{ +public: + vr::IVRSystem *gHMD = 0; + vr::IVRCompositor* gCompositor = 0; + vr::IVRRenderModels * gRenderModels = 0; + std::string gStrDriver; + std::string gStrDisplay; + vr::TrackedDevicePose_t gTrackedDevicePose[vr::k_unMaxTrackedDeviceCount]; + vr::VRCompositorError eError = vr::VRCompositorError_None; + vr::Texture_t lEyeTexture; + vr::Texture_t rEyeTexture; + + U32 bx = 0; + U32 by = 0; + U32 tx = 0; + U32 ty = 0; + + KEY m_kEditKey; + KEY m_kDebugKey; + KEY m_kMenuKey; + KEY m_kPlusKey; + KEY m_kMinusKey; + + bool m_bVrEnabled = 0; + + bool m_bVrActive = 0; + bool m_bVrKeyDown = 0; + + bool m_bEditKeyDown = 0; + bool m_bEditActive = 0; + + bool m_bDebugKeyDown = 0; + + bool m_bMenuKeyDown = 0; + bool m_bPlusKeyDown = 0; + bool m_bMinusKeyDown = 0; + + + bool isRenderingLeftEye = 0; + bool gVRInitComplete = 0; + + + S32 m_iTextureShift = 0; + + struct FramebufferDesc + { + GLuint m_nDepthBufferId; + GLuint m_nRenderTextureId; + GLuint m_nRenderFramebufferId; + GLuint m_nResolveTextureId; + GLuint mFBO; + GLuint IsReady; + }; + FramebufferDesc leftEyeDesc; + FramebufferDesc rightEyeDesc; + U32 m_nRenderWidth; + U32 m_nRenderHeight; + S32 m_iTrackedControllerCount; + S32 m_iTrackedControllerCount_Last; + S32 m_iValidPoseCount; + S32 m_iValidPoseCount_Last; + S32 m_iZoomIndex = 0; + U64 m_iClockCount; + U64 m_iClockCount2; + LLTimer m_tTimer1; + F32 m_fCamRotOffset = 90; + F32 m_fCamPosOffset = 0; + + LLVector3 m_vdir_orig; + LLVector3 m_vup_orig; + LLVector3 m_vleft_orig; + LLVector3 m_vpos_orig; + + LLVector3 m_vdir; + LLVector3 m_vup; + LLVector3 m_vleft; + LLVector3 m_vpos; + LLButton *m_pCamButtonLeft = 0; + LLButton *m_pCamButtonRight = 0; + LLButton *m_pCamButtonChat = 0; + LLButton *m_pCamButtonPref = 0; + LLFloaterCamera *m_pCamera_floater = 0; + LLView *m_pCamStack = 0; + + + + LLCoordWindow m_MousePos; + LLCoordWindow m_ScrSize; + S32 m_iHalfWidth; + S32 m_iHalfHeight; + S32 m_iThirdWidth; + S32 m_iThirdHeight; + + S32 m_iMenuIndex; + F32 m_fEyeDistance; + F32 m_fFocusDistance; + F32 m_fTextureShift; + F32 m_fFOV; + F32 m_fTextureZoom; + + //controller axes +// int m_iTrackedControllerCount; +// int m_iTrackedControllerCount_Last; + unsigned int m_uiControllerVertcount; + //vr::TrackedDevicePose_t m_rTrackedDevicePose[vr::k_unMaxTrackedDeviceCount]; + + float m_fNearClip; + float m_fFarClip; + + std::string m_strPoseClasses; + std::string m_strDriver; + std::string m_strDisplay; + + glh::matrix4f m_mat4HMDPose; + glh::matrix4f m_rmat4DevicePose[vr::k_unMaxTrackedDeviceCount]; + glh::matrix4f m_mat4eyePosLeft; + glh::matrix4f m_mat4eyePosRight; + + glh::matrix4f m_mat4ProjectionCenter; + glh::matrix4f m_mat4ProjectionLeft; + glh::matrix4f m_mat4ProjectionRight; + char m_rDevClassChar[vr::k_unMaxTrackedDeviceCount]; + + + glh::matrix4f ConvertSteamVRMatrixToMatrix4(const vr::HmdMatrix34_t &matPose); + glh::matrix4f GetHMDMatrixProjectionEye(vr::Hmd_Eye nEye); + glh::matrix4f GetHMDMatrixPoseEye(vr::Hmd_Eye nEye); + glh::matrix4f GetCurrentViewProjectionMatrix(vr::Hmd_Eye nEye); + + glh::matrix4f ConvertSteamVRMatrixToMatrix42(const vr::HmdMatrix34_t &matPose); + + vr::HmdQuaternion_t GetRotation(vr::HmdMatrix34_t matrix); + LLMatrix4 ConvertGLHMatrix4ToLLMatrix4(glh::matrix4f m); + + + std::string MatrixToStr(glh::matrix4f mat, std::string name); + std::string MatrixToStrLL(glh::matrix4f mat, std::string name); + bool gluInvertMatrix(const float m[16], float invOut[16]); + glh::ns_float::vec3 m_nPos; + + + LLVector3 gHMDAxes; + LLVector3 gCurrentCameraPos; + vr::HmdVector3_t gHMDFwd; + LLQuaternion gHMDQuat; + LLQuaternion gCtrlQuat[2]; + LLVector3 gHmdPos; + LLVector3 gHmdOffsetPos; + + LLVector3 gCtrlPos[vr::k_unMaxTrackedDeviceCount]; + LLVector3 gCtrlOrigin[vr::k_unMaxTrackedDeviceCount]; + //uint32_t gCtrlNum; + LLCoordGL gCtrlscreen[vr::k_unMaxTrackedDeviceCount]; + + LLMatrix4 gM4HMDPose; + LLMatrix4 gM4eyePosLeft; + LLMatrix4 gM4eyeProjectionLeft; + LLMatrix4 gM4eyePosRight; + LLMatrix4 gM4eyeProjectionRight; + LLHUDText *hud_textp; + std::string m_strHudText; + bool m_bHudTextUpdated=FALSE; + + bool gRightClick[vr::k_unMaxTrackedDeviceCount]; + bool gLeftClick[vr::k_unMaxTrackedDeviceCount]; + bool gLeftTouchpad = FALSE; + S32 gCursorDiff; + uint64_t gPreviousButtonMask; + + uint64_t gButton; + + bool m_rbShowTrackedDevice[vr::k_unMaxTrackedDeviceCount]; + uint32_t gPacketNum = 0; + + void UpdateHMDMatrixPose(); + //std::string GetTrackedDeviceString(vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_t unDevice, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *peError = NULL); + void SetupCameras(); + bool CreateFrameBuffer(int nWidth, int nHeight, FramebufferDesc &framebufferDesc); + void vrStartup(bool is_shutdown); + void vrDisplay(); + bool HandleInput(); + void DrawCursors(); + void ProcessVREvent(const vr::VREvent_t & event); + void agentYaw(F32 yaw_inc); + bool ProcessVRCamera(); + std::string GetTrackedDeviceString(vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_t unDevice, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *peError = NULL); + void RenderControllerAxes(); + BOOL posToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp) const; + void buttonCallbackLeft(); + void buttonCallbackRight(); + std::string Settings(); + F32 Modify(F32 val, F32 step, F32 min, F32 max); + std::string INISaveRead(bool save = false); + void HandleKeyboard(); + void Debug(); + void InitUI(); + + + llviewerVR(); + + ~llviewerVR(); +}; + diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 4b64eda9db4..d1d4cb20f22 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -87,6 +87,11 @@ #include "fsdata.h" #include "fsperfstats.h" // performance stats support +//################################### P373R ###################################### +#include "llviewerVR.cpp" +llviewerVR gVR; +//################################### END P373R ################################## + extern LLPointer gStartTexture; extern bool gShiftFrame; @@ -783,6 +788,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES); } + //upkeep gl name pools + LLGLNamePool::upkeepPools(); + //################################### P373R ###################################### + sec: + gVR.ProcessVRCamera(); + //################################### END P373R ################################## + stop_glerror(); display_update_camera(); stop_glerror(); @@ -1159,7 +1171,29 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!for_snapshot) { render_ui(); - swap(); + //################################### P373R ###################################### + gVR.vrDisplay(); + + //################################### END P373R ###################################### + //swap(); + //################################### P373R ###################################### + if (gVR.leftEyeDesc.IsReady && !gVR.rightEyeDesc.IsReady && gVR.m_fEyeDistance > 0) + { + goto sec; + + + } + if (!gVR.leftEyeDesc.IsReady && !gVR.rightEyeDesc.IsReady) + { + //gVR.HandleInput(); + + } + if (!gVR.m_bVrActive) + swap(); + + //################################### END P373R ################################## + //swap(); + } @@ -1594,6 +1628,9 @@ void render_ui_3d() gUIProgram.bind(); + //################################### P373R ###################################### + gVR.RenderControllerAxes(); + //################################### END P373R ################################## // Coordinate axes // gSavedSettings replacement //if (gSavedSettings.getBOOL("ShowAxes")) @@ -1732,7 +1769,9 @@ void render_ui_2d() { gViewerWindow->draw(); } - + //################################### P373R ###################################### + gVR.DrawCursors(); + //################################### END P373R ################################## // reset current origin for font rendering, in case of tiling render @@ -1818,6 +1857,9 @@ void render_disconnected_background() void display_cleanup() { + //################################### P373R ###################################### + gVR.vrStartup(TRUE); + //################################### END P373R ###################################### gDisconnectedImagep = NULL; } diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 76057fbdfb1..a28887ad19c 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -597,6 +597,9 @@ def construct(self): 'llplugin', 'slplugin', self.args['configuration']), "slplugin.exe") + with self.prefix(src=os.path.join(pkgdir, os.pardir, os.pardir, 'openvr', 'bin', 'win64')): + self.path("openvr_api.dll") + # Get shared libs from the shared libs staging directory with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'sharedlibs', self.args['configuration'])): @@ -1886,6 +1889,9 @@ def construct(self): self.path("launch_url.sh") self.path("install.sh") + with self.prefix(src=os.path.join(pkgdir, os.pardir, os.pardir, 'openvr', 'bin', 'linux64')): + self.path("libopenvr_api.so") + with self.prefix(dst="bin"): self.path( os.path.join(os.pardir,'build_data.json'), "build_data.json" ) self.path("firestorm-bin","do-not-directly-run-firestorm-bin") diff --git a/openvr b/openvr new file mode 160000 index 00000000000..d9cffe2ff87 --- /dev/null +++ b/openvr @@ -0,0 +1 @@ +Subproject commit d9cffe2ff87bf0bac69b56bcf6fb60652a9d4009 From 84f181d8ca7ce4a15d2d7fa74a2400cae19c70dd Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 May 2020 12:42:02 -0400 Subject: [PATCH 42/78] separate windows and ubuntu github actions --- .github/workflows/CompileUbuntu.yml | 45 +++++++++++++++ .github/workflows/CompileWindows.yml | 52 +++++++++++++++++ .github/workflows/ccpp.yml | 83 ---------------------------- 3 files changed, 97 insertions(+), 83 deletions(-) create mode 100644 .github/workflows/CompileUbuntu.yml create mode 100644 .github/workflows/CompileWindows.yml delete mode 100644 .github/workflows/ccpp.yml diff --git a/.github/workflows/CompileUbuntu.yml b/.github/workflows/CompileUbuntu.yml new file mode 100644 index 00000000000..2287c6e81b3 --- /dev/null +++ b/.github/workflows/CompileUbuntu.yml @@ -0,0 +1,45 @@ +name: CompileUbuntu + +on: [pull_request] + +jobs: + ubuntu_autobuild: + runs-on: ubuntu-16.04 + env: + AUTOBUILD_VSVER: 120 + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set env apt + run: | + sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb + echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables + echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@master + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + architecture: x64 + - name: Get software versions please + run: | + cmake --version + git --version + python --version + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + - name: Configure autobuild + run: | + autobuild --version + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - name: Build & Package + run: | + autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: fs-ubuntu-gha-artifact + path: build-linux-x86_64/newview/Phoenix*.tar.* diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml new file mode 100644 index 00000000000..53c76f27f55 --- /dev/null +++ b/.github/workflows/CompileWindows.yml @@ -0,0 +1,52 @@ +name: CompileWindows + +on: [pull_request] + +defaults: + run: + shell: bash + +jobs: + windows_build: + runs-on: windows-latest + env: + AUTOBUILD_VSVER: 120 + PreferredToolArchitecture: x64 + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set env + shell: cmd + run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables + - name: Download VS2013 Community + run: choco install visualstudiocommunity2013 + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: 2.7 + architecture: x64 + - name: Get software versions please + run: | + cmake --version + git --version + python --version + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + - name: Configure autobuild + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + autobuild --version + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE + - name: Build & Package + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 + msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: fs-windows-gha-artifact + path: build-vc120-64/newview/Release/*_Setup.exe diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml deleted file mode 100644 index 131ac7532ea..00000000000 --- a/.github/workflows/ccpp.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: C/C++ CI - -on: [push, pull_request] -defaults: - run: - shell: bash -jobs: - build: - strategy: - matrix: - os: [windows-latest, ubuntu-16.04] - build_type: [full] - runs-on: ${{matrix.os}} - env: - AUTOBUILD_VSVER: 120 - PreferredToolArchitecture: x64 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Set env - if: startsWith(matrix.os, 'windows') - shell: cmd - run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables - - name: Set env apt - if: startsWith(matrix.os, 'ubuntu') - shell: bash - run: | - sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb - echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables - echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 - - name: Download VS2013 Community - if: startsWith(matrix.os, 'windows') - run: choco install visualstudiocommunity2013 - - name: Setup Ninja - if: startsWith(matrix.os, 'ubuntu') - uses: seanmiddleditch/gha-setup-ninja@master - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: 2.7 - architecture: x64 - - name: Get software versions please - run: | - cmake --version - git --version - python --version - - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - - name: Get autobuild version - run: autobuild --version - - name: Configure autobuild - if: startsWith(matrix.os, 'windows') - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE - - name: Configure autobuild - if: startsWith(matrix.os, 'ubuntu') - shell: bash - run: | - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - name: Build & Package - if: startsWith(matrix.os, 'windows') - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount /detailedsummary - - name: Build & Package - if: startsWith(matrix.os, 'ubuntu') - shell: bash - run: | - autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'windows') - with: - name: fs-windows-gha-artifact - path: build-vc120-64/newview/Release/*_Setup.exe - - uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'ubuntu') - with: - name: fs-ubuntu-gha-artifact - path: build-linux-x86_64/newview/Phoenix*.tar.* From 89e17a25f7041b0b0ad485ec322426e0d7a412a5 Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 May 2020 20:47:10 -0400 Subject: [PATCH 43/78] use hardlinks while packaging to keep within gha disk limits --- .github/workflows/CompileUbuntu.yml | 16 +++++++++++----- indra/newview/viewer_manifest.py | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CompileUbuntu.yml b/.github/workflows/CompileUbuntu.yml index 2287c6e81b3..34a91f8800c 100644 --- a/.github/workflows/CompileUbuntu.yml +++ b/.github/workflows/CompileUbuntu.yml @@ -7,11 +7,13 @@ jobs: runs-on: ubuntu-16.04 env: AUTOBUILD_VSVER: 120 - + XZ_DEFAULTS: -T0 steps: - uses: actions/checkout@v2 with: submodules: true + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v2 - name: Set env apt run: | sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb @@ -24,20 +26,24 @@ jobs: with: python-version: 2.7 architecture: x64 + - name: Install autobuild through PIP + run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - name: Get software versions please run: | cmake --version git --version python --version - - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - - name: Configure autobuild - run: | autobuild --version + cat /proc/cpuinfo + - run: df -h + - name: Configure + run: | autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - run: df -h - name: Build & Package run: | autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja + - run: df -h - name: Upload Artifact uses: actions/upload-artifact@v2 with: diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index a28887ad19c..48e884aaef7 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1858,6 +1858,26 @@ class Darwin_x86_64_Manifest(DarwinManifest): class LinuxManifest(ViewerManifest): build_data_json_platform = 'lnx' + def ccopyfile(self, src, dst): + if re.match(".*firestorm-bin.*", src+dst): + print("not hardlinking firestorm-bin...", src) + super(LinuxManifest, self).ccopyfile(src, dst) + return + copy2 = shutil.copy2 + try: + shutil.copy2 = os.link + super(LinuxManifest, self).ccopyfile(src, dst) + finally: + shutil.copy2 = copy2 + + def ccopytree(self, src, dst): + copy2 = shutil.copy2 + try: + shutil.copy2 = os.link + super(LinuxManifest, self).ccopytree(src, dst) + finally: + shutil.copy2 = copy2 + def construct(self): # HACK! Force parent to always copy XML/... even when not having configured with --package. # This allows build result to be started without always having to --package and thus waiting for the length tar ball generation --package incurs From 5dffe35506dcba43e82d5cb329f430f018545599 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sun, 2 Aug 2020 17:12:41 -0400 Subject: [PATCH 44/78] update fs-build-variables submodule --- fs-build-variables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs-build-variables b/fs-build-variables index 5a8faeb41bc..42d48cbd78a 160000 --- a/fs-build-variables +++ b/fs-build-variables @@ -1 +1 @@ -Subproject commit 5a8faeb41bc540aa49467647d0699c4040bced7a +Subproject commit 42d48cbd78aafb8fac1c79d2ff711dc01f261546 From f9cbfb165e006e0b477d4017f7618f49cdfc1f7b Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 3 Aug 2020 11:06:14 -0400 Subject: [PATCH 45/78] update gha viewer revision --- .github/workflows/CompileWindows.yml | 18 +++++++++++++++--- scripts/configure_firestorm.sh | 6 ++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 53c76f27f55..f5479c8e07d 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -12,14 +12,26 @@ jobs: env: AUTOBUILD_VSVER: 120 PreferredToolArchitecture: x64 + VIEWER_CHANNEL: FirestormVR-GHA + VIEWER_VERSION_REVISION: 60799 steps: - uses: actions/checkout@v2 with: submodules: true + - name: Set VIEWER_VERSION_GITHASH + shell: bash + run: | + majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` + minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` + patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` + echo ::set-env name=VIEWER_VERSION_STR::${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} + echo ::set-env name=VIEWER_VERSION_GITHASH::$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) - name: Set env shell: cmd - run: echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables + run: | + echo ::set-env name=AUTOBUILD_ID::- + echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables - name: Download VS2013 Community run: choco install visualstudiocommunity2013 - name: Setup python @@ -39,7 +51,7 @@ jobs: run: | call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{env.VIEWER_CHANNEL}} -DLL_TESTS:BOOL=FALSE - name: Build & Package shell: cmd run: | @@ -48,5 +60,5 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: fs-windows-gha-artifact + name: windows-${{env.VIEWER_CHANNEL}}-${{env.VIEWER_VERSION_STR}}-${{env.VIEWER_VERSION_GITHASH}} path: build-vc120-64/newview/Release/*_Setup.exe diff --git a/scripts/configure_firestorm.sh b/scripts/configure_firestorm.sh index 353c760f9e8..70bb6fb4b62 100755 --- a/scripts/configure_firestorm.sh +++ b/scripts/configure_firestorm.sh @@ -428,7 +428,9 @@ fi if [ \( $WANTS_VERSION -eq $TRUE \) -o \( $WANTS_CONFIG -eq $TRUE \) ] ; then echo "Versioning..." pushd .. - if [ -d .git ] + if [ "$VIEWER_VERSION_REVISION" -gt 0 ] ; then + buildVer=$VIEWER_VERSION_REVISION + elif [ -d .git ] then buildVer=`git rev-list --count HEAD` else @@ -439,7 +441,7 @@ if [ \( $WANTS_VERSION -eq $TRUE \) -o \( $WANTS_CONFIG -eq $TRUE \) ] ; then majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` - gitHash=`git describe --always --exclude '*'` + gitHash=${VIEWER_VERSION_GITHASH:-`git describe --always --exclude '*'`} echo "Channel : ${CHANNEL}" echo "Version : ${majorVer}.${minorVer}.${patchVer}.${buildVer} [${gitHash}]" GITHASH=-DVIEWER_VERSION_GITHASH=\"${gitHash}\" From a5f062cec4ed4c96d138383554ce09ed9f16b388 Mon Sep 17 00:00:00 2001 From: humbletim Date: Wed, 2 Sep 2020 13:19:40 -0400 Subject: [PATCH 46/78] fix vrconfig.ini path --- indra/newview/llviewerVR.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerVR.cpp b/indra/newview/llviewerVR.cpp index 84809bc909d..66993561edd 100644 --- a/indra/newview/llviewerVR.cpp +++ b/indra/newview/llviewerVR.cpp @@ -2032,7 +2032,7 @@ F32 llviewerVR::Modify(F32 val, F32 step, F32 min, F32 max) std::string llviewerVR::INISaveRead(bool save) { std::string path = getenv("APPDATA"); - path.append("\\Firestorm_x64\\vrconfig.ini"); + path.append("\\FirestormVR_x64\\vrconfig.ini"); std::string ret; ret.append(path); ret.append("\n"); From 039838ca448a51fe2662ff779767fcf9bf44dcd1 Mon Sep 17 00:00:00 2001 From: humbletim Date: Wed, 9 Dec 2020 13:46:36 -0500 Subject: [PATCH 47/78] vs2019 updates switch to local fs-build-variables clone use local autobuild-1.1 repo fix shell; autobuild cache --- .github/workflows/CompileUbuntu.yml | 51 ------------------ .github/workflows/CompileWindows.yml | 77 +++++++++++++++++++++------- .gitmodules | 2 +- indra/cmake/00-Common.cmake | 20 ++++++++ indra/newview/fs_viewer_manifest.py | 2 + scripts/configure_firestorm.sh | 2 +- 6 files changed, 82 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/CompileUbuntu.yml diff --git a/.github/workflows/CompileUbuntu.yml b/.github/workflows/CompileUbuntu.yml deleted file mode 100644 index 34a91f8800c..00000000000 --- a/.github/workflows/CompileUbuntu.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: CompileUbuntu - -on: [pull_request] - -jobs: - ubuntu_autobuild: - runs-on: ubuntu-16.04 - env: - AUTOBUILD_VSVER: 120 - XZ_DEFAULTS: -T0 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - # - name: Setup tmate session - # uses: mxschmitt/action-tmate@v2 - - name: Set env apt - run: | - sudo apt-get install -y -qq libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxinerama-dev libxrender-dev gdb - echo ::set-env name=AUTOBUILD_VARIABLES_FILE::$PWD/fs-build-variables/variables - echo ::set-env name=LIBRARY_PATH::$PWD/openvr/lib/linux64 - - name: Setup Ninja - uses: seanmiddleditch/gha-setup-ninja@master - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 2.7 - architecture: x64 - - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild - - name: Get software versions please - run: | - cmake --version - git --version - python --version - autobuild --version - cat /proc/cpuinfo - - run: df -h - - name: Configure - run: | - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - run: df -h - - name: Build & Package - run: | - autobuild build -A 64 -c ReleaseFS_open -- --package --openal --chan FirestormVR-GHA -DLL_TESTS:BOOL=FALSE --ninja - - run: df -h - - name: Upload Artifact - uses: actions/upload-artifact@v2 - with: - name: fs-ubuntu-gha-artifact - path: build-linux-x86_64/newview/Phoenix*.tar.* diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index f5479c8e07d..1221258b3b0 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -10,55 +10,94 @@ jobs: windows_build: runs-on: windows-latest env: - AUTOBUILD_VSVER: 120 + FSVS_TARGET: 'Visual Studio 16 2019' + AUTOBUILD_VSVER: 164 PreferredToolArchitecture: x64 VIEWER_CHANNEL: FirestormVR-GHA - VIEWER_VERSION_REVISION: 60799 - + VIEWER_VERSION_REVISION: 64531 steps: - uses: actions/checkout@v2 with: submodules: true + - name: Set env + shell: cmd + run: | + echo %cd% + df -h + mkdir c:\cache + mkdir c:\cache\autobuild + + mkdir build-vc${{ env.AUTOBUILD_VSVER }}-64 + cd build-vc${{ env.AUTOBUILD_VSVER }}-64 + mkdir c:\cache\packages + mklink /j packages c:\cache\packages + + mkdir c:\build + mkdir c:\build\newview + mklink /j newview c:\build\newview + cd .. + + dir build-vc${{ env.AUTOBUILD_VSVER }}-64 + dir + echo AUTOBUILD_ID=->> %GITHUB_ENV% + echo AUTOBUILD_INSTALLABLE_CACHE=c:\cache\autobuild>> %GITHUB_ENV% + echo AUTOBUILD_VARIABLES_FILE=%cd%\fs-build-variables\variables>> %GITHUB_ENV% - name: Set VIEWER_VERSION_GITHASH shell: bash run: | majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` - echo ::set-env name=VIEWER_VERSION_STR::${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} - echo ::set-env name=VIEWER_VERSION_GITHASH::$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) - - name: Set env - shell: cmd - run: | - echo ::set-env name=AUTOBUILD_ID::- - echo ::set-env name=AUTOBUILD_VARIABLES_FILE::%cd%\fs-build-variables\variables - - name: Download VS2013 Community - run: choco install visualstudiocommunity2013 + echo VIEWER_VERSION_STR=${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} >> $GITHUB_ENV + echo VIEWER_VERSION_GITHASH=$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) >> $GITHUB_ENV + df -h + - name: Setup vsdevenv + uses: seanmiddleditch/gha-setup-vsdevenv@master + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.0.2 - name: Setup python uses: actions/setup-python@v2 with: python-version: 2.7 architecture: x64 - name: Get software versions please + shell: cmd run: | + echo AUTOBUILD_INSTALLABLE_CACHE='%AUTOBUILD_INSTALLABLE_CACHE%' cmake --version git --version python --version + cl.exe + MSBuild.exe -version + echo " " + df -h - name: Install autobuild through PIP - run: pip install git+https://vcs.firestormviewer.org/autobuild-1.1#egg=autobuild + run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild + + - name: cache -- autobuild downloaded installables + id: cacheddownloads + uses: actions/cache@v2 + with: + path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} + key: ${{ runner.os }}-cacheddownloads-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} + - name: cache -- packages cache + id: cachedpackages + uses: actions/cache@v2 + with: + path: c:\cache\packages + key: ${{ runner.os }}-cachedpackages-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} + - name: Configure autobuild shell: cmd run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{env.VIEWER_CHANNEL}} -DLL_TESTS:BOOL=FALSE + autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build & Package shell: cmd run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 - msbuild build-vc120-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount + msbuild build-vc${{ env.AUTOBUILD_VSVER }}-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount - name: Upload Artifact uses: actions/upload-artifact@v2 with: - name: windows-${{env.VIEWER_CHANNEL}}-${{env.VIEWER_VERSION_STR}}-${{env.VIEWER_VERSION_GITHASH}} - path: build-vc120-64/newview/Release/*_Setup.exe + name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} + path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/Release/*_Setup.exe diff --git a/.gitmodules b/.gitmodules index 721f2982d2d..1acdc604bf9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/ValveSoftware/openvr [submodule "fs-build-variables"] path = fs-build-variables - url = https://vcs.firestormviewer.org/fs-build-variables + url = https://github.com/humbletim/fs-build-variables diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 1045a6efae1..e4277f7b819 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -285,4 +285,24 @@ else (USESYSTEMLIBS) ) endif (USESYSTEMLIBS) +if (NOT GENERATE_DEBUG_SYMBOLS) + message(WARNING "DISENGAGING DEBUG SYMBOL GENERATION (removing /Z[oiI7]..)") + #string(REGEX REPLACE "/Z[oiI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/DEBUG(:[A-Z]+)?|/OPT:REF|/FORCE:MULTIPLE " "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + string(REGEX REPLACE "/DEBUG(:[A-Z]+)?|/OPT:REF|/FORCE:MULTIPLE " "" CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}") + string(REGEX REPLACE "/DEBUG(:[A-Z]+)?|/OPT:REF|/FORCE:MULTIPLE " "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") + set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") + + message(STATUS + "== CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}\n" + "== CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}\n" + "== CMAKE_CXX_LINKER_FLAGS ${CMAKE_CXX_LINKER_FLAGS}\n" + "== CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}]\n" + ) +endif() + endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/newview/fs_viewer_manifest.py b/indra/newview/fs_viewer_manifest.py index d6666d0fef9..463f869dcc0 100644 --- a/indra/newview/fs_viewer_manifest.py +++ b/indra/newview/fs_viewer_manifest.py @@ -97,6 +97,7 @@ def fs_linux_tar_excludes(self): return "--exclude=%s/bin/.debug" % installer_name def fs_save_windows_symbols(self): + return self.fs_save_symbols("windows") pdbName = "firestorm-bin.pdb" @@ -148,6 +149,7 @@ def fs_save_osx_symbols( self ): self.fs_save_symbols("darwin") def fs_save_symbols(self, osname): + return if (os.path.exists("%s/firestorm-symbols-%s-%d.tar.bz2" % (self.args['configuration'].lower(), osname, self.address_size))): diff --git a/scripts/configure_firestorm.sh b/scripts/configure_firestorm.sh index 70bb6fb4b62..f805ed01ea1 100755 --- a/scripts/configure_firestorm.sh +++ b/scripts/configure_firestorm.sh @@ -578,7 +578,7 @@ if [ $WANTS_CONFIG -eq $TRUE ] ; then fi fi - cmake -G "$TARGET" ../indra $CHANNEL ${GITHASH} $FMODSTUDIO $OPENAL $KDU $OPENSIM $SINGLEGRID $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $TRACY_PROFILER $TESTBUILD $PACKAGE \ + cmake -G "${FSVS_TARGET:-$TARGET}" ../indra $CHANNEL ${GITHASH} $FMODSTUDIO $OPENAL $KDU $OPENSIM $SINGLEGRID $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $TRACY_PROFILER $TESTBUILD $PACKAGE \ $UNATTENDED -DLL_TESTS:BOOL=OFF -DADDRESS_SIZE:STRING=$AUTOBUILD_ADDRSIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE $CACHE_OPT \ $CRASH_REPORTING -DVIEWER_SYMBOL_FILE:STRING="${VIEWER_SYMBOL_FILE:-}" $LL_ARGS_PASSTHRU ${VSCODE_FLAGS:-} | tee $LOG From bac1c0ca9679049f9d4620ca624b856e002545e3 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 26 Mar 2022 15:51:00 -0400 Subject: [PATCH 48/78] + gha workflow_dispatch options --- .github/workflows/CompileWindows.yml | 50 ++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 1221258b3b0..5f1c5a00ac0 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -1,6 +1,17 @@ name: CompileWindows -on: [pull_request] +on: + # pull_request: + workflow_dispatch: + inputs: + buildsys: + description: 'ninja or msbuild' + required: true + default: msbuild + llpackage: + description: 'build/package/upload firestorm installer (if false only autobuild configure and caching is performed)' + required: true + default: false defaults: run: @@ -8,13 +19,13 @@ defaults: jobs: windows_build: - runs-on: windows-latest + runs-on: windows-2019 env: FSVS_TARGET: 'Visual Studio 16 2019' AUTOBUILD_VSVER: 164 PreferredToolArchitecture: x64 VIEWER_CHANNEL: FirestormVR-GHA - VIEWER_VERSION_REVISION: 64531 + VIEWER_VERSION_REVISION: 65659 steps: - uses: actions/checkout@v2 with: @@ -54,7 +65,11 @@ jobs: - name: Setup vsdevenv uses: seanmiddleditch/gha-setup-vsdevenv@master - name: Setup MSBuild + if: ${{ github.event.inputs.buildsys == 'msbuild' }} uses: microsoft/setup-msbuild@v1.0.2 + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@master + if: ${{ github.event.inputs.buildsys == 'ninja' }} - name: Setup python uses: actions/setup-python@v2 with: @@ -68,7 +83,7 @@ jobs: git --version python --version cl.exe - MSBuild.exe -version + ${{ github.event.inputs.buildsys }}.exe -version echo " " df -h - name: Install autobuild through PIP @@ -87,17 +102,38 @@ jobs: path: c:\cache\packages key: ${{ runner.os }}-cachedpackages-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} - - name: Configure autobuild + - name: Configure autobuild (msbuild) + if: ${{ github.event.inputs.buildsys == 'msbuild' }} shell: cmd run: | autobuild --version autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - - name: Build & Package + - name: Build & Package (msbuild) + if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} shell: cmd run: | msbuild build-vc${{ env.AUTOBUILD_VSVER }}-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount - - name: Upload Artifact + - name: Upload Artifact (msbuild) + if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 with: name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/Release/*_Setup.exe + + - name: Configure autobuild (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' }} + shell: bash + run: | + autobuild --version + autobuild configure -A 64 -c ReleaseFS_open -- --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + - name: Build & Package (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + shell: bash + run: | + ninja -C build-vc${{ env.AUTOBUILD_VSVER }}-64 llpackage + - name: Upload Artifact (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + uses: actions/upload-artifact@v2 + with: + name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} + path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/*_Setup.exe From ca8f8c53dfd47560c8fd38a4c5bf208f2c6918e0 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 26 Mar 2022 16:55:21 -0400 Subject: [PATCH 49/78] AUTOBUILD_LOGLEVEL: --verbose --- .github/workflows/CompileWindows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 5f1c5a00ac0..1212a2bc5a3 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -23,6 +23,7 @@ jobs: env: FSVS_TARGET: 'Visual Studio 16 2019' AUTOBUILD_VSVER: 164 + AUTOBUILD_LOGLEVEL: '--verbose' PreferredToolArchitecture: x64 VIEWER_CHANNEL: FirestormVR-GHA VIEWER_VERSION_REVISION: 65659 From 6988ad4c707605e32eb3dbe33f34b51e0b91ac90 Mon Sep 17 00:00:00 2001 From: humbletim Date: Mon, 28 Mar 2022 04:31:33 -0400 Subject: [PATCH 50/78] 3p-inline + switch to ninja --- .github/3p/CompileWindows.autobuild-setup.sh | 32 +++++ .github/3p/_assert_defined.sh | 9 ++ .github/3p/_autobuild-json2xml.jq | 39 ++++++ .github/3p/_autobuild_prop_as_json.sh | 19 +++ .github/3p/_dsp_sourcefiles.sh | 17 +++ .../3p/build-cmds/3p-discord-rpc.build-cmd.sh | 29 ++++ .../3p/build-cmds/3p-freetype.build-cmd.sh | 41 ++++++ .github/3p/build-cmds/3p-glod.build-cmd.sh | 42 ++++++ .../3p/build-cmds/3p-gntp-growl.build-cmd.sh | 20 +++ .../build-cmds/3p-ndPhysicsStub.build-cmd.sh | 35 +++++ .../3p/build-cmds/3p-openjpeg2.build-cmd.sh | 25 ++++ .../3p/build-cmds/3p-openvr.autobuild.json | 24 ++++ .github/3p/build-cmds/3p-openvr.build-cmd.sh | 16 +++ .github/3p/inline-build.sh | 100 ++++++++++++++ .github/3p/use-alternate.sh | 42 ++++++ .github/fsenv.sh | 89 +++++++++++++ .github/workflows/CompileWindows.yml | 126 ++++++++++-------- indra/cmake/00-Common.cmake | 18 ++- indra/cmake/Copy3rdPartyLibs.cmake | 14 +- indra/cmake/OPENAL.cmake | 4 +- indra/newview/CMakeLists.txt | 69 +++++----- indra/newview/llviewerVR.cpp | 4 +- indra/newview/viewer_manifest.py | 11 +- scripts/configure_firestorm.sh | 7 +- 24 files changed, 717 insertions(+), 115 deletions(-) create mode 100644 .github/3p/CompileWindows.autobuild-setup.sh create mode 100644 .github/3p/_assert_defined.sh create mode 100644 .github/3p/_autobuild-json2xml.jq create mode 100644 .github/3p/_autobuild_prop_as_json.sh create mode 100644 .github/3p/_dsp_sourcefiles.sh create mode 100644 .github/3p/build-cmds/3p-discord-rpc.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-freetype.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-glod.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-gntp-growl.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-openjpeg2.build-cmd.sh create mode 100644 .github/3p/build-cmds/3p-openvr.autobuild.json create mode 100644 .github/3p/build-cmds/3p-openvr.build-cmd.sh create mode 100644 .github/3p/inline-build.sh create mode 100644 .github/3p/use-alternate.sh create mode 100644 .github/fsenv.sh diff --git a/.github/3p/CompileWindows.autobuild-setup.sh b/.github/3p/CompileWindows.autobuild-setup.sh new file mode 100644 index 00000000000..55d39e98bbe --- /dev/null +++ b/.github/3p/CompileWindows.autobuild-setup.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# github actions helper for compiling specific prebuilts inline +# -- humbletim 2022.03.27 + +set -eu +. .github/3p/_assert_defined.sh + +assert_defined AUTOBUILD_INSTALLABLE_CACHE AUTOBUILD_CONFIG_FILE \ + INLINE_FS3P_GITURL INLINE_FS3P_DEPS \ + ALTERNATE_FS3P_DEPS + +for x in $INLINE_FS3P_DEPS ; do + echo "[[ $x ]]" + time .github/3p/inline-build.sh 3p-inline $INLINE_FS3P_GITURL/3p-$x + echo +done + +for x in $ALTERNATE_FS3P_DEPS ; do + echo "[[ $x ]]" + time .github/3p/use-alternate.sh $x + echo +done + +# changes to autobuild.xml from autobuild tooling "randomly" reorder entries +# create a sorted hash+url list to use for change detection and cache keys +( + echo "import json; print(json.dumps((" ; autobuild installables print ; echo "), indent=4))" +) | python | jq -r ".[]|(.platforms.windows64//.platforms.common)|select(.)|.archive.hash+\"\t\"+.archive.url" \ + | sort -u | tee autobuild.xml.sorted.txt >&2 + +echo -n "// " >&2 +md5sum autobuild.xml.sorted.txt >&2 diff --git a/.github/3p/_assert_defined.sh b/.github/3p/_assert_defined.sh new file mode 100644 index 00000000000..13b02c39346 --- /dev/null +++ b/.github/3p/_assert_defined.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +function assert_defined() { + local x= + for x in $* ; do + test -n "${!x:-}" || { echo "environment variable '$x' missing" ; exit 1 ; } + if [[ -n "${DEBUG:-}" ]] ; then echo $x=${!x} >&2 ; fi + done +} diff --git a/.github/3p/_autobuild-json2xml.jq b/.github/3p/_autobuild-json2xml.jq new file mode 100644 index 00000000000..0957f8097e6 --- /dev/null +++ b/.github/3p/_autobuild-json2xml.jq @@ -0,0 +1,39 @@ +# jq helper for converting human-friendly autobuild.json into gory autobuild.xml + + +def _pad(level): + " " + | .[0:(if (level|type == "number" and level > 0) then level*2 else 0 end)]; + +def _wrap(level; name; stuff): + "<"+name+">"+( + if (level < 0 or (stuff|length == 0)) then stuff else "\n"+(stuff)+"\n"+_pad(level) end + )+""; + +def _llsd(level; value): + value as $value | + ( + if $value|type == "object" then + _wrap(level-1; "map"; ( + [ + ( $value | to_entries[] ) + | (""+_pad(level)+""+.key+"" + _llsd(level+1; .value) ) + ] | join("\n") + )) + elif $value|type == "array" then + _wrap(level-1; "array"; [$value[]|_pad(level)+_llsd(level; .)]|join("\n")) + elif $value|type == "string" then + _wrap(-1; "string"; $value) + else + _wrap(-1; "UNKNOWN"; $value|tostring) + end + ); + +def llsd: + "\n"+ + "\n" + + _pad(1) + _llsd(2; .) + "\n" + ""; + + + diff --git a/.github/3p/_autobuild_prop_as_json.sh b/.github/3p/_autobuild_prop_as_json.sh new file mode 100644 index 00000000000..b4af8bdab44 --- /dev/null +++ b/.github/3p/_autobuild_prop_as_json.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# example usage: +# autobuild_prop_as_json "glod" ".archive.url" +function autobuild_prop_as_json() { + ( + echo 'import json; print(json.dumps((' + autobuild installables print $1 + echo '), indent=4))' + ) | python | jq -r "(.platforms.windows64//.platforms.common)|$2" +} + +function autobuild_jq() { + ( + echo 'import json; print(json.dumps((' + autobuild installables print + echo '), indent=4))' + ) | python | jq -r "$@" +} diff --git a/.github/3p/_dsp_sourcefiles.sh b/.github/3p/_dsp_sourcefiles.sh new file mode 100644 index 00000000000..211b452acf1 --- /dev/null +++ b/.github/3p/_dsp_sourcefiles.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# helper function for extracting C SOURCE files from old school .dsp projects +# -- humbletim 2022.03.27 +# +# usage: _dsp_sourcefiles [optional per-source prefix -- eg: -Tp] +# example: +# SRCS=$(_dsp_sourcefiles project.dsp -Tp) +# cl.exe /c $SRCS +function _dsp_sourcefiles() { + local dspfile=$1 Tp=${2:-} + local reldir=${Tp}$(dirname $dspfile)/ + test -f $dspfile + echo "_dsp_sources($dspfile,$reldir)" >&2 + cat $dspfile | \ + grep -Ei '^SOURCE=.*\.(c|cxx|cpp|c+\+|cc)\s*$' | \ + sed -e "s@SOURCE=@${reldir}@;" -e 's@\\@/@g; s@/\./@/@g;' +} diff --git a/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh b/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh new file mode 100644 index 00000000000..c5e920f47b6 --- /dev/null +++ b/.github/3p/build-cmds/3p-discord-rpc.build-cmd.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +DISCORD_SOURCE_DIR="discord-rpc-3.4.0" + +# workaround older(?) autobuild runtime issue from Git+Windows MINGW bash prompt +USERPROFILEAppDataLocalMicrosoftWindowsApps= + +mkdir -p build +mkdir -p stage/lib/release +mkdir -p stage/LICENSES +mkdir -p stage/include/discord-rpc + +wdflags=$(echo " + warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern C' function under -EHc. + warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified +" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + +cmake -S $DISCORD_SOURCE_DIR -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS="`echo $wdflags`" +ninja -C build + +cp -av build/src/discord-rpc.{lib,dll} stage/lib/release/ +cp -av $DISCORD_SOURCE_DIR/LICENSE stage/LICENSES/discord-rpc.txt +cp -av $DISCORD_SOURCE_DIR/include/*.h stage/include/discord-rpc/ +cp -av VERSION.txt stage/ diff --git a/.github/3p/build-cmds/3p-freetype.build-cmd.sh b/.github/3p/build-cmds/3p-freetype.build-cmd.sh new file mode 100644 index 00000000000..857e0102919 --- /dev/null +++ b/.github/3p/build-cmds/3p-freetype.build-cmd.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +. $_3P_UTILSDIR/_dsp_sourcefiles.sh + +cd "$(dirname "$0")" + +FREETYPELIB_SOURCE_DIR="freetype-2.3.9" +FREETYPE_VERSION=${FREETYPELIB_SOURCE_DIR#*-} + +top="$(pwd)" +stage="$(pwd)/stage" +mkdir -p $stage/lib/release +mkdir -p $stage/include/freetype2/ +mkdir -p $stage/LICENSES +mkdir -p $stage/docs/freetype + +pushd $FREETYPELIB_SOURCE_DIR + SRCS=$(_dsp_sourcefiles builds/win32/visualc/freetype.dsp) + + # tidy up some warnings + wdflags=$(echo " + warning C4312: 'type cast': conversion from 'unsigned long' to 'void *' of greater size + warning C4311: 'type cast': pointer truncation from 'void *' to 'unsigned long' + " | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + + set -x + # -I$stage/packages/include/zlib-ng + cl -O2 -Iinclude -DNDEBUG -DFT2_BUILD_LIBRARY -D_MBCS -D_LIB -c $SRCS $wdflags + lib *.obj -out:$stage/lib/release/freetype.lib + set +x + + cp -av include/ft2build.h $stage/include/ + cp -av include/freetype $stage/include/freetype2/ + cp -av docs/LICENSE.TXT $stage/LICENSES/freetype.txt +popd + +cp -av README.Linden $stage/docs/freetype/ +echo "${FREETYPE_VERSION}.${AUTOBUILD_BUILD_ID}" | tee ${stage}/VERSION.txt diff --git a/.github/3p/build-cmds/3p-glod.build-cmd.sh b/.github/3p/build-cmds/3p-glod.build-cmd.sh new file mode 100644 index 00000000000..54c135f8674 --- /dev/null +++ b/.github/3p/build-cmds/3p-glod.build-cmd.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +. $_3P_UTILSDIR/_dsp_sourcefiles.sh + +cd "$(dirname "$0")" + +mkdir -p stage/include/glod +mkdir -p stage/LICENSES +mkdir -p stage/lib/release + +GLOD_VERSION=$(grep -E '^GLOD [0-9]' README | head -1 | awk '{ print $2 }') +echo "${GLOD_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +DSPFILES=" + src/api/glodlib.dsp + src/mt/mt.dsp + src/ply/ply.dsp + src/vds/vdslib_glod.dsp + src/xbs/xbs.dsp +" +SRCS=$( + for dsp in $DSPFILES ; do + _dsp_sourcefiles "$dsp" -Tp + done +) +echo SRCS=$SRCS >&2 + +# tidy up some warnings +wdflags=$(echo " + warning C4838: conversion from '__int64' to 'int' requires a narrowing conversion + warning C4477: 'fprintf' : format string '%x' requires an argument of type 'unsigned int' + warning C4313: 'fprintf': '%x' in format string conflicts with argument 1 of type 'Tri *' +" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + +cl -O2 -DNDEBUG -EHsc -DGLOD -D_MBCS -DGLOD_EXPORTS -Iinclude -Isrc/include -Isrc/mt -Isrc/xbs -Isrc/vds $wdflags $SRCS -LD -Feglod.dll + +cp -av glod.{lib,dll} stage/lib/release/ +cp -av include/glod.h stage/include/glod/ +cp -av LICENSE stage/LICENSES/GLOD.txt diff --git a/.github/3p/build-cmds/3p-gntp-growl.build-cmd.sh b/.github/3p/build-cmds/3p-gntp-growl.build-cmd.sh new file mode 100644 index 00000000000..3d34e0824c1 --- /dev/null +++ b/.github/3p/build-cmds/3p-gntp-growl.build-cmd.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +mkdir -p stage/lib/release stage/lib/debug +mkdir -p stage/include/Growl +mkdir -p stage/LICENSES +echo "1.0" > stage/VERSION.txt + +cmake -S gntp-send -G Ninja -B build -DCMAKE_BUILD_TYPE=Release +ninja -C build growl growl++ + +cp -av build/*.{dll,lib} stage/lib/release/ +cp -av build/*.{dll,lib} stage/lib/debug/ +cp -av gntp-send/headers/{growl++.hpp,growl.h} stage/include/Growl/ +cp -av gntp-send/LICENSE stage/LICENSES/gntp-growl.txt + diff --git a/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh b/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh new file mode 100644 index 00000000000..abe06e97f66 --- /dev/null +++ b/.github/3p/build-cmds/3p-ndPhysicsStub.build-cmd.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +mkdir -p stage/lib/release stage/include stage/LICENSES + +echo "1.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +wdflags=$(echo " + warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits + warning C4244: '=': conversion from 'const double' to 'float', possible loss of data + warning C4267: 'argument': conversion from 'size_t' to 'const T', possible loss of data + warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. + warning C4477: 'sprintf' : format string '%lu' requires an argument of type 'unsigned long' +" | awk '{ print $2 }' | sed -e 's@C@-wd@; s@:$@@;') + +# hacd="src/hacdGraph.cpp src/hacdHACD.cpp src/hacdICHull.cpp src/hacdManifoldMesh.cpp src/hacdMeshDecimator.cpp src/hacdMicroAllocator.cpp src/hacdRaycastMesh.cpp" +# nd_hacdConvexDecomposition="LLConvexDecomposition.cpp nd_hacdConvexDecomposition.cpp nd_hacdStructs.cpp nd_hacdUtils.cpp nd_EnterExitTracer.cpp nd_StructTracer.cpp" +# nd_Pathing="llpathinglib.cpp llphysicsextensions.cpp" +cxxflags="-D_WINDOWS -DNOMINMAX -D_SECURE_STL=0 -D_HAS_ITERATOR_DEBUGGING=0 -D_SECURE_SCL=0 -W3 -GR -EHsc -MD -O2 -Ob2 -DNDEBUG" + +cmake -Wno-dev -S . -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE="`echo $cxxflags $wdflags`" +ninja -C build + +cp -av build/Source/*/*.lib stage/lib/release/ +cp -av ndPhysicsStub.txt stage/LICENSES/ +cp -av Source/lib/LLConvexDecomposition.h stage/include/llconvexdecomposition.h +cp -av \ + Source/Pathing/llpathinglib.h \ + Source/Pathing/llphysicsextensions.h \ + Source/lib/ndConvexDecomposition.h \ + "stage/include/" diff --git a/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh b/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh new file mode 100644 index 00000000000..4eac92bd22c --- /dev/null +++ b/.github/3p/build-cmds/3p-openjpeg2.build-cmd.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +OPENJPEG_VERSION="2.4.0" + +mkdir -p build stage/lib/release stage/lib/debug stage/include/openjpeg stage/LICENSES + +echo "${OPENJPEG_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +wdflags=$(echo " + warning C4267: '=': conversion from 'size_t' to 'OPJ_UINT32', possible loss of data +" | awk '{ print $2 }' | sed -e 's@C@/wd@; s@:$@@;') + +cmake -Wno-dev -S src -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=" `echo $wdflags`" +ninja -C build openjp2 + +cp -av build/LICENSE.txt stage/LICENSES/openjpeg.txt +cp -av src/src/lib/openjp2/{openjpeg.h,opj_stdint.h,event.h} stage/include/openjpeg/ +cp -av build/src/lib/openjp2/opj_config.h stage/include/openjpeg/ +cp -av build/bin/openjp2{.dll,.lib} stage/lib/release/ +cp -av build/bin/openjp2{.dll,.lib} stage/lib/debug/ diff --git a/.github/3p/build-cmds/3p-openvr.autobuild.json b/.github/3p/build-cmds/3p-openvr.autobuild.json new file mode 100644 index 00000000000..2b0ca07c028 --- /dev/null +++ b/.github/3p/build-cmds/3p-openvr.autobuild.json @@ -0,0 +1,24 @@ +{ + "type": "autobuild", + "version": "1.3", + "package_description": { + "name": "openvr", + "copyright": "Copyright (c) 2015, Valve Corporation", + "description": "OpenVR is an API and runtime that allows access to VR hardware from multiple vendors...", + "license": "BSD-3-Clause", "license_file": "LICENSES/openvr.txt", + "platforms": { + "common": { + "configurations": {"default":{"build":{"command":"bash","options":["-c","../build-cmd.sh"]},"name":"default"}}, + "manifest": [ "include/openvr.h" ], + "name": "common" + }, + "windows64": { + "build_directory": "stage", + "configurations": {"default":{"build":{},"default":"true","name":"default"}}, + "manifest": [ "lib/release/openvr_api.lib", "lib/release/openvr_api.dll" ], + "name": "windows64" + } + }, + "version_file": "VERSION.txt" + } +} \ No newline at end of file diff --git a/.github/3p/build-cmds/3p-openvr.build-cmd.sh b/.github/3p/build-cmds/3p-openvr.build-cmd.sh new file mode 100644 index 00000000000..435211b39de --- /dev/null +++ b/.github/3p/build-cmds/3p-openvr.build-cmd.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# minimalist build-cmd.sh replacement for gha autobuilds - humbletim 2022.03.21 +set -eu +test -n "$AUTOBUILD" || { echo "only intended for use within AUTOBUILD" ; exit 1 ; } + +cd "$(dirname "$0")" + +OPENVR_VERSION="v1.6.10" + +mkdir -p build stage/lib/release stage/include stage/LICENSES + +echo "${OPENVR_VERSION}.${AUTOBUILD_BUILD_ID:=0}" > stage/VERSION.txt + +cp -av LICENSE stage/LICENSES/openvr.txt +cp -av headers/openvr.h stage/include +cp -av bin/win64/openvr_api.dll lib/win64/openvr_api.lib stage/lib/release/ diff --git a/.github/3p/inline-build.sh b/.github/3p/inline-build.sh new file mode 100644 index 00000000000..cf8be7a10e5 --- /dev/null +++ b/.github/3p/inline-build.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# github actions helper for compiling patched prebuilt deps inline +# -- humbletim 2022.03.27 + +# usage: +# .github/3p/inline-build.sh +# or .github/3p/inline-build.sh [autobuild_package_name] + +set -eu +. .github/3p/_assert_defined.sh +. .github/3p/_autobuild_prop_as_json.sh + +BUILDDIR=$1 +REPO=${2%=*} +COMMIT=${2#*=} +if [[ -n "$COMMIT" || "$COMMIT" == "$REPO" ]] ; then + COMMIT=${3:-master} +fi +NAME=${4:-$(basename $REPO)} +srcdir=$BUILDDIR/$NAME +buildcmd=$(dirname $0)/build-cmds/${NAME}.build-cmd.sh +assert_defined REPO COMMIT NAME + +assert_defined AUTOBUILD_PLATFORM AUTOBUILD_ADDRSIZE AUTOBUILD_VSVER AUTOBUILD_CONFIG_FILE + +function process_results_env() { + if [[ -f $srcdir/_results.env ]] ; then + . $srcdir/_results.env + assert_defined autobuild_package_name autobuild_package_filename autobuild_package_md5 + test -f $autobuild_package_filename || { echo "_results.env references missing autobuild_package_filename=$autobuild_package_filename" ; return 2 ; } + + local before=$(autobuild_prop_as_json $autobuild_package_name .archive) + test ! -f installables.log || rm -f installables.log + if [[ "$before" == "null" ]] ; then + echo -n "=== ADDING NEW PACKAGE $NAME " + { autobuild installables -a "file:///$autobuild_package_filename" add $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ + || { echo "FAILED TO ADD PACKAGE $NAME"; cat installables.log ; exit 5 ; } + echo ...done + else + echo -n "=== UPDATING PACKAGE $NAME " + { autobuild installables -a "file:///$autobuild_package_filename" edit $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ + || { echo "FAILED TO UPDATE PACKAGE $NAME"; cat installables.log ; exit 5 ; } + echo ...done + fi + local after=$(autobuild_prop_as_json $autobuild_package_name .archive) + if [[ "$before" != "$after" ]] ; then + echo "resulting autobuild.xml entry: $after" + fi + return 0 + else + echo "(skipping preflight process_results_env ($srcdir/_results.env not found))" >&2 + return 1 + fi +} + +# check for preexisting _results.env + autobuild archive +# (ie: if populated from github actions cache) +process_results_env && exit 0 || true + +test -e $buildcmd || { + echo "local build-cmd.sh override not found: $buildcmd" + echo "need to create/adapt a new build-cmd.sh override; see:" + echo " git clone $REPO $srcdir" + exit 2 +} + +# fetch dependency repo and commit point +test -e $srcdir/.git || ( + git clone -q $REPO $srcdir + cd $srcdir + git -c advice.detachedHead=false checkout -f $COMMIT 2>&1 +) + +# patch build-cmd.sh +cp -av $buildcmd $srcdir/build-cmd.sh +buildjson=$(dirname $0)/build-cmds/${NAME}.autobuild.json +if [[ -f $buildjson && ! -f $srcdir/autobuild.xml ]] ; then + echo "generating $NAME autobuild.xml from $buildjson" >&2 + jq -r "include \"$(dirname $0)/_autobuild-json2xml\" ; llsd" $buildjson \ + > $srcdir/autobuild.xml +fi + +( + cd $srcdir + unset AUTOBUILD_CONFIGURATION + export AUTOBUILD_CONFIG_FILE=$srcdir/autobuild.xml + export AUTOBUILD_BUILD_ID=$(git rev-parse --short HEAD) + success= + test ! -f build.log || rm -vf build.log + test ! -f package.log || rm -vf package.log + autobuild install + echo -n "==== BUILDING $NAME ==== " + { autobuild build 2>&1 ; } >> build.log || { echo "XXXXX BUILDING $NAME FAILED" ; cat build.log ; exit 3 ; } + echo "... done" + echo -n "==== PACKAGING $NAME ==== " + { autobuild package --results-file _results.env 2>&1 ; } >> package.log || { echo "XXXXX PACKAGING $NAME FAILED" ; cat package.log ; exit 4 ; } + echo "... done" +) + +process_results_env diff --git a/.github/3p/use-alternate.sh b/.github/3p/use-alternate.sh new file mode 100644 index 00000000000..a3588fdcb25 --- /dev/null +++ b/.github/3p/use-alternate.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# github actions helper that patches autobuild.xml to use an alternate source +# -- humbletim 2022.03.27 + +# note: autobuild props are derived from the url's tar.bz2 filename +# usage: +# .github/3p/use-alternate.sh +# or .github/3p/use-alternate.sh "=" + +set -eu +. .github/3p/_assert_defined.sh +. .github/3p/_autobuild_prop_as_json.sh + +assert_defined AUTOBUILD_CONFIG_FILE AUTOBUILD_PLATFORM + +autobuild_package_filename=${1%=*} +autobuild_package_md5=${1#*=} +if [[ -z $autobuild_package_md5 ]] ; then + autobuild_package_md5=${2} +fi + +# extract ---.tar.bz2 +filename=$(basename $autobuild_package_filename) +regex='^([-a-z][a-z0-9]+)-([.0-9]+)-(common|windows|windows64|darwin|darwin64|linux|linux64)-(.*)(\.tar\.(bz2|gz|xz)|\.zip)$' +if [[ $filename =~ $regex ]] ; then + autobuild_package_name=${BASH_REMATCH[1]} + autobuild_package_version=${BASH_REMATCH[2]} + autobuild_package_platform=${BASH_REMATCH[3]} + autobuild_package_id=${BASH_REMATCH[4]} +fi + +assert_defined autobuild_package_name autobuild_package_filename autobuild_package_md5 + +# snapshot autobuild.xml before/after state to detect modifications +before=$(autobuild_prop_as_json $autobuild_package_name .archive) + +autobuild installables edit $autobuild_package_name hash=$autobuild_package_md5 url=$autobuild_package_filename + +after=$(autobuild_prop_as_json $autobuild_package_name .archive) +if [[ "$before" != "$after" ]] ; then + echo "UPDATED autobuild.xml: $after" +fi diff --git a/.github/fsenv.sh b/.github/fsenv.sh new file mode 100644 index 00000000000..9a33e7025e8 --- /dev/null +++ b/.github/fsenv.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# github actions helper to initialize environment variables for building firestorm +# -- humbletim 2022.03.27 + +set -eu + +# function wrapper to avoid leaking variables when "sourced" into other scripts +function _fsenv() { + + # setenv [default-value] + # exports the named variable and emits a key="value" to stdout + # (a no-op when the variable doesn't exist and no default is specified) + function setenv() { + if [[ ! ${!1+x} ]] ; then + if [[ $# -lt 2 ]] ; then return 0 ; fi + eval "export ${1}=\"$2\"" + fi + echo "${1}=\"${!1}\"" + } + + setenv _3P_UTILSDIR "$(cd $(dirname $0)/3p && pwd)" + + ############################################################################ + # workaround for github actions receiving 403: Forbidden errors when trying to + # download prebuilts from 3p.firestormviewer.org + + # 3p- deps are resolved relative to this URL + setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries + + # format: packagerepo=gitcommit + setenv INLINE_FS3P_DEPS " + discord-rpc=a21e3dc + ndPhysicsStub=aad4d9e + freetype=a8975b6 + openjpeg2=d23ab9af + gntp-growl=7ed68be + glod=eecf86f + " + + # TODO: figure out where firestorm source code for 3p-dictionaries lives... + # but for now substituting the "official" LL prebuilt seems to work. + + # format: url=md5 + setenv ALTERNATE_FS3P_DEPS " + http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55025/511964/dictionaries-1.538984-common-538984.tar.bz2=d778c6a3475bc35ee8b9615dfc38b4a9 + " + # unused + # http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55025/511964/dictionaries-1.538984-common-538984.tar.bz2=d778c6a3475bc35ee8b9615dfc38b4a9 + # https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/78593/744010/freetype-2.4.4.557047-windows64-557047.tar.bz2=69307aaba16ac71531c9c4d930ace993 + # http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55004/511885/glod-1.0pre3.538980-windows64-538980.tar.bz2=6302ee1903ab419e76565d9eb6acd274 + # http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/54974/511767/openjpeg-1.5.1.538970-windows64-538970.tar.bz2=5b5c80807fa8161f3480be3d89fe9516 + # https://bitbucket.org/kokua/3p-ndPhysicsStub/downloads/ndPhysicsStub-1.0-windows64-203290044.tar.bz2=bd172f8cf47ce5ba53a4d4128b2580d5 + ############################################################################ + + ### AUTOBUILD_ environment variables + if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then + case `uname -s` in + MINGW*) local GITHUB_WORKSPACE=$(pwd -W) ;; + *) local GITHUB_WORKSPACE=$PWD ;; + esac + fi + setenv AUTOBUILD_VARIABLES_FILE ${GITHUB_WORKSPACE}/fs-build-variables/variables + setenv AUTOBUILD_CONFIG_FILE ${GITHUB_WORKSPACE}/autobuild.xml + setenv AUTOBUILD_INSTALLABLE_CACHE ${GITHUB_WORKSPACE}/autobuild-cache + + setenv AUTOBUILD_LOGLEVEL --verbose + setenv AUTOBUILD_PLATFORM windows64 + setenv AUTOBUILD_ADDRSIZE 64 + setenv AUTOBUILD_VSVER 164 + setenv AUTOBUILD_CONFIGURATION ReleaseFS_open + setenv AUTOBUILD_BUILD_ID 0 + + ### environment variables specific to github actions / windows builds + # setenv VIEWER_CHANNEL=FirestormVR-GHA + setenv PreferredToolArchitecture x64 + setenv VIEWER_VERSION_REVISION dev + setenv FSBUILD_DIR build-vc${AUTOBUILD_VSVER}-${AUTOBUILD_ADDRSIZE} + setenv FSVS_TARGET Ninja # 'Visual Studio 16 2019' + + setenv VIEWER_VERSION_STR `echo $(cat indra/newview/VIEWER_VERSION.txt)`.${AUTOBUILD_BUILD_ID} + setenv VIEWER_VERSION_GITHASH $(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short 2>/dev/null || git rev-parse --short HEAD) + setenv VIEWER_CHANNEL + unset _fsenv +} +_fsenv +# exec wrapped command line (if any) +if [[ -n $# ]] ; then + "$@" +fi diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 1212a2bc5a3..738ccad74a2 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -7,11 +7,11 @@ on: buildsys: description: 'ninja or msbuild' required: true - default: msbuild + default: ninja llpackage: description: 'build/package/upload firestorm installer (if false only autobuild configure and caching is performed)' required: true - default: false + default: 'false' defaults: run: @@ -21,48 +21,34 @@ jobs: windows_build: runs-on: windows-2019 env: - FSVS_TARGET: 'Visual Studio 16 2019' - AUTOBUILD_VSVER: 164 - AUTOBUILD_LOGLEVEL: '--verbose' - PreferredToolArchitecture: x64 - VIEWER_CHANNEL: FirestormVR-GHA - VIEWER_VERSION_REVISION: 65659 + VIEWER_CHANNEL: FirestormVR-GHA + AUTOBUILD_BUILD_ID: 65659 + AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - uses: actions/checkout@v2 with: submodules: true - - name: Set env + - name: Preset ENV + shell: bash + run: .github/fsenv.sh | tee -a $GITHUB_ENV + - name: Prep build dirs shell: cmd run: | - echo %cd% + echo cd=%cd% + echo FSBUILD_DIR=%FSBUILD_DIR% df -h - mkdir c:\cache + mkdir %FSBUILD_DIR% mkdir c:\cache\autobuild - - mkdir build-vc${{ env.AUTOBUILD_VSVER }}-64 - cd build-vc${{ env.AUTOBUILD_VSVER }}-64 mkdir c:\cache\packages - mklink /j packages c:\cache\packages - - mkdir c:\build mkdir c:\build\newview - mklink /j newview c:\build\newview + mkdir 3p-inline + cd %FSBUILD_DIR% + mklink /j packages c:\cache\packages + mklink /j newview c:\build\newview cd .. - - dir build-vc${{ env.AUTOBUILD_VSVER }}-64 + dir %FSBUILD_DIR% dir - echo AUTOBUILD_ID=->> %GITHUB_ENV% echo AUTOBUILD_INSTALLABLE_CACHE=c:\cache\autobuild>> %GITHUB_ENV% - echo AUTOBUILD_VARIABLES_FILE=%cd%\fs-build-variables\variables>> %GITHUB_ENV% - - name: Set VIEWER_VERSION_GITHASH - shell: bash - run: | - majorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 1` - minorVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 2` - patchVer=`cat indra/newview/VIEWER_VERSION.txt | cut -d "." -f 3` - echo VIEWER_VERSION_STR=${majorVer}.${minorVer}.${patchVer}.${VIEWER_VERSION_REVISION} >> $GITHUB_ENV - echo VIEWER_VERSION_GITHASH=$(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short || git rev-parse --short HEAD) >> $GITHUB_ENV - df -h - name: Setup vsdevenv uses: seanmiddleditch/gha-setup-vsdevenv@master - name: Setup MSBuild @@ -70,7 +56,7 @@ jobs: uses: microsoft/setup-msbuild@v1.0.2 - name: Setup Ninja uses: seanmiddleditch/gha-setup-ninja@master - if: ${{ github.event.inputs.buildsys == 'ninja' }} + # if: ${{ github.event.inputs.buildsys == 'ninja' }} - name: Setup python uses: actions/setup-python@v2 with: @@ -85,56 +71,80 @@ jobs: python --version cl.exe ${{ github.event.inputs.buildsys }}.exe -version + ninja --version echo " " df -h - name: Install autobuild through PIP run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild - - name: cache -- autobuild downloaded installables - id: cacheddownloads + - name: generate sorted 3p-inline manifest + shell: bash + run: for x in $INLINE_FS3P_DEPS ; do echo $x ; done | sort -u | tee 3p-inline.sorted.txt + - name: cache -- 3p-inline + id: cached-3p-inline + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-3p-inline-${{ hashFiles('3p-inline.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + path: | + 3p-inline/*/_results.env + 3p-inline/*/*.tar.bz2 + - name: Patch and build local 3p packages + # if: steps.cached-3p-inline.outputs.cache-hit != 'true' + shell: bash + run: | + .github/3p/CompileWindows.autobuild-setup.sh + test -f autobuild.xml.sorted.txt + + - name: cache -- autobuild downloads + id: cached-downloads uses: actions/cache@v2 with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} - key: ${{ runner.os }}-cacheddownloads-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} - - name: cache -- packages cache - id: cachedpackages + key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + + - name: cache -- buildir packages + id: cached-buildir-packages uses: actions/cache@v2 with: path: c:\cache\packages - key: ${{ runner.os }}-cachedpackages-${{ hashFiles('autobuild.xml') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + + - name: Configure autobuild (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' }} + shell: bash + run: | + autobuild --version + autobuild configure -- --no-vstools --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + - name: Build & Package (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + shell: bash + run: | + ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj llpackage + - name: Upload Artifact (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + uses: actions/upload-artifact@v2 + with: + name: ${{ join([ runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH ], '-') }} + path: | + ${{ env.FSBUILD_DIR }}/newview/*_Setup.exe + autobuild.xml.sorted.txt + 3p-inline.sorted.txt - name: Configure autobuild (msbuild) if: ${{ github.event.inputs.buildsys == 'msbuild' }} shell: cmd run: | autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + autobuild configure -- --package --no-vstools --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build & Package (msbuild) if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} shell: cmd run: | - msbuild build-vc${{ env.AUTOBUILD_VSVER }}-64/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount + msbuild ${{ env.FSBUILD_DIR }}/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount - name: Upload Artifact (msbuild) if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 with: name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} - path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/Release/*_Setup.exe + path: ${{ env.FSBUILD_DIR }}/newview/Release/*_Setup.exe - - name: Configure autobuild (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' }} - shell: bash - run: | - autobuild --version - autobuild configure -A 64 -c ReleaseFS_open -- --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - - name: Build & Package (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} - shell: bash - run: | - ninja -C build-vc${{ env.AUTOBUILD_VSVER }}-64 llpackage - - name: Upload Artifact (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} - uses: actions/upload-artifact@v2 - with: - name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} - path: build-vc${{ env.AUTOBUILD_VSVER }}-64/newview/*_Setup.exe diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index e4277f7b819..69ce6d1d6d6 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -286,7 +286,9 @@ else (USESYSTEMLIBS) endif (USESYSTEMLIBS) if (NOT GENERATE_DEBUG_SYMBOLS) - message(WARNING "DISENGAGING DEBUG SYMBOL GENERATION (removing /Z[oiI7]..)") + if (DEFINED ENV{CMAKE_DEBUG}) + message(WARNING "DISENGAGING DEBUG SYMBOL GENERATION (removing /Z[oiI7]..)") + endif() #string(REGEX REPLACE "/Z[oiI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REGEX REPLACE "/Z[oiI7]|/DEBUG" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -297,12 +299,14 @@ if (NOT GENERATE_DEBUG_SYMBOLS) set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG:NONE /INCREMENTAL:NO") - message(STATUS - "== CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}\n" - "== CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}\n" - "== CMAKE_CXX_LINKER_FLAGS ${CMAKE_CXX_LINKER_FLAGS}\n" - "== CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}]\n" - ) + if (DEFINED ENV{CMAKE_DEBUG}) + message(STATUS + "== CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}\n" + "== CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}\n" + "== CMAKE_CXX_LINKER_FLAGS ${CMAKE_CXX_LINKER_FLAGS}\n" + "== CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}]\n" + ) + endif() endif() endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index c628a4a36dc..94c6711c6ca 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -94,6 +94,7 @@ if(WINDOWS) endif (USE_BUGSPLAT) set(release_files ${release_files} growl++.dll growl.dll ) + set(release_files ${release_files} openvr_api.dll ) if (FMODSTUDIO) set(debug_files ${debug_files} fmodL.dll) set(release_files ${release_files} fmod.dll) @@ -225,8 +226,7 @@ elseif(LINUX) set(SHARED_LIB_STAGING_DIR_DEBUG "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO "${SHARED_LIB_STAGING_DIR}") set(SHARED_LIB_STAGING_DIR_RELEASE "${SHARED_LIB_STAGING_DIR}") - set(openvr_src_dir ${CMAKE_SOURCE_DIR}/../openvr/bin/linux64) - set(openvr_files libopenvr_api.so) + set(vivox_lib_dir "${ARCH_PREBUILT_DIRS_RELEASE}") set(vivox_libs @@ -254,6 +254,7 @@ elseif(LINUX) ${EXPAT_COPY} libhunspell-1.3.so.0.0.0 libopenal.so + libopenvr_api.so #libopenjpeg.so libuuid.so.16 libuuid.so.16.0.22 @@ -263,6 +264,7 @@ elseif(LINUX) else (NOT USESYSTEMLIBS) set(release_files libGLOD.so + libopenvr_api.so ) endif (NOT USESYSTEMLIBS) @@ -295,13 +297,7 @@ endif(WINDOWS) ################################################################ # Done building the file lists, now set up the copy commands. ################################################################ -copy_if_different( - ${openvr_src_dir} - "${SHARED_LIB_STAGING_DIR_RELEASE}" - out_targets - ${openvr_files} - ) -set(third_party_targets ${third_party_targets} ${out_targets}) + # Curiously, slvoice_files are only copied to SHARED_LIB_STAGING_DIR_RELEASE. # It's unclear whether this is oversight or intentional, but anyway leave the diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index fe52d1a9c95..3e0cbdb9ef6 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -10,7 +10,9 @@ else (LINUX) endif (LINUX) if (OPENAL) - message( WARNING "Using OpenAL is discouraged due to no maintenance of the viewers openal integration, possible memory leaks and no support for streaming audio. Switch to fmodstudio if possible" ) + if (NOT DEFINED ENV{FSVS_TARGET}) + message( WARNING "Using OpenAL is discouraged due to no maintenance of the viewers openal integration, possible memory leaks and no support for streaming audio. Switch to fmodstudio if possible" ) + endif() set(OPENAL_LIB_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/AL") if (USESYSTEMLIBS) include(FindPkgConfig) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3285a180f26..d24ab21415f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1,6 +1,7 @@ # -*- cmake -*- project(viewer) +set(CMAKE_CFG_INTDIR .) include(00-Common) # DON'T move Linking.cmake to its place in the alphabetized list below: it @@ -64,6 +65,8 @@ include(ColladaDom) include(jemalloc) include(Discord) +use_prebuilt_binary(openvr) + # if using ndPhysicsstub this variable will be unset, we don't need to build any stub code viewer side in that case if( LLPHYSICSEXTENSIONS_SRC_DIR ) # @@ -2257,36 +2260,36 @@ if (WINDOWS) # stores a list in the variable myfile in which each item is a line from the input file." # And of course it's straightforward to read a text file in Python. - set(COPY_INPUT_DEPENDENCIES + set(xCOPY_INPUT_DEPENDENCIES # The following commented dependencies are determined at variably at build time. Can't do this here. ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll + # ${SHARED_LIB_STAGING_DIR}/Release/llcommon.dll + ${SHARED_LIB_STAGING_DIR}/Release/libapr-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/libaprutil-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/libapriconv-1.dll # Restore GLOD build dependencies ${SHARED_LIB_STAGING_DIR}/Release/glod.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll # ${SHARED_LIB_STAGING_DIR}/Release/libcollada14dom22.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll + # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll + # ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll # Only copy OpenJPEG dll if needed #${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll #${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll #${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll # ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll + # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll + # ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/Release/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt + # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll + ${SHARED_LIB_STAGING_DIR}/Release/SLVoice.exe + ${SHARED_LIB_STAGING_DIR}/Release/libsndfile-1.dll + ${SHARED_LIB_STAGING_DIR}/Release/vivoxoal.dll + ${SHARED_LIB_STAGING_DIR}/Release/ca-bundle.crt ${GOOGLE_PERF_TOOLS_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt @@ -2298,9 +2301,13 @@ if (WINDOWS) #media_plugin_example # Don't package example plugin ) + if (NOT USE_BUGSPLAT) +# LIST(APPEND COPY_INPUT_DEPENDENCIES windows-crash-logger) + endif (NOT USE_BUGSPLAT) + # Only copy OpenJPEG dll if needed if (NOT USE_KDU) - list(APPEND COPY_INPUT_DEPENDENCIES + list(APPEND xCOPY_INPUT_DEPENDENCIES ${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll ${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll @@ -2309,16 +2316,16 @@ if (WINDOWS) # if (ADDRESS_SIZE EQUAL 64) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk_x64.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp_x64.dll + list(APPEND xCOPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk_x64.dll + ${SHARED_LIB_STAGING_DIR}/Release/ortp_x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll ) else (ADDRESS_SIZE EQUAL 64) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll + list(APPEND xCOPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk.dll + ${SHARED_LIB_STAGING_DIR}/Release/ortp.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll ) @@ -2333,9 +2340,9 @@ if (WINDOWS) endif (FMODSTUDIO) if (OPENAL) - list(APPEND COPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/OpenAL32.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/alut.dll + list(APPEND xCOPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/Release/OpenAL32.dll + ${SHARED_LIB_STAGING_DIR}/Release/alut.dll ) endif (OPENAL) @@ -2353,7 +2360,7 @@ if (WINDOWS) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2414,7 +2421,7 @@ if (WINDOWS) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2430,7 +2437,7 @@ if (WINDOWS) add_custom_target(llpackage ALL DEPENDS ${CMAKE_CFG_INTDIR}/touched.bat - windows-setup-build-all + #windows-setup-build-all ) # temporarily disable packaging of event_host until hg subrepos get # sorted out on the parabuild cluster... @@ -2602,7 +2609,7 @@ if (LINUX) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2628,7 +2635,7 @@ if (LINUX) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2723,7 +2730,7 @@ if (DARWIN) --buildtype=${CMAKE_BUILD_TYPE} --bundleid=${MACOSX_BUNDLE_GUI_IDENTIFIER} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${VIEWER_APP_BUNDLE} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} @@ -2758,7 +2765,7 @@ if (DARWIN) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} "--channel=${VIEWER_CHANNEL}" - --configuration=${CMAKE_CFG_INTDIR} + --configuration=Release --dest=${VIEWER_APP_BUNDLE} --grid=${GRID} --source=${CMAKE_CURRENT_SOURCE_DIR} diff --git a/indra/newview/llviewerVR.cpp b/indra/newview/llviewerVR.cpp index 66993561edd..d50808c4477 100644 --- a/indra/newview/llviewerVR.cpp +++ b/indra/newview/llviewerVR.cpp @@ -21,7 +21,7 @@ //#include "llrender.h" #ifdef _WIN32 -#pragma comment(lib, "../../openvr/lib/win64/openvr_api.lib") +#pragma comment(lib, "openvr_api") #endif #ifndef _WIN32 @@ -2298,4 +2298,4 @@ void llviewerVR::InitUI() //m_pButton1-> } } -} \ No newline at end of file +} diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 48e884aaef7..82e539ed91c 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -575,7 +575,7 @@ def construct(self): if self.is_packaging_viewer(): # Find firestorm-bin.exe in the 'configuration' dir, then rename it to the result of final_exe. - self.path(src='%s/firestorm-bin.exe' % self.args['configuration'], dst=self.final_exe()) + self.path(src='%s/firestorm-bin.exe' % '.' or self.args['configuration'], dst=self.final_exe()) # Remove VMP #with self.prefix(src=os.path.join(pkgdir, "VMP")): @@ -596,14 +596,17 @@ def construct(self): self.path2basename(os.path.join(os.pardir, 'llplugin', 'slplugin', self.args['configuration']), "slplugin.exe") - - with self.prefix(src=os.path.join(pkgdir, os.pardir, os.pardir, 'openvr', 'bin', 'win64')): - self.path("openvr_api.dll") + + with self.prefix(src=os.path.join(relpkgdir)): + self.path("discord-rpc.dll") # Get shared libs from the shared libs staging directory with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'sharedlibs', self.args['configuration'])): + # OpenVR + self.path("openvr_api.dll") + # Mesh 3rd party libs needed for auto LOD and collada reading try: self.path("glod.dll") diff --git a/scripts/configure_firestorm.sh b/scripts/configure_firestorm.sh index f805ed01ea1..3229ace9203 100755 --- a/scripts/configure_firestorm.sh +++ b/scripts/configure_firestorm.sh @@ -428,12 +428,13 @@ fi if [ \( $WANTS_VERSION -eq $TRUE \) -o \( $WANTS_CONFIG -eq $TRUE \) ] ; then echo "Versioning..." pushd .. - if [ "$VIEWER_VERSION_REVISION" -gt 0 ] ; then - buildVer=$VIEWER_VERSION_REVISION + buildVer=${AUTOBUILD_BUILD_ID:-${VIEWER_VERSION_REVISION:-}} + if [ -n $buildVer ] ; then + true elif [ -d .git ] then buildVer=`git rev-list --count HEAD` - else + elif which hg ; then buildVer=`hg summary | head -1 | cut -d " " -f 2 | cut -d : -f 1 | grep "[0-9]*"` fi export revision=${buildVer} From 55c9a484f778dbe8a3796fe9cd1c7c460eeb5b69 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:11:47 -0400 Subject: [PATCH 51/78] remove openvr (as git submodule) --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1acdc604bf9..077cb4bd29d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "openvr"] - path = openvr - url = https://github.com/ValveSoftware/openvr [submodule "fs-build-variables"] path = fs-build-variables url = https://github.com/humbletim/fs-build-variables From 163b7807c7127242add0bd99fa3a6d13a4b8e467 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:27:16 -0400 Subject: [PATCH 52/78] cleanup COPY_INPUT_DEPENDENCIES workaround --- indra/newview/CMakeLists.txt | 54 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d24ab21415f..2dff36d2ee5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2260,36 +2260,36 @@ if (WINDOWS) # stores a list in the variable myfile in which each item is a line from the input file." # And of course it's straightforward to read a text file in Python. - set(xCOPY_INPUT_DEPENDENCIES + set(COPY_INPUT_DEPENDENCIES # The following commented dependencies are determined at variably at build time. Can't do this here. ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg - # ${SHARED_LIB_STAGING_DIR}/Release/llcommon.dll - ${SHARED_LIB_STAGING_DIR}/Release/libapr-1.dll - ${SHARED_LIB_STAGING_DIR}/Release/libaprutil-1.dll - ${SHARED_LIB_STAGING_DIR}/Release/libapriconv-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapr-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libaprutil-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libapriconv-1.dll # Restore GLOD build dependencies ${SHARED_LIB_STAGING_DIR}/Release/glod.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/glod.dll ${SHARED_LIB_STAGING_DIR}/Debug/glod.dll # ${SHARED_LIB_STAGING_DIR}/Release/libcollada14dom22.dll - # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll - # ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libcollada14dom22.dll + ${SHARED_LIB_STAGING_DIR}/Debug/libcollada14dom22-d.dll # Only copy OpenJPEG dll if needed #${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll #${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll #${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll # ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll - # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll - # ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll + ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/Release/uriparser.dll - # ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll - ${SHARED_LIB_STAGING_DIR}/Release/SLVoice.exe - ${SHARED_LIB_STAGING_DIR}/Release/libsndfile-1.dll - ${SHARED_LIB_STAGING_DIR}/Release/vivoxoal.dll - ${SHARED_LIB_STAGING_DIR}/Release/ca-bundle.crt + ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/uriparser.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt ${GOOGLE_PERF_TOOLS_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/licenses-win32.txt ${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt @@ -2302,12 +2302,12 @@ if (WINDOWS) ) if (NOT USE_BUGSPLAT) -# LIST(APPEND COPY_INPUT_DEPENDENCIES windows-crash-logger) + LIST(APPEND COPY_INPUT_DEPENDENCIES windows-crash-logger) endif (NOT USE_BUGSPLAT) # Only copy OpenJPEG dll if needed if (NOT USE_KDU) - list(APPEND xCOPY_INPUT_DEPENDENCIES + list(APPEND COPY_INPUT_DEPENDENCIES ${SHARED_LIB_STAGING_DIR}/Release/openjp2.dll ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/openjp2.dll ${SHARED_LIB_STAGING_DIR}/Debug/openjp2.dll @@ -2316,16 +2316,16 @@ if (WINDOWS) # if (ADDRESS_SIZE EQUAL 64) - list(APPEND xCOPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk_x64.dll - ${SHARED_LIB_STAGING_DIR}/Release/ortp_x64.dll + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk_x64.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp_x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1-x64.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1-x64.dll ) else (ADDRESS_SIZE EQUAL 64) - list(APPEND xCOPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/Release/vivoxsdk.dll - ${SHARED_LIB_STAGING_DIR}/Release/ortp.dll + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libcrypto-1_1.dll ${ARCH_PREBUILT_DIRS_RELEASE}/libssl-1_1.dll ) @@ -2340,9 +2340,9 @@ if (WINDOWS) endif (FMODSTUDIO) if (OPENAL) - list(APPEND xCOPY_INPUT_DEPENDENCIES - ${SHARED_LIB_STAGING_DIR}/Release/OpenAL32.dll - ${SHARED_LIB_STAGING_DIR}/Release/alut.dll + list(APPEND COPY_INPUT_DEPENDENCIES + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/OpenAL32.dll + ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/alut.dll ) endif (OPENAL) @@ -2370,7 +2370,7 @@ if (WINDOWS) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py stage_third_party_libs - ${COPY_INPUT_DEPENDENCIES} + # ${COPY_INPUT_DEPENDENCIES} COMMENT "Performing viewer_manifest copy" ) @@ -2432,7 +2432,7 @@ if (WINDOWS) ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt - ${COPY_INPUT_DEPENDENCIES} + # ${COPY_INPUT_DEPENDENCIES} ) add_custom_target(llpackage ALL DEPENDS From dad6fb28df39c8789fe2a32ea0c2c2aa857387f0 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:32:59 -0400 Subject: [PATCH 53/78] fix openvr.h path --- indra/newview/llviewerVR.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerVR.h b/indra/newview/llviewerVR.h index fdbd12e0d5f..0d221b248c3 100644 --- a/indra/newview/llviewerVR.h +++ b/indra/newview/llviewerVR.h @@ -1,6 +1,6 @@ #pragma once -#include "../../openvr/headers/openvr.h" +#include #include "llhudtext.h" #include "llgl.h" #include "string.h" From 4fecb22844bc8defa1d4d7d4b0779a3a4297c19f Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:34:25 -0400 Subject: [PATCH 54/78] remove openvr folder --- openvr | 1 - 1 file changed, 1 deletion(-) delete mode 160000 openvr diff --git a/openvr b/openvr deleted file mode 160000 index d9cffe2ff87..00000000000 --- a/openvr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d9cffe2ff87bf0bac69b56bcf6fb60652a9d4009 From 6b3d18627b571a4fb6db0c7784f6de9725b74e60 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 04:45:29 -0400 Subject: [PATCH 55/78] use format instead of join --- .github/workflows/CompileWindows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 738ccad74a2..15044602797 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -124,7 +124,7 @@ jobs: if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 with: - name: ${{ join([ runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH ], '-') }} + name: ${{ format('{0}-{1}-{2}-{3}-{4}', runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH) }} path: | ${{ env.FSBUILD_DIR }}/newview/*_Setup.exe autobuild.xml.sorted.txt From 1aa39d4e6c9712d2eeee822e30c07739c8b53f98 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 05:02:07 -0400 Subject: [PATCH 56/78] fix multiline gha env vars --- .github/fsenv.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 9a33e7025e8..91bcade0782 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -15,7 +15,14 @@ function _fsenv() { if [[ $# -lt 2 ]] ; then return 0 ; fi eval "export ${1}=\"$2\"" fi - echo "${1}=\"${!1}\"" + if [[ ${!1} == *$'\n'* ]] ; then + # bash and github action multiline env vars compat + echo "${1}< Date: Tue, 29 Mar 2022 05:10:01 -0400 Subject: [PATCH 57/78] remove extra quotes from gha env --- .github/fsenv.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 91bcade0782..76f4b5cbf73 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -21,10 +21,11 @@ function _fsenv() { echo "${!1}" echo "EOF" else - echo "${1}=\"${!1}\"" + echo "${1}=${!1}" fi } + setenv GHA_TEST_WITH_SPACES "testing 1 2 3...tab\t." setenv _3P_UTILSDIR "$(cd $(dirname $0)/3p && pwd)" ############################################################################ From c121678f31916b2a1cbd2cdacf90308e3e7f84ae Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 05:22:24 -0400 Subject: [PATCH 58/78] use local 3p-* repos --- .github/fsenv.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 76f4b5cbf73..f8cc8c384f2 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -33,7 +33,9 @@ function _fsenv() { # download prebuilts from 3p.firestormviewer.org # 3p- deps are resolved relative to this URL - setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries + setenv INLINE_FS3P_GITURL https://github.com/holostorm + ### :/ also 403's with vcs.firestormviewer.org... + ### setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries # format: packagerepo=gitcommit setenv INLINE_FS3P_DEPS " From 4797230c4afe9b5c6f71e4d562b1468c96832313 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 05:48:27 -0400 Subject: [PATCH 59/78] + sideload 3p-openvr --- .github/3p/_autobuild-json2xml.jq | 2 +- .github/workflows/CompileWindows.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/3p/_autobuild-json2xml.jq b/.github/3p/_autobuild-json2xml.jq index 0957f8097e6..95522032a12 100644 --- a/.github/3p/_autobuild-json2xml.jq +++ b/.github/3p/_autobuild-json2xml.jq @@ -32,7 +32,7 @@ def _llsd(level; value): def llsd: "\n"+ "\n" + - _pad(1) + _llsd(2; .) + "\n" + _pad(1) + _llsd(2; .) + "\n" + ""; diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 15044602797..3b012084fa8 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -92,6 +92,8 @@ jobs: # if: steps.cached-3p-inline.outputs.cache-hit != 'true' shell: bash run: | + # sideload "3p-openvr" + .github/3p/inline-build.sh 3p-inline/ https://github.com/ValveSoftware/openvr d9cffe2 3p-openvr .github/3p/CompileWindows.autobuild-setup.sh test -f autobuild.xml.sorted.txt @@ -101,6 +103,7 @@ jobs: with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + restore-keys: Windows-downloads-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: cache -- buildir packages id: cached-buildir-packages @@ -108,6 +111,7 @@ jobs: with: path: c:\cache\packages key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From 5a7a0d323f36f3687ca5518192ea002850fdff0b Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 06:42:22 -0400 Subject: [PATCH 60/78] ninja fix for viewer_manifest.py --- indra/newview/viewer_manifest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 82e539ed91c..19117068157 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -594,7 +594,7 @@ def construct(self): # Plugin host application self.path2basename(os.path.join(os.pardir, - 'llplugin', 'slplugin', self.args['configuration']), + 'llplugin', 'slplugin', '.' or self.args['configuration']), "slplugin.exe") with self.prefix(src=os.path.join(relpkgdir)): @@ -698,11 +698,11 @@ def construct(self): # Media plugins - CEF with self.prefix(dst="llplugin"): with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins')): - with self.prefix(src=os.path.join('cef', self.args['configuration'])): + with self.prefix(src=os.path.join('cef', '.' or self.args['configuration'])): self.path("media_plugin_cef.dll") # Media plugins - LibVLC - with self.prefix(src=os.path.join('libvlc', self.args['configuration'])): + with self.prefix(src=os.path.join('libvlc', '.' or self.args['configuration'])): self.path("media_plugin_libvlc.dll") # Media plugins - Example (useful for debugging - not shipped with release viewer) From e1c9e67a3c5669c4e217379ab3a1103a64c14047 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 06:42:57 -0400 Subject: [PATCH 61/78] optimize cached reconfigure --- .github/workflows/CompileWindows.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 3b012084fa8..4ca8f0bc300 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -113,6 +113,12 @@ jobs: key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA + - name: Reset cached packages sentinels + if: steps.cached-buildir-packages.outputs.cache-hit == 'true' + shell: bash + run: | + touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` + - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} shell: bash From 2d3423a56d1086e3eb25919325152d1dbd727f5c Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:12:34 -0400 Subject: [PATCH 62/78] update 3p-inline strategy; ensure ninja build ordering --- .github/3p/CompileWindows.autobuild-setup.sh | 2 +- .github/3p/inline-build.sh | 21 +++++++++++++------- .github/fsenv.sh | 15 +++++++------- .github/workflows/CompileWindows.yml | 7 ++++--- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.github/3p/CompileWindows.autobuild-setup.sh b/.github/3p/CompileWindows.autobuild-setup.sh index 55d39e98bbe..15efdcf1653 100644 --- a/.github/3p/CompileWindows.autobuild-setup.sh +++ b/.github/3p/CompileWindows.autobuild-setup.sh @@ -11,7 +11,7 @@ assert_defined AUTOBUILD_INSTALLABLE_CACHE AUTOBUILD_CONFIG_FILE \ for x in $INLINE_FS3P_DEPS ; do echo "[[ $x ]]" - time .github/3p/inline-build.sh 3p-inline $INLINE_FS3P_GITURL/3p-$x + time .github/3p/inline-build.sh 3p-inline "$INLINE_FS3P_GITURL/$x" echo done diff --git a/.github/3p/inline-build.sh b/.github/3p/inline-build.sh index cf8be7a10e5..82abec63ff3 100644 --- a/.github/3p/inline-build.sh +++ b/.github/3p/inline-build.sh @@ -3,7 +3,7 @@ # -- humbletim 2022.03.27 # usage: -# .github/3p/inline-build.sh +# .github/3p/inline-build.sh # or .github/3p/inline-build.sh [autobuild_package_name] set -eu @@ -11,15 +11,22 @@ set -eu . .github/3p/_autobuild_prop_as_json.sh BUILDDIR=$1 -REPO=${2%=*} -COMMIT=${2#*=} -if [[ -n "$COMMIT" || "$COMMIT" == "$REPO" ]] ; then +regex='^([^@]+)@([^#]+)#?([-/_a-zA-Z0-9]*)?$' +if [[ "$2" =~ $regex ]] ; then + REPO=${BASH_REMATCH[1]} + COMMIT=${BASH_REMATCH[2]} + NAME=${BASH_REMATCH[3]} + NAME=${NAME:-${3:-$(basename $REPO)}} +else + REPO=$2 COMMIT=${3:-master} + NAME=${4:-$(basename $REPO)} fi -NAME=${4:-$(basename $REPO)} + srcdir=$BUILDDIR/$NAME buildcmd=$(dirname $0)/build-cmds/${NAME}.build-cmd.sh -assert_defined REPO COMMIT NAME +echo +DEBUG=1 assert_defined REPO COMMIT NAME assert_defined AUTOBUILD_PLATFORM AUTOBUILD_ADDRSIZE AUTOBUILD_VSVER AUTOBUILD_CONFIG_FILE @@ -35,7 +42,7 @@ function process_results_env() { echo -n "=== ADDING NEW PACKAGE $NAME " { autobuild installables -a "file:///$autobuild_package_filename" add $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ || { echo "FAILED TO ADD PACKAGE $NAME"; cat installables.log ; exit 5 ; } - echo ...done + echo ...done else echo -n "=== UPDATING PACKAGE $NAME " { autobuild installables -a "file:///$autobuild_package_filename" edit $autobuild_package_name hash=$autobuild_package_md5 2>&1 ; } >> installables.log \ diff --git a/.github/fsenv.sh b/.github/fsenv.sh index f8cc8c384f2..cc4467956f7 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -33,18 +33,19 @@ function _fsenv() { # download prebuilts from 3p.firestormviewer.org # 3p- deps are resolved relative to this URL - setenv INLINE_FS3P_GITURL https://github.com/holostorm + setenv INLINE_FS3P_GITURL https://github.com ### :/ also 403's with vcs.firestormviewer.org... ### setenv INLINE_FS3P_GITURL https://vcs.firestormviewer.org/3p-libraries # format: packagerepo=gitcommit setenv INLINE_FS3P_DEPS " - discord-rpc=a21e3dc - ndPhysicsStub=aad4d9e - freetype=a8975b6 - openjpeg2=d23ab9af - gntp-growl=7ed68be - glod=eecf86f + holostorm/3p-discord-rpc@a21e3dc#3p-discord-rpc + holostorm/3p-ndPhysicsStub@aad4d9e + holostorm/3p-freetype@a8975b6 + holostorm/3p-openjpeg2@d23ab9af + holostorm/3p-gntp-growl@7ed68be + holostorm/3p-glod@eecf86f + ValveSoftware/openvr@d9cffe2#3p-openvr " # TODO: figure out where firestorm source code for 3p-dictionaries lives... diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 4ca8f0bc300..c4b4b11af68 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -92,8 +92,6 @@ jobs: # if: steps.cached-3p-inline.outputs.cache-hit != 'true' shell: bash run: | - # sideload "3p-openvr" - .github/3p/inline-build.sh 3p-inline/ https://github.com/ValveSoftware/openvr d9cffe2 3p-openvr .github/3p/CompileWindows.autobuild-setup.sh test -f autobuild.xml.sorted.txt @@ -129,7 +127,10 @@ jobs: if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} shell: bash run: | - ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj llpackage + ninja -C ${{ env.FSBUILD_DIR }} SLPlugin media_plugin_cef media_plugin_libvlc + ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj + ninja -C ${{ env.FSBUILD_DIR }} firestorm-bin + ninja -C ${{ env.FSBUILD_DIR }} llpackage - name: Upload Artifact (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 From 532234d0e6247201a6872ce50b2ad26040554e1f Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:19:58 -0400 Subject: [PATCH 63/78] always attempt to update cached sentinels --- .github/workflows/CompileWindows.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index c4b4b11af68..96de2344e99 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -112,10 +112,11 @@ jobs: restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: Reset cached packages sentinels - if: steps.cached-buildir-packages.outputs.cache-hit == 'true' + # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash run: | - touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` + touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true + ls -l ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From ef7e72128e5651e6c6f9216953d8b500f3b6a15a Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:33:39 -0400 Subject: [PATCH 64/78] always attempt to update cached sentinels --- .github/workflows/CompileWindows.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 96de2344e99..ff4c71bab0a 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -115,8 +115,9 @@ jobs: # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash run: | - touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true - ls -l ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true + touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true + sleep 2 && touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true + ls -l autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From ec31204dca531906fe0c9eb4585a224ca5236dce Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 07:39:25 -0400 Subject: [PATCH 65/78] split ninja build steps --- .github/workflows/CompileWindows.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index ff4c71bab0a..dffb2246668 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -125,13 +125,21 @@ jobs: run: | autobuild --version autobuild configure -- --no-vstools --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - - name: Build & Package (ninja) + - name: Build plugins (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} - shell: bash run: | ninja -C ${{ env.FSBUILD_DIR }} SLPlugin media_plugin_cef media_plugin_libvlc + - name: Build precompiled header (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + run: | ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj + - name: Build firestorm-bin (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + run: | ninja -C ${{ env.FSBUILD_DIR }} firestorm-bin + - name: Package (ninja) + if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + run: | ninja -C ${{ env.FSBUILD_DIR }} llpackage - name: Upload Artifact (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} From a7544c1fb2dcc149282172e2a9ede56f032b0a0f Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 10:31:11 -0400 Subject: [PATCH 66/78] fix cosmetic revision (65658 not 65659) --- .github/workflows/CompileWindows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index dffb2246668..4664d9a51a2 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -22,7 +22,7 @@ jobs: runs-on: windows-2019 env: VIEWER_CHANNEL: FirestormVR-GHA - AUTOBUILD_BUILD_ID: 65659 + AUTOBUILD_BUILD_ID: 65658 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - uses: actions/checkout@v2 @@ -115,9 +115,9 @@ jobs: # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash run: | - touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true + sleep 2 && touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true sleep 2 && touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true - ls -l autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true + ls -lrt autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} From f05dd47f2db78d5a8417fa8272f9492126041b19 Mon Sep 17 00:00:00 2001 From: humbletim Date: Tue, 29 Mar 2022 10:35:56 -0400 Subject: [PATCH 67/78] remove temporary restore-keys --- .github/workflows/CompileWindows.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 4664d9a51a2..46cf0270e43 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -101,7 +101,6 @@ jobs: with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} - restore-keys: Windows-downloads-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: cache -- buildir packages id: cached-buildir-packages @@ -109,7 +108,6 @@ jobs: with: path: c:\cache\packages key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} - restore-keys: Windows-buildir-packages-cf779b9b86aceaf3eee860b0c6ffcce1176785053eb05075ed95b8d867963c07-FirestormVR-GHA - name: Reset cached packages sentinels # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' From 090019132187557a1d60ea52fd3b8f1fc2c81c5f Mon Sep 17 00:00:00 2001 From: humbletim Date: Wed, 30 Mar 2022 02:24:41 -0400 Subject: [PATCH 68/78] dedupe Firestorm-FirestormVR-.. within channel/titlebar --- .github/workflows/CompileWindows.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 46cf0270e43..2a9885ece75 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -21,7 +21,7 @@ jobs: windows_build: runs-on: windows-2019 env: - VIEWER_CHANNEL: FirestormVR-GHA + VIEWER_CHANNEL: VR-GHA AUTOBUILD_BUILD_ID: 65658 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: @@ -84,7 +84,7 @@ jobs: id: cached-3p-inline uses: actions/cache@v2 with: - key: ${{ runner.os }}-3p-inline-${{ hashFiles('3p-inline.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-3p-inline-${{ hashFiles('3p-inline.sorted.txt') }}-FirestormVR-GHA path: | 3p-inline/*/_results.env 3p-inline/*/*.tar.bz2 @@ -100,14 +100,14 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.AUTOBUILD_INSTALLABLE_CACHE }} - key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA - name: cache -- buildir packages id: cached-buildir-packages uses: actions/cache@v2 with: path: c:\cache\packages - key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-${{ env.VIEWER_CHANNEL }} + key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA - name: Reset cached packages sentinels # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' From 385a5df73bf922983c4490dc5e97447c2d3508ac Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 Jul 2022 01:50:20 -0400 Subject: [PATCH 69/78] bump to python3; simplify local commands --- .github/fsenv.sh | 1 + .github/workflows/CompileWindows.yml | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index cc4467956f7..fcf26581d13 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -83,6 +83,7 @@ function _fsenv() { ### environment variables specific to github actions / windows builds # setenv VIEWER_CHANNEL=FirestormVR-GHA + setenv PYTHONUTF8 1 setenv PreferredToolArchitecture x64 setenv VIEWER_VERSION_REVISION dev setenv FSBUILD_DIR build-vc${AUTOBUILD_VSVER}-${AUTOBUILD_ADDRSIZE} diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 2a9885ece75..276e91f6b90 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -22,7 +22,7 @@ jobs: runs-on: windows-2019 env: VIEWER_CHANNEL: VR-GHA - AUTOBUILD_BUILD_ID: 65658 + AUTOBUILD_BUILD_ID: 66221 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - uses: actions/checkout@v2 @@ -60,7 +60,7 @@ jobs: - name: Setup python uses: actions/setup-python@v2 with: - python-version: 2.7 + python-version: 3.8 architecture: x64 - name: Get software versions please shell: cmd @@ -75,7 +75,8 @@ jobs: echo " " df -h - name: Install autobuild through PIP - run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild + run: pip install git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild' + # run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild - name: generate sorted 3p-inline manifest shell: bash @@ -112,33 +113,38 @@ jobs: - name: Reset cached packages sentinels # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash + working-directory: ${{ env.FSBUILD_DIR }} run: | - sleep 2 && touch ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/sentinel_installed || true - sleep 2 && touch `ls ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true - ls -lrt autobuild.xml ${{ env.FSBUILD_DIR }}/packages/cmake_tracking/*_installed || true + sleep 2 && touch ./packages/cmake_tracking/sentinel_installed || true + sleep 2 && touch `ls ./packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true + ls -lrt ../autobuild.xml ./packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' }} shell: bash run: | autobuild --version - autobuild configure -- --no-vstools --ninja --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + autobuild configure -- --no-vstools --ninja --package --openal --chan ${VIEWER_CHANNEL} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build plugins (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} SLPlugin media_plugin_cef media_plugin_libvlc + ninja SLPlugin media_plugin_cef media_plugin_libvlc - name: Build precompiled header (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj + ninja newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj - name: Build firestorm-bin (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} firestorm-bin + ninja firestorm-bin - name: Package (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + working-directory: ${{ env.FSBUILD_DIR }} run: | - ninja -C ${{ env.FSBUILD_DIR }} llpackage + ninja llpackage - name: Upload Artifact (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} uses: actions/upload-artifact@v2 From ab5cfde77668ab0b971206bd5a40581558126474 Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 Jul 2022 01:57:06 -0400 Subject: [PATCH 70/78] fix yaml typo --- .github/workflows/CompileWindows.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 276e91f6b90..762f6679fda 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -75,9 +75,7 @@ jobs: echo " " df -h - name: Install autobuild through PIP - run: pip install git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild' - # run: pip install git+https://github.com/humbletim/autobuild-1.1#egg=autobuild - + run: pip install 'git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild' - name: generate sorted 3p-inline manifest shell: bash run: for x in $INLINE_FS3P_DEPS ; do echo $x ; done | sort -u | tee 3p-inline.sorted.txt From 5ffbda92230960fe6952af600c11666fd2a4d201 Mon Sep 17 00:00:00 2001 From: humbletim Date: Thu, 28 Jul 2022 09:51:31 -0400 Subject: [PATCH 71/78] fix env exports + #dev markers --- .github/fsenv.sh | 36 ++++++++++++++++-------- .github/workflows/CompileWindows.yml | 42 ++++++++++++++++------------ 2 files changed, 48 insertions(+), 30 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index fcf26581d13..a888eaaecbe 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -9,24 +9,33 @@ function _fsenv() { # setenv [default-value] # exports the named variable and emits a key="value" to stdout - # (a no-op when the variable doesn't exist and no default is specified) + # (a no-op when both the variable doesn't exist and no default is specified) function setenv() { if [[ ! ${!1+x} ]] ; then if [[ $# -lt 2 ]] ; then return 0 ; fi - eval "export ${1}=\"$2\"" + # var not present assign to default and export + printf -v "${1}" "%s" "${2}" fi - if [[ ${!1} == *$'\n'* ]] ; then - # bash and github action multiline env vars compat - echo "${1}< Date: Thu, 28 Jul 2022 14:18:04 -0400 Subject: [PATCH 72/78] add fs_reset_sentinels.sh --- .github/fs_reset_sentinels.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/fs_reset_sentinels.sh diff --git a/.github/fs_reset_sentinels.sh b/.github/fs_reset_sentinels.sh new file mode 100644 index 00000000000..57c08b03b40 --- /dev/null +++ b/.github/fs_reset_sentinels.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -eu +test -d "${1}" || { echo "$0 expected builddir as first and only script argument" ; exit 1; } +sleep 2 && touch ${1}/packages/cmake_tracking/sentinel_installed || true +sleep 2 && touch `ls ${1}/packages/cmake_tracking/*_installed | fgrep -v sentinel_installed` || true From afe5c64001edbf78ca1f1346c2f0f0e2382f15d2 Mon Sep 17 00:00:00 2001 From: humbletim Date: Fri, 16 Sep 2022 20:57:06 -0400 Subject: [PATCH 73/78] fix build errors --- .github/workflows/CompileWindows.yml | 6 +++--- indra/llcommon/lleventdispatcher.cpp | 2 ++ indra/llprimitive/lldaeloader.cpp | 1 + indra/newview/llviewerprecompiledheaders.h | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 8a828867a77..6e5f76dfa75 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -22,7 +22,7 @@ jobs: runs-on: windows-2019 env: VIEWER_CHANNEL: VR-GHA - AUTOBUILD_BUILD_ID: 66221 + AUTOBUILD_BUILD_ID: 67470 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - uses: actions/checkout@v2 @@ -132,7 +132,7 @@ jobs: run: | autobuild --version test -n "${VIEWER_CHANNEL}" && test -n "${PYTHON_EXECUTABLE}" #dev - autobuild configure -- --no-vstools --ninja --package --openal --chan "${VIEWER_CHANNEL}" -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON #dev + autobuild configure -- --ninja --package --openal --chan "${VIEWER_CHANNEL}" -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON #dev - name: Build plugins (ninja) if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} run: | @@ -164,7 +164,7 @@ jobs: shell: cmd run: | autobuild --version - autobuild configure -- --package --no-vstools --openal --chan ${{ env.VIEWER_CHANNEL }} -DPYTHON_EXECUTABLE=${{ env.PYTHON_EXECUTABLE }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON + autobuild configure -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DPYTHON_EXECUTABLE=${{ env.PYTHON_EXECUTABLE }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build & Package (msbuild) if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} shell: cmd diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp index 5b6d4efbe98..ec2cab3e1f2 100644 --- a/indra/llcommon/lleventdispatcher.cpp +++ b/indra/llcommon/lleventdispatcher.cpp @@ -1,3 +1,5 @@ +#define _HAS_AUTO_PTR_ETC 1 // vs2019 std::auto_ptr + /** * @file lleventdispatcher.cpp * @author Nat Goodspeed diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 2ab09db340b..38223c6c05c 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -1,3 +1,4 @@ +#define _HAS_AUTO_PTR_ETC 1 // vs2019 std::auto_ptr /** * @file lldaeloader.cpp * @brief LLDAELoader class implementation diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 3bed65e1c4c..4bd0e76a3a4 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -29,6 +29,9 @@ #ifndef LL_LLVIEWERPRECOMPILEDHEADERS_H #define LL_LLVIEWERPRECOMPILEDHEADERS_H +#define _HAS_AUTO_PTR_ETC 1 // vs2019 std::auto_ptr +#include + #include "llwin32headers.h" // This file MUST be the first one included by each .cpp file From 5c1d992e39cf66952757e050cae3fce020a514f5 Mon Sep 17 00:00:00 2001 From: humbletim Date: Fri, 16 Sep 2022 21:08:39 -0400 Subject: [PATCH 74/78] set os= where needed --- .github/fsenv.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index a45923f5147..68c2d638445 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -38,10 +38,16 @@ function _fsenv() { setenv GHA_TEST_WITH_SPACES "testing \"1\" 2 3...tab\t." + if [[ ! ${os+x} ]] ; then + case `uname -s` in + MINGW*) local os=windows ;; + *) local os=linux;; + esac + fi if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then case `uname -s` in - MINGW*) local os=windows GITHUB_WORKSPACE=$(pwd -W) ;; - *) local os=linux GITHUB_WORKSPACE=$PWD ;; + MINGW*) local GITHUB_WORKSPACE=$(pwd -W) ;; + *) local GITHUB_WORKSPACE=$PWD ;; esac fi setenv _3P_UTILSDIR ${GITHUB_WORKSPACE}/.github/3p From 39c8ac8b2ba6256a1a4da33c7445b5450348134a Mon Sep 17 00:00:00 2001 From: humbletim Date: Fri, 16 Sep 2022 21:14:35 -0400 Subject: [PATCH 75/78] export os= --- .github/fsenv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 68c2d638445..24de35806c6 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -40,8 +40,8 @@ function _fsenv() { if [[ ! ${os+x} ]] ; then case `uname -s` in - MINGW*) local os=windows ;; - *) local os=linux;; + MINGW*) setenv os windows ;; + *) setenv os linux ;; esac fi if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then From 863c2b21906fd944dd3af3663bc5ff842dc647d6 Mon Sep 17 00:00:00 2001 From: humbletim Date: Fri, 16 Sep 2022 21:23:42 -0400 Subject: [PATCH 76/78] verbose fsenv logging --- .github/fsenv.sh | 38 ++++++++++++++++++++-------- .github/workflows/CompileWindows.yml | 4 +++ 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index 24de35806c6..c6c556b018c 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -6,17 +6,35 @@ set -eu # function wrapper to avoid leaking variables when "sourced" into other scripts function _fsenv() { + local os + if [[ ${RUNNER_OS+x} ]] ; then + case $RUNNER_OS in + Windows) os=windows ;; + Linux) os=linux ;; + esac + fi + if [[ ! ${os+x} ]] ; then + case `uname -s` in + MINGW*) os=windows ;; + *) os=linux ;; + esac + fi # setenv [default-value] # exports the named variable and emits a key="value" to stdout # (a no-op when both the variable doesn't exist and no default is specified) function setenv() { if [[ ! ${!1+x} ]] ; then - if [[ $# -lt 2 ]] ; then return 0 ; fi + if [[ $# -lt 2 ]] ; then + echo "# setenv($1) -- no-op" >&2 + return 0 + fi # var not present assign to default and export + echo "# setenv($1,$2)" >&2 printf -v "${1}" "%s" "${2}" fi - eval "export ${1}" + echo "# export($1)" >&2 + [[ ${os} == linux ]] && eval "export ${1}" emitvar "$@" } @@ -38,18 +56,14 @@ function _fsenv() { setenv GHA_TEST_WITH_SPACES "testing \"1\" 2 3...tab\t." - if [[ ! ${os+x} ]] ; then - case `uname -s` in - MINGW*) setenv os windows ;; - *) setenv os linux ;; - esac - fi if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then case `uname -s` in MINGW*) local GITHUB_WORKSPACE=$(pwd -W) ;; *) local GITHUB_WORKSPACE=$PWD ;; esac fi + echo "os=$os" + setenv _3P_UTILSDIR ${GITHUB_WORKSPACE}/.github/3p ############################################################################ @@ -122,9 +136,11 @@ function _fsenv() { unset _fsenv } -if (return 0 2>/dev/null) ; then - # fsenv.sh was sourced ; export only - _fsenv > /dev/null +if [[ ! ${GITHUB_ACTIONS+x} ]] ; then + if (return 0 2>/dev/null) ; then + # fsenv.sh was sourced ; export only + _fsenv > /dev/null + fi elif [[ -n $# ]] ; then # fsenv.sh was passed subcommands ; export and execute _fsenv > /dev/null diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 6e5f76dfa75..663072d73c5 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -31,6 +31,10 @@ jobs: - name: Preset ENV shell: bash run: | + echo ============================================================= + .github/fsenv.sh + echo ============================================================= + .github/fsenv.sh | tee -a $GITHUB_ENV if [[ ! ${GITHUB_ACTIONS+x} ]] ; then #dev set -ea && source <( .github/fsenv.sh ) && set +ea && test -n "$VIEWER_CHANNEL" -a -n "$FSBUILD_DIR" -a -n "$AUTOBUILD_VSVER" #dev From a3368d9c0e297e83913bfe47ab577e43b4dbc5dc Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 17 Sep 2022 13:52:11 -0400 Subject: [PATCH 77/78] rework fsenv --- .github/fsenv.sh | 107 ++++++++++++++------------- .github/workflows/CompileWindows.yml | 82 ++++++++++++++++---- 2 files changed, 123 insertions(+), 66 deletions(-) diff --git a/.github/fsenv.sh b/.github/fsenv.sh index c6c556b018c..1ddb4bc5e38 100644 --- a/.github/fsenv.sh +++ b/.github/fsenv.sh @@ -2,44 +2,27 @@ # github actions helper to initialize environment variables for building firestorm # -- humbletim 2022.03.27 -set -eu - # function wrapper to avoid leaking variables when "sourced" into other scripts function _fsenv() { - local os - if [[ ${RUNNER_OS+x} ]] ; then - case $RUNNER_OS in - Windows) os=windows ;; - Linux) os=linux ;; - esac - fi - if [[ ! ${os+x} ]] ; then + set -eu + local os= gha= workspace= + if [[ ${GITHUB_ACTIONS+x} ]] ; then + gha=1 + workspace=${GITHUB_WORKSPACE} + os=${RUNNER_OS,,} # lowercase + else case `uname -s` in - MINGW*) os=windows ;; - *) os=linux ;; + MINGW*) os=windows workspace=$(pwd -W) ;; + *) os=linux workspace=$PWD ;; esac fi + function debug() { if [[ -n "${DEBUG:-}" ]] ; then echo "[_fsenv] $@" >&2 ; fi } - # setenv [default-value] - # exports the named variable and emits a key="value" to stdout - # (a no-op when both the variable doesn't exist and no default is specified) - function setenv() { - if [[ ! ${!1+x} ]] ; then - if [[ $# -lt 2 ]] ; then - echo "# setenv($1) -- no-op" >&2 - return 0 - fi - # var not present assign to default and export - echo "# setenv($1,$2)" >&2 - printf -v "${1}" "%s" "${2}" - fi - echo "# export($1)" >&2 - [[ ${os} == linux ]] && eval "export ${1}" - emitvar "$@" - } + debug "os=$os | gha=$gha | workspace=$workspace" >&2 function emitvar() { - if [[ ${GITHUB_ACTIONS+x} ]] ; then + debug "# emitvar($1)" >&2 + if [[ $gha ]] ; then # output github action (GITHUB_ENV) compatible multiline/escaped variables if [[ ${!1} == *$'\n'* ]] ; then echo "${1}<&2 + declare -p "$1" fi } - setenv GHA_TEST_WITH_SPACES "testing \"1\" 2 3...tab\t." + function isset() { + if [[ ${!1+x} ]] ; then return 0 ; fi + return -1 + } - if [[ ! ${GITHUB_WORKSPACE+x} ]] ; then - case `uname -s` in - MINGW*) local GITHUB_WORKSPACE=$(pwd -W) ;; - *) local GITHUB_WORKSPACE=$PWD ;; - esac - fi - echo "os=$os" + function assign() { + if [[ ${2+x} ]] ; then + debug "# assign($1,$2)" >&2 + printf -v "${1}" "%s" "${2}" + return 0 + else + debug "# assign($1) -- no-op" >&2 + return -1 + fi + } + + # setenv [default-value] + # exports the named variable and emits a key="value" to stdout + # (a no-op when both the variable doesn't exist and no default is specified) + function setenv() { + isset "$@" || assign "$@" || return 0 + if [[ $os == linux ]] ; then eval "export ${1}" ; fi + debug "# setenv($@)" >&2 + emitvar "${1}" + } + + + setenv GHA_TEST_WITH_SPACES "testing \"1\" 2 3...tab\t." - setenv _3P_UTILSDIR ${GITHUB_WORKSPACE}/.github/3p + setenv _3P_UTILSDIR ${workspace}/.github/3p ############################################################################ # workaround for github actions receiving 403: Forbidden errors when trying to @@ -107,9 +110,9 @@ function _fsenv() { ### AUTOBUILD_ environment variables - setenv AUTOBUILD_VARIABLES_FILE ${GITHUB_WORKSPACE}/fs-build-variables/variables - setenv AUTOBUILD_CONFIG_FILE ${GITHUB_WORKSPACE}/autobuild.xml - setenv AUTOBUILD_INSTALLABLE_CACHE ${GITHUB_WORKSPACE}/autobuild-cache + setenv AUTOBUILD_VARIABLES_FILE ${workspace}/fs-build-variables/variables + setenv AUTOBUILD_CONFIG_FILE ${workspace}/autobuild.xml + setenv AUTOBUILD_INSTALLABLE_CACHE ${workspace}/autobuild-cache setenv AUTOBUILD_LOGLEVEL --verbose setenv AUTOBUILD_PLATFORM ${os}64 @@ -118,7 +121,7 @@ function _fsenv() { setenv AUTOBUILD_CONFIGURATION ReleaseFS_open setenv AUTOBUILD_BUILD_ID 0 - ### environment variables specific to github actions / windows builds + ### environment variables specific to github actions / mod builds # setenv VIEWER_CHANNEL=FirestormVR-GHA setenv PYTHONUTF8 1 setenv PreferredToolArchitecture x64 @@ -128,7 +131,7 @@ function _fsenv() { else setenv FSBUILD_DIR build-linux-x86_64 fi - setenv FSVS_TARGET Ninja # 'Visual Studio 16 2019' + setenv FSVS_TARGET Ninja # for msbuild this would be 'Visual Studio 16 2019' setenv VIEWER_VERSION_STR `echo $(cat indra/newview/VIEWER_VERSION.txt)`.${AUTOBUILD_BUILD_ID} setenv VIEWER_VERSION_GITHASH $(git log -n 1 | grep "Merge " | awk '{ print $2 }' | xargs git rev-parse --short 2>/dev/null || git rev-parse --short HEAD) @@ -136,16 +139,18 @@ function _fsenv() { unset _fsenv } -if [[ ! ${GITHUB_ACTIONS+x} ]] ; then - if (return 0 2>/dev/null) ; then - # fsenv.sh was sourced ; export only - _fsenv > /dev/null - fi -elif [[ -n $# ]] ; then +if [[ ${GITHUB_ACTIONS+x} ]] ; then + _fsenv +elif (return 0 2>/dev/null) ; then + echo "[_fsenv] sourced (export only)" >&2 + _fsenv > /dev/null +elif [[ $# -gt 0 ]] ; then + echo "[_fsenv] export + exec ($@)" >&2 # fsenv.sh was passed subcommands ; export and execute _fsenv > /dev/null "$@" else + echo "[_fsenv] export and echo" >&2 # fsenv.sh was called without arguments ; export and echo to stdout _fsenv fi diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 663072d73c5..893cfec66de 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -4,14 +4,33 @@ on: # pull_request: workflow_dispatch: inputs: + fs3p_giturl: + description: | + base HTTPS folder to clone 3p dependencies from + - https://vcs.firestormviewer.org/3p-libraries + - https://github.com + required: true + default: https://github.com buildsys: description: 'ninja or msbuild' required: true default: ninja - llpackage: - description: 'build/package/upload firestorm installer (if false only autobuild configure and caching is performed)' - required: true - default: 'false' + tmate: + type: boolean + description: pause with tmate session + default: false + depth: + type: choice + description: depth + default: fsenv.3p.configure + options: + - fsenv + - fsenv.3p + - fsenv.3p.configure + - fsenv.3p.configure.llcommon + - fsenv.3p.configure.llcommon.plugins + - fsenv.3p.configure.llcommon.plugins.firestorm-bin + - fsenv.3p.configure.llcommon.plugins.firestorm-bin.llpackage defaults: run: @@ -25,12 +44,27 @@ jobs: AUTOBUILD_BUILD_ID: 67470 AUTOBUILD_CONFIGURATION: ReleaseFS_open steps: - - uses: actions/checkout@v2 + # - uses: actions/checkout@v2 + # with: + # submodules: true + - name: Quick Checkout + shell: bash + run: | + pwd + set -x + git clone --quiet --recurse-submodules --filter=tree:0 https://github.com/${GITHUB_REPOSITORY}.git --branch ${GITHUB_REF_NAME} ${GITHUB_WORKSPACE} + ls -lrtha + + - name: Setup tmate session + if: ${{ inputs.tmate == true }} + uses: mxschmitt/action-tmate@v3 with: - submodules: true + limit-access-to-actor: true + - name: Preset ENV shell: bash run: | + export INLINE_FS3P_GITURL="${{ github.event.inputs.fs3p_giturl }}" echo ============================================================= .github/fsenv.sh echo ============================================================= @@ -39,6 +73,13 @@ jobs: if [[ ! ${GITHUB_ACTIONS+x} ]] ; then #dev set -ea && source <( .github/fsenv.sh ) && set +ea && test -n "$VIEWER_CHANNEL" -a -n "$FSBUILD_DIR" -a -n "$AUTOBUILD_VSVER" #dev fi #dev + + - name: Verify ENV + shell: bash + run: | + . ${_3P_UTILSDIR}/_assert_defined.sh + assert_defined VIEWER_CHANNEL FSBUILD_DIR AUTOBUILD_CONFIG_FILE INLINE_FS3P_GITURL + - name: Prep build dirs shell: cmd run: | @@ -57,6 +98,7 @@ jobs: dir %FSBUILD_DIR% dir echo AUTOBUILD_INSTALLABLE_CACHE=c:\cache\autobuild>> %GITHUB_ENV% + - name: Setup vsdevenv uses: seanmiddleditch/gha-setup-vsdevenv@master - name: Setup MSBuild @@ -94,7 +136,9 @@ jobs: shell: bash run: | for x in $INLINE_FS3P_DEPS ; do echo $x ; done | sort -u | tee 3p-inline.sorted.txt + - name: cache -- 3p-inline + if: ${{ inputs.depth >= 'fsenv.3p' }} id: cached-3p-inline uses: actions/cache@v2 with: @@ -103,6 +147,7 @@ jobs: 3p-inline/*/_results.env 3p-inline/*/*.tar.bz2 - name: Patch and build local 3p packages + if: ${{ inputs.depth >= 'fsenv.3p' }} # if: steps.cached-3p-inline.outputs.cache-hit != 'true' shell: bash run: | @@ -110,6 +155,7 @@ jobs: test -f autobuild.xml.sorted.txt - name: cache -- autobuild downloads + if: ${{ inputs.depth >= 'fsenv.3p.configure' }} id: cached-downloads uses: actions/cache@v2 with: @@ -117,6 +163,7 @@ jobs: key: ${{ runner.os }}-downloads-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA - name: cache -- buildir packages + if: ${{ inputs.depth >= 'fsenv.3p.configure' }} id: cached-buildir-packages uses: actions/cache@v2 with: @@ -124,6 +171,7 @@ jobs: key: ${{ runner.os }}-buildir-packages-${{ hashFiles('autobuild.xml.sorted.txt') }}-FirestormVR-GHA - name: Reset cached packages sentinels + if: ${{ inputs.depth >= 'fsenv.3p.configure' }} # if: steps.cached-buildir-packages.outputs.cache-hit == 'true' shell: bash run: | @@ -131,30 +179,34 @@ jobs: ls -lrt autobuild.xml ${FSBUILD_DIR}/packages/cmake_tracking/*_installed || true - name: Configure autobuild (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' }} + if: ${{ inputs.buildsys == 'ninja' && inputs.depth >= 'fsenv.3p.configure' }} shell: bash run: | autobuild --version test -n "${VIEWER_CHANNEL}" && test -n "${PYTHON_EXECUTABLE}" #dev autobuild configure -- --ninja --package --openal --chan "${VIEWER_CHANNEL}" -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON #dev + - name: Build llcommon (ninja) + if: ${{ inputs.buildsys == 'ninja' && inputs.depth >= 'fsenv.3p.configure.llcommon' }} + run: | + ninja -C ${FSBUILD_DIR} SLPlugin media_plugin_cef media_plugin_libvlc #dev - name: Build plugins (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + if: ${{ inputs.buildsys == 'ninja' && inputs.depth >= 'fsenv.3p.configure.llcommon.plugins' }} run: | ninja -C ${FSBUILD_DIR} SLPlugin media_plugin_cef media_plugin_libvlc #dev - name: Build precompiled header (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + if: ${{ inputs.buildsys == 'ninja' && inputs.depth >= 'fsenv.3p.configure.llcommon.plugins.firestorm-bin' }} run: | ninja -C ${FSBUILD_DIR} newview/CMakeFiles/firestorm-bin.dir/llviewerprecompiledheaders.cpp.obj #dev - name: Build firestorm-bin (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + if: ${{ inputs.buildsys == 'ninja' && inputs.depth >= 'fsenv.3p.configure.llcommon.plugins.firestorm-bin' }} run: | ninja -C ${FSBUILD_DIR} firestorm-bin #dev - name: Package (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + if: ${{ inputs.buildsys == 'ninja' && inputs.depth >= 'fsenv.3p.configure.llcommon.plugins.firestorm-bin.llpackage' }} run: | ninja -C ${FSBUILD_DIR} llpackage #dev - name: Upload Artifact (ninja) - if: ${{ github.event.inputs.buildsys == 'ninja' && github.event.inputs.llpackage == 'true' }} + if: ${{ inputs.buildsys == 'ninja' && inputs.depth >= 'fsenv.3p.configure.llcommon.plugins.firestorm-bin.llpackage' }} uses: actions/upload-artifact@v2 with: name: ${{ format('{0}-{1}-{2}-{3}-{4}', runner.os, github.event.inputs.buildsys, env.VIEWER_CHANNEL, env.VIEWER_VERSION_STR, env.VIEWER_VERSION_GITHASH) }} @@ -164,18 +216,18 @@ jobs: 3p-inline.sorted.txt - name: Configure autobuild (msbuild) - if: ${{ github.event.inputs.buildsys == 'msbuild' }} + if: ${{ inputs.buildsys == 'msbuild' && inputs.depth >= 'fsenv.3p.configure' }} shell: cmd run: | autobuild --version autobuild configure -- --package --openal --chan ${{ env.VIEWER_CHANNEL }} -DPYTHON_EXECUTABLE=${{ env.PYTHON_EXECUTABLE }} -DLL_TESTS:BOOL=FALSE -DVS_DISABLE_FATAL_WARNINGS=ON - name: Build & Package (msbuild) - if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} + if: ${{ inputs.buildsys == 'msbuild' && inputs.depth >= 'fsenv.3p.configure.llcommon.plugins.firestorm-bin.llpackage' }} shell: cmd run: | msbuild ${{ env.FSBUILD_DIR }}/Firestorm.sln /target:llpackage /property:Configuration=Release;Platform=x64 /maxcpucount - name: Upload Artifact (msbuild) - if: ${{ github.event.inputs.buildsys == 'msbuild' && github.event.inputs.llpackage == 'true' }} + if: ${{ inputs.buildsys == 'msbuild' && inputs.depth >= 'fsenv.3p.configure.llcommon.plugins.firestorm-bin.llpackage' }} uses: actions/upload-artifact@v2 with: name: windows-${{ env.VIEWER_CHANNEL }}-${{ env.VIEWER_VERSION_STR }}-${{ env.VIEWER_VERSION_GITHASH }} From 3c1eeb692b11699807617fd8c9e17a95d055c28b Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 17 Sep 2022 14:50:10 -0400 Subject: [PATCH 78/78] cache pip dependencies --- .github/workflows/CompileWindows.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CompileWindows.yml b/.github/workflows/CompileWindows.yml index 893cfec66de..a05a5147b24 100644 --- a/.github/workflows/CompileWindows.yml +++ b/.github/workflows/CompileWindows.yml @@ -107,11 +107,15 @@ jobs: - name: Setup Ninja uses: seanmiddleditch/gha-setup-ninja@master # if: ${{ github.event.inputs.buildsys == 'ninja' }} + - name: Setup requirements.txt + run: | + echo "git+https://bitbucket.org/lindenlab/autobuild.git#egg=autobuild" | tee requirements.txt - name: Setup python uses: actions/setup-python@v2 with: python-version: 3.8 architecture: x64 + cache: 'pip' - name: Workaround Firestorm Python.cmake run: | export PYTHON_EXECUTABLE=$(cygpath -ms "`which python`") #dev @@ -125,7 +129,7 @@ jobs: git --version python --version cl.exe - ${{ github.event.inputs.buildsys }}.exe -version + ${{ github.event.inputs.buildsys }}.exe --version ninja --version echo " " df -h