From e99012efbb13e8e0132f8e808d46d63e946ce3f1 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 10:33:12 -0800 Subject: [PATCH 001/261] updates to build guides to remove soxr --- BUILD.md | 3 +- BUILD_OSX.md | 2 +- BUILD_WIN.md | 14 --------- assignment-client/CMakeLists.txt | 2 +- cmake/externals/soxr/CMakeLists.txt | 21 ++++++++++++++ .../macros/AddDependencyExternalProject.cmake | 25 ---------------- .../AddDependencyExternalProjects.cmake | 29 +++++++++++++++++++ gvr-interface/CMakeLists.txt | 2 +- interface/CMakeLists.txt | 2 +- libraries/audio-client/CMakeLists.txt | 4 +-- libraries/audio/CMakeLists.txt | 2 +- libraries/avatars/CMakeLists.txt | 2 +- libraries/entities-renderer/CMakeLists.txt | 2 +- libraries/entities/CMakeLists.txt | 2 +- libraries/environment/CMakeLists.txt | 2 +- libraries/fbx/CMakeLists.txt | 2 +- libraries/metavoxels/CMakeLists.txt | 2 +- libraries/model/CMakeLists.txt | 2 +- libraries/octree/CMakeLists.txt | 2 +- libraries/physics/CMakeLists.txt | 2 +- libraries/render-utils/CMakeLists.txt | 2 +- libraries/script-engine/CMakeLists.txt | 2 +- libraries/shared/CMakeLists.txt | 2 +- tests/physics/CMakeLists.txt | 2 +- 24 files changed, 71 insertions(+), 61 deletions(-) create mode 100644 cmake/externals/soxr/CMakeLists.txt delete mode 100644 cmake/macros/AddDependencyExternalProject.cmake create mode 100644 cmake/macros/AddDependencyExternalProjects.cmake diff --git a/BUILD.md b/BUILD.md index f7dc22882a..6bf8df2510 100644 --- a/BUILD.md +++ b/BUILD.md @@ -5,9 +5,7 @@ * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. * [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 -* [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 -* [Gverb](https://github.com/highfidelity/gverb/archive/master.zip) (direct download to latest version) #### CMake External Project Dependencies @@ -15,6 +13,7 @@ The following dependencies will be downloaded, built, linked and included automa * [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 * [gverb](https://github.com/highfidelity/gverb) +* [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 ### OS Specific Build Guides * [BUILD_OSX.md](BUILD_OSX.md) - additional instructions for OS X. diff --git a/BUILD_OSX.md b/BUILD_OSX.md index 2d5460d39d..563fd38c1c 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -4,7 +4,7 @@ Please read the [general build guide](BUILD.md) for information on dependencies [Homebrew](http://brew.sh/) is an excellent package manager for OS X. It makes install of all hifi dependencies very simple. brew tap highfidelity/homebrew-formulas - brew install cmake openssl tbb libsoxr + brew install cmake openssl tbb brew install highfidelity/formulas/qt5 brew link qt5 --force diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 6f26e8c809..219192b360 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -155,20 +155,6 @@ You now have Bullet libraries compiled, now you need to put them in the right pl _Note that the INSTALL target should handle the copying of files into an install directory automatically, however, without modifications to Cmake, the install target didn't work right for me, please update this instructions if you get that working right - Leo <leo@highfidelity.io>_ -###Soxr - -Download the zip from the [soxr sourceforge page](http://sourceforge.net/projects/soxr/). - -We recommend you install it to %HIFI_LIB_DIR%\soxr. This will help our FindSoxr cmake module find what it needs. You can place it wherever you like on your machine if you specify SOXR_ROOT_DIR as an environment variable or a variable passed when cmake is run. - -Extract the soxr archive wherever you like. Then, inside the extracted folder, create a directory called `build`. From that build directory, the following commands will build and then install soxr to `%HIFI_LIB_DIR%`. - -``` -cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%HIFI_LIB_DIR%/soxr -nmake -nmake install -``` - ###Build High Fidelity using Visual Studio Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake. diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index b16314811b..5475b0fc14 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -2,7 +2,7 @@ set(TARGET_NAME assignment-client) setup_hifi_project(Core Gui Network Script Widgets) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt new file mode 100644 index 0000000000..bb6f510eb6 --- /dev/null +++ b/cmake/externals/soxr/CMakeLists.txt @@ -0,0 +1,21 @@ +set(EXTERNAL_NAME soxr) + +include(ExternalProject) +ExternalProject_Add( + ${EXTERNAL_NAME} + PREFIX ${EXTERNAL_NAME} + URL http://pkgs.fedoraproject.org/repo/pkgs/soxr/soxr-0.1.1-Source.tar.xz/805651a245ead381c82fad6247af5968/soxr-0.1.1-Source.tar.xz + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_SHARED_LIBS=N + LOG_DOWNLOAD ON +) + +ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) + +string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING) + +if (WIN32) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.lib CACHE TYPE STRING) +else () + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.a CACHE TYPE STRING) +endif () \ No newline at end of file diff --git a/cmake/macros/AddDependencyExternalProject.cmake b/cmake/macros/AddDependencyExternalProject.cmake deleted file mode 100644 index ff0ced411e..0000000000 --- a/cmake/macros/AddDependencyExternalProject.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# -# SetupExternalProject.cmake -# cmake/macros -# -# Copyright 2015 High Fidelity, Inc. -# Created by Stephen Birarda on February 13, 2014 -# -# Distributed under the Apache License, Version 2.0. -# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -# - -macro(ADD_DEPENDENCY_EXTERNAL_PROJECT _PROJ_NAME) - - string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) - - if (NOT DEFINED GET_${_PROJ_NAME_UPPER} OR GET_${_PROJ_NAME_UPPER}) - if (NOT TARGET ${_PROJ_NAME}) - add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${CMAKE_BINARY_DIR}/externals/${_PROJ_NAME}) - endif () - - add_dependencies(${TARGET_NAME} ${_PROJ_NAME}) - - endif () - -endmacro() \ No newline at end of file diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake new file mode 100644 index 0000000000..e739e9994a --- /dev/null +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -0,0 +1,29 @@ +# +# SetupExternalProject.cmake +# cmake/macros +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 13, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS _PROJECTS) + + foreach(_PROJ_NAME ${_PROJECTS}) + + string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) + + if (NOT DEFINED GET_${_PROJ_NAME_UPPER} OR GET_${_PROJ_NAME_UPPER}) + if (NOT TARGET ${_PROJ_NAME}) + add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${CMAKE_BINARY_DIR}/externals/${_PROJ_NAME}) + endif () + + add_dependencies(${TARGET_NAME} ${_PROJ_NAME}) + + endif () + + endforeach() + +endmacro() \ No newline at end of file diff --git a/gvr-interface/CMakeLists.txt b/gvr-interface/CMakeLists.txt index de0b66165b..bdffb1fbd3 100644 --- a/gvr-interface/CMakeLists.txt +++ b/gvr-interface/CMakeLists.txt @@ -24,7 +24,7 @@ endif () include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 7d581284e5..c1e8b7d618 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -108,7 +108,7 @@ endif() add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM}) # set up the external glm library -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) diff --git a/libraries/audio-client/CMakeLists.txt b/libraries/audio-client/CMakeLists.txt index 1cd76cf2f5..7067e2ed81 100644 --- a/libraries/audio-client/CMakeLists.txt +++ b/libraries/audio-client/CMakeLists.txt @@ -8,8 +8,8 @@ link_hifi_libraries(audio) # append audio includes to our list of includes to bubble list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${HIFI_LIBRARY_DIR}/audio/src") -# have CMake grab Gverb from git and then set up linking and directory include -add_dependency_external_project(gverb) +# have CMake grab externals for us +add_dependency_external_projects(gverb soxr) find_package(Gverb REQUIRED) diff --git a/libraries/audio/CMakeLists.txt b/libraries/audio/CMakeLists.txt index 6ec35e00fc..b9dfc06cad 100644 --- a/libraries/audio/CMakeLists.txt +++ b/libraries/audio/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME audio) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/avatars/CMakeLists.txt b/libraries/avatars/CMakeLists.txt index bb4b8fdde0..ad06b4adfa 100644 --- a/libraries/avatars/CMakeLists.txt +++ b/libraries/avatars/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME avatars) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network Script) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/entities-renderer/CMakeLists.txt b/libraries/entities-renderer/CMakeLists.txt index e706b07538..b807428203 100644 --- a/libraries/entities-renderer/CMakeLists.txt +++ b/libraries/entities-renderer/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME entities-renderer) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Widgets OpenGL Network Script) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index d0c39cac84..5317f97b85 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME entities) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network Script) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/environment/CMakeLists.txt b/libraries/environment/CMakeLists.txt index e5e7b80701..1c4daa1a6f 100644 --- a/libraries/environment/CMakeLists.txt +++ b/libraries/environment/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME environment) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/fbx/CMakeLists.txt b/libraries/fbx/CMakeLists.txt index da6d471c72..b43e88bb3d 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME fbx) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/metavoxels/CMakeLists.txt b/libraries/metavoxels/CMakeLists.txt index 593ee800a7..f748971311 100644 --- a/libraries/metavoxels/CMakeLists.txt +++ b/libraries/metavoxels/CMakeLists.txt @@ -8,7 +8,7 @@ setup_hifi_library(Network Script Widgets) # link in the networking library link_hifi_libraries(shared networking) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/model/CMakeLists.txt b/libraries/model/CMakeLists.txt index 0f71a25047..e3eeae7137 100755 --- a/libraries/model/CMakeLists.txt +++ b/libraries/model/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME model) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/octree/CMakeLists.txt b/libraries/octree/CMakeLists.txt index 3c7e8e7749..ad6f32f0ff 100644 --- a/libraries/octree/CMakeLists.txt +++ b/libraries/octree/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME octree) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index 7fc3f82496..775d5fcb0f 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME physics) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library() -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/render-utils/CMakeLists.txt b/libraries/render-utils/CMakeLists.txt index 054b30d7fb..d6e419fa49 100644 --- a/libraries/render-utils/CMakeLists.txt +++ b/libraries/render-utils/CMakeLists.txt @@ -8,7 +8,7 @@ qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Widgets OpenGL Network Script) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/script-engine/CMakeLists.txt b/libraries/script-engine/CMakeLists.txt index 4e13ddf513..99ac9da87c 100644 --- a/libraries/script-engine/CMakeLists.txt +++ b/libraries/script-engine/CMakeLists.txt @@ -3,7 +3,7 @@ set(TARGET_NAME script-engine) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Gui Network Script Widgets) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index 54cd91deaf..ab4b853b6d 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -4,7 +4,7 @@ set(TARGET_NAME shared) # TODO: there isn't really a good reason to have Script linked here - let's get what is requiring it out (RegisteredMetaTypes.cpp) setup_hifi_library(Gui Network Script Widgets) -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index e20f323392..0f15f596c0 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -2,7 +2,7 @@ set(TARGET_NAME physics-tests) setup_hifi_project() -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) From 2d1ad4977fbdd990fd9f2e51b1d1b5f8cbd60d73 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 10:46:19 -0800 Subject: [PATCH 002/261] handle soxr build for android --- cmake/externals/soxr/CMakeLists.txt | 10 +++++++++- cmake/macros/AddDependencyExternalProjects.cmake | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index bb6f510eb6..0c21780cbc 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -1,11 +1,17 @@ set(EXTERNAL_NAME soxr) +if (ANDROID) + set(PLATFORM_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19" "-DHAVE_WORDS_BIGENDIAN_EXITCODE=1") +else () + set(PLATFORM_CMAKE_ARGS "-DBUILD_SHARED_LIBS=0") +endif () + include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} PREFIX ${EXTERNAL_NAME} URL http://pkgs.fedoraproject.org/repo/pkgs/soxr/soxr-0.1.1-Source.tar.xz/805651a245ead381c82fad6247af5968/soxr-0.1.1-Source.tar.xz - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_SHARED_LIBS=N + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) @@ -16,6 +22,8 @@ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING if (WIN32) set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.lib CACHE TYPE STRING) +elseif (ANDROID) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE STRING) else () set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.a CACHE TYPE STRING) endif () \ No newline at end of file diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index e739e9994a..3ae59dd18e 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -9,9 +9,9 @@ # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # -macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS _PROJECTS) +macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) - foreach(_PROJ_NAME ${_PROJECTS}) + foreach(_PROJ_NAME ${ARGN}) string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) From f31199863408758a1011a5cb1e3474df438ad340 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 10:47:42 -0800 Subject: [PATCH 003/261] remove soxr from the android build dir --- BUILD_ANDROID.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/BUILD_ANDROID.md b/BUILD_ANDROID.md index 6ff3160775..9fe286744d 100644 --- a/BUILD_ANDROID.md +++ b/BUILD_ANDROID.md @@ -88,22 +88,6 @@ mkdir lib cp `find . -name "*.so"` lib/ ``` -####Soxr - -Download the [Soxr source](http://sourceforge.net/projects/soxr/) and extract the tarball inside your `ANDROID_LIB_DIR`. Rename the extracted folder to `soxr`. - -From the soxr directory, use cmake, along with the `android.toolchain.cmake` file (included in this repository under cmake/android) to cross-compile soxr for Android. Note that you will need ANDROID_NDK set in your environment before using the toolchain file. - -The full set of commands to build soxr for Android is shown below. It is a long command, make sure you copy the entire command (up to `-DBUILD_TESTS=0`). - -``` -cmake -DCMAKE_TOOLCHAIN_FILE=$FULL_PATH_TO_TOOLCHAIN -DCMAKE_INSTALL_PREFIX=. -DHAVE_WORDS_BIGENDIAN_EXITCODE=1 -DBUILD_TESTS=0 -make -make install -``` - -This will create the `lib` and `include` folders inside `ANDROID_LIB_DIR/soxr` that FindSoxr will look for. - ####Oculus Mobile SDK The Oculus Mobile SDK is optional, for Gear VR support. It is not required to compile gvr-interface. From c82f5b7c0dbe507d8f4701e9dcb10f73a6d0f17d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 10:50:43 -0800 Subject: [PATCH 004/261] use hifi-public as host for libsoxr --- cmake/externals/soxr/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 0c21780cbc..ed173f4402 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -10,7 +10,7 @@ include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} PREFIX ${EXTERNAL_NAME} - URL http://pkgs.fedoraproject.org/repo/pkgs/soxr/soxr-0.1.1-Source.tar.xz/805651a245ead381c82fad6247af5968/soxr-0.1.1-Source.tar.xz + URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1-Source.tar.xz CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) From c53465e55019bf4db6dae7ed2c6a9ad3169c5b5c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 10:52:31 -0800 Subject: [PATCH 005/261] fix archive type for soxr external project --- cmake/externals/soxr/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index ed173f4402..e65b171cfb 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -10,7 +10,7 @@ include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} PREFIX ${EXTERNAL_NAME} - URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1-Source.tar.xz + URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1-Source.tar.gz CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) From a5bd9be51075a7860d24ba687caf7822e072e56d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 11:00:23 -0800 Subject: [PATCH 006/261] put externals in build-externals to avoid clean build removal --- CMakeLists.txt | 7 +++++++ cmake/macros/AddDependencyExternalProjects.cmake | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6eb3b935e..10d7998454 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/mo set(MACRO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macros") set(EXTERNAL_PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/externals") +set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-externals") +if (ANDROID) + set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/android/${CMAKE_GENERATOR}") +else () + set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/${CMAKE_GENERATOR}") +endif () + file(GLOB HIFI_CUSTOM_MACROS "cmake/macros/*.cmake") foreach(CUSTOM_MACRO ${HIFI_CUSTOM_MACROS}) include(${CUSTOM_MACRO}) diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index 3ae59dd18e..c039d09987 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -16,8 +16,8 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) if (NOT DEFINED GET_${_PROJ_NAME_UPPER} OR GET_${_PROJ_NAME_UPPER}) - if (NOT TARGET ${_PROJ_NAME}) - add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${CMAKE_BINARY_DIR}/externals/${_PROJ_NAME}) + if (NOT TARGET ${_PROJ_NAME}) + add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${EXTERNALS_BINARY_DIR}/${_PROJ_NAME}) endif () add_dependencies(${TARGET_NAME} ${_PROJ_NAME}) From 013bb0433cf5f4d22127c8924077f5a47496ff0b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 11:01:00 -0800 Subject: [PATCH 007/261] clarify build guide for sep externals build dir --- BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index 6bf8df2510..e4bf1f2718 100644 --- a/BUILD.md +++ b/BUILD.md @@ -9,7 +9,7 @@ #### CMake External Project Dependencies -The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. +The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-externals` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. * [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 * [gverb](https://github.com/highfidelity/gverb) From 19cd24fb059f92962b0c15004d0f731ae7d954fa Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 11:02:20 -0800 Subject: [PATCH 008/261] more clarification to BUILD guide for externals --- BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index e4bf1f2718..9501f7ad0a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -9,7 +9,7 @@ #### CMake External Project Dependencies -The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-externals` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. +The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-externals` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. Should you want to force a re-download and re-compile of a specific external, you can simply remove that directory from the appropriate subfolder in `build-externals`. Should you want to force a re-download and re-compile of all externals, just remove the `build-externals` folder. * [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 * [gverb](https://github.com/highfidelity/gverb) From c7befe8018dad8e2f8349a4a746430ddba3235b0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 11:56:30 -0800 Subject: [PATCH 009/261] build the dynamic soxr to reduce manual linking --- cmake/externals/soxr/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index e65b171cfb..1c74a6904a 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -2,8 +2,6 @@ set(EXTERNAL_NAME soxr) if (ANDROID) set(PLATFORM_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19" "-DHAVE_WORDS_BIGENDIAN_EXITCODE=1") -else () - set(PLATFORM_CMAKE_ARGS "-DBUILD_SHARED_LIBS=0") endif () include(ExternalProject) @@ -22,8 +20,8 @@ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING if (WIN32) set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.lib CACHE TYPE STRING) -elseif (ANDROID) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE STRING) +elseif (APPLE) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.dylib CACHE TYPE STRING) else () - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.a CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE STRING) endif () \ No newline at end of file From 26b4340417c5e0c11cd750fc1c1d6f65361b61aa Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 12:07:57 -0800 Subject: [PATCH 010/261] change soxr source to friendly zip --- cmake/externals/soxr/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 1c74a6904a..bcb06e4e25 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -8,7 +8,7 @@ include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} PREFIX ${EXTERNAL_NAME} - URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1-Source.tar.gz + URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1-Source.zip CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) From 66756308a45f58c29274daf85839dcba42d760fa Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 12:21:19 -0800 Subject: [PATCH 011/261] force soxr to be shared lib, use new zip --- cmake/externals/soxr/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index bcb06e4e25..2c967d5761 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -8,8 +8,8 @@ include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} PREFIX ${EXTERNAL_NAME} - URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1-Source.zip - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= + URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1.zip + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_SHARED_LIBS=1 -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) From 016ef2b2430f3a5d54b925a307209ba7ec738408 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 12:36:26 -0800 Subject: [PATCH 012/261] fix name of soxr lib for windows --- cmake/externals/soxr/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 2c967d5761..03b49bd7d1 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -19,7 +19,7 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING) if (WIN32) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.lib CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE STRING) elseif (APPLE) set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.dylib CACHE TYPE STRING) else () From bc899eaa581da85157ff1601c6499485fe52f653 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 13:17:23 -0800 Subject: [PATCH 013/261] add fixup_bundle step for WIN32 interface --- CMakeLists.txt | 5 +++-- cmake/macros/AddDependencyExternalProjects.cmake | 2 +- cmake/scripts/FixupBundlePostBuild.cmake | 13 +++++++++++++ interface/CMakeLists.txt | 9 +++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 cmake/scripts/FixupBundlePostBuild.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 10d7998454..6ebf5ea5e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,8 +103,9 @@ set(HIFI_LIBRARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries") # setup for find modules set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") -set(MACRO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macros") -set(EXTERNAL_PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/externals") +set(HIFI_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +set(MACRO_DIR "${HIFI_CMAKE_DIR}/macros") +set(EXTERNAL_PROJECT_DIR "${HIFI_CMAKE_DIR}/externals") set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-externals") if (ANDROID) diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index c039d09987..72dbad6639 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -1,5 +1,5 @@ # -# SetupExternalProject.cmake +# AddDependencyExternalProjects.cmake # cmake/macros # # Copyright 2015 High Fidelity, Inc. diff --git a/cmake/scripts/FixupBundlePostBuild.cmake b/cmake/scripts/FixupBundlePostBuild.cmake new file mode 100644 index 0000000000..7a74089bfa --- /dev/null +++ b/cmake/scripts/FixupBundlePostBuild.cmake @@ -0,0 +1,13 @@ +# +# FixupBundlePostBuild.cmake.in +# cmake/templates +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 13, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +include(BundleUtilities) +fixup_bundle("${BUNDLE_EXECUTABLE}" "" "") \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index c1e8b7d618..459a47a1ce 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -239,5 +239,14 @@ else (APPLE) endif() endif (APPLE) +if (WIN32) + # add a post-build command to copy DLLs beside the interface executable + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -DBUNDLE_EXECUTABLE=$ -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake + ) +endif () + # link any dependencies bubbled up from our linked dependencies include_dependency_includes() From 250b25154cfe5b81d5979138e3d6070de8f0da0f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 13:41:37 -0800 Subject: [PATCH 014/261] test for recursive dll dir search --- cmake/scripts/FixupBundlePostBuild.cmake | 2 +- interface/CMakeLists.txt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/scripts/FixupBundlePostBuild.cmake b/cmake/scripts/FixupBundlePostBuild.cmake index 7a74089bfa..e41d5cbc45 100644 --- a/cmake/scripts/FixupBundlePostBuild.cmake +++ b/cmake/scripts/FixupBundlePostBuild.cmake @@ -10,4 +10,4 @@ # include(BundleUtilities) -fixup_bundle("${BUNDLE_EXECUTABLE}" "" "") \ No newline at end of file +fixup_bundle("${BUNDLE_EXECUTABLE}" "" "${LIB_SEARCH_DIRS}") \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 459a47a1ce..746f08e0d6 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -240,11 +240,15 @@ else (APPLE) endif (APPLE) if (WIN32) + list(APPEND LIB_SEARCH_DIRS ${EXTERNALS_BINARY_DIR}) # add a post-build command to copy DLLs beside the interface executable add_custom_command( TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -DBUNDLE_EXECUTABLE=$ -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake + COMMAND ${CMAKE_COMMAND} + -DBUNDLE_EXECUTABLE=$ + -DLIB_SEARCH_DIRS=${LIB_SEARCH_DIRS} + -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake ) endif () From 767601de4fdb0e156cb669e6f60749997dac7474 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 14:09:26 -0800 Subject: [PATCH 015/261] use a cache variable to pass around lib paths --- cmake/macros/AddPathToLibPaths.cmake | 16 ++++++++++++++++ cmake/modules/FindSoxr.cmake | 5 +++++ cmake/scripts/FixupBundlePostBuild.cmake | 2 +- interface/CMakeLists.txt | 3 +-- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 cmake/macros/AddPathToLibPaths.cmake diff --git a/cmake/macros/AddPathToLibPaths.cmake b/cmake/macros/AddPathToLibPaths.cmake new file mode 100644 index 0000000000..397680a237 --- /dev/null +++ b/cmake/macros/AddPathToLibPaths.cmake @@ -0,0 +1,16 @@ +# +# AddPathToLibPaths.cmake +# cmake/macros +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 13, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(ADD_PATH_TO_LIB_PATHS _PATH) + set(TEMP_LIB_PATHS ${LIB_PATHS}) + list(APPEND TEMP_LIB_PATHS ${_PATH}) + set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) +endmacro() \ No newline at end of file diff --git a/cmake/modules/FindSoxr.cmake b/cmake/modules/FindSoxr.cmake index 367022e9ec..cfe0428ebc 100644 --- a/cmake/modules/FindSoxr.cmake +++ b/cmake/modules/FindSoxr.cmake @@ -24,6 +24,11 @@ hifi_library_search_hints("soxr") find_path(SOXR_INCLUDE_DIRS soxr.h PATH_SUFFIXES include HINTS ${SOXR_SEARCH_DIRS}) find_library(SOXR_LIBRARIES NAMES soxr PATH_SUFFIXES lib HINTS ${SOXR_SEARCH_DIRS}) +if (NOT DEFINED SOXR_LIB_PATH) + get_filename_component(SOXR_LIB_PATH ${SOXR_LIBRARIES} DIRECTORY CACHE) + add_path_to_lib_paths(${SOXR_LIB_PATH}) +endif () + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SOXR DEFAULT_MSG SOXR_INCLUDE_DIRS SOXR_LIBRARIES) diff --git a/cmake/scripts/FixupBundlePostBuild.cmake b/cmake/scripts/FixupBundlePostBuild.cmake index e41d5cbc45..826033d791 100644 --- a/cmake/scripts/FixupBundlePostBuild.cmake +++ b/cmake/scripts/FixupBundlePostBuild.cmake @@ -10,4 +10,4 @@ # include(BundleUtilities) -fixup_bundle("${BUNDLE_EXECUTABLE}" "" "${LIB_SEARCH_DIRS}") \ No newline at end of file +fixup_bundle("${BUNDLE_EXECUTABLE}" "" "${LIB_PATHS}") \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 746f08e0d6..fd13aa7092 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -240,14 +240,13 @@ else (APPLE) endif (APPLE) if (WIN32) - list(APPEND LIB_SEARCH_DIRS ${EXTERNALS_BINARY_DIR}) # add a post-build command to copy DLLs beside the interface executable add_custom_command( TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -DBUNDLE_EXECUTABLE=$ - -DLIB_SEARCH_DIRS=${LIB_SEARCH_DIRS} + -DLIB_PATHS=${LIB_PATHS} -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake ) endif () From 07e3064cc44791aae65fcea48a5fd1647df2d322 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 14:18:10 -0800 Subject: [PATCH 016/261] add an output message to verify LIB_PATHS --- cmake/scripts/FixupBundlePostBuild.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/scripts/FixupBundlePostBuild.cmake b/cmake/scripts/FixupBundlePostBuild.cmake index 826033d791..c6d0b42aea 100644 --- a/cmake/scripts/FixupBundlePostBuild.cmake +++ b/cmake/scripts/FixupBundlePostBuild.cmake @@ -10,4 +10,5 @@ # include(BundleUtilities) +message(STATUS "LIB_PATHS for fixup_bundle bundle ${BUNDLE_EXECUTABLE} are ${LIB_PATHS}") fixup_bundle("${BUNDLE_EXECUTABLE}" "" "${LIB_PATHS}") \ No newline at end of file From 801ab0e2b99efe95bff60185360a64169bfaefda Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 14:30:20 -0800 Subject: [PATCH 017/261] windows unhelpfully puts soxr dll in bin, not lib --- cmake/externals/soxr/CMakeLists.txt | 1 + cmake/modules/FindSoxr.cmake | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 03b49bd7d1..fcd28d4db5 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -20,6 +20,7 @@ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING if (WIN32) set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE TYPE STRING) elseif (APPLE) set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.dylib CACHE TYPE STRING) else () diff --git a/cmake/modules/FindSoxr.cmake b/cmake/modules/FindSoxr.cmake index cfe0428ebc..b980b4ea1f 100644 --- a/cmake/modules/FindSoxr.cmake +++ b/cmake/modules/FindSoxr.cmake @@ -24,10 +24,10 @@ hifi_library_search_hints("soxr") find_path(SOXR_INCLUDE_DIRS soxr.h PATH_SUFFIXES include HINTS ${SOXR_SEARCH_DIRS}) find_library(SOXR_LIBRARIES NAMES soxr PATH_SUFFIXES lib HINTS ${SOXR_SEARCH_DIRS}) -if (NOT DEFINED SOXR_LIB_PATH) - get_filename_component(SOXR_LIB_PATH ${SOXR_LIBRARIES} DIRECTORY CACHE) - add_path_to_lib_paths(${SOXR_LIB_PATH}) -endif () +if (WIN32) + find_path(SOXR_DLL_PATH soxr.dll PATH_SUFFIXES bin HINTS ${SOXR_SEARCH_DIRS}) + add_path_to_lib_paths(${SOXR_DLL_PATH}) +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SOXR DEFAULT_MSG SOXR_INCLUDE_DIRS SOXR_LIBRARIES) From 97fa1412e27e9417fd546ed88f6730618da166be Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 14:45:26 -0800 Subject: [PATCH 018/261] copy dlls beside windows executable for all executables --- cmake/macros/AddPathToLibPaths.cmake | 2 +- .../CopyDllsBesideWindowsExecutable.cmake | 24 +++++++++++++++++++ cmake/macros/SetupHifiProject.cmake | 2 ++ interface/CMakeLists.txt | 12 +--------- 4 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 cmake/macros/CopyDllsBesideWindowsExecutable.cmake diff --git a/cmake/macros/AddPathToLibPaths.cmake b/cmake/macros/AddPathToLibPaths.cmake index 397680a237..f1f7c46a1c 100644 --- a/cmake/macros/AddPathToLibPaths.cmake +++ b/cmake/macros/AddPathToLibPaths.cmake @@ -3,7 +3,7 @@ # cmake/macros # # Copyright 2015 High Fidelity, Inc. -# Created by Stephen Birarda on February 13, 2014 +# Created by Stephen Birarda on February 17, 2014 # # Distributed under the Apache License, Version 2.0. # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake new file mode 100644 index 0000000000..b0379e4764 --- /dev/null +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -0,0 +1,24 @@ +# +# CopyDllsBesideWindowsExecutable.cmake +# cmake/macros +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 17, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) + if (WIN32) + # add a post-build command to copy DLLs beside the interface executable + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + -DBUNDLE_EXECUTABLE=$ + -DLIB_PATHS=${LIB_PATHS} + -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake + ) + endif () +endmacro() \ No newline at end of file diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 3f9787faa1..8b3bc43101 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -34,4 +34,6 @@ macro(SETUP_HIFI_PROJECT) foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES}) target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE}) endforeach() + + copy_dlls_beside_windows_executable() endmacro() \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index fd13aa7092..200d7a72e6 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -239,17 +239,7 @@ else (APPLE) endif() endif (APPLE) -if (WIN32) - # add a post-build command to copy DLLs beside the interface executable - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DBUNDLE_EXECUTABLE=$ - -DLIB_PATHS=${LIB_PATHS} - -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake - ) -endif () +copy_dlls_beside_windows_executable() # link any dependencies bubbled up from our linked dependencies include_dependency_includes() From 18f293b59b727147acecd7fb1b6841b7c12bc9a5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 14:53:22 -0800 Subject: [PATCH 019/261] disable bundle fixup on Release build --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index b0379e4764..e0558f7a44 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -10,7 +10,7 @@ # macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) - if (WIN32) + if (WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") # add a post-build command to copy DLLs beside the interface executable add_custom_command( TARGET ${TARGET_NAME} From 6fc74eb83003da6c8716b2fd55a894a5dc18336b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 14:56:34 -0800 Subject: [PATCH 020/261] fix cmake build type check for interface icon --- interface/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 200d7a72e6..31d8f3df45 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -78,7 +78,7 @@ if (APPLE) set(MACOSX_BUNDLE_BUNDLE_NAME Interface) set(MACOSX_BUNDLE_GUI_IDENTIFIER io.highfidelity.Interface) - if (${CMAKE_BUILD_TYPE} MATCHES "RELEASE") + if (CMAKE_BUILD_TYPE STREQUAL "Release") set(ICON_FILENAME "interface.icns") else () set(ICON_FILENAME "interface-beta.icns") From 34cf7bb1f1c0d258d8d3d95cfc6ed9f400bff889 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:04:57 -0800 Subject: [PATCH 021/261] add leap motion dll path for fixup_bundle --- cmake/modules/FindLeapMotion.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/FindLeapMotion.cmake b/cmake/modules/FindLeapMotion.cmake index cb49ceb597..8813956696 100644 --- a/cmake/modules/FindLeapMotion.cmake +++ b/cmake/modules/FindLeapMotion.cmake @@ -20,6 +20,9 @@ find_path(LEAPMOTION_INCLUDE_DIRS Leap.h PATH_SUFFIXES include HINTS ${LEAPMOTIO if (WIN32) find_library(LEAPMOTION_LIBRARY_DEBUG Leapd PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) + + find_path(LEAPMOTION_DLL_PATH Leapd.dll PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) + add_path_to_lib_paths(${LEAPMOTION_DLL_PATH}) elseif (APPLE) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib HINTS ${LEAPMOTION_SEARCH_DIRS}) endif () From b682cd03f3f573a3bc91ad38f0412a61556efc4d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:08:30 -0800 Subject: [PATCH 022/261] cleanup leap dll path for win --- cmake/modules/FindLeapMotion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindLeapMotion.cmake b/cmake/modules/FindLeapMotion.cmake index 8813956696..baed00ef50 100644 --- a/cmake/modules/FindLeapMotion.cmake +++ b/cmake/modules/FindLeapMotion.cmake @@ -21,7 +21,7 @@ if (WIN32) find_library(LEAPMOTION_LIBRARY_DEBUG Leapd PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) - find_path(LEAPMOTION_DLL_PATH Leapd.dll PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) + get_filename_component(LEAPMOTION_DLL_PATH ${LEAPMOTION_LIBRARY_RELEASE} DIRECTORY CACHE) add_path_to_lib_paths(${LEAPMOTION_DLL_PATH}) elseif (APPLE) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib HINTS ${LEAPMOTION_SEARCH_DIRS}) From c233dc7b57136c05b6f978e2711f5d4c1c9cbbad Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:08:41 -0800 Subject: [PATCH 023/261] get sdl2 dll path for win32 fixup_bundle --- cmake/modules/FindSDL2.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake index 6ef9ffa52a..25d61899a1 100644 --- a/cmake/modules/FindSDL2.cmake +++ b/cmake/modules/FindSDL2.cmake @@ -254,3 +254,8 @@ ENDIF(SDL2_LIBRARY_TEMP) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) + +if (WIN32) + get_filename_component(SDL2_DLL_PATH ${SDL2_LIBRARY} DIRECTORY CACHE) + add_path_to_lib_paths(${SDL2_DLL_PATH}) +endif () From e7b4746c160efca7ab367ab8dc4cba90e00f393d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:12:13 -0800 Subject: [PATCH 024/261] add TBB dll path to lib paths --- cmake/modules/FindTBB.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index 03ac99b73c..596cd3ccca 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -56,6 +56,9 @@ elseif (WIN32) endif() set(_TBB_LIB_DIR "lib/${_TBB_ARCH_DIR}/vc12") + + find_path(TBB_DLL_PATH tbb_debug.dll PATH_SUFFIXES "bin/${_TBB_ARCH_DIR}/vc12" HINTS ${TBB_SEARCH_DIRS}) + add_path_to_lib_paths(${TBB_DLL_PATH}) elseif (ANDROID) set(_TBB_DEFAULT_INSTALL_DIR "/tbb") set(_TBB_LIB_NAME "tbb") From b727c910d11f004391d0184ac0c76b5de0015967 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:19:17 -0800 Subject: [PATCH 025/261] handle multiple dll paths, add sixense --- cmake/macros/AddPathToLibPaths.cmake | 10 ++++++---- cmake/modules/FindLeapMotion.cmake | 2 +- cmake/modules/FindSDL2.cmake | 2 +- cmake/modules/FindSixense.cmake | 14 +++++++++++++- cmake/modules/FindSoxr.cmake | 2 +- cmake/modules/FindTBB.cmake | 13 +++++++++++-- 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/cmake/macros/AddPathToLibPaths.cmake b/cmake/macros/AddPathToLibPaths.cmake index f1f7c46a1c..abdc65c9be 100644 --- a/cmake/macros/AddPathToLibPaths.cmake +++ b/cmake/macros/AddPathToLibPaths.cmake @@ -9,8 +9,10 @@ # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html # -macro(ADD_PATH_TO_LIB_PATHS _PATH) - set(TEMP_LIB_PATHS ${LIB_PATHS}) - list(APPEND TEMP_LIB_PATHS ${_PATH}) - set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) +macro(ADD_PATHS_TO_LIB_PATHS) + foreach(_PATH in ${ARGN}) + set(TEMP_LIB_PATHS ${LIB_PATHS}) + list(APPEND TEMP_LIB_PATHS ${_PATH}) + set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) + endforeach() endmacro() \ No newline at end of file diff --git a/cmake/modules/FindLeapMotion.cmake b/cmake/modules/FindLeapMotion.cmake index baed00ef50..6ccba0ea66 100644 --- a/cmake/modules/FindLeapMotion.cmake +++ b/cmake/modules/FindLeapMotion.cmake @@ -22,7 +22,7 @@ if (WIN32) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) get_filename_component(LEAPMOTION_DLL_PATH ${LEAPMOTION_LIBRARY_RELEASE} DIRECTORY CACHE) - add_path_to_lib_paths(${LEAPMOTION_DLL_PATH}) + add_paths_to_lib_paths(${LEAPMOTION_DLL_PATH}) elseif (APPLE) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib HINTS ${LEAPMOTION_SEARCH_DIRS}) endif () diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake index 25d61899a1..d9fa3c3c37 100644 --- a/cmake/modules/FindSDL2.cmake +++ b/cmake/modules/FindSDL2.cmake @@ -257,5 +257,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_D if (WIN32) get_filename_component(SDL2_DLL_PATH ${SDL2_LIBRARY} DIRECTORY CACHE) - add_path_to_lib_paths(${SDL2_DLL_PATH}) + add_paths_to_lib_paths(${SDL2_DLL_PATH} ${SDL2_RELEASE_PATH}) endif () diff --git a/cmake/modules/FindSixense.cmake b/cmake/modules/FindSixense.cmake index f772c42e41..7e6581ffd0 100644 --- a/cmake/modules/FindSixense.cmake +++ b/cmake/modules/FindSixense.cmake @@ -32,14 +32,26 @@ elseif (UNIX) elseif (WIN32) find_library(SIXENSE_LIBRARY_RELEASE lib/win32/release_dll/sixense.lib HINTS ${SIXENSE_SEARCH_DIRS}) find_library(SIXENSE_LIBRARY_DEBUG lib/win32/debug_dll/sixensed.lib HINTS ${SIXENSE_SEARCH_DIRS}) + + find_path(SIXENSE_DEBUG_DLL_PATH sixensed.dll PATH_SUFFIXES bin/win32/debug_dll HINTS ${SIXENSE_SEARCH_DIRS}) + find_path(SIXENSE_RELEASE_DLL_PATH sixense.dll PATH_SUFFIXES bin/win32/release_dll HINTS ${SIXENSE_SEARCH_DIRS}) endif () include(SelectLibraryConfigurations) select_library_configurations(SIXENSE) +set(SIXENSE_REQUIREMENTS SIXENSE_INCLUDE_DIRS SIXENSE_LIBRARIES) +if (WIN32) + list(APPEND SIXENSE_REQUIREMENTS SIXENSE_DEBUG_DLL_PATH SIXENSE_RELEASE_DLL_PATH) +endif () + set(SIXENSE_LIBRARIES "${SIXENSE_LIBRARY}") include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Sixense DEFAULT_MSG SIXENSE_INCLUDE_DIRS SIXENSE_LIBRARIES) +find_package_handle_standard_args(Sixense DEFAULT_MSG SIXENSE_REQUIREMENTS) + +if (WIN32) + add_paths_to_lib_paths(${SIXSENSE_DEBUG_DLL_PATH}) +endif () mark_as_advanced(SIXENSE_LIBRARIES SIXENSE_INCLUDE_DIRS SIXENSE_SEARCH_DIRS) diff --git a/cmake/modules/FindSoxr.cmake b/cmake/modules/FindSoxr.cmake index b980b4ea1f..fba6158f14 100644 --- a/cmake/modules/FindSoxr.cmake +++ b/cmake/modules/FindSoxr.cmake @@ -26,7 +26,7 @@ find_library(SOXR_LIBRARIES NAMES soxr PATH_SUFFIXES lib HINTS ${SOXR_SEARCH_DIR if (WIN32) find_path(SOXR_DLL_PATH soxr.dll PATH_SUFFIXES bin HINTS ${SOXR_SEARCH_DIRS}) - add_path_to_lib_paths(${SOXR_DLL_PATH}) + add_paths_to_lib_paths(${SOXR_DLL_PATH}) endif() include(FindPackageHandleStandardArgs) diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index 596cd3ccca..c18d619612 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -58,7 +58,7 @@ elseif (WIN32) set(_TBB_LIB_DIR "lib/${_TBB_ARCH_DIR}/vc12") find_path(TBB_DLL_PATH tbb_debug.dll PATH_SUFFIXES "bin/${_TBB_ARCH_DIR}/vc12" HINTS ${TBB_SEARCH_DIRS}) - add_path_to_lib_paths(${TBB_DLL_PATH}) + elseif (ANDROID) set(_TBB_DEFAULT_INSTALL_DIR "/tbb") set(_TBB_LIB_NAME "tbb") @@ -80,6 +80,15 @@ include(FindPackageHandleStandardArgs) select_library_configurations(TBB) select_library_configurations(TBB_MALLOC) -find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARY TBB_MALLOC_LIBRARY TBB_INCLUDE_DIRS) +set(TBB_REQUIREMENTS TBB_LIBRARY TBB_MALLOC_LIBRARY TBB_INCLUDE_DIRS) +if (WIN32) + list(APPEND TBB_REQUIREMENTS TBB_DLL_PATH) +endif () + +find_package_handle_standard_args(TBB DEFAULT_MSG TBB_REQUIREMENTS) + +if (WIN32) + add_paths_to_lib_paths(${TBB_DLL_PATH}) +endif () set(TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY}) From bc0ddd8c1cb6d69dbb2a6d6eb94c4d77e9565c6b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:19:57 -0800 Subject: [PATCH 026/261] rename AddPathToLibPaths file so it is findable --- .../{AddPathToLibPaths.cmake => AddPathsToLibPaths.cmake} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename cmake/macros/{AddPathToLibPaths.cmake => AddPathsToLibPaths.cmake} (94%) diff --git a/cmake/macros/AddPathToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake similarity index 94% rename from cmake/macros/AddPathToLibPaths.cmake rename to cmake/macros/AddPathsToLibPaths.cmake index abdc65c9be..93e3287b5a 100644 --- a/cmake/macros/AddPathToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -1,5 +1,5 @@ # -# AddPathToLibPaths.cmake +# AddPathsToLibPaths.cmake # cmake/macros # # Copyright 2015 High Fidelity, Inc. From e582709185a192fb41853e58977befceb022578e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:22:22 -0800 Subject: [PATCH 027/261] ensure leapmotion dll path is found --- cmake/modules/FindLeapMotion.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/modules/FindLeapMotion.cmake b/cmake/modules/FindLeapMotion.cmake index 6ccba0ea66..6b9d4355f7 100644 --- a/cmake/modules/FindLeapMotion.cmake +++ b/cmake/modules/FindLeapMotion.cmake @@ -21,8 +21,7 @@ if (WIN32) find_library(LEAPMOTION_LIBRARY_DEBUG Leapd PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) - get_filename_component(LEAPMOTION_DLL_PATH ${LEAPMOTION_LIBRARY_RELEASE} DIRECTORY CACHE) - add_paths_to_lib_paths(${LEAPMOTION_DLL_PATH}) + find_path(LEAPMOTION_DLL_PATH Leap.dll PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS}) elseif (APPLE) find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib HINTS ${LEAPMOTION_SEARCH_DIRS}) endif () @@ -32,7 +31,16 @@ select_library_configurations(LEAPMOTION) set(LEAPMOTION_LIBRARIES "${LEAPMOTION_LIBRARY}") +set(LEAPMOTION_REQUIREMENTS LEAPMOTION_INCLUDE_DIRS LEAPMOTION_LIBRARIES) +if (WIN32) + list(APPEND LEAPMOTION_REQUIREMENTS LEAPMOTION_DLL_PATH) +endif () + include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LeapMotion DEFAULT_MSG LEAPMOTION_INCLUDE_DIRS LEAPMOTION_LIBRARIES) +find_package_handle_standard_args(LeapMotion DEFAULT_MSG LEAPMOTION_REQUIREMENTS) + +if (WIN32) + add_paths_to_lib_paths(${LEAPMOTION_DLL_PATH}) +endif () mark_as_advanced(LEAPMOTION_INCLUDE_DIRS LEAPMOTION_LIBRARIES LEAPMOTION_SEARCH_DIRS) From ecbbb481d01329be9c9d684ebe508ad56d3d05b9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:27:12 -0800 Subject: [PATCH 028/261] ensure dll path is found for sdl2 --- cmake/modules/FindSDL2.cmake | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake index d9fa3c3c37..b42cacb16a 100644 --- a/cmake/modules/FindSDL2.cmake +++ b/cmake/modules/FindSDL2.cmake @@ -138,6 +138,10 @@ IF(CMAKE_SIZEOF_VOID_P EQUAL 8) /opt/csw /opt ) + + if (WIN32) + find_path(SDL2_DLL_PATH SDL2.dll PATH_SUFFIXES lib/x64 HINTS ${SDL2_SEARCH_DIRS}) + endif () # On 32bit build find the 32bit libs ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) FIND_LIBRARY(SDL2_LIBRARY_TEMP SDL2 @@ -153,6 +157,10 @@ ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) /opt/csw /opt ) + + if (WIN32) + find_path(SDL2_DLL_PATH SDL2.dll PATH_SUFFIXES lib/x86 HINTS ${SDL2_SEARCH_DIRS}) + endif () ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) IF(NOT SDL2_BUILDING_LIBRARY) @@ -253,9 +261,13 @@ ENDIF(SDL2_LIBRARY_TEMP) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) +set(SDL2_REQUIREMENTS SDL2_LIBRARY SDL2_INCLUDE_DIR) +if (WIN32) + list(APPEND SDL2_REQUIREMENTS SDL2_DLL_PATH) +endif () + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_REQUIREMENTS) if (WIN32) - get_filename_component(SDL2_DLL_PATH ${SDL2_LIBRARY} DIRECTORY CACHE) - add_paths_to_lib_paths(${SDL2_DLL_PATH} ${SDL2_RELEASE_PATH}) + add_paths_to_lib_paths(${SDL2_DLL_PATH}) endif () From 10cdbc4fa08ecada6991911aaf930876830b10c0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:33:26 -0800 Subject: [PATCH 029/261] fix dynamic requirements in find modules --- cmake/modules/FindLeapMotion.cmake | 4 ++-- cmake/modules/FindSDL2.cmake | 2 +- cmake/modules/FindSixense.cmake | 2 +- cmake/modules/FindTBB.cmake | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/modules/FindLeapMotion.cmake b/cmake/modules/FindLeapMotion.cmake index 6b9d4355f7..6f177cd3d7 100644 --- a/cmake/modules/FindLeapMotion.cmake +++ b/cmake/modules/FindLeapMotion.cmake @@ -29,7 +29,7 @@ endif () include(SelectLibraryConfigurations) select_library_configurations(LEAPMOTION) -set(LEAPMOTION_LIBRARIES "${LEAPMOTION_LIBRARY}") +set(LEAPMOTION_LIBRARIES ${LEAPMOTION_LIBRARY}) set(LEAPMOTION_REQUIREMENTS LEAPMOTION_INCLUDE_DIRS LEAPMOTION_LIBRARIES) if (WIN32) @@ -37,7 +37,7 @@ if (WIN32) endif () include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LeapMotion DEFAULT_MSG LEAPMOTION_REQUIREMENTS) +find_package_handle_standard_args(LeapMotion DEFAULT_MSG ${LEAPMOTION_REQUIREMENTS}) if (WIN32) add_paths_to_lib_paths(${LEAPMOTION_DLL_PATH}) diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake index b42cacb16a..55dae82f82 100644 --- a/cmake/modules/FindSDL2.cmake +++ b/cmake/modules/FindSDL2.cmake @@ -266,7 +266,7 @@ if (WIN32) list(APPEND SDL2_REQUIREMENTS SDL2_DLL_PATH) endif () -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_REQUIREMENTS) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS ${SDL2_REQUIREMENTS}) if (WIN32) add_paths_to_lib_paths(${SDL2_DLL_PATH}) diff --git a/cmake/modules/FindSixense.cmake b/cmake/modules/FindSixense.cmake index 7e6581ffd0..11ca704407 100644 --- a/cmake/modules/FindSixense.cmake +++ b/cmake/modules/FindSixense.cmake @@ -48,7 +48,7 @@ endif () set(SIXENSE_LIBRARIES "${SIXENSE_LIBRARY}") include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Sixense DEFAULT_MSG SIXENSE_REQUIREMENTS) +find_package_handle_standard_args(Sixense DEFAULT_MSG ${SIXENSE_REQUIREMENTS}) if (WIN32) add_paths_to_lib_paths(${SIXSENSE_DEBUG_DLL_PATH}) diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index c18d619612..9781154c1a 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -85,7 +85,7 @@ if (WIN32) list(APPEND TBB_REQUIREMENTS TBB_DLL_PATH) endif () -find_package_handle_standard_args(TBB DEFAULT_MSG TBB_REQUIREMENTS) +find_package_handle_standard_args(TBB DEFAULT_MSG ${TBB_REQUIREMENTS}) if (WIN32) add_paths_to_lib_paths(${TBB_DLL_PATH}) From d0d4eaec868d1691cc897596764269accec1991a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:44:03 -0800 Subject: [PATCH 030/261] fix AddPathsToLibPaths foreach, soxr requirements --- cmake/macros/AddPathsToLibPaths.cmake | 2 +- cmake/modules/FindSoxr.cmake | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index 93e3287b5a..e88fd06f95 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -10,7 +10,7 @@ # macro(ADD_PATHS_TO_LIB_PATHS) - foreach(_PATH in ${ARGN}) + foreach(_PATH ${ARGN}) set(TEMP_LIB_PATHS ${LIB_PATHS}) list(APPEND TEMP_LIB_PATHS ${_PATH}) set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) diff --git a/cmake/modules/FindSoxr.cmake b/cmake/modules/FindSoxr.cmake index fba6158f14..b36c9465b7 100644 --- a/cmake/modules/FindSoxr.cmake +++ b/cmake/modules/FindSoxr.cmake @@ -25,11 +25,19 @@ find_path(SOXR_INCLUDE_DIRS soxr.h PATH_SUFFIXES include HINTS ${SOXR_SEARCH_DIR find_library(SOXR_LIBRARIES NAMES soxr PATH_SUFFIXES lib HINTS ${SOXR_SEARCH_DIRS}) if (WIN32) - find_path(SOXR_DLL_PATH soxr.dll PATH_SUFFIXES bin HINTS ${SOXR_SEARCH_DIRS}) - add_paths_to_lib_paths(${SOXR_DLL_PATH}) + find_path(SOXR_DLL_PATH soxr.dll PATH_SUFFIXES bin HINTS ${SOXR_SEARCH_DIRS}) endif() +set(SOXR_REQUIREMENTS SOXR_INCLUDE_DIRS SOXR_LIBRARIES) +if (WIN32) + list(APPEND SOXR_REQUIREMENTS SOXR_DLL_PATH) +endif () + include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SOXR DEFAULT_MSG SOXR_INCLUDE_DIRS SOXR_LIBRARIES) +find_package_handle_standard_args(SOXR DEFAULT_MSG ${SOXR_REQUIREMENTS}) + +if (WIN32) + add_paths_to_lib_paths(${SOXR_DLL_PATH}) +endif () mark_as_advanced(SOXR_INCLUDE_DIRS SOXR_LIBRARIES SOXR_SEARCH_DIRS) \ No newline at end of file From c3b71196c7b3541c4daf63b866ce569af5816f92 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 15:58:08 -0800 Subject: [PATCH 031/261] add debug to catch LIB_PATHS override --- cmake/macros/AddPathsToLibPaths.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index e88fd06f95..bc066304bc 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -10,9 +10,14 @@ # macro(ADD_PATHS_TO_LIB_PATHS) + message(STATUS "ADD_PATHS called with ${ARGN}") foreach(_PATH ${ARGN}) + message(STATUS "ADDING ${_PATH}") + message(STATUS "CURRENT LIB_PATHS is ${LIB_PATHS}") set(TEMP_LIB_PATHS ${LIB_PATHS}) list(APPEND TEMP_LIB_PATHS ${_PATH}) + set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) + message(STATUS "LIB PATHS IS NOW ${LIB_PATHS}") endforeach() endmacro() \ No newline at end of file From b14110f596f78d0c4539c87b0b5906d73e71e519 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:01:41 -0800 Subject: [PATCH 032/261] ensure fixup bundle post build step called with list --- cmake/macros/AddPathsToLibPaths.cmake | 4 ---- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index bc066304bc..d86d054615 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -10,14 +10,10 @@ # macro(ADD_PATHS_TO_LIB_PATHS) - message(STATUS "ADD_PATHS called with ${ARGN}") foreach(_PATH ${ARGN}) - message(STATUS "ADDING ${_PATH}") - message(STATUS "CURRENT LIB_PATHS is ${LIB_PATHS}") set(TEMP_LIB_PATHS ${LIB_PATHS}) list(APPEND TEMP_LIB_PATHS ${_PATH}) set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) - message(STATUS "LIB PATHS IS NOW ${LIB_PATHS}") endforeach() endmacro() \ No newline at end of file diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index e0558f7a44..d6a8147ed4 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -17,7 +17,7 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) POST_BUILD COMMAND ${CMAKE_COMMAND} -DBUNDLE_EXECUTABLE=$ - -DLIB_PATHS=${LIB_PATHS} + -DLIB_PATHS="${LIB_PATHS}" -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake ) endif () From 1a0a4d0e208b8705dd1167063807dac68c4587e8 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:05:32 -0800 Subject: [PATCH 033/261] use seperate_arguments to allow cmake path escape --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index d6a8147ed4..2d42e3eff4 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -11,13 +11,14 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) if (WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") + seperate_arguments(LIB_PATHS_ARG WINDOWS_COMMAND ${LIB_PATHS}) # add a post-build command to copy DLLs beside the interface executable add_custom_command( TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -DBUNDLE_EXECUTABLE=$ - -DLIB_PATHS="${LIB_PATHS}" + -DLIB_PATHS=${LIB_PATHS_ARG} -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake ) endif () From 7920f7afa324e73bf40f7debb25aaf13711c6fe3 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:13:53 -0800 Subject: [PATCH 034/261] spell things correctly so cmake knows what you want --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 2d42e3eff4..827c542b18 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -11,7 +11,7 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) if (WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") - seperate_arguments(LIB_PATHS_ARG WINDOWS_COMMAND ${LIB_PATHS}) + separate_arguments(LIB_PATHS_ARG WINDOWS_COMMAND ${LIB_PATHS}) # add a post-build command to copy DLLs beside the interface executable add_custom_command( TARGET ${TARGET_NAME} From 73891b61b09e0046c031d0a3d42d329ecaac05b4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:18:35 -0800 Subject: [PATCH 035/261] use separate arugments to get colon separated list of paths --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 827c542b18..8c04e3183a 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -11,7 +11,7 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) if (WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") - separate_arguments(LIB_PATHS_ARG WINDOWS_COMMAND ${LIB_PATHS}) + separate_arguments(LIB_PATHS_ARG ${LIB_PATHS}) # add a post-build command to copy DLLs beside the interface executable add_custom_command( TARGET ${TARGET_NAME} From bc9481051b2fc6d4c880f43f569763a23da1b17d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:30:39 -0800 Subject: [PATCH 036/261] use configure_file to pass lib_paths to fixup_bundle --- cmake/macros/AddPathsToLibPaths.cmake | 2 ++ .../macros/CopyDllsBesideWindowsExecutable.cmake | 15 ++++++++++----- .../FixupBundlePostBuild.cmake.in} | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) rename cmake/{scripts/FixupBundlePostBuild.cmake => templates/FixupBundlePostBuild.cmake.in} (67%) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index d86d054615..f9556b9363 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -14,6 +14,8 @@ macro(ADD_PATHS_TO_LIB_PATHS) set(TEMP_LIB_PATHS ${LIB_PATHS}) list(APPEND TEMP_LIB_PATHS ${_PATH}) + list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) + set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) endforeach() endmacro() \ No newline at end of file diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 8c04e3183a..2498c0dcf3 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -11,15 +11,20 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) if (WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") - separate_arguments(LIB_PATHS_ARG ${LIB_PATHS}) + + configure_file( + ${HIFI_CMAKE_DIR}/templates/FixupBundlePostBuild.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake + @ONLY + ) + # add a post-build command to copy DLLs beside the interface executable add_custom_command( TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DBUNDLE_EXECUTABLE=$ - -DLIB_PATHS=${LIB_PATHS_ARG} - -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake + COMMAND ${CMAKE_COMMAND} + -DBUNDLE_EXECUTABLE=$ + -P ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake ) endif () endmacro() \ No newline at end of file diff --git a/cmake/scripts/FixupBundlePostBuild.cmake b/cmake/templates/FixupBundlePostBuild.cmake.in similarity index 67% rename from cmake/scripts/FixupBundlePostBuild.cmake rename to cmake/templates/FixupBundlePostBuild.cmake.in index c6d0b42aea..f72ba577b9 100644 --- a/cmake/scripts/FixupBundlePostBuild.cmake +++ b/cmake/templates/FixupBundlePostBuild.cmake.in @@ -10,5 +10,5 @@ # include(BundleUtilities) -message(STATUS "LIB_PATHS for fixup_bundle bundle ${BUNDLE_EXECUTABLE} are ${LIB_PATHS}") -fixup_bundle("${BUNDLE_EXECUTABLE}" "" "${LIB_PATHS}") \ No newline at end of file +message(STATUS "LIB_PATHS for fixup_bundle called for bundle ${BUNDLE_EXECUTABLE} are @LIB_PATHS@") +fixup_bundle("${BUNDLE_EXECUTABLE}" "" "@LIB_PATHS@") \ No newline at end of file From 315ab73900c60a89dc14e90f8cdd10b2de92a1f7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:32:52 -0800 Subject: [PATCH 037/261] fix a typo on temporary list --- cmake/macros/AddPathsToLibPaths.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index f9556b9363..a696f5a3e5 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -11,11 +11,11 @@ macro(ADD_PATHS_TO_LIB_PATHS) foreach(_PATH ${ARGN}) - set(TEMP_LIB_PATHS ${LIB_PATHS}) - list(APPEND TEMP_LIB_PATHS ${_PATH}) + set(_TEMP_LIB_PATHS ${LIB_PATHS}) + list(APPEND _TEMP_LIB_PATHS ${_PATH}) list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) - set(LIB_PATHS ${TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) + set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) endforeach() endmacro() \ No newline at end of file From df72594afe9501fff06274e70c5507943303b229 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:41:16 -0800 Subject: [PATCH 038/261] fix for docstring of external projects --- cmake/externals/glm/CMakeLists.txt | 2 +- cmake/externals/gverb/CMakeLists.txt | 6 +++--- cmake/externals/soxr/CMakeLists.txt | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index b1aed7dd7f..0ca4aa3cb2 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -12,4 +12,4 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING) \ No newline at end of file +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE) \ No newline at end of file diff --git a/cmake/externals/gverb/CMakeLists.txt b/cmake/externals/gverb/CMakeLists.txt index 19a44781b1..463ee26ff0 100644 --- a/cmake/externals/gverb/CMakeLists.txt +++ b/cmake/externals/gverb/CMakeLists.txt @@ -16,10 +16,10 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING) +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE "Path to gverb include directory") if (WIN32) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/gverb.lib CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/gverb.lib CACHE TYPE "List of gverb libraries") else () - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libgverb.a CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libgverb.a CACHE TYPE "List of gverb libraries") endif () \ No newline at end of file diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index fcd28d4db5..2c8dd5de7d 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -16,13 +16,13 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE STRING) +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE "List of soxr include directories") if (WIN32) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE STRING) - set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE "List of soxr libraries") + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE TYPE "Path to soxr dll") elseif (APPLE) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.dylib CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.dylib CACHE TYPE "List of soxr libraries") else () - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE STRING) + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE "List of soxr libraries") endif () \ No newline at end of file From d8bf8e322bb53c81526301a530c14b0c47556fe2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:42:24 -0800 Subject: [PATCH 039/261] fix a docstring in glm external project --- cmake/externals/glm/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index 0ca4aa3cb2..a9b4ad118d 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -12,4 +12,4 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE) \ No newline at end of file +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE "List of glm include directories") \ No newline at end of file From 0ff382e68a1bcf09a32cf800b07abeb915e06fc9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 16:54:59 -0800 Subject: [PATCH 040/261] correct typo in sixense dll path --- cmake/modules/FindSixense.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindSixense.cmake b/cmake/modules/FindSixense.cmake index 11ca704407..f1bfc92bc0 100644 --- a/cmake/modules/FindSixense.cmake +++ b/cmake/modules/FindSixense.cmake @@ -51,7 +51,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Sixense DEFAULT_MSG ${SIXENSE_REQUIREMENTS}) if (WIN32) - add_paths_to_lib_paths(${SIXSENSE_DEBUG_DLL_PATH}) + add_paths_to_lib_paths(${SIXENSE_DEBUG_DLL_PATH} ${SIXENSE_RELEASE_DLL_PATH}) endif () mark_as_advanced(SIXENSE_LIBRARIES SIXENSE_INCLUDE_DIRS SIXENSE_SEARCH_DIRS) From 5b563e3bc5f8ad37845b823b5887df69c64a2806 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 17:12:14 -0800 Subject: [PATCH 041/261] add LIB_PATHS debugging to catch destruction --- cmake/macros/AddPathsToLibPaths.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index a696f5a3e5..02e3693470 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -12,10 +12,14 @@ macro(ADD_PATHS_TO_LIB_PATHS) foreach(_PATH ${ARGN}) set(_TEMP_LIB_PATHS ${LIB_PATHS}) + message(STATUS "RIGHT NOW LIB_PATHS IS ${LIB_PATHS}") + list(APPEND _TEMP_LIB_PATHS ${_PATH}) list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) + + message(STATUS "WE JUST SET LIB_PATHS TO ${LIB_PATHS}") endforeach() endmacro() \ No newline at end of file From 68c19866c426ddfcd308982445868fb0e2cce42b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 17:17:30 -0800 Subject: [PATCH 042/261] call dll copy after project deps are setup --- assignment-client/CMakeLists.txt | 2 ++ cmake/macros/SetupHifiProject.cmake | 2 -- domain-server/CMakeLists.txt | 4 +++- gvr-interface/CMakeLists.txt | 4 +++- ice-server/CMakeLists.txt | 4 +++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 5475b0fc14..e149a8549e 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -18,3 +18,5 @@ if (UNIX) endif (UNIX) include_dependency_includes() + +copy_dlls_beside_windows_executable() diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 8b3bc43101..3f9787faa1 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -34,6 +34,4 @@ macro(SETUP_HIFI_PROJECT) foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES}) target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE}) endforeach() - - copy_dlls_beside_windows_executable() endmacro() \ No newline at end of file diff --git a/domain-server/CMakeLists.txt b/domain-server/CMakeLists.txt index 421a1da2d4..17d2c9185b 100644 --- a/domain-server/CMakeLists.txt +++ b/domain-server/CMakeLists.txt @@ -52,4 +52,6 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") # append OpenSSL to our list of libraries to link target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/gvr-interface/CMakeLists.txt b/gvr-interface/CMakeLists.txt index bdffb1fbd3..20d35fb204 100644 --- a/gvr-interface/CMakeLists.txt +++ b/gvr-interface/CMakeLists.txt @@ -87,4 +87,6 @@ if (ANDROID) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/hockeyapp.xml.in" "${ANDROID_APK_BUILD_DIR}/res/values/hockeyapp.xml") qt_create_apk() -endif (ANDROID) \ No newline at end of file +endif (ANDROID) + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/ice-server/CMakeLists.txt b/ice-server/CMakeLists.txt index 6a8ca5bd9f..7224bdc31a 100644 --- a/ice-server/CMakeLists.txt +++ b/ice-server/CMakeLists.txt @@ -6,4 +6,6 @@ setup_hifi_project(Network) # link the shared hifi libraries link_hifi_libraries(embedded-webserver networking shared) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file From 9d7212cdaef5535cb3cb2614f034232ee4469587 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 17:18:24 -0800 Subject: [PATCH 043/261] remove some debug in AddPathsToLibPaths --- cmake/macros/AddPathsToLibPaths.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index 02e3693470..ab1aef697b 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -12,14 +12,11 @@ macro(ADD_PATHS_TO_LIB_PATHS) foreach(_PATH ${ARGN}) set(_TEMP_LIB_PATHS ${LIB_PATHS}) - message(STATUS "RIGHT NOW LIB_PATHS IS ${LIB_PATHS}") list(APPEND _TEMP_LIB_PATHS ${_PATH}) list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) - - message(STATUS "WE JUST SET LIB_PATHS TO ${LIB_PATHS}") endforeach() endmacro() \ No newline at end of file From 7d250136590310b64610fc02ee47aa11537d1f95 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 17:44:58 -0800 Subject: [PATCH 044/261] add DLL copying for all project targets --- tests/audio/CMakeLists.txt | 4 +++- tests/jitter/CMakeLists.txt | 4 +++- tests/metavoxels/CMakeLists.txt | 4 +++- tests/networking/CMakeLists.txt | 4 +++- tests/octree/CMakeLists.txt | 2 ++ tests/physics/CMakeLists.txt | 2 ++ tests/render-utils/CMakeLists.txt | 1 + tests/shared/CMakeLists.txt | 4 +++- tools/bitstream2json/CMakeLists.txt | 4 +++- tools/json2bitstream/CMakeLists.txt | 4 +++- tools/mtc/CMakeLists.txt | 4 +++- tools/scribe/CMakeLists.txt | 4 +++- 12 files changed, 32 insertions(+), 9 deletions(-) diff --git a/tests/audio/CMakeLists.txt b/tests/audio/CMakeLists.txt index 62d0ce5be9..a499ecaf1a 100644 --- a/tests/audio/CMakeLists.txt +++ b/tests/audio/CMakeLists.txt @@ -5,4 +5,6 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared audio networking) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/jitter/CMakeLists.txt b/tests/jitter/CMakeLists.txt index 93f7caefdd..8cfee4b9ad 100644 --- a/tests/jitter/CMakeLists.txt +++ b/tests/jitter/CMakeLists.txt @@ -5,4 +5,6 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared networking) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/metavoxels/CMakeLists.txt b/tests/metavoxels/CMakeLists.txt index 76f8870b34..1c3cb88328 100644 --- a/tests/metavoxels/CMakeLists.txt +++ b/tests/metavoxels/CMakeLists.txt @@ -7,4 +7,6 @@ setup_hifi_project(Network Script Widgets) # link in the shared libraries link_hifi_libraries(metavoxels networking shared) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/networking/CMakeLists.txt b/tests/networking/CMakeLists.txt index 113a75ab50..0e15965966 100644 --- a/tests/networking/CMakeLists.txt +++ b/tests/networking/CMakeLists.txt @@ -5,4 +5,6 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared networking) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/octree/CMakeLists.txt b/tests/octree/CMakeLists.txt index 99e3516431..7542e40f87 100644 --- a/tests/octree/CMakeLists.txt +++ b/tests/octree/CMakeLists.txt @@ -6,3 +6,5 @@ setup_hifi_project(Script Network) link_hifi_libraries(shared octree gpu model fbx metavoxels networking entities avatars audio animation script-engine physics) include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index 0f15f596c0..c4107b9bfc 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -11,3 +11,5 @@ include_bullet() link_hifi_libraries(shared physics) include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/render-utils/CMakeLists.txt b/tests/render-utils/CMakeLists.txt index 12a9fe5701..3745f904df 100644 --- a/tests/render-utils/CMakeLists.txt +++ b/tests/render-utils/CMakeLists.txt @@ -15,3 +15,4 @@ endif () #link_libraries(animation fbx shared gpu) include_dependency_includes() +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/shared/CMakeLists.txt b/tests/shared/CMakeLists.txt index 0402d3c74b..8f8d6c425b 100644 --- a/tests/shared/CMakeLists.txt +++ b/tests/shared/CMakeLists.txt @@ -5,4 +5,6 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/bitstream2json/CMakeLists.txt b/tools/bitstream2json/CMakeLists.txt index 64ffbae5bf..b7b2eb198c 100644 --- a/tools/bitstream2json/CMakeLists.txt +++ b/tools/bitstream2json/CMakeLists.txt @@ -3,4 +3,6 @@ setup_hifi_project(Widgets Script) link_hifi_libraries(metavoxels) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/json2bitstream/CMakeLists.txt b/tools/json2bitstream/CMakeLists.txt index d69a8dbe17..a258fbf263 100644 --- a/tools/json2bitstream/CMakeLists.txt +++ b/tools/json2bitstream/CMakeLists.txt @@ -3,4 +3,6 @@ setup_hifi_project(Widgets Script) link_hifi_libraries(metavoxels) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/mtc/CMakeLists.txt b/tools/mtc/CMakeLists.txt index 06b9f86d06..ea21eaf5fc 100644 --- a/tools/mtc/CMakeLists.txt +++ b/tools/mtc/CMakeLists.txt @@ -1,4 +1,6 @@ set(TARGET_NAME mtc) setup_hifi_project() -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/scribe/CMakeLists.txt b/tools/scribe/CMakeLists.txt index e67354cffa..3464809b38 100755 --- a/tools/scribe/CMakeLists.txt +++ b/tools/scribe/CMakeLists.txt @@ -2,4 +2,6 @@ set(TARGET_NAME scribe) setup_hifi_project() # call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +include_dependency_includes() + +copy_dlls_beside_windows_executable() \ No newline at end of file From 48d268420957c67d2471863aef00be8588d1780a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 17:51:54 -0800 Subject: [PATCH 045/261] add path to DeviceDLL for sixense --- cmake/modules/FindSixense.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindSixense.cmake b/cmake/modules/FindSixense.cmake index f1bfc92bc0..f47cfa65ad 100644 --- a/cmake/modules/FindSixense.cmake +++ b/cmake/modules/FindSixense.cmake @@ -35,6 +35,7 @@ elseif (WIN32) find_path(SIXENSE_DEBUG_DLL_PATH sixensed.dll PATH_SUFFIXES bin/win32/debug_dll HINTS ${SIXENSE_SEARCH_DIRS}) find_path(SIXENSE_RELEASE_DLL_PATH sixense.dll PATH_SUFFIXES bin/win32/release_dll HINTS ${SIXENSE_SEARCH_DIRS}) + find_path(SIXENSE_DEVICE_DLL_PATH DeviceDLL.dll PATH_SUFFIXES samples/win32/sixense_simple3d HINTS ${SIXENSE_SEARCH_DIRS}) endif () include(SelectLibraryConfigurations) @@ -42,7 +43,7 @@ select_library_configurations(SIXENSE) set(SIXENSE_REQUIREMENTS SIXENSE_INCLUDE_DIRS SIXENSE_LIBRARIES) if (WIN32) - list(APPEND SIXENSE_REQUIREMENTS SIXENSE_DEBUG_DLL_PATH SIXENSE_RELEASE_DLL_PATH) + list(APPEND SIXENSE_REQUIREMENTS SIXENSE_DEBUG_DLL_PATH SIXENSE_RELEASE_DLL_PATH SIXENSE_DEVICE_DLL_PATH) endif () set(SIXENSE_LIBRARIES "${SIXENSE_LIBRARY}") @@ -51,7 +52,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Sixense DEFAULT_MSG ${SIXENSE_REQUIREMENTS}) if (WIN32) - add_paths_to_lib_paths(${SIXENSE_DEBUG_DLL_PATH} ${SIXENSE_RELEASE_DLL_PATH}) + add_paths_to_lib_paths(${SIXENSE_DEBUG_DLL_PATH} ${SIXENSE_RELEASE_DLL_PATH} ${SIXENSE_DEVICE_DLL_PATH}) endif () mark_as_advanced(SIXENSE_LIBRARIES SIXENSE_INCLUDE_DIRS SIXENSE_SEARCH_DIRS) From cc29297a19eca6a3e9b2996a426a2222d3f9185c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 10:13:23 -0800 Subject: [PATCH 046/261] remove requirement of Qt dlls in path --- BUILD_WIN.md | 20 ++++++++------------ CMakeLists.txt | 4 ++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 219192b360..b3feb19c08 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -6,7 +6,7 @@ Please read the [general build guide](BUILD.md) for information on dependencies * [zLib](http://www.zlib.net/) ~> 1.2.8 * (remember that you need all other dependencies listed in [BUILD.md](BUILD.md)) -####Visual Studio 2013 +###Visual Studio 2013 You can use the Community or Professional editions of Visual Studio 2013. @@ -32,10 +32,8 @@ NOTE: Qt does not support 64-bit builds on Windows 7, so you must use the 32-bit * [Download the offline installer](http://download.qt-project.org/official_releases/qt/5.3/5.3.2/qt-opensource-windows-x86-msvc2013_opengl-5.3.2.exe) Once Qt is installed, you need to manually configure the following: -* Make sure the Qt runtime DLLs are loadable. You must do this before you attempt to build because some tools for the build depend on Qt. E.g., add to the PATH: `Qt\5.3.2\msvc2013_opengl\bin\`. -* Go to Control Panel > System > Advanced System Settings > Environment Variables > New ... * Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.3.2\msvc2013_opengl` directory. - + * You can set an environment variable from Control Panel > System > Advanced System Settings > Environment Variables > New ###External Libraries As it stands, Hifi/Interface is a 32-bit application, so all libraries should also be 32-bit. @@ -70,9 +68,7 @@ The recommended route for CMake to find the external dependencies is to place al For many of the external libraries where precompiled binaries are readily available you should be able to simply copy the extracted folder that you get from the download links provided at the top of the guide. Otherwise you may need to build from source and install the built product to this directory. The `root_lib_dir` in the above example can be wherever you choose on your system - as long as the environment variable HIFI_LIB_DIR is set to it. From here on, whenever you see %HIFI_LIB_DIR% you should substitute the directory that you chose. -As with the Qt libraries, you will need to make sure that directories containing DLL'S are in your path. Where possible, you can use static builds of the external dependencies to avoid this requirement. - -###OpenSSL +####OpenSSL Qt will use OpenSSL if it's available, but it doesn't install it, so you must install it separately. @@ -92,13 +88,13 @@ To prevent these problems, install OpenSSL yourself. Download the following bina Install OpenSSL into the Windows system directory, to make sure that Qt uses the version that you've just installed, and not some other version. -###Intel Threading Building Blocks (TBB) +####Intel Threading Building Blocks (TBB) Download the zip from the [TBB website](https://www.threadingbuildingblocks.org/). We recommend you extract it to %HIFI_LIB_DIR%\tbb. This will help our FindTBB cmake module find what it needs. You can place it wherever you like on your machine if you specify TBB_ROOT_DIR as an environment variable or a variable passed when cmake is run. -###Zlib +####Zlib Download the compiled DLL from the [zlib website](http://www.zlib.net/). Extract to %HIFI_LIB_DIR%\zlib. @@ -114,19 +110,19 @@ Add to the PATH: `%HIFI_LIB_DIR%\zlib` Important! This should be added at the beginning of the path, not the end (your system likely has many copies of zlib1.dll, and you want High Fidelity to use the correct version). If High Fidelity picks up the wrong zlib1.dll then it might be unable to use it, and that would cause it to fail to start, showing only the cryptic error "The application was unable to start correctly: 0xc0000022". -###freeglut +####freeglut Download the binary package: `freeglut-MSVC-2.8.1-1.mp.zip`. Extract to %HIFI_LIB_DIR%\freeglut. Add to the PATH: `%HIFI_LIB_DIR%\freeglut\bin` -###GLEW +####GLEW Download the binary package: `glew-1.10.0-win32.zip`. Extract to %HIFI_LIB_DIR%\glew (you'll need to rename the default directory name). Add to the PATH: `%HIFI_LIB_DIR%\glew\bin\Release\Win32` -###Bullet +####Bullet Bullet 2.82 source can be [downloaded here](https://code.google.com/p/bullet/downloads/detail?name=bullet-2.82-r2704.zip). Bullet does not come with prebuilt libraries, you need to make those yourself. diff --git a/CMakeLists.txt b/CMakeLists.txt index 9731582b59..7a523501d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,10 @@ endif () set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) +if (WIN32) + add_paths_to_lib_paths("${QT_CMAKE_PREFIX_PATH}/bin") +endif () + # set our OS X deployment target to set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) From c9fea9330ef311ccbf176cde48b6f4c46210b4e0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 10:16:45 -0800 Subject: [PATCH 047/261] explain in win guide that fixup_bundle is finding DLLs --- BUILD_WIN.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index b3feb19c08..a3c15eea37 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -34,12 +34,15 @@ NOTE: Qt does not support 64-bit builds on Windows 7, so you must use the 32-bit Once Qt is installed, you need to manually configure the following: * Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.3.2\msvc2013_opengl` directory. * You can set an environment variable from Control Panel > System > Advanced System Settings > Environment Variables > New + ###External Libraries As it stands, Hifi/Interface is a 32-bit application, so all libraries should also be 32-bit. CMake will need to know where the headers and libraries for required external dependencies are. +We use CMake's `fixup_bundle` to find the DLLs all of our exectuable targets require, and then copy them beside the executable in a post-build step. If `fixup_bundle` is having problems finding a DLL, you can fix it manually on your end by adding the folder containing that DLL to your path. Let us know which DLL CMake had trouble finding, as it is possible a tweak to our CMake files is required. + The recommended route for CMake to find the external dependencies is to place all of the dependencies in one folder and set one ENV variable - HIFI_LIB_DIR. That ENV variable should point to a directory with the following structure: root_lib_dir From 5230b805d28328bddeaf781288e5ad40c8e1dac9 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 18 Feb 2015 19:24:29 +0100 Subject: [PATCH 048/261] Fix warnings --- interface/src/scripting/HMDScriptingInterface.cpp | 1 - interface/src/ui/ApplicationOverlay.cpp | 2 +- libraries/model/src/model/Light.cpp | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/interface/src/scripting/HMDScriptingInterface.cpp b/interface/src/scripting/HMDScriptingInterface.cpp index fe274b6878..f258fd695c 100644 --- a/interface/src/scripting/HMDScriptingInterface.cpp +++ b/interface/src/scripting/HMDScriptingInterface.cpp @@ -48,7 +48,6 @@ QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* conte QScriptValue HMDScriptingInterface::getHUDLookAtPosition3D(QScriptContext* context, QScriptEngine* engine) { glm::vec3 result; - HMDScriptingInterface* hmdInterface = &HMDScriptingInterface::getInstance(); if ((&HMDScriptingInterface::getInstance())->getHUDLookAtPosition3D(result)) { return qScriptValueFromValue(engine, result); } diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index 569ef0cf80..632e76c840 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -136,10 +136,10 @@ ApplicationOverlay::ApplicationOverlay() : _textureFov(glm::radians(DEFAULT_OCULUS_UI_ANGULAR_SIZE)), _textureAspectRatio(1.0f), _lastMouseMove(0), + _magnifier(true), _alpha(1.0f), _oculusUIRadius(1.0f), _crosshairTexture(0), - _magnifier(true), _previousBorderWidth(-1), _previousBorderHeight(-1), _previousMagnifierBottomLeft(), diff --git a/libraries/model/src/model/Light.cpp b/libraries/model/src/model/Light.cpp index 9616ed2106..a9425bed4b 100755 --- a/libraries/model/src/model/Light.cpp +++ b/libraries/model/src/model/Light.cpp @@ -76,7 +76,6 @@ void Light::setSpotAngle(float angle) { if (angle <= 0.f) { angle = 0.0f; } - float cosAngle = cos(angle); editSchema()._spot.x = cos(angle); editSchema()._spot.y = sin(angle); editSchema()._spot.z = angle; From e2d7fb574aa81dae8d0afe05480462edd02f40d5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 11:27:37 -0800 Subject: [PATCH 049/261] move macro call so it is actually loaded --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a523501d2..c821eafe90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,10 +88,6 @@ endif () set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) -if (WIN32) - add_paths_to_lib_paths("${QT_CMAKE_PREFIX_PATH}/bin") -endif () - # set our OS X deployment target to set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) @@ -130,6 +126,10 @@ if (ANDROID) endforeach() endif () +if (WIN32) + add_paths_to_lib_paths("${QT_CMAKE_PREFIX_PATH}/bin") +endif () + # add subdirectories for all targets if (NOT ANDROID) add_subdirectory(assignment-client) From b2ecf990083a3aaba96200b1b87b5ccb2679f931 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 11:36:49 -0800 Subject: [PATCH 050/261] back out of lib cmake dir to get Qt bin --- BUILD_WIN.md | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index a3c15eea37..5f3e4c2228 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -32,7 +32,7 @@ NOTE: Qt does not support 64-bit builds on Windows 7, so you must use the 32-bit * [Download the offline installer](http://download.qt-project.org/official_releases/qt/5.3/5.3.2/qt-opensource-windows-x86-msvc2013_opengl-5.3.2.exe) Once Qt is installed, you need to manually configure the following: -* Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.3.2\msvc2013_opengl` directory. +* Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.3.2\msvc2013_opengl\lib\cmake` directory. * You can set an environment variable from Control Panel > System > Advanced System Settings > Environment Variables > New ###External Libraries diff --git a/CMakeLists.txt b/CMakeLists.txt index c821eafe90..7238cd14a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,7 +127,7 @@ if (ANDROID) endif () if (WIN32) - add_paths_to_lib_paths("${QT_CMAKE_PREFIX_PATH}/bin") + add_paths_to_lib_paths("${QT_CMAKE_PREFIX_PATH}\\..\\..\\bin") endif () # add subdirectories for all targets From 84e82f045d7256e81c1c782983b0517a6bb06030 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 11:38:08 -0800 Subject: [PATCH 051/261] find QT_DIR in root CMakeLists --- CMakeLists.txt | 5 ++++- cmake/android/QtCreateAPK.cmake | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7238cd14a1..3dcb3731c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,9 @@ else () endif () endif () +# figure out where the qt dir is +get_filename_component(QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../" ABSOLUTE) + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) # set our OS X deployment target to @@ -127,7 +130,7 @@ if (ANDROID) endif () if (WIN32) - add_paths_to_lib_paths("${QT_CMAKE_PREFIX_PATH}\\..\\..\\bin") + add_paths_to_lib_paths("${QT_DIR}/bin") endif () # add subdirectories for all targets diff --git a/cmake/android/QtCreateAPK.cmake b/cmake/android/QtCreateAPK.cmake index a8543a5fbc..c3a4a48ac7 100644 --- a/cmake/android/QtCreateAPK.cmake +++ b/cmake/android/QtCreateAPK.cmake @@ -39,9 +39,6 @@ macro(qt_create_apk) # create "strings.xml" configure_file("${ANDROID_THIS_DIRECTORY}/strings.xml.in" "${ANDROID_APK_BUILD_DIR}/res/values/strings.xml") - - # figure out where the qt dir is - get_filename_component(QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../" ABSOLUTE) # find androiddeployqt find_program(ANDROID_DEPLOY_QT androiddeployqt HINTS "${QT_DIR}/bin") From a5b737314d931ab0a06535d799fd452939c2e270 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 11:44:15 -0800 Subject: [PATCH 052/261] Add auto-scale to preferences dialog --- interface/src/ui/PreferencesDialog.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index e27875ce67..caab326f90 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -26,6 +27,18 @@ const int PREFERENCES_HEIGHT_PADDING = 20; +void scaleWidgetFontSizes(QWidget* widget, float scale) { + for (auto child : widget->findChildren()) { + if (child->parent() == widget) { + scaleWidgetFontSizes(child, scale); + } + } + QFont font = widget->font(); + qDebug() << "Pref: " << widget->objectName() << ": " << font.pointSizeF(); + font.setPointSizeF(font.pointSizeF() * scale); + widget->setFont(font); +} + PreferencesDialog::PreferencesDialog(QWidget* parent) : QDialog(parent) { @@ -46,8 +59,14 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : // move dialog to left side move(parentWidget()->geometry().topLeft()); setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING); + + auto glCanvas = DependencyManager::get(); + float dpiScale = 72.0f / glCanvas->logicalDpiX(); + + scaleWidgetFontSizes(ui.scrollArea, dpiScale); } + void PreferencesDialog::accept() { savePreferences(); close(); From ab542c3599e180a09abaac2b2773d679dde51c21 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 12:21:06 -0800 Subject: [PATCH 053/261] Update DPI scaling to not update default fonts --- interface/src/ui/PreferencesDialog.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index caab326f90..56a6e33bc2 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -35,8 +35,10 @@ void scaleWidgetFontSizes(QWidget* widget, float scale) { } QFont font = widget->font(); qDebug() << "Pref: " << widget->objectName() << ": " << font.pointSizeF(); - font.setPointSizeF(font.pointSizeF() * scale); - widget->setFont(font); + if (font != QFont()) { + font.setPointSizeF(font.pointSizeF() * scale); + widget->setFont(font); + } } PreferencesDialog::PreferencesDialog(QWidget* parent) : @@ -61,9 +63,11 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING); auto glCanvas = DependencyManager::get(); + + // All font sizes are based on 72 DPI. float dpiScale = 72.0f / glCanvas->logicalDpiX(); - scaleWidgetFontSizes(ui.scrollArea, dpiScale); + scaleWidgetFontSizes(this, dpiScale); } From 18a92464b5666f909b0575924215fdbad9552d3d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 12:23:56 -0800 Subject: [PATCH 054/261] Remove custom font sizes on preferences dialog --- interface/ui/preferencesDialog.ui | 5 ----- 1 file changed, 5 deletions(-) diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui index e9b0f43924..c413ed1266 100644 --- a/interface/ui/preferencesDialog.ui +++ b/interface/ui/preferencesDialog.ui @@ -133,7 +133,6 @@ Arial - 14 @@ -194,7 +193,6 @@ Arial - 14 @@ -276,7 +274,6 @@ Arial - 14 @@ -388,7 +385,6 @@ Arial - 13 @@ -508,7 +504,6 @@ Arial - 13 From c446e72226ba71519b46b815b1a6e884218a6907 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 18 Feb 2015 12:39:51 -0800 Subject: [PATCH 055/261] Add Face Tracking menu item to select the face tracker to use Includes new DDE Face Regression option. --- interface/src/Application.cpp | 10 ++++++++++ interface/src/Application.h | 2 ++ interface/src/Menu.cpp | 34 ++++++++++++++++++++++++-------- interface/src/Menu.h | 10 ++++++---- interface/src/devices/Visage.cpp | 3 ++- 5 files changed, 46 insertions(+), 13 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ce33b04777..4f771ccbf0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1601,6 +1601,16 @@ FaceTracker* Application::getActiveFaceTracker() { (visage->isActive() ? static_cast(visage.data()) : NULL))); } +void Application::setActiveFaceTracker() { +#ifdef HAVE_FACESHIFT + DependencyManager::get()->setTCPEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift)); +#endif + DependencyManager::get()->setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::DDEFaceRegression)); +#ifdef HAVE_VISAGE + DependencyManager::get()->updateEnabled(); +#endif +} + bool Application::exportEntities(const QString& filename, float x, float y, float z, float scale) { QVector entities; _entities.getTree()->findEntities(AACube(glm::vec3(x / (float)TREE_SCALE, diff --git a/interface/src/Application.h b/interface/src/Application.h index da29920ef9..2db120aa27 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -366,6 +366,8 @@ public slots: void notifyPacketVersionMismatch(); + void setActiveFaceTracker(); + private slots: void clearDomainOctreeDetails(); void timer(); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 46b6141ba9..1478a6d3d6 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -27,6 +27,7 @@ #include "audio/AudioIOStatsRenderer.h" #include "audio/AudioScope.h" #include "avatar/AvatarManager.h" +#include "devices/DDEFaceTracker.h" #include "devices/Faceshift.h" #include "devices/RealSense.h" #include "devices/SixenseManager.h" @@ -357,18 +358,35 @@ Menu::Menu() { dialogsManager.data(), SLOT(lodTools())); QMenu* avatarDebugMenu = developerMenu->addMenu("Avatar"); + + QMenu* faceTrackingMenu = avatarDebugMenu->addMenu("Face Tracking"); + { + QActionGroup* faceTrackerGroup = new QActionGroup(avatarDebugMenu); + + QAction* noFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::NoFaceTracking, + 0, true, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(noFaceTracker); + #ifdef HAVE_FACESHIFT - addCheckableActionToQMenuAndActionHash(avatarDebugMenu, - MenuOption::Faceshift, - 0, - true, - DependencyManager::get().data(), - SLOT(setTCPEnabled(bool))); + QAction* faceshiftFaceTracker = addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Faceshift, + 0, true, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(faceshiftFaceTracker); #endif + + QAction* ddeFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::DDEFaceRegression, + 0, false, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(ddeFaceTracker); + #ifdef HAVE_VISAGE - addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, 0, false, - DependencyManager::get().data(), SLOT(updateEnabled())); + QAction* visageFaceTracker = addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, + 0, false, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(visageFaceTracker); #endif + } addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSkeletonCollisionShapes); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderHeadCollisionShapes); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 19e51ad044..6dbc841a42 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -133,13 +133,12 @@ namespace MenuOption { const QString CollideWithEnvironment = "Collide With World Boundaries"; const QString Collisions = "Collisions"; const QString Console = "Console..."; + const QString ControlWithSpeech = "Control With Speech"; const QString CopyAddress = "Copy Address to Clipboard"; const QString CopyPath = "Copy Path to Clipboard"; - const QString ControlWithSpeech = "Control With Speech"; - const QString DeleteBookmark = "Delete Bookmark..."; - const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene"; - const QString DontDoPrecisionPicking = "Don't Do Precision Picking"; + const QString DDEFaceRegression = "DDE Face Regression"; const QString DecreaseAvatarSize = "Decrease Avatar Size"; + const QString DeleteBookmark = "Delete Bookmark..."; const QString DisableActivityLogger = "Disable Activity Logger"; const QString DisableAutoAdjustLOD = "Disable Automatically Adjusting LOD"; const QString DisableLightEntities = "Disable Light Entities"; @@ -152,7 +151,9 @@ namespace MenuOption { const QString DisplayModelElementChildProxies = "Display Model Element Children"; const QString DisplayModelElementProxy = "Display Model Element Bounds"; const QString DisplayTimingDetails = "Display Timing Details"; + const QString DontDoPrecisionPicking = "Don't Do Precision Picking"; const QString DontFadeOnOctreeServerChanges = "Don't Fade In/Out on Octree Server Changes"; + const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene"; const QString EchoLocalAudio = "Echo Local Audio"; const QString EchoServerAudio = "Echo Server Audio"; const QString EditEntitiesHelp = "Edit Entities Help..."; @@ -192,6 +193,7 @@ namespace MenuOption { const QString MuteEnvironment = "Mute Environment"; const QString NetworkSimulator = "Network Simulator..."; const QString NewVoxelCullingMode = "New Voxel Culling Mode"; + const QString NoFaceTracking = "None"; const QString ObeyEnvironmentalGravity = "Obey Environmental Gravity"; const QString OctreeStats = "Voxel and Entity Statistics"; const QString OffAxisProjection = "Off-Axis Projection"; diff --git a/interface/src/devices/Visage.cpp b/interface/src/devices/Visage.cpp index bdb33cc092..39bda83e61 100644 --- a/interface/src/devices/Visage.cpp +++ b/interface/src/devices/Visage.cpp @@ -174,7 +174,8 @@ void Visage::reset() { void Visage::updateEnabled() { setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Visage) && !(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift) && - DependencyManager::get()->isConnectedOrConnecting())); + DependencyManager::get()->isConnectedOrConnecting()) && + !Menu::getInstance()->isOptionChecked(MenuOption::DDEFaceRegression)); } void Visage::setEnabled(bool enabled) { From a66af77b23d843caf84799da3acc14da7c39161d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 18 Feb 2015 12:40:59 -0800 Subject: [PATCH 056/261] Update DDE face tracker to work with menu item --- interface/src/Application.cpp | 1 + interface/src/devices/DdeFaceTracker.cpp | 84 ++++++++++-------------- interface/src/devices/DdeFaceTracker.h | 11 ++-- 3 files changed, 41 insertions(+), 55 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4f771ccbf0..ac73920399 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1728,6 +1728,7 @@ void Application::init() { // initialize our face trackers after loading the menu settings DependencyManager::get()->init(); + DependencyManager::get()->init(); DependencyManager::get()->init(); Leapmotion::init(); diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index d8766ca0ab..c4797c4018 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -44,58 +44,40 @@ struct Packet{ }; DdeFaceTracker::DdeFaceTracker() : -_lastReceiveTimestamp(0), -_reset(false), -_leftBlinkIndex(0), // see http://support.faceshift.com/support/articles/35129-export-of-blendshapes -_rightBlinkIndex(1), -_leftEyeOpenIndex(8), -_rightEyeOpenIndex(9), -_browDownLeftIndex(14), -_browDownRightIndex(15), -_browUpCenterIndex(16), -_browUpLeftIndex(17), -_browUpRightIndex(18), -_mouthSmileLeftIndex(28), -_mouthSmileRightIndex(29), -_jawOpenIndex(21) + DdeFaceTracker(QHostAddress::Any, DDE_FEATURE_POINT_SERVER_PORT) +{ + +} + +DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 port) : + _lastReceiveTimestamp(0), + _reset(false), + _leftBlinkIndex(0), // see http://support.faceshift.com/support/articles/35129-export-of-blendshapes + _rightBlinkIndex(1), + _leftEyeOpenIndex(8), + _rightEyeOpenIndex(9), + _browDownLeftIndex(14), + _browDownRightIndex(15), + _browUpCenterIndex(16), + _browUpLeftIndex(17), + _browUpRightIndex(18), + _mouthSmileLeftIndex(28), + _mouthSmileRightIndex(29), + _jawOpenIndex(21), + _host(host), + _port(port) { _blendshapeCoefficients.resize(NUM_EXPRESSION); connect(&_udpSocket, SIGNAL(readyRead()), SLOT(readPendingDatagrams())); connect(&_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketErrorOccurred(QAbstractSocket::SocketError))); connect(&_udpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(socketStateChanged(QAbstractSocket::SocketState))); - - bindTo(DDE_FEATURE_POINT_SERVER_PORT); -} - -DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 port) : -_lastReceiveTimestamp(0), -_reset(false), -_leftBlinkIndex(0), // see http://support.faceshift.com/support/articles/35129-export-of-blendshapes -_rightBlinkIndex(1), -_leftEyeOpenIndex(8), -_rightEyeOpenIndex(9), -_browDownLeftIndex(14), -_browDownRightIndex(15), -_browUpCenterIndex(16), -_browUpLeftIndex(17), -_browUpRightIndex(18), -_mouthSmileLeftIndex(28), -_mouthSmileRightIndex(29), -_jawOpenIndex(21) -{ - _blendshapeCoefficients.resize(NUM_EXPRESSION); - - connect(&_udpSocket, SIGNAL(readyRead()), SLOT(readPendingDatagrams())); - connect(&_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketErrorOccurred(QAbstractSocket::SocketError))); - connect(&_udpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SIGNAL(socketStateChanged(QAbstractSocket::SocketState))); - - bindTo(host, port); } DdeFaceTracker::~DdeFaceTracker() { - if(_udpSocket.isOpen()) + if (_udpSocket.isOpen()) { _udpSocket.close(); + } } void DdeFaceTracker::init() { @@ -110,15 +92,15 @@ void DdeFaceTracker::update() { } -void DdeFaceTracker::bindTo(quint16 port) { - bindTo(QHostAddress::Any, port); -} - -void DdeFaceTracker::bindTo(const QHostAddress& host, quint16 port) { - if(_udpSocket.isOpen()) { +void DdeFaceTracker::setEnabled(bool enabled) { + if (enabled) { + if (_udpSocket.isOpen()) { + _udpSocket.close(); + } + _udpSocket.bind(_host, _port); + } else { _udpSocket.close(); } - _udpSocket.bind(host, port); } bool DdeFaceTracker::isActive() const { @@ -135,7 +117,7 @@ void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState QString state; switch(socketState) { case QAbstractSocket::BoundState: - state = "Bounded"; + state = "Bound"; break; case QAbstractSocket::ClosingState: state = "Closing"; @@ -156,7 +138,7 @@ void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState state = "Unconnected"; break; } - qDebug() << "[Info] DDE Face Tracker Socket: " << socketState; + qDebug() << "[Info] DDE Face Tracker Socket: " << state; } void DdeFaceTracker::readPendingDatagrams() { diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 71a743cce0..bd5d066732 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -28,9 +28,6 @@ public: void reset(); void update(); - //sockets - void bindTo(quint16 port); - void bindTo(const QHostAddress& host, quint16 port); bool isActive() const; float getLeftBlink() const { return getBlendshapeCoefficient(_leftBlinkIndex); } @@ -47,7 +44,10 @@ public: float getMouthSize() const { return getBlendshapeCoefficient(_jawOpenIndex); } float getMouthSmileLeft() const { return getBlendshapeCoefficient(_mouthSmileLeftIndex); } float getMouthSmileRight() const { return getBlendshapeCoefficient(_mouthSmileRightIndex); } - + +public slots: + void setEnabled(bool enabled); + private slots: //sockets @@ -59,6 +59,9 @@ private: DdeFaceTracker(); DdeFaceTracker(const QHostAddress& host, quint16 port); ~DdeFaceTracker(); + + QHostAddress _host; + quint16 _port; float getBlendshapeCoefficient(int index) const; void decodePacket(const QByteArray& buffer); From d704af21acff0739d4b5537e127c5c31e3e897b9 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 18 Feb 2015 12:41:54 -0800 Subject: [PATCH 057/261] Generalize "faceshift" data handling to "facetracker" DDE face tracking data is now broadcast to other avatars. --- assignment-client/src/Agent.cpp | 2 +- interface/src/avatar/Head.cpp | 13 ++++--------- libraries/avatars/src/AvatarData.cpp | 14 +++++++------- libraries/avatars/src/AvatarData.h | 4 ++-- libraries/avatars/src/HeadData.cpp | 2 +- libraries/avatars/src/HeadData.h | 2 +- libraries/avatars/src/Player.cpp | 10 +++++----- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 4755d9137a..323d5695ed 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -193,7 +193,7 @@ void Agent::run() { // setup an Avatar for the script to use ScriptableAvatar scriptedAvatar(&_scriptEngine); - scriptedAvatar.setForceFaceshiftConnected(true); + scriptedAvatar.setForceFaceTrackerConnected(true); // call model URL setters with empty URLs so our avatar, if user, will have the default models scriptedAvatar.setFaceModelURL(QUrl()); diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index afc1346ad8..52f1b3ee86 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -80,15 +80,10 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) { // Only use face trackers when not playing back a recording. if (!myAvatar->isPlaying()) { FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker(); - auto dde = DependencyManager::get(); - auto faceshift = DependencyManager::get(); - - if ((_isFaceshiftConnected = (faceshift == faceTracker))) { + _isFaceTrackerConnected = faceTracker != NULL; + if (_isFaceTrackerConnected) { _blendshapeCoefficients = faceTracker->getBlendshapeCoefficients(); - } else if (dde->isActive()) { - faceTracker = dde.data(); - _blendshapeCoefficients = faceTracker->getBlendshapeCoefficients(); - } + } } // Twist the upper body to follow the rotation of the head, but only do this with my avatar, // since everyone else will see the full joint rotations for other people. @@ -109,7 +104,7 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) { _longTermAverageLoudness = glm::mix(_longTermAverageLoudness, _averageLoudness, glm::min(deltaTime / AUDIO_LONG_TERM_AVERAGING_SECS, 1.0f)); } - if (!(_isFaceshiftConnected || billboard)) { + if (!(_isFaceTrackerConnected || billboard)) { // Update eye saccades const float AVERAGE_MICROSACCADE_INTERVAL = 0.50f; const float AVERAGE_SACCADE_INTERVAL = 4.0f; diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 4c71c5e9ed..a3d330f84b 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -44,7 +44,7 @@ AvatarData::AvatarData() : _handState(0), _keyState(NO_KEY_DOWN), _isChatCirclingEnabled(false), - _forceFaceshiftConnected(false), + _forceFaceTrackerConnected(false), _hasNewJointRotations(true), _headData(NULL), _handData(NULL), @@ -136,8 +136,8 @@ QByteArray AvatarData::toByteArray() { if (!_headData) { _headData = new HeadData(this); } - if (_forceFaceshiftConnected) { - _headData->_isFaceshiftConnected = true; + if (_forceFaceTrackerConnected) { + _headData->_isFaceTrackerConnected = true; } QByteArray avatarDataByteArray; @@ -191,7 +191,7 @@ QByteArray AvatarData::toByteArray() { setAtBit(bitItems, HAND_STATE_FINGER_POINTING_BIT); } // faceshift state - if (_headData->_isFaceshiftConnected) { + if (_headData->_isFaceTrackerConnected) { setAtBit(bitItems, IS_FACESHIFT_CONNECTED); } if (_isChatCirclingEnabled) { @@ -208,7 +208,7 @@ QByteArray AvatarData::toByteArray() { } // If it is connected, pack up the data - if (_headData->_isFaceshiftConnected) { + if (_headData->_isFaceTrackerConnected) { memcpy(destinationBuffer, &_headData->_leftEyeBlink, sizeof(float)); destinationBuffer += sizeof(float); @@ -417,7 +417,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { _handState = getSemiNibbleAt(bitItems, HAND_STATE_START_BIT) + (oneAtBit(bitItems, HAND_STATE_FINGER_POINTING_BIT) ? IS_FINGER_POINTING_FLAG : 0); - _headData->_isFaceshiftConnected = oneAtBit(bitItems, IS_FACESHIFT_CONNECTED); + _headData->_isFaceTrackerConnected = oneAtBit(bitItems, IS_FACESHIFT_CONNECTED); _isChatCirclingEnabled = oneAtBit(bitItems, IS_CHAT_CIRCLING_ENABLED); bool hasReferential = oneAtBit(bitItems, HAS_REFERENTIAL); @@ -436,7 +436,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { } - if (_headData->_isFaceshiftConnected) { + if (_headData->_isFaceTrackerConnected) { float leftEyeBlink, rightEyeBlink, averageLoudness, browAudioLift; minPossibleSize += sizeof(leftEyeBlink) + sizeof(rightEyeBlink) + sizeof(averageLoudness) + sizeof(browAudioLift); minPossibleSize++; // one byte for blendDataSize diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 8848a261df..a8a330485c 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -241,7 +241,7 @@ public: Q_INVOKABLE void setBlendshape(QString name, float val) { _headData->setBlendshape(name, val); } - void setForceFaceshiftConnected(bool connected) { _forceFaceshiftConnected = connected; } + void setForceFaceTrackerConnected(bool connected) { _forceFaceTrackerConnected = connected; } // key state void setKeyState(KeyState s) { _keyState = s; } @@ -357,7 +357,7 @@ protected: KeyState _keyState; bool _isChatCirclingEnabled; - bool _forceFaceshiftConnected; + bool _forceFaceTrackerConnected; bool _hasNewJointRotations; // set in AvatarData, cleared in Avatar HeadData* _headData; diff --git a/libraries/avatars/src/HeadData.cpp b/libraries/avatars/src/HeadData.cpp index 8dec8368c9..7789385547 100644 --- a/libraries/avatars/src/HeadData.cpp +++ b/libraries/avatars/src/HeadData.cpp @@ -31,7 +31,7 @@ HeadData::HeadData(AvatarData* owningAvatar) : _torsoTwist(0.0f), _lookAtPosition(0.0f, 0.0f, 0.0f), _audioLoudness(0.0f), - _isFaceshiftConnected(false), + _isFaceTrackerConnected(false), _leftEyeBlink(0.0f), _rightEyeBlink(0.0f), _averageLoudness(0.0f), diff --git a/libraries/avatars/src/HeadData.h b/libraries/avatars/src/HeadData.h index cef5d5fbca..b180541914 100644 --- a/libraries/avatars/src/HeadData.h +++ b/libraries/avatars/src/HeadData.h @@ -92,7 +92,7 @@ protected: glm::vec3 _lookAtPosition; float _audioLoudness; - bool _isFaceshiftConnected; + bool _isFaceTrackerConnected; float _leftEyeBlink; float _rightEyeBlink; float _averageLoudness; diff --git a/libraries/avatars/src/Player.cpp b/libraries/avatars/src/Player.cpp index 2fabc39bac..2b92acb189 100644 --- a/libraries/avatars/src/Player.cpp +++ b/libraries/avatars/src/Player.cpp @@ -110,7 +110,7 @@ void Player::startPlaying() { } // Fake faceshift connection - _avatar->setForceFaceshiftConnected(true); + _avatar->setForceFaceTrackerConnected(true); qDebug() << "Recorder::startPlaying()"; setupAudioThread(); @@ -136,8 +136,8 @@ void Player::stopPlaying() { cleanupAudioThread(); _avatar->clearJointsData(); - // Turn off fake faceshift connection - _avatar->setForceFaceshiftConnected(false); + // Turn off fake face tracker connection + _avatar->setForceFaceTrackerConnected(false); if (_useAttachments) { _avatar->setAttachmentData(_currentContext.attachments); @@ -255,8 +255,8 @@ void Player::play() { HeadData* head = const_cast(_avatar->getHeadData()); if (head) { - // Make sure fake faceshift connection doesn't get turned off - _avatar->setForceFaceshiftConnected(true); + // Make sure fake face tracker connection doesn't get turned off + _avatar->setForceFaceTrackerConnected(true); QVector blendCoef(currentFrame.getBlendshapeCoefficients().size()); for (int i = 0; i < currentFrame.getBlendshapeCoefficients().size(); ++i) { From f44ec6da1295363b3643c94706fe358dd0606750 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 12:49:11 -0800 Subject: [PATCH 058/261] Set global font size in preferencesDialog --- interface/ui/preferencesDialog.ui | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui index c413ed1266..6435f87f24 100644 --- a/interface/ui/preferencesDialog.ui +++ b/interface/ui/preferencesDialog.ui @@ -28,6 +28,11 @@ 16777215 + + + 13 + + From 0a01a6f566a0af0c7d80e004ac8d20554f2fdd22 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 13:24:59 -0800 Subject: [PATCH 059/261] add TBB as external_project, handle on OS X --- BUILD_OSX.md | 2 +- cmake/externals/tbb/CMakeLists.txt | 41 +++++++++++++++++++++++++++++ libraries/networking/CMakeLists.txt | 6 +++-- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 cmake/externals/tbb/CMakeLists.txt diff --git a/BUILD_OSX.md b/BUILD_OSX.md index 563fd38c1c..c199fe4c73 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -4,7 +4,7 @@ Please read the [general build guide](BUILD.md) for information on dependencies [Homebrew](http://brew.sh/) is an excellent package manager for OS X. It makes install of all hifi dependencies very simple. brew tap highfidelity/homebrew-formulas - brew install cmake openssl tbb + brew install cmake openssl brew install highfidelity/formulas/qt5 brew link qt5 --force diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt new file mode 100644 index 0000000000..52c01227ea --- /dev/null +++ b/cmake/externals/tbb/CMakeLists.txt @@ -0,0 +1,41 @@ +set(EXTERNAL_NAME tbb) + +if (APPLE) + set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) +elseif (WIN32) + +elseif (UNIX) + +elseif (ANDROID) + +endif () + +include(ExternalProject) +ExternalProject_Add( + ${EXTERNAL_NAME} + PREFIX ${EXTERNAL_NAME} + URL ${DOWNLOAD_URL} + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" + UPDATE_COMMAND "" + LOG_DOWNLOAD ON +) + +ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) + +string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE "List of tbb include directories") + +if (APPLE) + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${SOURCE_DIR}/lib/libc++/libtbb_debug.dylib CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/lib/libc++/libtbb.dylib CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${SOURCE_DIR}/lib/libc++/libtbbmalloc_debug.dylib CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${SOURCE_DIR}/lib/libc++/libtbbmalloc.dylib CACHE TYPE "TBB malloc release library location") +elseif (WIN32) + # set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE "List of soxr libraries") + # set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE TYPE "Path to soxr dll") + +else () + # set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE "List of soxr libraries") +endif () \ No newline at end of file diff --git a/libraries/networking/CMakeLists.txt b/libraries/networking/CMakeLists.txt index bc251a42d4..2236b93d32 100644 --- a/libraries/networking/CMakeLists.txt +++ b/libraries/networking/CMakeLists.txt @@ -10,6 +10,8 @@ if (WIN32) target_link_libraries(${TARGET_NAME} ws2_32.lib) endif () +add_dependency_external_projects(tbb) + # find required dependencies find_package(OpenSSL REQUIRED) find_package(TBB REQUIRED) @@ -25,8 +27,8 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") # append OpenSSL to our list of libraries to link target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES} ${TBB_LIBRARIES}) -# append libcuckoo includes to our list of includes to bubble -list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${TBB_INCLUDE_DIRS}") +# append tbb includes to our list of includes to bubble +target_include_directories(${TARGET_NAME} PUBLIC ${TBB_INCLUDE_DIRS}) # call macro to include our dependency includes and bubble them up via a property on our target include_dependency_includes() \ No newline at end of file From 0d60c09d03c60eabe16733ea02a723f94b7c7071 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 13:33:19 -0800 Subject: [PATCH 060/261] Add UI font scaling to UIUtil --- interface/src/UIUtil.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ interface/src/UIUtil.h | 3 +++ 2 files changed, 43 insertions(+) diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 3be6a824fa..5d01ddaa3d 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -12,6 +12,9 @@ #include #include +#include "DependencyManager.h" +#include "GLCanvas.h" + #include "UIUtil.h" int UIUtil::getWindowTitleBarHeight(const QWidget* window) { @@ -27,3 +30,40 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) { return titleBarHeight; } + +// When setting the font size of a widget in points, the rendered text will be larger +// on Windows and Linux than on Mac OSX. This is because Windows and Linux use a DPI +// of 96, while OSX uses 72. +// In order to get consistent results across platforms, the font sizes need to be scaled +// based on the system DPI. +// This function will scale the font size of widget and all +// of its children recursively. +void UIUtil::scaleWidgetFontSizes(QWidget* widget) { + auto glCanvas = DependencyManager::get(); + + // This is the base dpi that we are targetting. This is based on Mac OSXs default DPI, + // and is the basis for all font sizes. + const float BASE_DPI = 72.0f; + +#ifdef Q_OS_MAC + const float NATIVE_DPI = 72.0f; +#else + const float NATIVE_DPI = 96.0f; +#endif + + float fontScale = (BASE_DPI / NATIVE_DPI) * (glCanvas->logicalDpiX() / NATIVE_DPI); + + internalScaleWidgetFontSizes(widget, fontScale); +} + +void UIUtil::internalScaleWidgetFontSizes(QWidget* widget, float scale) { + for (auto child : widget->findChildren()) { + if (child->parent() == widget) { + internalScaleWidgetFontSizes(child, scale); + } + } + + QFont font = widget->font(); + font.setPointSizeF(font.pointSizeF() * scale); + widget->setFont(font); +} diff --git a/interface/src/UIUtil.h b/interface/src/UIUtil.h index f9dc669840..0866101ebe 100644 --- a/interface/src/UIUtil.h +++ b/interface/src/UIUtil.h @@ -18,7 +18,10 @@ class UIUtil { public: static int getWindowTitleBarHeight(const QWidget* window); + static void scaleWidgetFontSizes(QWidget* widget); +private: + static void internalScaleWidgetFontSizes(QWidget* widget, float scale); }; #endif // hifi_UIUtil_h From ba66155d4653300fc701e62615bed73c2ea704d0 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 13:33:39 -0800 Subject: [PATCH 061/261] Add font scaling to login dialog --- interface/src/ui/LoginDialog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index 049e5bd1cd..3f0a69e578 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -21,6 +21,7 @@ #include "AccountManager.h" #include "ui_loginDialog.h" #include "LoginDialog.h" +#include "UIUtil.h" const QString FORGOT_PASSWORD_URL = "https://metaverse.highfidelity.io/users/password/new"; @@ -41,6 +42,8 @@ LoginDialog::LoginDialog(QWidget* parent) : this, &LoginDialog::handleLoginClicked); connect(_ui->closeButton, &QPushButton::clicked, this, &LoginDialog::close); + + UIUtil::scaleWidgetFontSizes(this); }; LoginDialog::~LoginDialog() { From 9550339a2a80a021c03cd63e8731a606a1a5168e Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 13:34:01 -0800 Subject: [PATCH 062/261] Move preferences dialog font scaling to UIUtil --- interface/src/ui/PreferencesDialog.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 56a6e33bc2..29035dacd1 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -24,23 +24,10 @@ #include "PreferencesDialog.h" #include "Snapshot.h" #include "UserActivityLogger.h" +#include "UIUtil.h" const int PREFERENCES_HEIGHT_PADDING = 20; -void scaleWidgetFontSizes(QWidget* widget, float scale) { - for (auto child : widget->findChildren()) { - if (child->parent() == widget) { - scaleWidgetFontSizes(child, scale); - } - } - QFont font = widget->font(); - qDebug() << "Pref: " << widget->objectName() << ": " << font.pointSizeF(); - if (font != QFont()) { - font.setPointSizeF(font.pointSizeF() * scale); - widget->setFont(font); - } -} - PreferencesDialog::PreferencesDialog(QWidget* parent) : QDialog(parent) { @@ -67,7 +54,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : // All font sizes are based on 72 DPI. float dpiScale = 72.0f / glCanvas->logicalDpiX(); - scaleWidgetFontSizes(this, dpiScale); + UIUtil::scaleWidgetFontSizes(this); } From e048f7a36c53bb1e431832862e57c8610fd12d5e Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 13:34:28 -0800 Subject: [PATCH 063/261] Add font scaling to running scripts window --- interface/src/ui/RunningScriptsWidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index 4346d813bb..86944e8cfd 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -64,6 +64,8 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) : connect(ui->loadScriptFromURLButton, &QPushButton::clicked, Application::getInstance(), &Application::loadScriptURLDialog); connect(&_signalMapper, SIGNAL(mapped(QString)), Application::getInstance(), SLOT(stopScript(const QString&))); + + UIUtil::scaleWidgetFontSizes(this); } RunningScriptsWidget::~RunningScriptsWidget() { From a069a2f21c95500b5154f7b83440cdba09183412 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 13:34:48 -0800 Subject: [PATCH 064/261] Add default font to running scripts window --- interface/ui/runningScriptsWidget.ui | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index ec078681e3..34b288ad7a 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -10,6 +10,12 @@ 728 + + + Helvetica,Arial,sans-serif + 13 + + Running Scripts From 889851f6ea914ec146aaa7dc91d5777084c5cb36 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 18 Feb 2015 13:51:50 -0800 Subject: [PATCH 065/261] Fix typo --- interface/src/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ac73920399..01a2d9608b 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1603,7 +1603,7 @@ FaceTracker* Application::getActiveFaceTracker() { void Application::setActiveFaceTracker() { #ifdef HAVE_FACESHIFT - DependencyManager::get()->setTCPEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift)); + DependencyManager::get()->setTCPEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift)); #endif DependencyManager::get()->setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::DDEFaceRegression)); #ifdef HAVE_VISAGE From 60fc4d2c1c65a8b1c50451559be92c24252cd192 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 13:54:30 -0800 Subject: [PATCH 066/261] attempt to handle android via tbb binaries --- cmake/externals/tbb/CMakeLists.txt | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 52c01227ea..d8b1fa6983 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -3,17 +3,14 @@ set(EXTERNAL_NAME tbb) if (APPLE) set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) elseif (WIN32) - -elseif (UNIX) - -elseif (ANDROID) - + set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb43_20150209oss_win.zip) +else() + set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20150209oss_lin.tgz) endif () include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} - PREFIX ${EXTERNAL_NAME} URL ${DOWNLOAD_URL} BUILD_COMMAND "" CONFIGURE_COMMAND "" @@ -36,6 +33,15 @@ elseif (WIN32) # set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE "List of soxr libraries") # set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE TYPE "Path to soxr dll") +elseif (ANDROID) + set(_TBB_ANDROID_LIB_PATH "${SOURCE_DIR}/lib/android/x86_64") + + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_PATH}/libtbb_debug.so CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_PATH}/libtbb.so CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_PATH}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_PATH}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") +elseif (UNIX) + else () - # set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE "List of soxr libraries") -endif () \ No newline at end of file + message(STATUS "Your OS is not handled by our TBB external project CMakeLists.txt. Please install TBB yourself and pass -DGET_TBB=0 when running CMake.") +endif () \ No newline at end of file From 973a076f34df20d28e601bef50121c13bfbc0433 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 13:54:39 -0800 Subject: [PATCH 067/261] use default prefix for external project --- cmake/externals/glm/CMakeLists.txt | 1 - cmake/externals/gverb/CMakeLists.txt | 1 - cmake/externals/soxr/CMakeLists.txt | 1 - 3 files changed, 3 deletions(-) diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index a9b4ad118d..1fa393e69e 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -3,7 +3,6 @@ set(EXTERNAL_NAME glm) include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} - PREFIX ${EXTERNAL_NAME} URL http://pkgs.fedoraproject.org/repo/pkgs/glm/glm-0.9.5.4.zip/fab76fc982b256b46208e5c750ed456a/glm-0.9.5.4.zip CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON diff --git a/cmake/externals/gverb/CMakeLists.txt b/cmake/externals/gverb/CMakeLists.txt index 463ee26ff0..972b5b602f 100644 --- a/cmake/externals/gverb/CMakeLists.txt +++ b/cmake/externals/gverb/CMakeLists.txt @@ -7,7 +7,6 @@ endif () include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} - PREFIX ${EXTERNAL_NAME} GIT_REPOSITORY https://github.com/birarda/gverb.git CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 2c8dd5de7d..49d7c7598a 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -7,7 +7,6 @@ endif () include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} - PREFIX ${EXTERNAL_NAME} URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1.zip CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_SHARED_LIBS=1 -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON From 4a383ff17723d472b61d6ead1ef96f622b2fd453 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 13:56:41 -0800 Subject: [PATCH 068/261] Update font sizes in running scripts panel --- interface/ui/runningScriptsWidget.ui | 37 ++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index 34b288ad7a..0e6aebf9ac 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -37,6 +37,12 @@ 141 + + + Helvetica,Arial,sans-serif + 13 + + 0 @@ -197,8 +203,14 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 14 + + - font: 14pt; color: #5f5f5f; margin: 2px; + color: #5f5f5f; margin: 2px; There are no scripts running. @@ -261,12 +273,15 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 14 + + Qt::LeftToRight - - font-size: 14pt; - 0 @@ -285,6 +300,12 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 14 + + 0 @@ -306,8 +327,14 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 14 + + - font: 14pt; color: #5f5f5f; margin: 2px; + color: #5f5f5f; margin: 2px; Tip From 71482f6ad73a50f4e9182d4135cdca43d1f0180c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 13:58:20 -0800 Subject: [PATCH 069/261] include tbb as system include, use project as prefix --- CMakeLists.txt | 2 ++ libraries/networking/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dcb3731c3..dbe853dfcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,8 @@ else () set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/${CMAKE_GENERATOR}") endif () +set_property(DIRECTORY PROPERTY EP_PREFIX "project") + file(GLOB HIFI_CUSTOM_MACROS "cmake/macros/*.cmake") foreach(CUSTOM_MACRO ${HIFI_CUSTOM_MACROS}) include(${CUSTOM_MACRO}) diff --git a/libraries/networking/CMakeLists.txt b/libraries/networking/CMakeLists.txt index 2236b93d32..f7dea6c10f 100644 --- a/libraries/networking/CMakeLists.txt +++ b/libraries/networking/CMakeLists.txt @@ -28,7 +28,7 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES} ${TBB_LIBRARIES}) # append tbb includes to our list of includes to bubble -target_include_directories(${TARGET_NAME} PUBLIC ${TBB_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS}) # call macro to include our dependency includes and bubble them up via a property on our target include_dependency_includes() \ No newline at end of file From ff1fb07b2d2241ed760e27ef9eb9f62deea6ce32 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 14:04:02 -0800 Subject: [PATCH 070/261] Add high-dpi support to scaleWidgetFontSizes --- interface/src/UIUtil.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 5d01ddaa3d..27f40539a4 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -51,7 +51,14 @@ void UIUtil::scaleWidgetFontSizes(QWidget* widget) { const float NATIVE_DPI = 96.0f; #endif - float fontScale = (BASE_DPI / NATIVE_DPI) * (glCanvas->logicalDpiX() / NATIVE_DPI); + // Scale fonts based on the native dpi. On Windows, where the native DPI is 96, + // the scale will be: 72.0 / 96.0 = 0.75 + float fontScale = (BASE_DPI / NATIVE_DPI); + + // Scale the font further by the system's DPI settings. If using a 2x high-dpi screen + // on Windows, for example, the font will be further scaled by: 192.0 / 96.0 = 2.0 + // This would give a final scale of: 0.75 * 2.0 = 1.5 + fontScale *= (glCanvas->logicalDpiX() / NATIVE_DPI); internalScaleWidgetFontSizes(widget, fontScale); } From b2e587dbbdb85ffc5972cb96e613eddddc91aff3 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 14:12:05 -0800 Subject: [PATCH 071/261] remove use of include_dependency_includes and use cmake --- assignment-client/CMakeLists.txt | 2 - cmake/macros/IncludeDependencyIncludes.cmake | 22 ----------- domain-server/CMakeLists.txt | 2 - gvr-interface/CMakeLists.txt | 1 - ice-server/CMakeLists.txt | 2 - interface/CMakeLists.txt | 3 -- libraries/animation/CMakeLists.txt | 5 +-- libraries/audio-client/CMakeLists.txt | 7 +--- libraries/audio/CMakeLists.txt | 5 +-- libraries/avatars/CMakeLists.txt | 3 -- libraries/embedded-webserver/CMakeLists.txt | 5 +-- libraries/entities-renderer/CMakeLists.txt | 5 +-- libraries/entities/CMakeLists.txt | 3 -- libraries/environment/CMakeLists.txt | 5 +-- libraries/fbx/CMakeLists.txt | 5 +-- libraries/gpu/CMakeLists.txt | 9 +---- libraries/metavoxels/CMakeLists.txt | 5 +-- libraries/model/CMakeLists.txt | 5 +-- libraries/networking/CMakeLists.txt | 5 +-- libraries/octree/CMakeLists.txt | 3 -- libraries/physics/CMakeLists.txt | 3 -- libraries/render-utils/CMakeLists.txt | 41 +++++++++----------- libraries/script-engine/CMakeLists.txt | 4 -- libraries/shared/CMakeLists.txt | 5 +-- tests/audio/CMakeLists.txt | 2 - tests/jitter/CMakeLists.txt | 2 - tests/metavoxels/CMakeLists.txt | 2 - tests/networking/CMakeLists.txt | 2 - tests/octree/CMakeLists.txt | 2 - tests/physics/CMakeLists.txt | 2 - tests/render-utils/CMakeLists.txt | 3 -- tests/shared/CMakeLists.txt | 2 - tools/bitstream2json/CMakeLists.txt | 2 - tools/json2bitstream/CMakeLists.txt | 2 - tools/mtc/CMakeLists.txt | 2 - tools/scribe/CMakeLists.txt | 3 -- 36 files changed, 33 insertions(+), 148 deletions(-) delete mode 100644 cmake/macros/IncludeDependencyIncludes.cmake diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index e149a8549e..41343f52d0 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -17,6 +17,4 @@ if (UNIX) target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS}) endif (UNIX) -include_dependency_includes() - copy_dlls_beside_windows_executable() diff --git a/cmake/macros/IncludeDependencyIncludes.cmake b/cmake/macros/IncludeDependencyIncludes.cmake deleted file mode 100644 index 4474bdc53a..0000000000 --- a/cmake/macros/IncludeDependencyIncludes.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -# IncludeDependencyIncludes.cmake -# cmake/macros -# -# Copyright 2014 High Fidelity, Inc. -# Created by Stephen Birarda on August 8, 2014 -# -# Distributed under the Apache License, Version 2.0. -# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -# - -macro(INCLUDE_DEPENDENCY_INCLUDES) - if (${TARGET_NAME}_DEPENDENCY_INCLUDES) - list(REMOVE_DUPLICATES ${TARGET_NAME}_DEPENDENCY_INCLUDES) - - # include those in our own target - include_directories(SYSTEM ${${TARGET_NAME}_DEPENDENCY_INCLUDES}) - - # set the property on this target so it can be retreived by targets linking to us - set_target_properties(${TARGET_NAME} PROPERTIES DEPENDENCY_INCLUDES "${${TARGET_NAME}_DEPENDENCY_INCLUDES}") - endif() -endmacro(INCLUDE_DEPENDENCY_INCLUDES) \ No newline at end of file diff --git a/domain-server/CMakeLists.txt b/domain-server/CMakeLists.txt index 17d2c9185b..4ff3c1cce1 100644 --- a/domain-server/CMakeLists.txt +++ b/domain-server/CMakeLists.txt @@ -52,6 +52,4 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") # append OpenSSL to our list of libraries to link target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/gvr-interface/CMakeLists.txt b/gvr-interface/CMakeLists.txt index 20d35fb204..a986fcae0d 100644 --- a/gvr-interface/CMakeLists.txt +++ b/gvr-interface/CMakeLists.txt @@ -29,7 +29,6 @@ find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared networking audio-client avatars) -include_dependency_includes() if (ANDROID) find_package(LibOVR) diff --git a/ice-server/CMakeLists.txt b/ice-server/CMakeLists.txt index 7224bdc31a..13d89fc4a2 100644 --- a/ice-server/CMakeLists.txt +++ b/ice-server/CMakeLists.txt @@ -6,6 +6,4 @@ setup_hifi_project(Network) # link the shared hifi libraries link_hifi_libraries(embedded-webserver networking shared) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 31d8f3df45..7458a6c784 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -240,6 +240,3 @@ else (APPLE) endif (APPLE) copy_dlls_beside_windows_executable() - -# link any dependencies bubbled up from our linked dependencies -include_dependency_includes() diff --git a/libraries/animation/CMakeLists.txt b/libraries/animation/CMakeLists.txt index 4024205f81..8c75d5620c 100644 --- a/libraries/animation/CMakeLists.txt +++ b/libraries/animation/CMakeLists.txt @@ -3,7 +3,4 @@ set(TARGET_NAME animation) # use setup_hifi_library macro to setup our project and link appropriate Qt modules setup_hifi_library(Network Script) -link_hifi_libraries(shared gpu model fbx) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +link_hifi_libraries(shared gpu model fbx) \ No newline at end of file diff --git a/libraries/audio-client/CMakeLists.txt b/libraries/audio-client/CMakeLists.txt index 7067e2ed81..fa7249bee5 100644 --- a/libraries/audio-client/CMakeLists.txt +++ b/libraries/audio-client/CMakeLists.txt @@ -6,7 +6,7 @@ setup_hifi_library(Network Multimedia) link_hifi_libraries(audio) # append audio includes to our list of includes to bubble -list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${HIFI_LIBRARY_DIR}/audio/src") +target_include_directories(${TARGET_NAME} PUBLIC "${HIFI_LIBRARY_DIR}/audio/src") # have CMake grab externals for us add_dependency_external_projects(gverb soxr) @@ -25,7 +25,4 @@ if (APPLE) find_library(CoreAudio CoreAudio) find_library(CoreFoundation CoreFoundation) target_link_libraries(${TARGET_NAME} ${CoreAudio} ${CoreFoundation}) -endif () - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +endif () \ No newline at end of file diff --git a/libraries/audio/CMakeLists.txt b/libraries/audio/CMakeLists.txt index b9dfc06cad..c2d5c8aca9 100644 --- a/libraries/audio/CMakeLists.txt +++ b/libraries/audio/CMakeLists.txt @@ -7,7 +7,4 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -link_hifi_libraries(networking shared) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +link_hifi_libraries(networking shared) \ No newline at end of file diff --git a/libraries/avatars/CMakeLists.txt b/libraries/avatars/CMakeLists.txt index ad06b4adfa..acc939b25c 100644 --- a/libraries/avatars/CMakeLists.txt +++ b/libraries/avatars/CMakeLists.txt @@ -8,6 +8,3 @@ find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(audio shared networking) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() diff --git a/libraries/embedded-webserver/CMakeLists.txt b/libraries/embedded-webserver/CMakeLists.txt index ef2cf1054c..955487e540 100644 --- a/libraries/embedded-webserver/CMakeLists.txt +++ b/libraries/embedded-webserver/CMakeLists.txt @@ -1,7 +1,4 @@ set(TARGET_NAME embedded-webserver) # use setup_hifi_library macro to setup our project and link appropriate Qt modules -setup_hifi_library(Network) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +setup_hifi_library(Network) \ No newline at end of file diff --git a/libraries/entities-renderer/CMakeLists.txt b/libraries/entities-renderer/CMakeLists.txt index b807428203..c0880ed15d 100644 --- a/libraries/entities-renderer/CMakeLists.txt +++ b/libraries/entities-renderer/CMakeLists.txt @@ -7,7 +7,4 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -link_hifi_libraries(shared gpu script-engine render-utils) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() +link_hifi_libraries(shared gpu script-engine render-utils) \ No newline at end of file diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index 5317f97b85..156f3d1f09 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -10,6 +10,3 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) include_bullet() link_hifi_libraries(avatars shared octree gpu model fbx networking animation) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() diff --git a/libraries/environment/CMakeLists.txt b/libraries/environment/CMakeLists.txt index 1c4daa1a6f..61a8c6b8df 100644 --- a/libraries/environment/CMakeLists.txt +++ b/libraries/environment/CMakeLists.txt @@ -14,7 +14,4 @@ find_package(ZLIB REQUIRED) include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") # add it to our list of libraries to link -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) \ No newline at end of file diff --git a/libraries/fbx/CMakeLists.txt b/libraries/fbx/CMakeLists.txt index b43e88bb3d..c1ba5a1c2a 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -11,7 +11,4 @@ link_hifi_libraries(shared gpu model networking octree) find_package(ZLIB REQUIRED) include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() +target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) \ No newline at end of file diff --git a/libraries/gpu/CMakeLists.txt b/libraries/gpu/CMakeLists.txt index 789ffdbfeb..6e7a38f594 100644 --- a/libraries/gpu/CMakeLists.txt +++ b/libraries/gpu/CMakeLists.txt @@ -19,8 +19,7 @@ elseif (WIN32) target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARIES} opengl32.lib) - # need to bubble up the GLEW_INCLUDE_DIRS - list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${GLEW_INCLUDE_DIRS}") + target_include_directories(${TARGET_NAME} PUBLIC ${GLEW_INCLUDE_DIRS}) # try to find the Nsight package and add it to the build if we find it find_package(NSIGHT) @@ -40,9 +39,5 @@ else () target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}") - # need to bubble up the OPENGL_INCLUDE_DIR - list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${OPENGL_INCLUDE_DIR}") + target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR}) endif (APPLE) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() diff --git a/libraries/metavoxels/CMakeLists.txt b/libraries/metavoxels/CMakeLists.txt index f748971311..240a2d8853 100644 --- a/libraries/metavoxels/CMakeLists.txt +++ b/libraries/metavoxels/CMakeLists.txt @@ -10,7 +10,4 @@ link_hifi_libraries(shared networking) add_dependency_external_projects(glm) find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) \ No newline at end of file diff --git a/libraries/model/CMakeLists.txt b/libraries/model/CMakeLists.txt index e3eeae7137..c62b29599f 100755 --- a/libraries/model/CMakeLists.txt +++ b/libraries/model/CMakeLists.txt @@ -7,7 +7,4 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -link_hifi_libraries(shared gpu) - -# call macro to link our dependencies and bubble them up via a property on our target -include_dependency_includes() +link_hifi_libraries(shared gpu) \ No newline at end of file diff --git a/libraries/networking/CMakeLists.txt b/libraries/networking/CMakeLists.txt index f7dea6c10f..6b386ace92 100644 --- a/libraries/networking/CMakeLists.txt +++ b/libraries/networking/CMakeLists.txt @@ -28,7 +28,4 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES} ${TBB_LIBRARIES}) # append tbb includes to our list of includes to bubble -target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS}) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS}) \ No newline at end of file diff --git a/libraries/octree/CMakeLists.txt b/libraries/octree/CMakeLists.txt index ad6f32f0ff..1f44795148 100644 --- a/libraries/octree/CMakeLists.txt +++ b/libraries/octree/CMakeLists.txt @@ -16,6 +16,3 @@ include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") # append ZLIB and OpenSSL to our list of libraries to link target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index 775d5fcb0f..c3dfcafa48 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -14,6 +14,3 @@ endif (BULLET_FOUND) link_hifi_libraries(shared fbx entities) include_hifi_library_headers(fbx) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() diff --git a/libraries/render-utils/CMakeLists.txt b/libraries/render-utils/CMakeLists.txt index d6e419fa49..b266c001e4 100644 --- a/libraries/render-utils/CMakeLists.txt +++ b/libraries/render-utils/CMakeLists.txt @@ -1,23 +1,20 @@ -set(TARGET_NAME render-utils) - -AUTOSCRIBE_SHADER_LIB() - -# pull in the resources.qrc file -qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc") - -# use setup_hifi_library macro to setup our project and link appropriate Qt modules -setup_hifi_library(Widgets OpenGL Network Script) - -add_dependency_external_projects(glm) +set(TARGET_NAME render-utils) + +AUTOSCRIBE_SHADER_LIB() + +# pull in the resources.qrc file +qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc") + +# use setup_hifi_library macro to setup our project and link appropriate Qt modules +setup_hifi_library(Widgets OpenGL Network Script) + +add_dependency_external_projects(glm) find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -link_hifi_libraries(animation fbx shared gpu) - -if (WIN32) - # we're using static GLEW, so define GLEW_STATIC - add_definitions(-DGLEW_STATIC) -endif () - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() +target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) + +link_hifi_libraries(animation fbx shared gpu) + +if (WIN32) + # we're using static GLEW, so define GLEW_STATIC + add_definitions(-DGLEW_STATIC) +endif () diff --git a/libraries/script-engine/CMakeLists.txt b/libraries/script-engine/CMakeLists.txt index 99ac9da87c..013f43530c 100644 --- a/libraries/script-engine/CMakeLists.txt +++ b/libraries/script-engine/CMakeLists.txt @@ -8,7 +8,3 @@ find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared octree gpu model fbx entities animation audio physics metavoxels) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() - diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index ab4b853b6d..9785994a29 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -6,7 +6,4 @@ setup_hifi_library(Gui Network Script Widgets) add_dependency_external_projects(glm) find_package(GLM REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() \ No newline at end of file +target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) \ No newline at end of file diff --git a/tests/audio/CMakeLists.txt b/tests/audio/CMakeLists.txt index a499ecaf1a..a106fc9ea9 100644 --- a/tests/audio/CMakeLists.txt +++ b/tests/audio/CMakeLists.txt @@ -5,6 +5,4 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared audio networking) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/jitter/CMakeLists.txt b/tests/jitter/CMakeLists.txt index 8cfee4b9ad..377dcc1081 100644 --- a/tests/jitter/CMakeLists.txt +++ b/tests/jitter/CMakeLists.txt @@ -5,6 +5,4 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared networking) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/metavoxels/CMakeLists.txt b/tests/metavoxels/CMakeLists.txt index 1c3cb88328..e6a62dc55c 100644 --- a/tests/metavoxels/CMakeLists.txt +++ b/tests/metavoxels/CMakeLists.txt @@ -7,6 +7,4 @@ setup_hifi_project(Network Script Widgets) # link in the shared libraries link_hifi_libraries(metavoxels networking shared) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/networking/CMakeLists.txt b/tests/networking/CMakeLists.txt index 0e15965966..6b9d3738d4 100644 --- a/tests/networking/CMakeLists.txt +++ b/tests/networking/CMakeLists.txt @@ -5,6 +5,4 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared networking) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/octree/CMakeLists.txt b/tests/octree/CMakeLists.txt index 7542e40f87..70457e220a 100644 --- a/tests/octree/CMakeLists.txt +++ b/tests/octree/CMakeLists.txt @@ -5,6 +5,4 @@ setup_hifi_project(Script Network) # link in the shared libraries link_hifi_libraries(shared octree gpu model fbx metavoxels networking entities avatars audio animation script-engine physics) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index c4107b9bfc..12cd9b8531 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -10,6 +10,4 @@ include_bullet() link_hifi_libraries(shared physics) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/render-utils/CMakeLists.txt b/tests/render-utils/CMakeLists.txt index 3745f904df..d55d3c542b 100644 --- a/tests/render-utils/CMakeLists.txt +++ b/tests/render-utils/CMakeLists.txt @@ -12,7 +12,4 @@ if (WIN32) add_definitions(-DGLEW_STATIC) endif () -#link_libraries(animation fbx shared gpu) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tests/shared/CMakeLists.txt b/tests/shared/CMakeLists.txt index 8f8d6c425b..9ae00756e8 100644 --- a/tests/shared/CMakeLists.txt +++ b/tests/shared/CMakeLists.txt @@ -5,6 +5,4 @@ setup_hifi_project() # link in the shared libraries link_hifi_libraries(shared) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/bitstream2json/CMakeLists.txt b/tools/bitstream2json/CMakeLists.txt index b7b2eb198c..32a5a639ab 100644 --- a/tools/bitstream2json/CMakeLists.txt +++ b/tools/bitstream2json/CMakeLists.txt @@ -3,6 +3,4 @@ setup_hifi_project(Widgets Script) link_hifi_libraries(metavoxels) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/json2bitstream/CMakeLists.txt b/tools/json2bitstream/CMakeLists.txt index a258fbf263..abda40667c 100644 --- a/tools/json2bitstream/CMakeLists.txt +++ b/tools/json2bitstream/CMakeLists.txt @@ -3,6 +3,4 @@ setup_hifi_project(Widgets Script) link_hifi_libraries(metavoxels) -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/mtc/CMakeLists.txt b/tools/mtc/CMakeLists.txt index ea21eaf5fc..5c598eaf0b 100644 --- a/tools/mtc/CMakeLists.txt +++ b/tools/mtc/CMakeLists.txt @@ -1,6 +1,4 @@ set(TARGET_NAME mtc) setup_hifi_project() -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/tools/scribe/CMakeLists.txt b/tools/scribe/CMakeLists.txt index 3464809b38..bc07fec230 100755 --- a/tools/scribe/CMakeLists.txt +++ b/tools/scribe/CMakeLists.txt @@ -1,7 +1,4 @@ set(TARGET_NAME scribe) setup_hifi_project() -# call macro to include our dependency includes and bubble them up via a property on our target -include_dependency_includes() - copy_dlls_beside_windows_executable() \ No newline at end of file From 7dab39a2f19d3ed3336baf4fcb873764f67f65a5 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 14:16:33 -0800 Subject: [PATCH 072/261] Add qDebug message to scaleWidgetFontSizes --- interface/src/UIUtil.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 27f40539a4..d39b3229aa 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -60,6 +60,8 @@ void UIUtil::scaleWidgetFontSizes(QWidget* widget) { // This would give a final scale of: 0.75 * 2.0 = 1.5 fontScale *= (glCanvas->logicalDpiX() / NATIVE_DPI); + qDebug() << "Scaling widgets by: " << fontScale; + internalScaleWidgetFontSizes(widget, fontScale); } From b2e1d8a38c6941e82641c65e1298cd53cf8664f4 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 14:37:56 -0800 Subject: [PATCH 073/261] Remove font scaling based on system DPI --- interface/src/UIUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index d39b3229aa..9de2ad35e9 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -58,7 +58,7 @@ void UIUtil::scaleWidgetFontSizes(QWidget* widget) { // Scale the font further by the system's DPI settings. If using a 2x high-dpi screen // on Windows, for example, the font will be further scaled by: 192.0 / 96.0 = 2.0 // This would give a final scale of: 0.75 * 2.0 = 1.5 - fontScale *= (glCanvas->logicalDpiX() / NATIVE_DPI); + // fontScale *= (glCanvas->logicalDpiX() / NATIVE_DPI); qDebug() << "Scaling widgets by: " << fontScale; From 51f5719e0ff90577f6d6e07a38e7bb9da2ce0674 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 14:59:52 -0800 Subject: [PATCH 074/261] Update font sizes in running scripts window --- interface/ui/runningScriptsWidget.ui | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index 0e6aebf9ac..852d61a7ba 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -125,6 +125,12 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 13 + + reloadStopButtonArea { padding: 0 } @@ -143,6 +149,12 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 13 + + Reload all @@ -150,6 +162,12 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 13 + + Stop all @@ -179,6 +197,12 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 13 + + 0 From 24d03deb210201521ae7215198c4d3a0b4827451 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 18 Feb 2015 15:02:44 -0800 Subject: [PATCH 075/261] Fix typo --- interface/src/Menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 1478a6d3d6..bd609a6840 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -27,7 +27,7 @@ #include "audio/AudioIOStatsRenderer.h" #include "audio/AudioScope.h" #include "avatar/AvatarManager.h" -#include "devices/DDEFaceTracker.h" +#include "devices/DdeFaceTracker.h" #include "devices/Faceshift.h" #include "devices/RealSense.h" #include "devices/SixenseManager.h" From 2828b65bea550500bdcde6b8523278cd6ab4d278 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 15:09:41 -0800 Subject: [PATCH 076/261] Add scaling for high-dpi Windows/Linux displays --- .../src/scripting/ControllerScriptingInterface.cpp | 14 +++++++++++++- interface/src/ui/ApplicationOverlay.cpp | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index 929a763e70..a871adeb08 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -271,7 +271,19 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) { glm::vec2 ControllerScriptingInterface::getViewportDimensions() const { auto glCanvas = DependencyManager::get(); - return glm::vec2(glCanvas->width(), glCanvas->height()); +#ifdef Q_OS_MAC + const float dpiScaleX = 1.0f; + const float dpiScaleY = 1.0f; +#else + const float NATIVE_DPI = 96.0f; + const float dpiScaleX = NATIVE_DPI / glCanvas->logicalDpiX(); + const float dpiScaleY = NATIVE_DPI / glCanvas->logicalDpiY(); +#endif + + const float width = glCanvas->width() / dpiScaleX; + const float height = glCanvas->height() / dpiScaleY; + + return glm::vec2(width, height); } AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) { diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index f9437221e5..16d6dbca02 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -203,7 +203,17 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) { const float NEAR_CLIP = -10000; const float FAR_CLIP = 10000; glLoadIdentity(); - glOrtho(0, glCanvas->width(), glCanvas->height(), 0, NEAR_CLIP, FAR_CLIP); + +#ifdef Q_OS_MAC + // OSX will take care of scaling for us + const float dpiScaleX = 1.0f; + const float dpiScaleY = 1.0f; +#else + const float NATIVE_DPI = 96.0f; + const float dpiScaleX = NATIVE_DPI / glCanvas->logicalDpiX(); + const float dpiScaleY = NATIVE_DPI / glCanvas->logicalDpiY(); +#endif + glOrtho(0, glCanvas->width() * dpiScaleX, glCanvas->height() * dpiScaleY, 0, NEAR_CLIP, FAR_CLIP); glMatrixMode(GL_MODELVIEW); From b6d660fdd321f3a7eefe8020c80df66ccb4d556a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 15:26:33 -0800 Subject: [PATCH 077/261] setup TBB external project for windows --- cmake/externals/tbb/CMakeLists.txt | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index d8b1fa6983..bc689c2c08 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -4,7 +4,7 @@ if (APPLE) set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) elseif (WIN32) set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb43_20150209oss_win.zip) -else() +else () set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20150209oss_lin.tgz) endif () @@ -25,21 +25,26 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE "List of tbb include directories") if (APPLE) - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${SOURCE_DIR}/lib/libc++/libtbb_debug.dylib CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/lib/libc++/libtbb.dylib CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${SOURCE_DIR}/lib/libc++/libtbbmalloc_debug.dylib CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${SOURCE_DIR}/lib/libc++/libtbbmalloc.dylib CACHE TYPE "TBB malloc release library location") + set(_TBB_APPLE_LIB_DIR "${SOURCE_DIR}/lib/libc++") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_APPLE_LIB_DIR}/libtbb_debug.dylib CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_APPLE_LIB_DIR}/libtbb.dylib CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_APPLE_LIB_DIR}/libtbbmalloc_debug.dylib CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_APPLE_LIB_DIR}/libtbbmalloc.dylib CACHE TYPE "TBB malloc release library location") elseif (WIN32) - # set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE "List of soxr libraries") - # set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE TYPE "Path to soxr dll") + set(_TBB_WIN_LIB_DIR "${SOURCE_DIR}/lib/ia32/vc12") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/libtbb_debug.lib CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/libtbb.lib CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/libtbbmalloc_debug.lib CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/libtbbmalloc.lib CACHE TYPE "TBB malloc release library location") + set(${EXTERNAL_NAME_UPPER}_DLL_PATH "${SOURCE_DIR}/bin/ia32/vc12" CACHE TYPE "Path to TBB DLLs") elseif (ANDROID) - set(_TBB_ANDROID_LIB_PATH "${SOURCE_DIR}/lib/android/x86_64") + set(_TBB_ANDROID_LIB_DIR "${SOURCE_DIR}/lib/android/x86_64") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_PATH}/libtbb_debug.so CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_PATH}/libtbb.so CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_PATH}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_PATH}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_DIR}/libtbb_debug.so CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_DIR}/libtbb.so CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_DIR}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_DIR}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") elseif (UNIX) else () From 9b719273ab1aa2e8fe3e9111d390d512aad6cc51 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 15:30:39 -0800 Subject: [PATCH 078/261] Fix dpi scaling in getViewportDimensions --- interface/src/scripting/ControllerScriptingInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index a871adeb08..1c9cccf26f 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -280,8 +280,8 @@ glm::vec2 ControllerScriptingInterface::getViewportDimensions() const { const float dpiScaleY = NATIVE_DPI / glCanvas->logicalDpiY(); #endif - const float width = glCanvas->width() / dpiScaleX; - const float height = glCanvas->height() / dpiScaleY; + const float width = glCanvas->width() * dpiScaleX; + const float height = glCanvas->height() * dpiScaleY; return glm::vec2(width, height); } From 22d46e3e6ba239407f5d8c49fe18b6815e679be9 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 15:33:24 -0800 Subject: [PATCH 079/261] Update runningscripts script font to match parent --- interface/src/ui/RunningScriptsWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index 86944e8cfd..9ff600675f 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -105,6 +105,7 @@ void RunningScriptsWidget::setRunningScripts(const QStringList& list) { hash.insert(list.at(i), 1); } QWidget* row = new QWidget(ui->scriptListWidget); + row->setFont(ui->scriptListWidget->font()); row->setLayout(new QHBoxLayout(row)); QUrl url = QUrl(list.at(i)); From b3b292a45f2cd6ca0da94cd361a6dd92066b346c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 15:40:14 -0800 Subject: [PATCH 080/261] handle linux binary find for tbb external project --- cmake/externals/tbb/CMakeLists.txt | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index bc689c2c08..a31ec09382 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -1,11 +1,11 @@ set(EXTERNAL_NAME tbb) if (APPLE) - set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) + set(DOWNLOAD_URL http://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) elseif (WIN32) - set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb43_20150209oss_win.zip) + set(DOWNLOAD_URL http://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb43_20150209oss_win.zip) else () - set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20150209oss_lin.tgz) + set(DOWNLOAD_URL http://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20150209oss_lin.tgz) endif () include(ExternalProject) @@ -46,6 +46,29 @@ elseif (ANDROID) set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_DIR}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_DIR}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") elseif (UNIX) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_TBB_ARCH_DIR "intel64") + else() + set(_TBB_ARCH_DIR "ia32") + endif() + + execute_process( + COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION + ) + + if (GCC_VERSION VERSION_GREATER 4.4 OR GCC_VERSION VERSION_EQUAL 4.4) + set(_TBB_LINUX_LIB_DIR "${SOURCE_DIR}/lib/${_TBB_ARCH_DIR}/gcc4.4") + elseif (GCC_VERSION VERSION_GREATER 4.1 OR GCC_VERSION VERSION_EQUAL 4.1) + set(_TBB_LINUX_LIB_DIR "${SOURCE_DIR}/lib/${_TBB_ARCH_DIR}/gcc4.1") + else () + message(FATAL_ERROR "Could not find a compatible version of Threading Building Blocks library for your compiler.") + endif () + + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbb_debug.so CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbb.so CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") else () message(STATUS "Your OS is not handled by our TBB external project CMakeLists.txt. Please install TBB yourself and pass -DGET_TBB=0 when running CMake.") From e665a1b4bb27f63893ccb38c09e1de7e604ac0ba Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 15:47:33 -0800 Subject: [PATCH 081/261] use https for tbb urls since it will redirect --- cmake/externals/tbb/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index a31ec09382..858cdaeb9f 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -1,11 +1,11 @@ set(EXTERNAL_NAME tbb) if (APPLE) - set(DOWNLOAD_URL http://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) + set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) elseif (WIN32) - set(DOWNLOAD_URL http://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb43_20150209oss_win.zip) + set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb43_20150209oss_win.zip) else () - set(DOWNLOAD_URL http://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20150209oss_lin.tgz) + set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20150209oss_lin.tgz) endif () include(ExternalProject) @@ -26,12 +26,14 @@ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE "List o if (APPLE) set(_TBB_APPLE_LIB_DIR "${SOURCE_DIR}/lib/libc++") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_APPLE_LIB_DIR}/libtbb_debug.dylib CACHE TYPE "TBB debug library location") set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_APPLE_LIB_DIR}/libtbb.dylib CACHE TYPE "TBB release library location") set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_APPLE_LIB_DIR}/libtbbmalloc_debug.dylib CACHE TYPE "TBB malloc debug library location") set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_APPLE_LIB_DIR}/libtbbmalloc.dylib CACHE TYPE "TBB malloc release library location") elseif (WIN32) set(_TBB_WIN_LIB_DIR "${SOURCE_DIR}/lib/ia32/vc12") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/libtbb_debug.lib CACHE TYPE "TBB debug library location") set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/libtbb.lib CACHE TYPE "TBB release library location") set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/libtbbmalloc_debug.lib CACHE TYPE "TBB malloc debug library location") From 75b193d784c234beb0ebfad9eb9608aa20f1d2b5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 16:03:12 -0800 Subject: [PATCH 082/261] mirror tbb in HF S3 for http link --- cmake/externals/tbb/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 858cdaeb9f..756badf3b0 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -1,11 +1,11 @@ set(EXTERNAL_NAME tbb) if (APPLE) - set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/mac/tbb43_20150209oss_osx.tgz) + set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_osx.tgz) elseif (WIN32) - set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb43_20150209oss_win.zip) + set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_win.zip) else () - set(DOWNLOAD_URL https://www.threadingbuildingblocks.org/sites/default/files/software_releases/linux/tbb43_20150209oss_lin.tgz) + set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_lin.tgz) endif () include(ExternalProject) From 03eb1a984f5501a655b1fd81840a22dfd4c5d8a3 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 16:15:53 -0800 Subject: [PATCH 083/261] Revert "Fix dpi scaling in getViewportDimensions" This reverts commit 9b719273ab1aa2e8fe3e9111d390d512aad6cc51. --- interface/src/scripting/ControllerScriptingInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index 1c9cccf26f..a871adeb08 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -280,8 +280,8 @@ glm::vec2 ControllerScriptingInterface::getViewportDimensions() const { const float dpiScaleY = NATIVE_DPI / glCanvas->logicalDpiY(); #endif - const float width = glCanvas->width() * dpiScaleX; - const float height = glCanvas->height() * dpiScaleY; + const float width = glCanvas->width() / dpiScaleX; + const float height = glCanvas->height() / dpiScaleY; return glm::vec2(width, height); } From 4751974c459ac25f5e29ec4b60037bdcd32b82cb Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 16:16:50 -0800 Subject: [PATCH 084/261] Revert "Add scaling for high-dpi Windows/Linux displays" This reverts commit 2828b65bea550500bdcde6b8523278cd6ab4d278. --- .../src/scripting/ControllerScriptingInterface.cpp | 14 +------------- interface/src/ui/ApplicationOverlay.cpp | 12 +----------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index a871adeb08..929a763e70 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -271,19 +271,7 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) { glm::vec2 ControllerScriptingInterface::getViewportDimensions() const { auto glCanvas = DependencyManager::get(); -#ifdef Q_OS_MAC - const float dpiScaleX = 1.0f; - const float dpiScaleY = 1.0f; -#else - const float NATIVE_DPI = 96.0f; - const float dpiScaleX = NATIVE_DPI / glCanvas->logicalDpiX(); - const float dpiScaleY = NATIVE_DPI / glCanvas->logicalDpiY(); -#endif - - const float width = glCanvas->width() / dpiScaleX; - const float height = glCanvas->height() / dpiScaleY; - - return glm::vec2(width, height); + return glm::vec2(glCanvas->width(), glCanvas->height()); } AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) { diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index 16d6dbca02..f9437221e5 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -203,17 +203,7 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) { const float NEAR_CLIP = -10000; const float FAR_CLIP = 10000; glLoadIdentity(); - -#ifdef Q_OS_MAC - // OSX will take care of scaling for us - const float dpiScaleX = 1.0f; - const float dpiScaleY = 1.0f; -#else - const float NATIVE_DPI = 96.0f; - const float dpiScaleX = NATIVE_DPI / glCanvas->logicalDpiX(); - const float dpiScaleY = NATIVE_DPI / glCanvas->logicalDpiY(); -#endif - glOrtho(0, glCanvas->width() * dpiScaleX, glCanvas->height() * dpiScaleY, 0, NEAR_CLIP, FAR_CLIP); + glOrtho(0, glCanvas->width(), glCanvas->height(), 0, NEAR_CLIP, FAR_CLIP); glMatrixMode(GL_MODELVIEW); From a8999964f6dbb266e8bbf5bc9eba8aed13d6b024 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 18 Feb 2015 16:21:51 -0800 Subject: [PATCH 085/261] Cleanup dpi scaling comments --- interface/src/UIUtil.cpp | 14 +++----------- interface/src/ui/PreferencesDialog.cpp | 6 ------ 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 9de2ad35e9..c907c2b8e9 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -33,9 +33,8 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) { // When setting the font size of a widget in points, the rendered text will be larger // on Windows and Linux than on Mac OSX. This is because Windows and Linux use a DPI -// of 96, while OSX uses 72. -// In order to get consistent results across platforms, the font sizes need to be scaled -// based on the system DPI. +// of 96, while OSX uses 72. In order to get consistent results across platforms, the +// font sizes need to be scaled based on the system DPI. // This function will scale the font size of widget and all // of its children recursively. void UIUtil::scaleWidgetFontSizes(QWidget* widget) { @@ -53,14 +52,7 @@ void UIUtil::scaleWidgetFontSizes(QWidget* widget) { // Scale fonts based on the native dpi. On Windows, where the native DPI is 96, // the scale will be: 72.0 / 96.0 = 0.75 - float fontScale = (BASE_DPI / NATIVE_DPI); - - // Scale the font further by the system's DPI settings. If using a 2x high-dpi screen - // on Windows, for example, the font will be further scaled by: 192.0 / 96.0 = 2.0 - // This would give a final scale of: 0.75 * 2.0 = 1.5 - // fontScale *= (glCanvas->logicalDpiX() / NATIVE_DPI); - - qDebug() << "Scaling widgets by: " << fontScale; + float fontScale = BASE_DPI / NATIVE_DPI; internalScaleWidgetFontSizes(widget, fontScale); } diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 29035dacd1..1a3ad541c9 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -49,15 +49,9 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : move(parentWidget()->geometry().topLeft()); setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING); - auto glCanvas = DependencyManager::get(); - - // All font sizes are based on 72 DPI. - float dpiScale = 72.0f / glCanvas->logicalDpiX(); - UIUtil::scaleWidgetFontSizes(this); } - void PreferencesDialog::accept() { savePreferences(); close(); From 7ec01c90958d9fe181a01fc945adb42bc5694506 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 17:20:13 -0800 Subject: [PATCH 086/261] handle android build of tbb, don't prefix win with lib --- CMakeLists.txt | 6 ++- cmake/externals/tbb/AndroidTBBLibCopy.cmake | 23 ++++++++ cmake/externals/tbb/CMakeLists.txt | 59 +++++++++++++-------- libraries/audio-client/CMakeLists.txt | 2 +- 4 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 cmake/externals/tbb/AndroidTBBLibCopy.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index dbe853dfcc..924d0367c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,11 +110,13 @@ set(HIFI_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(MACRO_DIR "${HIFI_CMAKE_DIR}/macros") set(EXTERNAL_PROJECT_DIR "${HIFI_CMAKE_DIR}/externals") +STRING(REGEX REPLACE " " "-" CMAKE_GENERATOR_FOLDER_NAME ${CMAKE_GENERATOR}) + set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-externals") if (ANDROID) - set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/android/${CMAKE_GENERATOR}") + set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/android/${CMAKE_GENERATOR_FOLDER_NAME}") else () - set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/${CMAKE_GENERATOR}") + set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/${CMAKE_GENERATOR_FOLDER_NAME}") endif () set_property(DIRECTORY PROPERTY EP_PREFIX "project") diff --git a/cmake/externals/tbb/AndroidTBBLibCopy.cmake b/cmake/externals/tbb/AndroidTBBLibCopy.cmake new file mode 100644 index 0000000000..733ee00124 --- /dev/null +++ b/cmake/externals/tbb/AndroidTBBLibCopy.cmake @@ -0,0 +1,23 @@ +# +# AndroidTBBLibCopy.cmake +# cmake/macros +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 18, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +# first find the so files in the source dir +file(GLOB_RECURSE _TBB_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/build/*.so") + +# raise an error if we found none +if (NOT _TBB_LIBRARIES) + message(FATAL_ERROR "Did not find any compiled TBB libraries") +endif () + +# make the libs directory and copy the resulting files there +file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib") +message(STATUS "Copying TBB Android libs to ${CMAKE_CURRENT_SOURCE_DIR}/lib") +file(COPY ${_TBB_LIBRARIES} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/lib") \ No newline at end of file diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 756badf3b0..cbf7d80c68 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -1,23 +1,38 @@ set(EXTERNAL_NAME tbb) -if (APPLE) - set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_osx.tgz) -elseif (WIN32) - set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_win.zip) -else () - set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_lin.tgz) -endif () - include(ExternalProject) -ExternalProject_Add( - ${EXTERNAL_NAME} - URL ${DOWNLOAD_URL} - BUILD_COMMAND "" - CONFIGURE_COMMAND "" - INSTALL_COMMAND "" - UPDATE_COMMAND "" - LOG_DOWNLOAD ON -) + +if (ANDROID) + + find_program(NDK_BUILD_COMMAND NAMES ndk-build DOC "Path to the ndk-build command") + + ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://hifi-public.s3.amazonaws.com/dependencies/tbb43_20150209oss_src.tgz + BUILD_COMMAND ${NDK_BUILD_COMMAND} --directory=jni target=android tbb tbbmalloc arch=arm + BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/AndroidTBBLibCopy.cmake + LOG_DOWNLOAD ON + ) +else () + if (APPLE) + set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_osx.tgz) + elseif (WIN32) + set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_win.zip) + else () + set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_lin.tgz) + endif () + + ExternalProject_Add( + ${EXTERNAL_NAME} + URL ${DOWNLOAD_URL} + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD ON + ) +endif () ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) @@ -34,14 +49,14 @@ if (APPLE) elseif (WIN32) set(_TBB_WIN_LIB_DIR "${SOURCE_DIR}/lib/ia32/vc12") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/libtbb_debug.lib CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/libtbb.lib CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/libtbbmalloc_debug.lib CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/libtbbmalloc.lib CACHE TYPE "TBB malloc release library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/tbb_debug.lib CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/tbb.lib CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/tbbmalloc_debug.lib CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/tbbmalloc.lib CACHE TYPE "TBB malloc release library location") set(${EXTERNAL_NAME_UPPER}_DLL_PATH "${SOURCE_DIR}/bin/ia32/vc12" CACHE TYPE "Path to TBB DLLs") elseif (ANDROID) - set(_TBB_ANDROID_LIB_DIR "${SOURCE_DIR}/lib/android/x86_64") + set(_TBB_ANDROID_LIB_DIR "${SOURCE_DIR}/lib") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_DIR}/libtbb_debug.so CACHE TYPE "TBB debug library location") set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_DIR}/libtbb.so CACHE TYPE "TBB release library location") diff --git a/libraries/audio-client/CMakeLists.txt b/libraries/audio-client/CMakeLists.txt index fa7249bee5..43a2016acf 100644 --- a/libraries/audio-client/CMakeLists.txt +++ b/libraries/audio-client/CMakeLists.txt @@ -19,7 +19,7 @@ target_include_directories(${TARGET_NAME} PRIVATE ${GVERB_INCLUDE_DIRS}) # we use libsoxr for resampling find_package(Soxr REQUIRED) target_link_libraries(${TARGET_NAME} ${SOXR_LIBRARIES}) -include_directories(SYSTEM ${SOXR_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${SOXR_INCLUDE_DIRS}) if (APPLE) find_library(CoreAudio CoreAudio) From 6231a9d8da996748226a533132f512d9c22d4907 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Feb 2015 17:29:32 -0800 Subject: [PATCH 087/261] remove TBB from build guides --- BUILD.md | 2 +- BUILD_ANDROID.md | 17 ----------------- BUILD_WIN.md | 6 ------ 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/BUILD.md b/BUILD.md index 9501f7ad0a..f3e9c81b78 100644 --- a/BUILD.md +++ b/BUILD.md @@ -4,13 +4,13 @@ * [Qt](http://qt-project.org/downloads) ~> 5.3.2 * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. -* [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 #### CMake External Project Dependencies The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-externals` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. Should you want to force a re-download and re-compile of a specific external, you can simply remove that directory from the appropriate subfolder in `build-externals`. Should you want to force a re-download and re-compile of all externals, just remove the `build-externals` folder. +* [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 * [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 * [gverb](https://github.com/highfidelity/gverb) * [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 diff --git a/BUILD_ANDROID.md b/BUILD_ANDROID.md index 9fe286744d..9f86e7e925 100644 --- a/BUILD_ANDROID.md +++ b/BUILD_ANDROID.md @@ -72,22 +72,6 @@ This should generate libcrypto and libssl in the root of the OpenSSL directory. If you have been building other components it is possible that the OpenSSL compile will fail based on the values other cross-compilations (tbb, bullet) have set. Ensure that you are in a new terminal window to avoid compilation errors from previously set environment variables. -####Intel Threading Building Blocks - -Download the [Intel Threading Building Blocks source](https://www.threadingbuildingblocks.org/download) and extract the tarball inside your `ANDROID_LIB_DIR`. Rename the extracted folder to `tbb`. - -NOTE: BEFORE YOU ATTEMPT TO CROSS-COMPILE TBB, DISCONNECT ANY DEVICES ADB WOULD DETECT. The tbb build process asks adb for a couple of strings, and if a device is plugged in extra characters get added that will cause ndk-build to fail with an error. - -From the tbb directory, execute the following commands. First, we build TBB using `ndk-build`. Then, the compiled libs are copied to a lib folder in the root of tbb directory. - -``` -cd jni -ndk-build target=android tbb tbbmalloc arch=arm -cd ../ -mkdir lib -cp `find . -name "*.so"` lib/ -``` - ####Oculus Mobile SDK The Oculus Mobile SDK is optional, for Gear VR support. It is not required to compile gvr-interface. @@ -111,7 +95,6 @@ To put the Gear VR Service into developer mode you need an application with an O Once the application is on your device, go to `Settings->Application Manager->Gear VR Service->Manage Storage`. Tap on `VR Service Version` six times. It will scan your device to verify that you have an osig file in an application on your device, and then it will let you enable Developer mode. - ###CMake We use CMake to generate the makefiles that compile and deploy the Android APKs to your device. In order to create Makefiles for the Android targets, CMake requires that some environment variables are set, and that other variables are passed to it when it is run. diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 5f3e4c2228..88984a7f2d 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -91,12 +91,6 @@ To prevent these problems, install OpenSSL yourself. Download the following bina Install OpenSSL into the Windows system directory, to make sure that Qt uses the version that you've just installed, and not some other version. -####Intel Threading Building Blocks (TBB) - -Download the zip from the [TBB website](https://www.threadingbuildingblocks.org/). - -We recommend you extract it to %HIFI_LIB_DIR%\tbb. This will help our FindTBB cmake module find what it needs. You can place it wherever you like on your machine if you specify TBB_ROOT_DIR as an environment variable or a variable passed when cmake is run. - ####Zlib Download the compiled DLL from the [zlib website](http://www.zlib.net/). Extract to %HIFI_LIB_DIR%\zlib. From 27c6f80a61e978758fa40dbe9424f31c37827669 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 09:33:22 -0800 Subject: [PATCH 088/261] use md5 hash to verify downloaded externals --- cmake/externals/glm/CMakeLists.txt | 1 + cmake/externals/gverb/CMakeLists.txt | 1 + cmake/externals/soxr/CMakeLists.txt | 1 + cmake/externals/tbb/CMakeLists.txt | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index 1fa393e69e..1afa9a89e8 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -4,6 +4,7 @@ include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} URL http://pkgs.fedoraproject.org/repo/pkgs/glm/glm-0.9.5.4.zip/fab76fc982b256b46208e5c750ed456a/glm-0.9.5.4.zip + URL_MD5 fab76fc982b256b46208e5c750ed456a CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) diff --git a/cmake/externals/gverb/CMakeLists.txt b/cmake/externals/gverb/CMakeLists.txt index c62284a133..4173efa073 100644 --- a/cmake/externals/gverb/CMakeLists.txt +++ b/cmake/externals/gverb/CMakeLists.txt @@ -8,6 +8,7 @@ include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} URL http://hifi-public.s3.amazonaws.com/dependencies/gverb-master.zip + URL_MD5 8b16d586390a2102804e46b87820dfc6 CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 49d7c7598a..2b00db883a 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -8,6 +8,7 @@ include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1.zip + URL_MD5 349b5b2f323a7380bc12186d98c77d1d CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_SHARED_LIBS=1 -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD ON ) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index cbf7d80c68..e5243edf8c 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -9,6 +9,7 @@ if (ANDROID) ExternalProject_Add( ${EXTERNAL_NAME} URL http://hifi-public.s3.amazonaws.com/dependencies/tbb43_20150209oss_src.tgz + URL_MD5 f09c9abe8ec74e6558c1f89cebbe2893 BUILD_COMMAND ${NDK_BUILD_COMMAND} --directory=jni target=android tbb tbbmalloc arch=arm BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "" @@ -18,10 +19,13 @@ if (ANDROID) else () if (APPLE) set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_osx.tgz) + set(DOWNLOAD_MD5 3e683c19792582b61382e0d760ea5db2) elseif (WIN32) set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_win.zip) + set(DOWNLOAD_MD5 e19c184f2bb0e944fc5f397f1e34ca84) else () set(DOWNLOAD_URL http://s3.amazonaws.com/hifi-public/dependencies/tbb43_20150209oss_lin.tgz) + set(DOWNLOAD_MD5 d9c2a6f7807df364be44a8c3c05e8457) endif () ExternalProject_Add( From 4a8e3193a9c44292df6458fc63106b4605179f6e Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 19 Feb 2015 12:01:27 -0800 Subject: [PATCH 089/261] Add more comments to UIUtil::scaleWidgetFontSizes --- interface/src/UIUtil.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index c907c2b8e9..19d3a51917 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -37,6 +37,12 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) { // font sizes need to be scaled based on the system DPI. // This function will scale the font size of widget and all // of its children recursively. +// +// When creating widgets, if a font size isn't explicitly set Qt will choose a +// reasonable, but often different font size across platforms. This means +// YOU SHOUD EXPLICITLY SET ALL FONT SIZES and call this function OR not use +// this function at all. If you mix both you will end up with inconsistent results +// across platforms. void UIUtil::scaleWidgetFontSizes(QWidget* widget) { auto glCanvas = DependencyManager::get(); @@ -57,6 +63,8 @@ void UIUtil::scaleWidgetFontSizes(QWidget* widget) { internalScaleWidgetFontSizes(widget, fontScale); } +// Depth-first traversal through widget hierarchy. It is important to do a depth-first +// traversal because modifying the font size of a parent node can affect children. void UIUtil::internalScaleWidgetFontSizes(QWidget* widget, float scale) { for (auto child : widget->findChildren()) { if (child->parent() == widget) { From 6f055ca0d7fac78c6bf7cc146773b9b2ba8785cb Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 12:01:40 -0800 Subject: [PATCH 090/261] add an external project to handle bullet --- cmake/externals/bullet/CMakeLists.txt | 36 +++++++++++++++++++++++++++ cmake/externals/glm/CMakeLists.txt | 5 +++- cmake/externals/gverb/CMakeLists.txt | 5 +++- cmake/externals/soxr/CMakeLists.txt | 5 +++- cmake/externals/tbb/CMakeLists.txt | 5 +++- cmake/macros/IncludeBullet.cmake | 16 ------------ interface/CMakeLists.txt | 8 +++--- libraries/entities/CMakeLists.txt | 6 ++++- libraries/physics/CMakeLists.txt | 9 ++++--- tests/physics/CMakeLists.txt | 6 ++++- 10 files changed, 72 insertions(+), 29 deletions(-) create mode 100644 cmake/externals/bullet/CMakeLists.txt delete mode 100644 cmake/macros/IncludeBullet.cmake diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt new file mode 100644 index 0000000000..91a6a486b7 --- /dev/null +++ b/cmake/externals/bullet/CMakeLists.txt @@ -0,0 +1,36 @@ +set(EXTERNAL_NAME bullet) + +if (ANDROID) + set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") +endif () + +include(ExternalProject) +ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz + URL_MD5 70b3c8d202dee91a0854b4cbc88173e8 + CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 +) + +ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) + +string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include CACHE TYPE "Path to bullet include directory") + +set(BULLET_LIB_DIR "${INSTALL_DIR}/lib") + +set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletDynamics.dylib CACHE TYPE "Bullet dynamics release library location") +set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet dynamics debug library location") + +set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletCollision.dylib CACHE TYPE "Bullet collision release library location") +set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet collision debug library location") + +set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libLinearMath.dylib CACHE TYPE "Bullet math release library location") +set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet math debug library location") + +set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletSoftbody.dylib CACHE TYPE "Bullet softbody release library location") +set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") \ No newline at end of file diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index 1afa9a89e8..e1874f66e4 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -6,7 +6,10 @@ ExternalProject_Add( URL http://pkgs.fedoraproject.org/repo/pkgs/glm/glm-0.9.5.4.zip/fab76fc982b256b46208e5c750ed456a/glm-0.9.5.4.zip URL_MD5 fab76fc982b256b46208e5c750ed456a CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= - LOG_DOWNLOAD ON + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/externals/gverb/CMakeLists.txt b/cmake/externals/gverb/CMakeLists.txt index 4173efa073..1e6cc8a567 100644 --- a/cmake/externals/gverb/CMakeLists.txt +++ b/cmake/externals/gverb/CMakeLists.txt @@ -10,7 +10,10 @@ ExternalProject_Add( URL http://hifi-public.s3.amazonaws.com/dependencies/gverb-master.zip URL_MD5 8b16d586390a2102804e46b87820dfc6 CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= - LOG_DOWNLOAD ON + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 2b00db883a..9ca540f49d 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -10,7 +10,10 @@ ExternalProject_Add( URL http://hifi-public.s3.amazonaws.com/dependencies/soxr-0.1.1.zip URL_MD5 349b5b2f323a7380bc12186d98c77d1d CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DBUILD_SHARED_LIBS=1 -DBUILD_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH= - LOG_DOWNLOAD ON + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index e5243edf8c..9bfb682128 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -14,7 +14,10 @@ if (ANDROID) BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/AndroidTBBLibCopy.cmake - LOG_DOWNLOAD ON + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 ) else () if (APPLE) diff --git a/cmake/macros/IncludeBullet.cmake b/cmake/macros/IncludeBullet.cmake deleted file mode 100644 index 186e84d1ab..0000000000 --- a/cmake/macros/IncludeBullet.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -# IncludeBullet.cmake -# -# Copyright 2014 High Fidelity, Inc. -# -# Distributed under the Apache License, Version 2.0. -# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -# - -macro(INCLUDE_BULLET) - find_package(Bullet REQUIRED) - include_directories("${BULLET_INCLUDE_DIRS}") - if (APPLE OR UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}") - endif() -endmacro(INCLUDE_BULLET) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 7458a6c784..69beddaaaf 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -32,8 +32,6 @@ elseif (WIN32) set(GL_HEADERS "#include \n#include \n#include ") endif () -include_bullet() - # create the InterfaceConfig.h file based on GL_HEADERS above configure_file(InterfaceConfig.h.in "${PROJECT_BINARY_DIR}/includes/InterfaceConfig.h") configure_file(InterfaceVersion.h.in "${PROJECT_BINARY_DIR}/includes/InterfaceVersion.h") @@ -108,10 +106,14 @@ endif() add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM}) # set up the external glm library -add_dependency_external_projects(glm) +add_dependency_external_projects(glm bullet) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) +find_package(Bullet REQUIRED) +target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) + # link required hifi libraries link_hifi_libraries(shared octree environment gpu model fbx metavoxels networking entities avatars audio audio-client animation script-engine physics diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index 156f3d1f09..944929dba6 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -7,6 +7,10 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -include_bullet() +add_dependency_external_projects(bullet) + +find_package(Bullet REQUIRED) +target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) link_hifi_libraries(avatars shared octree gpu model fbx networking animation) diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index c3dfcafa48..8929ab4fec 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -7,10 +7,11 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -include_bullet() -if (BULLET_FOUND) - target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) -endif (BULLET_FOUND) +add_dependency_external_projects(bullet) + +find_package(Bullet REQUIRED) +target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) link_hifi_libraries(shared fbx entities) include_hifi_library_headers(fbx) diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index 12cd9b8531..5dd1e270b8 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -6,7 +6,11 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -include_bullet() +add_dependency_external_projects(bullet) + +find_package(Bullet REQUIRED) +target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) link_hifi_libraries(shared physics) From 70a89680f5ae3694c0854796f0f884a6a74f13d7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 12:04:41 -0800 Subject: [PATCH 091/261] fix bullet include to match previous format --- cmake/externals/bullet/CMakeLists.txt | 2 +- libraries/physics/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 91a6a486b7..dd293da059 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -19,7 +19,7 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include CACHE TYPE "Path to bullet include directory") +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE TYPE "Path to bullet include directory") set(BULLET_LIB_DIR "${INSTALL_DIR}/lib") diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index 8929ab4fec..9229bbeca7 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -10,7 +10,7 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) add_dependency_external_projects(bullet) find_package(Bullet REQUIRED) -target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} PUBLIC SYSTEM ${BULLET_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) link_hifi_libraries(shared fbx entities) From d563c80ca095e14cec39aeaadaebf0d3f70423ea Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 12:12:41 -0800 Subject: [PATCH 092/261] handle bullet external project on unix/android --- cmake/externals/bullet/CMakeLists.txt | 28 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index dd293da059..479d921bf4 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -9,7 +9,7 @@ ExternalProject_Add( ${EXTERNAL_NAME} URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz URL_MD5 70b3c8d202dee91a0854b4cbc88173e8 - CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 + CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 @@ -23,14 +23,24 @@ set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE TYPE set(BULLET_LIB_DIR "${INSTALL_DIR}/lib") -set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletDynamics.dylib CACHE TYPE "Bullet dynamics release library location") -set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet dynamics debug library location") +if (APPLE OR UNIX OR ANDROID) + if (APPLE) + set(SHARED_LIB_EXT "dylib") + else () + set(SHARED_LIB_EXT "so") + endif () + + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletDynamics.${SHARED_LIB_EXT} CACHE TYPE "Bullet dynamics release library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet dynamics debug library location") -set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletCollision.dylib CACHE TYPE "Bullet collision release library location") -set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet collision debug library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletCollision.${SHARED_LIB_EXT} CACHE TYPE "Bullet collision release library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet collision debug library location") -set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libLinearMath.dylib CACHE TYPE "Bullet math release library location") -set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet math debug library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libLinearMath.${SHARED_LIB_EXT} CACHE TYPE "Bullet math release library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet math debug library location") -set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletSoftbody.dylib CACHE TYPE "Bullet softbody release library location") -set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") \ No newline at end of file + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletSoftbody.${SHARED_LIB_EXT} CACHE TYPE "Bullet softbody release library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") +elseif (WIN32) + +endif () \ No newline at end of file From 03809131a4f7017935fe9973f0ed890efa942e8b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 12:39:48 -0800 Subject: [PATCH 093/261] log install to be able to confirm installed files --- cmake/externals/bullet/CMakeLists.txt | 1 - cmake/externals/gverb/CMakeLists.txt | 1 - cmake/externals/soxr/CMakeLists.txt | 1 - cmake/externals/tbb/CMakeLists.txt | 1 - 4 files changed, 4 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 479d921bf4..32d4d884b4 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -13,7 +13,6 @@ ExternalProject_Add( LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 - LOG_INSTALL 1 ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/externals/gverb/CMakeLists.txt b/cmake/externals/gverb/CMakeLists.txt index 1e6cc8a567..cc7be74c2f 100644 --- a/cmake/externals/gverb/CMakeLists.txt +++ b/cmake/externals/gverb/CMakeLists.txt @@ -13,7 +13,6 @@ ExternalProject_Add( LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 - LOG_INSTALL 1 ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 9ca540f49d..03b43074c6 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -13,7 +13,6 @@ ExternalProject_Add( LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 - LOG_INSTALL 1 ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 9bfb682128..b26adc559c 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -17,7 +17,6 @@ if (ANDROID) LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 - LOG_INSTALL 1 ) else () if (APPLE) From 71b273ceecfdf65d6ab91608c030cb01e85610dc Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 12:42:28 -0800 Subject: [PATCH 094/261] fix order for found result in bullet find module --- cmake/modules/FindBullet.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/modules/FindBullet.cmake b/cmake/modules/FindBullet.cmake index c4f63860f2..9ef25f7e1e 100644 --- a/cmake/modules/FindBullet.cmake +++ b/cmake/modules/FindBullet.cmake @@ -85,9 +85,7 @@ set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR}) set(BULLET_LIBRARIES ${BULLET_DYNAMICS_LIBRARY} ${BULLET_COLLISION_LIBRARY} ${BULLET_MATH_LIBRARY} ${BULLET_SOFTBODY_LIBRARY}) find_package_handle_standard_args(Bullet "Could NOT find Bullet, try to set the path to Bullet root folder in the system variable BULLET_ROOT_DIR" - BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY BULLET_INCLUDE_DIRS + BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY BULLET_SOFTBODY_LIBRARY BULLET_LIBRARIES -) - - +) \ No newline at end of file From 2cdb8edbbf18019c4a688b85d9ed525aaf00acf7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 12:44:49 -0800 Subject: [PATCH 095/261] fix casing for libBulletSoftBody --- cmake/externals/bullet/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 32d4d884b4..dfd84ecda2 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -38,7 +38,7 @@ if (APPLE OR UNIX OR ANDROID) set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libLinearMath.${SHARED_LIB_EXT} CACHE TYPE "Bullet math release library location") set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet math debug library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletSoftbody.${SHARED_LIB_EXT} CACHE TYPE "Bullet softbody release library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletSoftBody.${SHARED_LIB_EXT} CACHE TYPE "Bullet softbody release library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") elseif (WIN32) From 6b08b2993ae2bdef6a995db29cf2d0b3ec1f1f6f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 13:03:16 -0800 Subject: [PATCH 096/261] fix for bullet system include to silence warnings --- interface/CMakeLists.txt | 2 +- libraries/entities/CMakeLists.txt | 2 +- libraries/physics/CMakeLists.txt | 2 +- tests/physics/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 69beddaaaf..ad42dd97cf 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -111,7 +111,7 @@ find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) find_package(Bullet REQUIRED) -target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) # link required hifi libraries diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index 944929dba6..e57bcf67fa 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -10,7 +10,7 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) add_dependency_external_projects(bullet) find_package(Bullet REQUIRED) -target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) link_hifi_libraries(avatars shared octree gpu model fbx networking animation) diff --git a/libraries/physics/CMakeLists.txt b/libraries/physics/CMakeLists.txt index 9229bbeca7..5e94513da4 100644 --- a/libraries/physics/CMakeLists.txt +++ b/libraries/physics/CMakeLists.txt @@ -10,7 +10,7 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) add_dependency_external_projects(bullet) find_package(Bullet REQUIRED) -target_include_directories(${TARGET_NAME} PUBLIC SYSTEM ${BULLET_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) link_hifi_libraries(shared fbx entities) diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt index 5dd1e270b8..888b158035 100644 --- a/tests/physics/CMakeLists.txt +++ b/tests/physics/CMakeLists.txt @@ -9,7 +9,7 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) add_dependency_external_projects(bullet) find_package(Bullet REQUIRED) -target_include_directories(${TARGET_NAME} PRIVATE SYSTEM ${BULLET_INCLUDE_DIRS}) +target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES}) link_hifi_libraries(shared physics) From d185c775a43a6bd08c4dee0e39ba0b49d30900d2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 13:17:39 -0800 Subject: [PATCH 097/261] fix install step for OS X bullet --- cmake/externals/bullet/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index dfd84ecda2..3166c7b2f3 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -9,7 +9,7 @@ ExternalProject_Add( ${EXTERNAL_NAME} URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz URL_MD5 70b3c8d202dee91a0854b4cbc88173e8 - CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 + CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From cbc6ae98d87a1f7040d178919a4f2439b0782f7a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 13:22:33 -0800 Subject: [PATCH 098/261] groundwork for windows support in bullet external project --- cmake/externals/bullet/CMakeLists.txt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 3166c7b2f3..d82cbd5fad 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -1,15 +1,25 @@ set(EXTERNAL_NAME bullet) if (ANDROID) - set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") + set(PLATFORM_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") +elseif (WIN32) + set(PLATFORM_CMAKE_ARGS "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=1") +endif () + +if (WIN32) + set(DOWNLOAD_URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip) + set(DOWNLOAD_MD5 f5e8914fc9064ad32e0d62d19d33d977) +else () + set(DOWNLOAD_URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz) + set(DOWNLOAD_MD5 70b3c8d202dee91a0854b4cbc88173e8) endif () include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} - URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz - URL_MD5 70b3c8d202dee91a0854b4cbc88173e8 - CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 + URL ${DOWNLOAD_URL} + URL_MD5 ${DOWNLOAD_MD5} + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 721be462f57e8d1767e0d31e22a6b179661600b9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 13:40:17 -0800 Subject: [PATCH 099/261] attempt to handle windows in bullet external project --- cmake/externals/bullet/CMakeLists.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index d82cbd5fad..de17c71322 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -19,7 +19,7 @@ ExternalProject_Add( ${EXTERNAL_NAME} URL ${DOWNLOAD_URL} URL_MD5 ${DOWNLOAD_MD5} - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 @@ -39,17 +39,23 @@ if (APPLE OR UNIX OR ANDROID) set(SHARED_LIB_EXT "so") endif () - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletDynamics.${SHARED_LIB_EXT} CACHE TYPE "Bullet dynamics release library location") + set(LIB_PREFIX "lib") +elseif (WIN32) + set(SHARED_LIB_EXT "lib") +else () + message(STATUS "Your OS is not handled by our Bullet external project CMakeLists.txt. Please install Bullet yourself and pass -DGET_BULLET=0 when running CMake.") +endif () + +if (DEFINED SHARED_LIB_EXT) + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${SHARED_LIB_EXT} CACHE TYPE "Bullet dynamics release library location") set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet dynamics debug library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletCollision.${SHARED_LIB_EXT} CACHE TYPE "Bullet collision release library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${SHARED_LIB_EXT} CACHE TYPE "Bullet collision release library location") set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet collision debug library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libLinearMath.${SHARED_LIB_EXT} CACHE TYPE "Bullet math release library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${SHARED_LIB_EXT} CACHE TYPE "Bullet math release library location") set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet math debug library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/libBulletSoftBody.${SHARED_LIB_EXT} CACHE TYPE "Bullet softbody release library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${SHARED_LIB_EXT} CACHE TYPE "Bullet softbody release library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") -elseif (WIN32) - endif () \ No newline at end of file From 01c92ba94dc7da68afd5de2540ad9ecc2b204225 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 13:53:48 -0800 Subject: [PATCH 100/261] don't attempt to build shared bullet libs on windows --- cmake/externals/bullet/CMakeLists.txt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index de17c71322..12ad076b7b 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -1,9 +1,13 @@ set(EXTERNAL_NAME bullet) -if (ANDROID) - set(PLATFORM_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") -elseif (WIN32) +if (WIN32) set(PLATFORM_CMAKE_ARGS "-DUSE_MSVC_RUNTIME_LIBRARY_DLL=1") +else () + set(PLATFORM_CMAKE_ARGS "-DBUILD_SHARED_LIBS=1") + + if (ANDROID) + set(PLATFORM_CMAKE_ARGS "${PLATFORM_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") + endif() endif () if (WIN32) @@ -34,28 +38,28 @@ set(BULLET_LIB_DIR "${INSTALL_DIR}/lib") if (APPLE OR UNIX OR ANDROID) if (APPLE) - set(SHARED_LIB_EXT "dylib") + set(BULLET_LIB_EXT "dylib") else () - set(SHARED_LIB_EXT "so") + set(BULLET_LIB_EXT "so") endif () set(LIB_PREFIX "lib") elseif (WIN32) - set(SHARED_LIB_EXT "lib") + set(BULLET_LIB_EXT "lib") else () message(STATUS "Your OS is not handled by our Bullet external project CMakeLists.txt. Please install Bullet yourself and pass -DGET_BULLET=0 when running CMake.") endif () if (DEFINED SHARED_LIB_EXT) - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${SHARED_LIB_EXT} CACHE TYPE "Bullet dynamics release library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE TYPE "Bullet dynamics release library location") set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet dynamics debug library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${SHARED_LIB_EXT} CACHE TYPE "Bullet collision release library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE TYPE "Bullet collision release library location") set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet collision debug library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${SHARED_LIB_EXT} CACHE TYPE "Bullet math release library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE TYPE "Bullet math release library location") set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet math debug library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${SHARED_LIB_EXT} CACHE TYPE "Bullet softbody release library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE TYPE "Bullet softbody release library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") endif () \ No newline at end of file From d47a114f23f01b19d77c5ff6df0679314ea52872 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 13:57:31 -0800 Subject: [PATCH 101/261] actually remove BUILD_SHARED_LIBS from combo command --- cmake/externals/bullet/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 12ad076b7b..8738212450 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -23,7 +23,7 @@ ExternalProject_Add( ${EXTERNAL_NAME} URL ${DOWNLOAD_URL} URL_MD5 ${DOWNLOAD_MD5} - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DBUILD_SHARED_LIBS=1 -DUSE_GLM=0 + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLM=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 4dfe7257214925bc4a7a91f2e52ad8d31ca8fe6d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 19 Feb 2015 14:02:15 -0800 Subject: [PATCH 102/261] Update preferences dialog to use layouts throughout --- interface/ui/preferencesDialog.ui | 4608 +++++++++++++++-------------- 1 file changed, 2316 insertions(+), 2292 deletions(-) diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui index 6435f87f24..13894a2592 100644 --- a/interface/ui/preferencesDialog.ui +++ b/interface/ui/preferencesDialog.ui @@ -33,1075 +33,567 @@ 13 - - - - 0 - 0 - 500 - 491 - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - + + 0 - - true + + 0 - - - - 0 - -825 - 485 - 1611 - - - - + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + 0 - - 30 + + true - - 0 - - - 30 - - - 30 - - - - - - 0 - 40 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Avatar basics - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - - - - - - 0 - 0 - - - - - 0 - 28 - - - - - Arial - - - - <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - displayNameEdit - - - - - - - - 0 - 0 - - - - - 280 - 0 - - - - - Arial - - - - Qt::LeftToRight - - - - - - Not showing a name - - - - - - - - 0 - 0 - - - - - 0 - 28 - - - - - Arial - - - - Head - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 0 - 28 - - - - - Arial - - - - Body - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - skeletonURLEdit - - - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Snapshots - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - - Arial - - - - Place my Snapshots here: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - - - 0 - 0 - - - - - Arial - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Scripts - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - - Arial - - - - Load scripts from this directory: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - - - 0 - 0 - - - - - Arial - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - - 300 - 0 - - - - - Arial - - - - Load Default Scripts - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Privacy - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - 0 - 0 - - - - - 32 - 28 - - - - - 0 - 0 - - - - - Arial - - - - Send data - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Avatar tuning - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - + + + + 0 + -107 + 485 + 1550 + + + 0 - - 7 + + 30 - + 0 + + 30 + - 7 + 30 - + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + Arial + 18 + 75 + true - + color:#29967e; - Real world vertical field of view (angular size of monitor) + Avatar basics - + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + 0 - - fieldOfViewSpin + + 7 - + + 7 + + + + + + Arial + + + + <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + displayNameEdit + + + + + + + 4 + + + 140 + + + 4 + + + + + + Arial + + + + Qt::LeftToRight + + + Not showing a name + + + + + + - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 1 - - - 180 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - - - - Vertical field of view - - + + 0 - - fieldOfViewSpin + + 7 - + + 7 + + + + + + Arial + + + + Head + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + snapshotLocationEdit + + + + + + + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 1 - - - 180 - - - - - - - - - 0 - - - 8 - - - 8 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 25 - - - - - Arial - - - - Lean scale (applies to Faceshift users) - - + + 0 - - leanScaleSpin + + 7 - + + 7 + + + + + + Arial + + + + Body + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + skeletonURLEdit + + + + + + + 0 + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + - - - - Arial - - + - Qt::Horizontal + Qt::Vertical - QSizePolicy::Expanding + QSizePolicy::Fixed - 40 - 10 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - Arial - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Avatar scale <span style=" color:#909090;">(default is 1.0)</span> - - - 0 - - - avatarScaleSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 + 20 20 - - - - 100 - 0 - - - - - 70 - 16777215 - - + Arial + 18 + 75 + true - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Pupil dillation + Snapshots - - 0 - - - pupilDilationSlider + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + + + + Arial + + + + Place my Snapshots here: + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + snapshotLocationEdit + + + + + + + 0 + + + + + + Arial + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - + + + + Arial + 18 + 75 + true + + + + color:#29967e + + + Scripts + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + 0 + + + 7 + + + 0 + + + + + + Arial + + + + Load scripts from this directory: + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + snapshotLocationEdit + + + + + + + 0 + + + + + + 0 + 0 + + + + + Arial + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + + + + 0 @@ -1110,1456 +602,1988 @@ - 130 + 150 + 0 + + + + + 300 0 - - - Arial - - - - Qt::Horizontal - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - Arial - Faceshift eye detection - - - 0 - - - faceshiftEyeDeflectionSider + Load Default Scripts - - - - Arial - - + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - + + + + Arial + 18 + 75 + true + + + + color:#29967e + + + Privacy + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + snapshotLocationEdit + + + + + - + 0 0 - 130 - 0 + 32 + 28 - - - Arial - - - - Qt::Horizontal - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Faceshift hostname - - - 0 - - - faceshiftHostnameEdit - - - - - - - - Arial - - - - Qt::Horizontal - - + 0 0 - - - - Arial - - Qt::LeftToRight + + Send data + + + + 0 + 0 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + Arial + 18 + 75 + true + - - - - localhost - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Audio - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - 0 - 40 - - - - - Arial - - - - Enable Dynamic Jitter Buffers - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + color:#29967e - Static Jitter Buffer Frames + Avatar tuning - - 0 - - - staticDesiredJitterBufferFramesSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + + + + Real world vertical field of view (angular size of monitor) + + + 0 + + + fieldOfViewSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 100 + 0 + + + + + 95 + 36 + + + + + Arial + + + + 1 + + + 180 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + + + + Vertical field of view + + + 0 + + + fieldOfViewSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 95 + 36 + + + + + Arial + + + + 1 + + + 180 + + + + + + + + + 0 + + + 8 + + + 8 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 25 + + + + + Arial + + + + Lean scale (applies to Faceshift users) + + + 0 + + + leanScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 10 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + Arial + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Avatar scale <span style=" color:#909090;">(default is 1.0)</span> + + + 0 + + + avatarScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Pupil dillation + + + 0 + + + pupilDilationSlider + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 130 + 0 + + + + + Arial + + + + Qt::Horizontal + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Faceshift eye detection + + + 0 + + + faceshiftEyeDeflectionSider + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 130 + 0 + + + + + Arial + + + + Qt::Horizontal + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Faceshift hostname + + + 0 + + + faceshiftHostnameEdit + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + Arial + + + + Qt::LeftToRight + + + + + + localhost + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 0 - 0 - - - - - 100 - 0 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Max Frames Over Desired + Audio - - 0 - - - maxFramesOverDesiredSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 7 + + 7 + + + + + + 0 + 40 + + + + + Arial + + + + Enable Dynamic Jitter Buffers + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Static Jitter Buffer Frames + + + 0 + + + staticDesiredJitterBufferFramesSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Max Frames Over Desired + + + 0 + + + maxFramesOverDesiredSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 7 + + + 7 + + + + + + 0 + 32 + + + + + Arial + + + + Use Stdev for Dynamic Jitter Calc + + + + 32 + 32 + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Window A Starve Threshold + + + 0 + + + windowStarveThresholdSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Window A (raise desired on N starves) Seconds + + + 0 + + + windowSecondsForDesiredCalcOnTooManyStarvesSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Window B (desired ceiling) Seconds + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 7 + + + 7 + + + + + + 0 + 0 + + + + + Arial + + + + Repetition with Fade + + + + 32 + 32 + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Output Buffer Size (Frames) + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 1 + + + 20 + + + 1 + + + + + + + + + 7 + + + 7 + + + + + + 0 + 0 + + + + + Arial + + + + Output Starve Detection (Automatic Buffer Size Increase) + + + + 32 + 32 + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Output Starve Detection Threshold + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 1 + + + 500 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Output Starve Detection Period (ms) + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 1 + + + 999999999 + + + 1 + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 100 - 0 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - 0 - 32 - - - - - Arial - - - - Use Stdev for Dynamic Jitter Calc - - - - 32 - 32 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Window A Starve Threshold + Octree - - 0 - - - windowStarveThresholdSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Max packets sent each second + + + 0 + + + maxOctreePPSSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 60 + + + 6000 + + + 10 + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Window A (raise desired on N starves) Seconds + Oculus Rift - - 0 - - - windowSecondsForDesiredCalcOnTooManyStarvesSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + User Interface Angular Size + + + 0 + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 30 + + + 160 + + + 1 + + + 72 + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Window B (desired ceiling) Seconds + Sixense Controllers - - 0 - - - windowSecondsForDesiredReductionSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 7 - - Qt::Horizontal + + 7 - - - 40 - 20 - - - + + + + + 0 + 40 + + + + + Arial + + + + Invert Mouse Buttons + + + + 0 + 0 + + + + + - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - + + 0 - - 10000 + + 7 - - 1 + + 0 - + + 7 + + + + + + Arial + + + + Reticle Movement Speed + + + 0 + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 100 + + + 1 + + + 50 + + + + - - - - - - 0 - 0 - - - - - 32 - 40 - - - - - 0 - 0 - - - - - Arial - - - - Repetition with Fade - - - - 32 - 32 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Buffer Size (Frames) - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 20 - - - 1 - - - - - - - - - - 0 - 0 - - - - - 32 - 40 - - - - - 0 - 0 - - - - - Arial - - - - Output Starve Detection (Automatic Buffer Size Increase) - - - - 32 - 32 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Starve Detection Threshold - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 500 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Starve Detection Period (ms) - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 999999999 - - - 1 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Octree - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Max packets sent each second - - - 0 - - - maxOctreePPSSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 60 - - - 6000 - - - 10 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Oculus Rift - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - User Interface Angular Size - - - 0 - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 30 - - - 160 - - - 1 - - - 72 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Sixense Controllers - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 35 - - - - - 0 - 40 - - - - - Arial - - - - Invert Mouse Buttons - - - - 0 - 0 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Reticle Movement Speed - - - 0 - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 100 - - - 1 - - - 50 - - - - - - - - - - - - 0 - 490 - 501 - 50 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - 0 - 0 - 491 - 41 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - Arial - - - - Cancel - - - false - - - - - - - - Arial - - - - Save all changes - - - true - - - false - - - - - - + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Arial + + + + Cancel + + + false + + + + + + + + Arial + + + + Save all changes + + + true + + + false + + + + + + + + + From a0a4882ed66c251e0d6a93f313114530fad55e49 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 14:18:05 -0800 Subject: [PATCH 103/261] shorten externals binary dir path --- CMakeLists.txt | 14 +++------- cmake/macros/SetupExternalsBinaryDir.cmake | 30 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 cmake/macros/SetupExternalsBinaryDir.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 924d0367c2..e216d304c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,17 +110,6 @@ set(HIFI_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(MACRO_DIR "${HIFI_CMAKE_DIR}/macros") set(EXTERNAL_PROJECT_DIR "${HIFI_CMAKE_DIR}/externals") -STRING(REGEX REPLACE " " "-" CMAKE_GENERATOR_FOLDER_NAME ${CMAKE_GENERATOR}) - -set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-externals") -if (ANDROID) - set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/android/${CMAKE_GENERATOR_FOLDER_NAME}") -else () - set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/${CMAKE_GENERATOR_FOLDER_NAME}") -endif () - -set_property(DIRECTORY PROPERTY EP_PREFIX "project") - file(GLOB HIFI_CUSTOM_MACROS "cmake/macros/*.cmake") foreach(CUSTOM_MACRO ${HIFI_CUSTOM_MACROS}) include(${CUSTOM_MACRO}) @@ -133,6 +122,9 @@ if (ANDROID) endforeach() endif () +set_property(DIRECTORY PROPERTY EP_PREFIX "project") +setup_externals_binary_dir() + if (WIN32) add_paths_to_lib_paths("${QT_DIR}/bin") endif () diff --git a/cmake/macros/SetupExternalsBinaryDir.cmake b/cmake/macros/SetupExternalsBinaryDir.cmake new file mode 100644 index 0000000000..0e59328a23 --- /dev/null +++ b/cmake/macros/SetupExternalsBinaryDir.cmake @@ -0,0 +1,30 @@ +# +# SetupExternalsBinaryDir.cmake +# cmake/macros +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 19, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(SETUP_EXTERNALS_BINARY_DIR) + + # get a short name for the generator to use in the path + STRING(REGEX REPLACE " " "-" CMAKE_GENERATOR_FOLDER_NAME ${CMAKE_GENERATOR}) + + if (CMAKE_GENERATOR_FOLDER_NAME STREQUAL "Unix-Makefiles") + set(CMAKE_GENERATOR_FOLDER_NAME "makefiles") + elseif (CMAKE_GENERATOR_FOLDER_NAME STREQUAL "Visual-Studio-12") + set(CMAKE_GENERATOR_FOLDER_NAME "vs12") + endif () + + set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-externals") + if (ANDROID) + set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/android/${CMAKE_GENERATOR_FOLDER_NAME}") + else () + set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/${CMAKE_GENERATOR_FOLDER_NAME}") + endif () + +endmacro() \ No newline at end of file From a3d370f01f9e3bdb911efa6e4cb1bdc3d03b9ddd Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 14:33:31 -0800 Subject: [PATCH 104/261] more path shortening for build of external projects --- CMakeLists.txt | 3 ++- cmake/externals/bullet/CMakeLists.txt | 1 + cmake/externals/glm/CMakeLists.txt | 1 + cmake/externals/gverb/CMakeLists.txt | 1 + cmake/externals/soxr/CMakeLists.txt | 1 + cmake/macros/SetupExternalsBinaryDir.cmake | 2 +- 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e216d304c8..563ece524f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,8 @@ if (ANDROID) endforeach() endif () -set_property(DIRECTORY PROPERTY EP_PREFIX "project") +set(EXTERNAL_PROJECT_PREFIX "project") +set_property(DIRECTORY PROPERTY EP_PREFIX ${EXTERNAL_PROJECT_PREFIX}) setup_externals_binary_dir() if (WIN32) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 8738212450..1cf82032bf 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -27,6 +27,7 @@ ExternalProject_Add( LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 + BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index e1874f66e4..a6f74b52fe 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -5,6 +5,7 @@ ExternalProject_Add( ${EXTERNAL_NAME} URL http://pkgs.fedoraproject.org/repo/pkgs/glm/glm-0.9.5.4.zip/fab76fc982b256b46208e5c750ed456a/glm-0.9.5.4.zip URL_MD5 fab76fc982b256b46208e5c750ed456a + BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= LOG_DOWNLOAD 1 LOG_CONFIGURE 1 diff --git a/cmake/externals/gverb/CMakeLists.txt b/cmake/externals/gverb/CMakeLists.txt index cc7be74c2f..c7791c2424 100644 --- a/cmake/externals/gverb/CMakeLists.txt +++ b/cmake/externals/gverb/CMakeLists.txt @@ -10,6 +10,7 @@ ExternalProject_Add( URL http://hifi-public.s3.amazonaws.com/dependencies/gverb-master.zip URL_MD5 8b16d586390a2102804e46b87820dfc6 CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= + BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index 03b43074c6..c2f5163f94 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -13,6 +13,7 @@ ExternalProject_Add( LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 + BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) diff --git a/cmake/macros/SetupExternalsBinaryDir.cmake b/cmake/macros/SetupExternalsBinaryDir.cmake index 0e59328a23..c066363455 100644 --- a/cmake/macros/SetupExternalsBinaryDir.cmake +++ b/cmake/macros/SetupExternalsBinaryDir.cmake @@ -20,7 +20,7 @@ macro(SETUP_EXTERNALS_BINARY_DIR) set(CMAKE_GENERATOR_FOLDER_NAME "vs12") endif () - set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-externals") + set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-ext") if (ANDROID) set(EXTERNALS_BINARY_DIR "${EXTERNALS_BINARY_ROOT_DIR}/android/${CMAKE_GENERATOR_FOLDER_NAME}") else () From afae7297e760c859202260391c9077c5a666eaa4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 14:41:23 -0800 Subject: [PATCH 105/261] adjustements to build guides to remove bullet --- BUILD.md | 2 +- BUILD_WIN.md | 29 ----------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/BUILD.md b/BUILD.md index f3e9c81b78..dd2b65fb3b 100644 --- a/BUILD.md +++ b/BUILD.md @@ -4,12 +4,12 @@ * [Qt](http://qt-project.org/downloads) ~> 5.3.2 * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. -* [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 #### CMake External Project Dependencies The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-externals` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. Should you want to force a re-download and re-compile of a specific external, you can simply remove that directory from the appropriate subfolder in `build-externals`. Should you want to force a re-download and re-compile of all externals, just remove the `build-externals` folder. +* [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 * [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 * [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 * [gverb](https://github.com/highfidelity/gverb) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 88984a7f2d..a2d87623a2 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -119,35 +119,6 @@ Download the binary package: `glew-1.10.0-win32.zip`. Extract to %HIFI_LIB_DIR%\ Add to the PATH: `%HIFI_LIB_DIR%\glew\bin\Release\Win32` -####Bullet - -Bullet 2.82 source can be [downloaded here](https://code.google.com/p/bullet/downloads/detail?name=bullet-2.82-r2704.zip). Bullet does not come with prebuilt libraries, you need to make those yourself. - -* Download the zip file and extract into a temporary folder -* Create a directory named cmakebuild. Bullet comes with a build\ directory by default, however, that directory is intended for use with premake, and considering premake doesn't support VS2013, we prefer to run the cmake build on its own directory. -* Make the following modifications to Bullet's source: - 1. In file: Extras\HACD\hacdICHull.cpp --- in line: 17 --- insert: #include <algorithm> - 2. In file: src\MiniCL\cl_MiniCL_Defs.h --- comment lines 364 to 372 - 3. In file: CMakeLists.txt set to ON the option USE_MSVC_RUNTIME_LIBRARY_DLL in line 27 - -Then create the Visual Studio solution and build the libraries - run the following commands from a Visual Studio 2013 command prompt, from within the cmakebuild directory created before: - -```shell -cmake .. -G "Visual Studio 12" -msbuild BULLET_PHYSICS.sln /p:Configuration=Debug -``` - -This will create Debug libraries in cmakebuild\lib\Debug. You can replace Debug with Release in the msbuild command and that will generate Release libraries in cmakebuild\lib\Release. - -You now have Bullet libraries compiled, now you need to put them in the right place for hifi to find them: - -* Create a directory named bullet\ inside your %HIFI_LIB_DIR% -* Create two directores named lib\ and include\ inside bullet\ -* Copy all the contents inside src\ from the bullet unzip path into %HIFI_LIB_DIR%\bullet\include\ -* Copy all the contents inside cmakebuild\lib\ into %HIFI_LIB_DIR\bullet\lib - -_Note that the INSTALL target should handle the copying of files into an install directory automatically, however, without modifications to Cmake, the install target didn't work right for me, please update this instructions if you get that working right - Leo <leo@highfidelity.io>_ - ###Build High Fidelity using Visual Studio Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake. From 799cee32aa074f71b82ac04115be24373a873dd7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 14:43:34 -0800 Subject: [PATCH 106/261] remove freeglut from build guides, no longer needed --- BUILD_WIN.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index a2d87623a2..ae71970466 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -2,7 +2,6 @@ Please read the [general build guide](BUILD.md) for information on dependencies ###Windows Specific Dependencies * [GLEW](http://glew.sourceforge.net/) ~> 1.10.0 -* [freeglut MSVC](http://www.transmissionzero.co.uk/software/freeglut-devel/) ~> 2.8.1 * [zLib](http://www.zlib.net/) ~> 1.2.8 * (remember that you need all other dependencies listed in [BUILD.md](BUILD.md)) @@ -46,13 +45,6 @@ We use CMake's `fixup_bundle` to find the DLLs all of our exectuable targets req The recommended route for CMake to find the external dependencies is to place all of the dependencies in one folder and set one ENV variable - HIFI_LIB_DIR. That ENV variable should point to a directory with the following structure: root_lib_dir - -> bullet - -> include - -> lib - -> freeglut - -> bin - -> include - -> lib -> glew -> bin -> include @@ -61,9 +53,6 @@ The recommended route for CMake to find the external dependencies is to place al -> bin -> include -> lib - -> tbb - -> include - -> lib -> zlib -> include -> lib @@ -107,12 +96,6 @@ Add to the PATH: `%HIFI_LIB_DIR%\zlib` Important! This should be added at the beginning of the path, not the end (your system likely has many copies of zlib1.dll, and you want High Fidelity to use the correct version). If High Fidelity picks up the wrong zlib1.dll then it might be unable to use it, and that would cause it to fail to start, showing only the cryptic error "The application was unable to start correctly: 0xc0000022". -####freeglut - -Download the binary package: `freeglut-MSVC-2.8.1-1.mp.zip`. Extract to %HIFI_LIB_DIR%\freeglut. - -Add to the PATH: `%HIFI_LIB_DIR%\freeglut\bin` - ####GLEW Download the binary package: `glew-1.10.0-win32.zip`. Extract to %HIFI_LIB_DIR%\glew (you'll need to rename the default directory name). From c3b9198ec393265e9b6d343a75ef9f0ec63ce1a1 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 15:19:52 -0800 Subject: [PATCH 107/261] cleanup handling of external projects if OS not handled --- cmake/externals/bullet/CMakeLists.txt | 7 +- cmake/externals/tbb/CMakeLists.txt | 23 +-- cmake/externals/zlib/CMakeLists.txt | 22 +++ .../AddDependencyExternalProjects.cmake | 31 +++- cmake/modules/FindZLIB.cmake | 162 ++++++++++++++++++ interface/CMakeLists.txt | 2 +- 6 files changed, 226 insertions(+), 21 deletions(-) create mode 100644 cmake/externals/zlib/CMakeLists.txt create mode 100644 cmake/modules/FindZLIB.cmake diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 1cf82032bf..38bf031387 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -33,7 +33,6 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE TYPE "Path to bullet include directory") set(BULLET_LIB_DIR "${INSTALL_DIR}/lib") @@ -47,8 +46,6 @@ if (APPLE OR UNIX OR ANDROID) set(LIB_PREFIX "lib") elseif (WIN32) set(BULLET_LIB_EXT "lib") -else () - message(STATUS "Your OS is not handled by our Bullet external project CMakeLists.txt. Please install Bullet yourself and pass -DGET_BULLET=0 when running CMake.") endif () if (DEFINED SHARED_LIB_EXT) @@ -63,4 +60,8 @@ if (DEFINED SHARED_LIB_EXT) set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE TYPE "Bullet softbody release library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") +endif () + +if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE TYPE "Path to bullet include directory") endif () \ No newline at end of file diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index b26adc559c..39ec4aa8f2 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -43,7 +43,6 @@ endif () ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE "List of tbb include directories") if (APPLE) set(_TBB_APPLE_LIB_DIR "${SOURCE_DIR}/lib/libc++") @@ -85,14 +84,18 @@ elseif (UNIX) elseif (GCC_VERSION VERSION_GREATER 4.1 OR GCC_VERSION VERSION_EQUAL 4.1) set(_TBB_LINUX_LIB_DIR "${SOURCE_DIR}/lib/${_TBB_ARCH_DIR}/gcc4.1") else () - message(FATAL_ERROR "Could not find a compatible version of Threading Building Blocks library for your compiler.") + message(STATUS "Could not find a compatible version of Threading Building Blocks library for your compiler.") endif () - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbb_debug.so CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbb.so CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") - -else () - message(STATUS "Your OS is not handled by our TBB external project CMakeLists.txt. Please install TBB yourself and pass -DGET_TBB=0 when running CMake.") -endif () \ No newline at end of file + if (DEFINED _TBB_LINUX_LIB_DIR) + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbb_debug.so CACHE TYPE "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbb.so CACHE TYPE "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") + endif () +endif () + +if (DEFINED ${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE) + + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE "List of tbb include directories") +endif () \ No newline at end of file diff --git a/cmake/externals/zlib/CMakeLists.txt b/cmake/externals/zlib/CMakeLists.txt new file mode 100644 index 0000000000..af980484be --- /dev/null +++ b/cmake/externals/zlib/CMakeLists.txt @@ -0,0 +1,22 @@ +set(EXTERNAL_NAME zlib) + +include(ExternalProject) + +if (WIN32) + ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://zlib.net/zlib128-dll.zip + URL_MD5 42eccc2af5bac6b7a1188d7817d03549 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD 1 + ) + + ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) + + set(${EXTERNAL_NAME_UPPER}_LIBRARY ${SOURCE_DIR}/lib/zdll.lib CACHE TYPE "Location of zlib library") + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/include CACHE TYPE "Location of zlib includes") + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR} CACHE TYPE "Location of zlib DLL") +endif () + diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index 72dbad6639..816036fc81 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -14,14 +14,31 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) foreach(_PROJ_NAME ${ARGN}) string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) - - if (NOT DEFINED GET_${_PROJ_NAME_UPPER} OR GET_${_PROJ_NAME_UPPER}) - if (NOT TARGET ${_PROJ_NAME}) - add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${EXTERNALS_BINARY_DIR}/${_PROJ_NAME}) - endif () - - add_dependencies(${TARGET_NAME} ${_PROJ_NAME}) + # has the user told us they specific don't want this as an external project? + if (NOT DEFINED GET_${_PROJ_NAME_UPPER} OR GET_${_PROJ_NAME_UPPER}) + # have we already detected we can't have this as external project on this OS? + if (NOT DEFINED ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT OR ${EXTERNAL_NAME_UPPER}_EXTERNAL_PROJECT) + # have we already setup the target? + if (NOT TARGET ${_PROJ_NAME}) + add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${EXTERNALS_BINARY_DIR}/${_PROJ_NAME}) + + # did we end up adding an external project target? + if (NOT TARGET ${_PROJ_NAME}) + set(${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT FALSE CACHE TYPE "Presence of ${_PROJ_NAME} as external target") + + message(STATUS "${_PROJ_NAME} was not added as an external project target for your OS." + " Either your system should already have the external library or you will need to install it separately.") + else () + set(${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT TRUE CACHE TYPE "Presence of ${_PROJ_NAME} as external target") + endif () + endif () + + if (TARGET ${_PROJ_NAME}) + add_dependencies(${TARGET_NAME} ${_PROJ_NAME}) + endif () + + endif () endif () endforeach() diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake new file mode 100644 index 0000000000..f052939d04 --- /dev/null +++ b/cmake/modules/FindZLIB.cmake @@ -0,0 +1,162 @@ +#.rst: +# FindZLIB +# -------- +# +# Find the native ZLIB includes and library. +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if +# ZLIB has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: +# +# :: +# +# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. +# ZLIB_LIBRARIES - List of libraries when using zlib. +# ZLIB_FOUND - True if zlib found. +# +# :: +# +# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) +# ZLIB_VERSION_MAJOR - The major version of zlib +# ZLIB_VERSION_MINOR - The minor version of zlib +# ZLIB_VERSION_PATCH - The patch version of zlib +# ZLIB_VERSION_TWEAK - The tweak version of zlib +# +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ +# +# The following variable are provided for backward compatibility +# +# :: +# +# ZLIB_MAJOR_VERSION - The major version of zlib +# ZLIB_MINOR_VERSION - The minor version of zlib +# ZLIB_PATCH_VERSION - The patch version of zlib +# +# Hints +# ^^^^^ +# +# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this +# module where to look. + +#============================================================================= +# Copyright 2000-2014 Kitware, Inc. +# Copyright 2000-2011 Insight Software Consortium +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +# Modified on 2/19/2015 by Stephen Birarda +# The High Fidelity modification adds a ZLIB_DLL_PATH variable for fixup_bundle on windows + +set(_ZLIB_SEARCHES) + +# Search ZLIB_ROOT first if it is set. +if(ZLIB_ROOT) + set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH) + list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT) +endif() + +# Normal search. +set(_ZLIB_SEARCH_NORMAL + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]" + "$ENV{PROGRAMFILES}/zlib" + ) +list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) + +set(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) + +# Try each search configuration. +foreach(search ${_ZLIB_SEARCHES}) + find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) + find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) + + if (WIN32) + find_path(ZLIB_DLL_PATH NAMES zlib.dll ${${search}} PATH_SUFFIXES bin) + endif () +endforeach() + +mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) + +if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") + file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") + + string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") + string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") + string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") + set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") + + # only append a TWEAK version if it exists: + set(ZLIB_VERSION_TWEAK "") + if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)") + set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") + set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") + endif() + + set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") + set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") + set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") +endif() + +set(ZLIB_REQUIREMENTS ZLIB_LIBRARY ZLIB_INCLUDE_DIR VERSION_VAR ZLIB_VERSION_STRING) +if (WIN32) + list(APPEND ZLIB_REQUIREMENTS ZLIB_DLL_PATH) +endif () + +# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ${ZLIB_REQUIREMENTS}) + +if(ZLIB_FOUND) + set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) + set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) + + if(NOT TARGET ZLIB::ZLIB) + add_library(ZLIB::ZLIB UNKNOWN IMPORTED) + set_target_properties(ZLIB::ZLIB PROPERTIES + IMPORTED_LOCATION "${ZLIB_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") + endif() + + if (WIN32) + add_path_to_lib_paths(${ZLIB_DLL_PATH}) + endif () +endif() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index ad42dd97cf..c54199dfe8 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -106,7 +106,7 @@ endif() add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM}) # set up the external glm library -add_dependency_external_projects(glm bullet) +add_dependency_external_projects(glm bullet zlib) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) From 63d4538b76ffb0779d82433879c6de6af12df23b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 15:22:37 -0800 Subject: [PATCH 108/261] fix ZLIB dll find, bullet check --- cmake/externals/bullet/CMakeLists.txt | 2 +- cmake/modules/FindZLIB.cmake | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 38bf031387..e46cb093d4 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -48,7 +48,7 @@ elseif (WIN32) set(BULLET_LIB_EXT "lib") endif () -if (DEFINED SHARED_LIB_EXT) +if (DEFINED BULLET_LIB_EXT) set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE TYPE "Bullet dynamics release library location") set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet dynamics debug library location") diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake index f052939d04..e6212247b3 100644 --- a/cmake/modules/FindZLIB.cmake +++ b/cmake/modules/FindZLIB.cmake @@ -135,10 +135,11 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") endif() -set(ZLIB_REQUIREMENTS ZLIB_LIBRARY ZLIB_INCLUDE_DIR VERSION_VAR ZLIB_VERSION_STRING) +set(ZLIB_REQUIREMENTS ZLIB_LIBRARY ZLIB_INCLUDE_DIR) if (WIN32) list(APPEND ZLIB_REQUIREMENTS ZLIB_DLL_PATH) endif () +list(APPEND ZLIB_REQUIREMENTS VERSION_VAR ZLIB_VERSION_STRING) # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE From 44f8e599e2f02c1f8076a95b490808c6170a4d15 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 15:29:28 -0800 Subject: [PATCH 109/261] test the possibility that zlib is no longer required --- interface/CMakeLists.txt | 7 ++----- libraries/environment/CMakeLists.txt | 9 +-------- libraries/fbx/CMakeLists.txt | 6 +----- libraries/octree/CMakeLists.txt | 8 -------- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index c54199dfe8..fb29667e09 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -106,7 +106,7 @@ endif() add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM}) # set up the external glm library -add_dependency_external_projects(glm bullet zlib) +add_dependency_external_projects(glm bullet) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PRIVATE ${GLM_INCLUDE_DIRS}) @@ -119,9 +119,6 @@ link_hifi_libraries(shared octree environment gpu model fbx metavoxels networkin audio audio-client animation script-engine physics render-utils entities-renderer) -# find any optional and required libraries -find_package(ZLIB REQUIRED) - # perform standard include and linking for found externals foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) @@ -185,7 +182,7 @@ endif () include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/includes") target_link_libraries( - ${TARGET_NAME} ${ZLIB_LIBRARIES} + ${TARGET_NAME} Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL Qt5::Script Qt5::Svg Qt5::WebKitWidgets ) diff --git a/libraries/environment/CMakeLists.txt b/libraries/environment/CMakeLists.txt index 61a8c6b8df..a2ee9e3f55 100644 --- a/libraries/environment/CMakeLists.txt +++ b/libraries/environment/CMakeLists.txt @@ -7,11 +7,4 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -link_hifi_libraries(shared networking) - -# find ZLIB -find_package(ZLIB REQUIRED) -include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") - -# add it to our list of libraries to link -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) \ No newline at end of file +link_hifi_libraries(shared networking) \ No newline at end of file diff --git a/libraries/fbx/CMakeLists.txt b/libraries/fbx/CMakeLists.txt index c1ba5a1c2a..1ce1c74922 100644 --- a/libraries/fbx/CMakeLists.txt +++ b/libraries/fbx/CMakeLists.txt @@ -7,8 +7,4 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -link_hifi_libraries(shared gpu model networking octree) - -find_package(ZLIB REQUIRED) -include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) \ No newline at end of file +link_hifi_libraries(shared gpu model networking octree) \ No newline at end of file diff --git a/libraries/octree/CMakeLists.txt b/libraries/octree/CMakeLists.txt index 1f44795148..cc36aead15 100644 --- a/libraries/octree/CMakeLists.txt +++ b/libraries/octree/CMakeLists.txt @@ -8,11 +8,3 @@ find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) link_hifi_libraries(shared networking) - -# find ZLIB -find_package(ZLIB REQUIRED) - -include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") - -# append ZLIB and OpenSSL to our list of libraries to link -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) From dab524fb0f294525821227c0db2cebfe09cc2eaf Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 15:35:38 -0800 Subject: [PATCH 110/261] remove zlib modules and mentions in build guides --- BUILD_LINUX.md | 6 - BUILD_WIN.md | 17 --- cmake/externals/zlib/CMakeLists.txt | 22 ---- cmake/modules/FindZLIB.cmake | 163 ---------------------------- 4 files changed, 208 deletions(-) delete mode 100644 cmake/externals/zlib/CMakeLists.txt delete mode 100644 cmake/modules/FindZLIB.cmake diff --git a/BUILD_LINUX.md b/BUILD_LINUX.md index 08945716ae..933e73e869 100644 --- a/BUILD_LINUX.md +++ b/BUILD_LINUX.md @@ -1,11 +1,5 @@ Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only Linux specific instructions are found in this file. -###Linux Specific Dependencies -* [freeglut](http://freeglut.sourceforge.net/) ~> 2.8.0 -* [zLib](http://www.zlib.net/) ~> 1.2.8 - -In general, as long as external dependencies are placed in OS standard locations, CMake will successfully find them during its run. When possible, you may choose to install depencies from your package manager of choice, or from source. - ###Qt5 Dependencies Should you choose not to install Qt5 via a package manager that handles dependencies for you, you may be missing some Qt5 dependencies. On Ubuntu, for example, the following additional packages are required: diff --git a/BUILD_WIN.md b/BUILD_WIN.md index ae71970466..f6d484fcd1 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -2,7 +2,6 @@ Please read the [general build guide](BUILD.md) for information on dependencies ###Windows Specific Dependencies * [GLEW](http://glew.sourceforge.net/) ~> 1.10.0 -* [zLib](http://www.zlib.net/) ~> 1.2.8 * (remember that you need all other dependencies listed in [BUILD.md](BUILD.md)) ###Visual Studio 2013 @@ -80,22 +79,6 @@ To prevent these problems, install OpenSSL yourself. Download the following bina Install OpenSSL into the Windows system directory, to make sure that Qt uses the version that you've just installed, and not some other version. -####Zlib - -Download the compiled DLL from the [zlib website](http://www.zlib.net/). Extract to %HIFI_LIB_DIR%\zlib. - -Add the following environment variables (remember to substitute your own directory for %HIFI_LIB_DIR%): - - ZLIB_LIBRARY=%HIFI_LIB_DIR%\zlib\lib\zdll.lib - ZLIB_INCLUDE_DIR=%HIFI_LIB_DIR%\zlib\include - -Add to the PATH: `%HIFI_LIB_DIR%\zlib` - -(The PATH environment variable is where Windows looks for its DLL's and executables. There's a great tool for editing these variables with ease, [Rapid Environment Editor](http://www.rapidee.com/en/download)) - -Important! This should be added at the beginning of the path, not the end (your -system likely has many copies of zlib1.dll, and you want High Fidelity to use the correct version). If High Fidelity picks up the wrong zlib1.dll then it might be unable to use it, and that would cause it to fail to start, showing only the cryptic error "The application was unable to start correctly: 0xc0000022". - ####GLEW Download the binary package: `glew-1.10.0-win32.zip`. Extract to %HIFI_LIB_DIR%\glew (you'll need to rename the default directory name). diff --git a/cmake/externals/zlib/CMakeLists.txt b/cmake/externals/zlib/CMakeLists.txt deleted file mode 100644 index af980484be..0000000000 --- a/cmake/externals/zlib/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(EXTERNAL_NAME zlib) - -include(ExternalProject) - -if (WIN32) - ExternalProject_Add( - ${EXTERNAL_NAME} - URL http://zlib.net/zlib128-dll.zip - URL_MD5 42eccc2af5bac6b7a1188d7817d03549 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - LOG_DOWNLOAD 1 - ) - - ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) - - set(${EXTERNAL_NAME_UPPER}_LIBRARY ${SOURCE_DIR}/lib/zdll.lib CACHE TYPE "Location of zlib library") - set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/include CACHE TYPE "Location of zlib includes") - set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR} CACHE TYPE "Location of zlib DLL") -endif () - diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake deleted file mode 100644 index e6212247b3..0000000000 --- a/cmake/modules/FindZLIB.cmake +++ /dev/null @@ -1,163 +0,0 @@ -#.rst: -# FindZLIB -# -------- -# -# Find the native ZLIB includes and library. -# -# IMPORTED Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if -# ZLIB has been found. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following variables: -# -# :: -# -# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. -# ZLIB_LIBRARIES - List of libraries when using zlib. -# ZLIB_FOUND - True if zlib found. -# -# :: -# -# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) -# ZLIB_VERSION_MAJOR - The major version of zlib -# ZLIB_VERSION_MINOR - The minor version of zlib -# ZLIB_VERSION_PATCH - The patch version of zlib -# ZLIB_VERSION_TWEAK - The tweak version of zlib -# -# Backward Compatibility -# ^^^^^^^^^^^^^^^^^^^^^^ -# -# The following variable are provided for backward compatibility -# -# :: -# -# ZLIB_MAJOR_VERSION - The major version of zlib -# ZLIB_MINOR_VERSION - The minor version of zlib -# ZLIB_PATCH_VERSION - The patch version of zlib -# -# Hints -# ^^^^^ -# -# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this -# module where to look. - -#============================================================================= -# Copyright 2000-2014 Kitware, Inc. -# Copyright 2000-2011 Insight Software Consortium -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the names of Kitware, Inc., the Insight Software Consortium, -# nor the names of their contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -# Modified on 2/19/2015 by Stephen Birarda -# The High Fidelity modification adds a ZLIB_DLL_PATH variable for fixup_bundle on windows - -set(_ZLIB_SEARCHES) - -# Search ZLIB_ROOT first if it is set. -if(ZLIB_ROOT) - set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH) - list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT) -endif() - -# Normal search. -set(_ZLIB_SEARCH_NORMAL - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]" - "$ENV{PROGRAMFILES}/zlib" - ) -list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) - -set(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1) - -# Try each search configuration. -foreach(search ${_ZLIB_SEARCHES}) - find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) - find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) - - if (WIN32) - find_path(ZLIB_DLL_PATH NAMES zlib.dll ${${search}} PATH_SUFFIXES bin) - endif () -endforeach() - -mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) - -if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") - file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") - - string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") - string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") - string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") - set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") - - # only append a TWEAK version if it exists: - set(ZLIB_VERSION_TWEAK "") - if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)") - set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") - set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") - endif() - - set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") - set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") - set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") -endif() - -set(ZLIB_REQUIREMENTS ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -if (WIN32) - list(APPEND ZLIB_REQUIREMENTS ZLIB_DLL_PATH) -endif () -list(APPEND ZLIB_REQUIREMENTS VERSION_VAR ZLIB_VERSION_STRING) - -# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ${ZLIB_REQUIREMENTS}) - -if(ZLIB_FOUND) - set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) - set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) - - if(NOT TARGET ZLIB::ZLIB) - add_library(ZLIB::ZLIB UNKNOWN IMPORTED) - set_target_properties(ZLIB::ZLIB PROPERTIES - IMPORTED_LOCATION "${ZLIB_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") - endif() - - if (WIN32) - add_path_to_lib_paths(${ZLIB_DLL_PATH}) - endif () -endif() From b7c03c34a8fcd456a90bb8705dab035b2dcf1992 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 16:39:05 -0800 Subject: [PATCH 111/261] use path and filepath where appropriate for cache --- cmake/externals/bullet/CMakeLists.txt | 18 +++---- cmake/externals/glm/CMakeLists.txt | 2 +- cmake/externals/gverb/CMakeLists.txt | 6 +-- cmake/externals/soxr/CMakeLists.txt | 10 ++-- cmake/externals/tbb/CMakeLists.txt | 51 ++++++++----------- .../AddDependencyExternalProjects.cmake | 4 +- cmake/macros/AddPathsToLibPaths.cmake | 2 +- 7 files changed, 43 insertions(+), 50 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index e46cb093d4..661beac212 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -49,19 +49,19 @@ elseif (WIN32) endif () if (DEFINED BULLET_LIB_EXT) - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE TYPE "Bullet dynamics release library location") - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet dynamics debug library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics release library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet dynamics debug library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE TYPE "Bullet collision release library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet collision debug library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision release library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet collision debug library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE TYPE "Bullet math release library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet math debug library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math release library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet math debug library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE TYPE "Bullet softbody release library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE TYPE "Bullet softbody debug library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody release library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet softbody debug library location") endif () if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) - set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE TYPE "Path to bullet include directory") + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE PATH "Path to bullet include directory") endif () \ No newline at end of file diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index a6f74b52fe..eda9e0df98 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -16,4 +16,4 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE "List of glm include directories") \ No newline at end of file +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE PATH "List of glm include directories") \ No newline at end of file diff --git a/cmake/externals/gverb/CMakeLists.txt b/cmake/externals/gverb/CMakeLists.txt index c7791c2424..f5372f6895 100644 --- a/cmake/externals/gverb/CMakeLists.txt +++ b/cmake/externals/gverb/CMakeLists.txt @@ -19,10 +19,10 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE "Path to gverb include directory") +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE FILEPATH "Path to gverb include directory") if (WIN32) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/gverb.lib CACHE TYPE "List of gverb libraries") + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/gverb.lib CACHE FILEPATH "List of gverb libraries") else () - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libgverb.a CACHE TYPE "List of gverb libraries") + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libgverb.a CACHE FILEPATH "List of gverb libraries") endif () \ No newline at end of file diff --git a/cmake/externals/soxr/CMakeLists.txt b/cmake/externals/soxr/CMakeLists.txt index c2f5163f94..d004cf9ccb 100644 --- a/cmake/externals/soxr/CMakeLists.txt +++ b/cmake/externals/soxr/CMakeLists.txt @@ -19,13 +19,13 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE TYPE "List of soxr include directories") +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE PATH "List of soxr include directories") if (WIN32) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE TYPE "List of soxr libraries") - set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE TYPE "Path to soxr dll") + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/soxr.lib CACHE FILEPATH "List of soxr libraries") + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/bin CACHE PATH "Path to soxr dll") elseif (APPLE) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.dylib CACHE TYPE "List of soxr libraries") + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.dylib CACHE FILEPATH "List of soxr libraries") else () - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE TYPE "List of soxr libraries") + set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${INSTALL_DIR}/lib/libsoxr.so CACHE FILEPATH "List of soxr libraries") endif () \ No newline at end of file diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 39ec4aa8f2..56997db490 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -45,29 +45,21 @@ ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) if (APPLE) - set(_TBB_APPLE_LIB_DIR "${SOURCE_DIR}/lib/libc++") - - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_APPLE_LIB_DIR}/libtbb_debug.dylib CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_APPLE_LIB_DIR}/libtbb.dylib CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_APPLE_LIB_DIR}/libtbbmalloc_debug.dylib CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_APPLE_LIB_DIR}/libtbbmalloc.dylib CACHE TYPE "TBB malloc release library location") + set(_TBB_LIB_DIR "${SOURCE_DIR}/lib/libc++") + set(_LIB_PREFIX "lib") + set(_LIB_EXT "dylib") elseif (WIN32) - set(_TBB_WIN_LIB_DIR "${SOURCE_DIR}/lib/ia32/vc12") - - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/tbb_debug.lib CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/tbb.lib CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_WIN_LIB_DIR}/tbbmalloc_debug.lib CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_WIN_LIB_DIR}/tbbmalloc.lib CACHE TYPE "TBB malloc release library location") - - set(${EXTERNAL_NAME_UPPER}_DLL_PATH "${SOURCE_DIR}/bin/ia32/vc12" CACHE TYPE "Path to TBB DLLs") + set(_TBB_LIB_DIR "${SOURCE_DIR}/lib/ia32/vc12") + set(_LIB_EXT "lib") + set(${EXTERNAL_NAME_UPPER}_DLL_PATH "${SOURCE_DIR}/bin/ia32/vc12" CACHE PATH "Path to TBB DLLs") elseif (ANDROID) - set(_TBB_ANDROID_LIB_DIR "${SOURCE_DIR}/lib") - - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_DIR}/libtbb_debug.so CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_DIR}/libtbb.so CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_ANDROID_LIB_DIR}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_ANDROID_LIB_DIR}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") + set(_TBB_LIB_DIR "${SOURCE_DIR}/lib") + set(_LIB_PREFIX "lib") + set(_LIB_EXT "so") elseif (UNIX) + set(_LIB_PREFIX "lib") + set(_LIB_EXT "so") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_TBB_ARCH_DIR "intel64") else() @@ -80,22 +72,23 @@ elseif (UNIX) ) if (GCC_VERSION VERSION_GREATER 4.4 OR GCC_VERSION VERSION_EQUAL 4.4) - set(_TBB_LINUX_LIB_DIR "${SOURCE_DIR}/lib/${_TBB_ARCH_DIR}/gcc4.4") + set(_TBB_LIB_DIR "${SOURCE_DIR}/lib/${_TBB_ARCH_DIR}/gcc4.4") elseif (GCC_VERSION VERSION_GREATER 4.1 OR GCC_VERSION VERSION_EQUAL 4.1) - set(_TBB_LINUX_LIB_DIR "${SOURCE_DIR}/lib/${_TBB_ARCH_DIR}/gcc4.1") + set(_TBB_LIB_DIR "${SOURCE_DIR}/lib/${_TBB_ARCH_DIR}/gcc4.1") else () message(STATUS "Could not find a compatible version of Threading Building Blocks library for your compiler.") endif () - if (DEFINED _TBB_LINUX_LIB_DIR) - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbb_debug.so CACHE TYPE "TBB debug library location") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbb.so CACHE TYPE "TBB release library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_LINUX_LIB_DIR}/libtbbmalloc_debug.so CACHE TYPE "TBB malloc debug library location") - set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_LINUX_LIB_DIR}/libtbbmalloc.so CACHE TYPE "TBB malloc release library location") - endif () + endif () -if (DEFINED ${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE) +if (DEFINED _TBB_LIB_DIR) + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbb_debug.${_LIB_EXT} CACHE FILEPATH "TBB debug library location") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbb.${_LIB_EXT} CACHE FILEPATH "TBB release library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbbmalloc_debug.${_LIB_EXT} CACHE FILEPATH "TBB malloc debug library location") + set(${EXTERNAL_NAME_UPPER}_MALLOC_LIBRARY_RELEASE ${_TBB_LIB_DIR}/${_LIB_PREFIX}tbbmalloc.${_LIB_EXT} CACHE FILEPATH "TBB malloc release library location") +endif () +if (DEFINED ${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE "List of tbb include directories") endif () \ No newline at end of file diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index 816036fc81..f9ba91e1cb 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -25,12 +25,12 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) # did we end up adding an external project target? if (NOT TARGET ${_PROJ_NAME}) - set(${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT FALSE CACHE TYPE "Presence of ${_PROJ_NAME} as external target") + set(${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT FALSE CACHE BOOL "Presence of ${_PROJ_NAME} as external target") message(STATUS "${_PROJ_NAME} was not added as an external project target for your OS." " Either your system should already have the external library or you will need to install it separately.") else () - set(${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT TRUE CACHE TYPE "Presence of ${_PROJ_NAME} as external target") + set(${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT TRUE CACHE BOOL "Presence of ${_PROJ_NAME} as external target") endif () endif () diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index ab1aef697b..d92a339ba7 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -17,6 +17,6 @@ macro(ADD_PATHS_TO_LIB_PATHS) list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) - set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE TYPE LIST FORCE) + set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE LIST FORCE) endforeach() endmacro() \ No newline at end of file From 12f03c560656f7388aa617eb127789000eb0ab26 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 19 Feb 2015 17:39:30 -0800 Subject: [PATCH 112/261] set install name dir for bullet on OS X --- cmake/externals/bullet/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 661beac212..4fb8b0a5d1 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -6,7 +6,9 @@ else () set(PLATFORM_CMAKE_ARGS "-DBUILD_SHARED_LIBS=1") if (ANDROID) - set(PLATFORM_CMAKE_ARGS "${PLATFORM_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") + list(APPEND PLATFORM_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") + elseif (APPLE) + list(APPEND PLATFORM_CMAKE_ARGS "-DCMAKE_INSTALL_NAME_DIR=/lib") endif() endif () @@ -23,7 +25,7 @@ ExternalProject_Add( ${EXTERNAL_NAME} URL ${DOWNLOAD_URL} URL_MD5 ${DOWNLOAD_MD5} - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLM=0 + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 4b3183d820b5cf9eddcffda9724f0a3c7cba42d3 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 19 Feb 2015 17:44:06 -0800 Subject: [PATCH 113/261] AssignmentClients accept an id on the command-line. AssignmentClientMonitor now has a NodeList. It stores its local port in shared memory, like the DomainServer does. As it spawns children, it addes Nodes to the NodeList for each one. The children send status updates to the Monitor. The Monitor will notice if there are no spares and fork another child. --- assignment-client/src/AssignmentClient.cpp | 77 +++++++--- assignment-client/src/AssignmentClient.h | 12 +- assignment-client/src/AssignmentClientApp.cpp | 84 ++++++++++ assignment-client/src/AssignmentClientApp.h | 19 +++ .../src/AssignmentClientMonitor.cpp | 143 +++++++++++++++++- .../src/AssignmentClientMonitor.h | 21 ++- assignment-client/src/main.cpp | 30 +--- domain-server/src/DomainServer.cpp | 16 +- libraries/networking/src/LimitedNodeList.cpp | 38 +++++ libraries/networking/src/LimitedNodeList.h | 10 ++ libraries/networking/src/NodeList.cpp | 8 +- libraries/networking/src/NodeList.h | 1 + libraries/networking/src/PacketHeaders.cpp | 3 + libraries/networking/src/PacketHeaders.h | 4 +- 14 files changed, 389 insertions(+), 77 deletions(-) create mode 100644 assignment-client/src/AssignmentClientApp.cpp create mode 100644 assignment-client/src/AssignmentClientApp.h diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index bf67d4d597..9098a258e7 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -40,10 +41,11 @@ SharedAssignmentPointer AssignmentClient::_currentAssignment; int hifiSockAddrMeta = qRegisterMetaType("HifiSockAddr"); -AssignmentClient::AssignmentClient(int &argc, char **argv) : +AssignmentClient::AssignmentClient(int &argc, char **argv, QUuid nodeUUID) : QCoreApplication(argc, argv), _assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME), - _localASPortSharedMem(NULL) + _localASPortSharedMem(NULL), + _localACMPortSharedMem(NULL) { LogUtils::init(); @@ -57,6 +59,8 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : auto addressManager = DependencyManager::set(); auto nodeList = DependencyManager::set(NodeType::Unassigned); auto avatarHashMap = DependencyManager::set(); + + nodeList->setSessionUUID(nodeUUID); // setup a shutdown event listener to handle SIGTERM or WM_CLOSE for us #ifdef _WIN32 @@ -123,9 +127,8 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : // call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required qDebug() << "Waiting for assignment -" << _requestAssignment; - QTimer* timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(sendAssignmentRequest())); - timer->start(ASSIGNMENT_REQUEST_INTERVAL_MSECS); + connect(&_requestTimer, SIGNAL(timeout()), SLOT(sendAssignmentRequest())); + _requestTimer.start(ASSIGNMENT_REQUEST_INTERVAL_MSECS); // connect our readPendingDatagrams method to the readyRead() signal of the socket connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClient::readPendingDatagrams); @@ -136,6 +139,36 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : // Create Singleton objects on main thread NetworkAccessManager::getInstance(); + + setUpStatsToMonitor(); +} + + +void AssignmentClient::setUpStatsToMonitor() { + // Figure out the address to send out stats to + quint16 localMonitorServerPort = DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT; + auto nodeList = DependencyManager::get(); + + nodeList->getLocalPortFromSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, + _localACMPortSharedMem, localMonitorServerPort); + _assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, localMonitorServerPort, true); + + // send a stats packet every 1 seconds + connect(&_statsTimerACM, &QTimer::timeout, this, &AssignmentClient::sendStatsPacketToACM); + _statsTimerACM.start(1000); +} + +void AssignmentClient::sendStatsPacketToACM() { + // tell the assignment client monitor what this assignment client is doing (if anything) + QJsonObject statsObject; + auto nodeList = DependencyManager::get(); + + if (_currentAssignment) { + statsObject["assignment_type"] = _currentAssignment->getTypeName(); + } else { + statsObject["assignment_type"] = "none"; + } + nodeList->sendStats(statsObject, _assignmentClientMonitorSocket); } void AssignmentClient::sendAssignmentRequest() { @@ -145,34 +178,22 @@ void AssignmentClient::sendAssignmentRequest() { if (_assignmentServerHostname == "localhost") { // we want to check again for the local domain-server port in case the DS has restarted - if (!_localASPortSharedMem) { - _localASPortSharedMem = new QSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this); - - if (!_localASPortSharedMem->attach(QSharedMemory::ReadOnly)) { - qWarning() << "Could not attach to shared memory at key" << DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY - << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort(); - } - } - - if (_localASPortSharedMem->isAttached()) { - _localASPortSharedMem->lock(); - - quint16 localAssignmentServerPort; - memcpy(&localAssignmentServerPort, _localASPortSharedMem->data(), sizeof(localAssignmentServerPort)); - - _localASPortSharedMem->unlock(); - + quint16 localAssignmentServerPort; + if (nodeList->getLocalPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, _localASPortSharedMem, + localAssignmentServerPort)) { if (localAssignmentServerPort != _assignmentServerSocket.getPort()) { qDebug() << "Port for local assignment server read from shared memory is" - << localAssignmentServerPort; + << localAssignmentServerPort; _assignmentServerSocket.setPort(localAssignmentServerPort); nodeList->setAssignmentServerSocket(_assignmentServerSocket); } } - + else { + qDebug () << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort(); + } } - + nodeList->sendAssignment(_requestAssignment); } } @@ -227,10 +248,16 @@ void AssignmentClient::readPendingDatagrams() { } else { qDebug() << "Received an assignment that could not be unpacked. Re-requesting."; } + } else if (packetTypeForPacket(receivedPacket) == PacketTypeStopNode) { + qDebug() << "Network told me to exit"; + quit(); } else { + qDebug() << "punt"; // have the NodeList attempt to handle it nodeList->processNodeData(senderSockAddr, receivedPacket); } + } else { + qDebug() << "packetVersionAndHashMatch said no"; } } } diff --git a/assignment-client/src/AssignmentClient.h b/assignment-client/src/AssignmentClient.h index 053458f136..7f0f16e6d6 100644 --- a/assignment-client/src/AssignmentClient.h +++ b/assignment-client/src/AssignmentClient.h @@ -21,7 +21,7 @@ class QSharedMemory; class AssignmentClient : public QCoreApplication { Q_OBJECT public: - AssignmentClient(int &argc, char **argv); + AssignmentClient(int &argc, char **argv, QUuid nodeUUID); static const SharedAssignmentPointer& getCurrentAssignment() { return _currentAssignment; } private slots: @@ -29,13 +29,21 @@ private slots: void readPendingDatagrams(); void assignmentCompleted(); void handleAuthenticationRequest(); + void sendStatsPacketToACM(); private: + void setUpStatsToMonitor(); Assignment _requestAssignment; static SharedAssignmentPointer _currentAssignment; QString _assignmentServerHostname; HifiSockAddr _assignmentServerSocket; - QSharedMemory* _localASPortSharedMem; + QSharedMemory* _localASPortSharedMem; // memory shared with domain server + QSharedMemory* _localACMPortSharedMem; // memory shared with assignment client monitor + QTimer _requestTimer; // timer for requesting and assignment + QTimer _statsTimerACM; // timer for sending stats to assignment client monitor + + protected: + HifiSockAddr _assignmentClientMonitorSocket; }; #endif // hifi_AssignmentClient_h diff --git a/assignment-client/src/AssignmentClientApp.cpp b/assignment-client/src/AssignmentClientApp.cpp new file mode 100644 index 0000000000..4541732e2c --- /dev/null +++ b/assignment-client/src/AssignmentClientApp.cpp @@ -0,0 +1,84 @@ +// +// AssignmentClientapp.cpp +// assignment-client/src +// +// Created by Seth Alves on 2/19/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include + +#include +#include + +#include "Assignment.h" +#include "AssignmentClient.h" +#include "AssignmentClientMonitor.h" +#include "AssignmentClientApp.h" + + +AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) : + QApplication(argc, argv) +{ +# ifndef WIN32 + setvbuf(stdout, NULL, _IOLBF, 0); +# endif + + // use the verbose message handler in Logging + qInstallMessageHandler(LogHandler::verboseMessageHandler); + + // parse command-line + QCommandLineParser parser; + parser.setApplicationDescription("High Fidelity Assignment Client"); + parser.addHelpOption(); + + const QCommandLineOption helpOption = parser.addHelpOption(); + + const QCommandLineOption numChildsOption("n", "number of children to fork", "child-count"); + parser.addOption(numChildsOption); + + const QCommandLineOption idOption("i", "assignment client id", "uuid"); + parser.addOption(idOption); + + if (!parser.parse(QCoreApplication::arguments())) { + qCritical() << parser.errorText() << endl; + parser.showHelp(); + Q_UNREACHABLE(); + } + + if (parser.isSet(helpOption)) { + parser.showHelp(); + Q_UNREACHABLE(); + } + + if (parser.isSet(numChildsOption) && parser.isSet(idOption)) { + qCritical() << "using both -i and -n doesn't make sense."; + parser.showHelp(); + Q_UNREACHABLE(); + } + + unsigned int numForks = 0; + if (parser.isSet(numChildsOption)) { + numForks = parser.value(numChildsOption).toInt(); + } + + QUuid nodeUUID = QUuid::createUuid(); + if (parser.isSet(idOption)) { + nodeUUID = QUuid(parser.value(idOption)); + } + + if (numForks) { + AssignmentClientMonitor monitor(argc, argv, numForks); + monitor.exec(); + } else { + AssignmentClient client(argc, argv, nodeUUID); + client.exec(); + } +} + + +AssignmentClientApp::~AssignmentClientApp() { +} diff --git a/assignment-client/src/AssignmentClientApp.h b/assignment-client/src/AssignmentClientApp.h new file mode 100644 index 0000000000..6c91fa06a3 --- /dev/null +++ b/assignment-client/src/AssignmentClientApp.h @@ -0,0 +1,19 @@ +// +// AssignmentClientapp.h +// assignment-client/src +// +// Created by Seth Alves on 2/19/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include + +class AssignmentClientApp : public QApplication { + Q_OBJECT +public: + AssignmentClientApp(int argc, char* argv[]); + ~AssignmentClientApp(); +}; diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 45e1f56d53..831d50c134 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -14,13 +14,18 @@ #include #include + +#include // XXX need this? + + #include "AssignmentClientMonitor.h" +#include "PacketHeaders.h" const char* NUM_FORKS_PARAMETER = "-n"; const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor"; -AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, int numAssignmentClientForks) : +AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, const unsigned int numAssignmentClientForks) : QCoreApplication(argc, argv) { // start the Logging class with the parent's target name @@ -41,17 +46,38 @@ AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, int num // this removes both the "-n" parameter and the number of forks passed _childArguments.removeAt(forksParameterIndex); _childArguments.removeAt(forksParameterIndex); + + + // create a NodeList so we can receive stats from children + DependencyManager::registerInheritance(); + auto addressManager = DependencyManager::set(); + // auto nodeList = DependencyManager::set(NodeType::Unassigned); + auto nodeList = DependencyManager::set(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT, + DEFAULT_ASSIGNMENT_CLIENT_MONITOR_DTLS_PORT); + + connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClientMonitor::readPendingDatagrams); + + nodeList->putLocalPortIntoSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, this); // use QProcess to fork off a process for each of the child assignment clients - for (int i = 0; i < numAssignmentClientForks; i++) { + for (unsigned int i = 0; i < numAssignmentClientForks; i++) { spawnChildClient(); } + + connect(&_checkSparesTimer, SIGNAL(timeout()), SLOT(checkSpares())); + _checkSparesTimer.start(5000); } AssignmentClientMonitor::~AssignmentClientMonitor() { stopChildProcesses(); + + foreach (AssignmentClientChildData* childStatus, _childStatus) { + delete childStatus; + } } + + void AssignmentClientMonitor::stopChildProcesses() { QList >::Iterator it = _childProcesses.begin(); @@ -74,11 +100,18 @@ void AssignmentClientMonitor::spawnChildClient() { QProcess *assignmentClient = new QProcess(this); _childProcesses.append(QPointer(assignmentClient)); + + QUuid childUUID = QUuid::createUuid(); + + // create a Node for this child. this is done so we can idenitfy packets from unknown children + DependencyManager::get()->addOrUpdateNode + (childUUID, NodeType::Unassigned, HifiSockAddr("localhost", 0), HifiSockAddr("localhost", 0), false); // make sure that the output from the child process appears in our output assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); - - assignmentClient->start(applicationFilePath(), _childArguments); + + QStringList idArgs = QStringList() << "-i" << childUUID.toString(); + assignmentClient->start(applicationFilePath(), _childArguments + idArgs); // link the child processes' finished slot to our childProcessFinished slot connect(assignmentClient, SIGNAL(finished(int, QProcess::ExitStatus)), this, @@ -96,3 +129,105 @@ void AssignmentClientMonitor::childProcessFinished(int exitCode, QProcess::ExitS spawnChildClient(); } + + + +void AssignmentClientMonitor::checkSpares() { + qDebug() << "check spares:"; + + QString aSpareId = ""; + unsigned int spareCount = 0; + + QHash::const_iterator i = _childStatus.constBegin(); + while (i != _childStatus.constEnd()) { + qDebug() << " " << i.key() << i.value()->getChildType(); + if (i.value()->getChildType() == "none") { + spareCount ++; + aSpareId = i.key(); + } + ++i; + } + + qDebug() << "spare count is" << spareCount; + + if (spareCount < 1) { + qDebug() << "FORK"; + spawnChildClient(); + } + + if (spareCount > 1) { + qDebug() << "KILL"; + } +} + + + + +void AssignmentClientMonitor::readPendingDatagrams() { + auto nodeList = DependencyManager::get(); + + QByteArray receivedPacket; + HifiSockAddr senderSockAddr; + + while (nodeList->getNodeSocket().hasPendingDatagrams()) { + receivedPacket.resize(nodeList->getNodeSocket().pendingDatagramSize()); + nodeList->getNodeSocket().readDatagram(receivedPacket.data(), receivedPacket.size(), + senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer()); + + if (nodeList->packetVersionAndHashMatch(receivedPacket)) { + if (packetTypeForPacket(receivedPacket) == PacketTypeNodeJsonStats) { + + QUuid packetUUID = uuidFromPacketHeader(receivedPacket); + // qDebug() << "packetUUID = " << packetUUID; + + SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket); + if (!matchingNode) { + qDebug() << "got packet from unknown child, id =" << packetUUID.toString(); + // tell unknown assignment-client child to exit. + QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); + nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); + } + + if (matchingNode) { + // update our records about how to reach this child + matchingNode->setLocalSocket(senderSockAddr); + + // push past the packet header + QDataStream packetStream(receivedPacket); + packetStream.skipRawData(numBytesForPacketHeader(receivedPacket)); + + QVariantMap unpackedVariantMap; + + packetStream >> unpackedVariantMap; + + QJsonObject unpackedStatsJSON = QJsonObject::fromVariantMap(unpackedVariantMap); + + // qDebug() << "ACM got stats packet, id =" << packetUUID.toString() + // << "type =" << unpackedStatsJSON["assignment_type"]; + + QString key(QString(packetUUID.toString())); + if (_childStatus.contains(key)) { + delete _childStatus[ key ]; + } + + QString childType = unpackedStatsJSON["assignment_type"].toString(); + auto childStatus = new AssignmentClientChildData(childType); + _childStatus[ key ] = childStatus; + + } + } else { + // have the NodeList attempt to handle it + nodeList->processNodeData(senderSockAddr, receivedPacket); + } + } + } +} + + +AssignmentClientChildData::AssignmentClientChildData(QString childType) { + _childType = childType; +} + + +AssignmentClientChildData::~AssignmentClientChildData() { +} diff --git a/assignment-client/src/AssignmentClientMonitor.h b/assignment-client/src/AssignmentClientMonitor.h index 9a7bca9cb3..75d2296533 100644 --- a/assignment-client/src/AssignmentClientMonitor.h +++ b/assignment-client/src/AssignmentClientMonitor.h @@ -20,20 +20,39 @@ extern const char* NUM_FORKS_PARAMETER; +class AssignmentClientChildData { + public: + AssignmentClientChildData(QString childType); + ~AssignmentClientChildData(); + + QString getChildType() { return _childType; } + + private: + QString _childType; + // ... timestamp +}; + + class AssignmentClientMonitor : public QCoreApplication { Q_OBJECT public: - AssignmentClientMonitor(int &argc, char **argv, int numAssignmentClientForks); + AssignmentClientMonitor(int &argc, char **argv, const unsigned int numAssignmentClientForks); ~AssignmentClientMonitor(); void stopChildProcesses(); private slots: void childProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); + void readPendingDatagrams(); + void checkSpares(); + private: void spawnChildClient(); QList > _childProcesses; QStringList _childArguments; + QHash _childStatus; + + QTimer _checkSparesTimer; // every few seconds see if it need fewer or more spare children }; #endif // hifi_AssignmentClientMonitor_h diff --git a/assignment-client/src/main.cpp b/assignment-client/src/main.cpp index 3bf6990a74..81a12526bf 100644 --- a/assignment-client/src/main.cpp +++ b/assignment-client/src/main.cpp @@ -9,34 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include -#include "Assignment.h" -#include "AssignmentClient.h" -#include "AssignmentClientMonitor.h" +#include "AssignmentClientApp.h" int main(int argc, char* argv[]) { -#ifndef WIN32 - setvbuf(stdout, NULL, _IOLBF, 0); -#endif - - // use the verbose message handler in Logging - qInstallMessageHandler(LogHandler::verboseMessageHandler); - - const char* numForksString = getCmdOption(argc, (const char**)argv, NUM_FORKS_PARAMETER); - - int numForks = 0; - - if (numForksString) { - numForks = atoi(numForksString); - } - - if (numForks) { - AssignmentClientMonitor monitor(argc, argv, numForks); - return monitor.exec(); - } else { - AssignmentClient client(argc, argv); - return client.exec(); - } + AssignmentClientApp app(argc, argv); + return 0; } diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index f84722a438..30d6dd4348 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -244,21 +244,9 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) { populateStaticScriptedAssignmentsFromSettings(); auto nodeList = DependencyManager::set(domainServerPort, domainServerDTLSPort); - + // no matter the local port, save it to shared mem so that local assignment clients can ask what it is - QSharedMemory* sharedPortMem = new QSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this); - quint16 localPort = nodeList->getNodeSocket().localPort(); - - // attempt to create the shared memory segment - if (sharedPortMem->create(sizeof(localPort)) || sharedPortMem->attach()) { - sharedPortMem->lock(); - memcpy(sharedPortMem->data(), &localPort, sizeof(localPort)); - sharedPortMem->unlock(); - - qDebug() << "Wrote local listening port" << localPort << "to shared memory at key" << DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY; - } else { - qWarning() << "Failed to create and attach to shared memory to share local port with assignment-client children."; - } + nodeList->putLocalPortIntoSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this); // set our LimitedNodeList UUID to match the UUID from our config // nodes will currently use this to add resources to data-web that relate to our domain diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index c8c454ff14..075fd5a44b 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -669,3 +669,41 @@ void LimitedNodeList::sendHeartbeatToIceServer(const HifiSockAddr& iceServerSock writeUnverifiedDatagram(iceRequestByteArray, iceServerSockAddr); } + +void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* parent) { + // save our local port to shared memory so that assignment client children know how to talk to this parent + QSharedMemory* sharedPortMem = new QSharedMemory(key, parent); + quint16 localPort = getNodeSocket().localPort(); + + // attempt to create the shared memory segment + if (sharedPortMem->create(sizeof(localPort)) || sharedPortMem->attach()) { + sharedPortMem->lock(); + memcpy(sharedPortMem->data(), &localPort, sizeof(localPort)); + sharedPortMem->unlock(); + + qDebug() << "Wrote local listening port" << localPort << "to shared memory at key" << key; + } else { + qWarning() << "Failed to create and attach to shared memory to share local port with assignment-client children."; + } +} + + +bool LimitedNodeList::getLocalPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, + quint16& localPort) { + if (!sharedMem) { + sharedMem = new QSharedMemory(key, this); + + if (!sharedMem->attach(QSharedMemory::ReadOnly)) { + qWarning() << "Could not attach to shared memory at key" << key; + } + } + + if (sharedMem->isAttached()) { + sharedMem->lock(); + memcpy(&localPort, sharedMem->data(), sizeof(localPort)); + sharedMem->unlock(); + return true; + } + + return false; +} diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index 72aefdb2b3..e7ccbe7746 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -25,6 +25,8 @@ #include #include #include +#include + #include #include @@ -49,6 +51,11 @@ const char STUN_SERVER_HOSTNAME[] = "stun.highfidelity.io"; const unsigned short STUN_SERVER_PORT = 3478; const QString DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY = "domain-server.local-port"; +const QString ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY = "assignment-client-monitor.local-port"; + +const char DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME[] = "localhost"; +const unsigned short DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT = 40104; +const unsigned short DEFAULT_ASSIGNMENT_CLIENT_MONITOR_DTLS_PORT = 40105; class HifiSockAddr; @@ -168,6 +175,9 @@ public: return SharedNodePointer(); } + + void putLocalPortIntoSharedMemory(const QString key, QObject* parent); + bool getLocalPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, quint16& localPort); public slots: void reset(); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index f70c2d9b3c..e63f230f6e 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -62,13 +62,17 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned connect(&AccountManager::getInstance(), &AccountManager::logoutComplete , this, &NodeList::reset); } -qint64 NodeList::sendStatsToDomainServer(const QJsonObject& statsObject) { +qint64 NodeList::sendStats(const QJsonObject& statsObject, HifiSockAddr destination) { QByteArray statsPacket = byteArrayWithPopulatedHeader(PacketTypeNodeJsonStats); QDataStream statsPacketStream(&statsPacket, QIODevice::Append); statsPacketStream << statsObject.toVariantMap(); - return writeUnverifiedDatagram(statsPacket, _domainHandler.getSockAddr()); + return writeUnverifiedDatagram(statsPacket, destination); +} + +qint64 NodeList::sendStatsToDomainServer(const QJsonObject& statsObject) { + return sendStats(statsObject, _domainHandler.getSockAddr()); } void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer& sendingNode) { diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h index 907fccfcac..1c6de4bb6c 100644 --- a/libraries/networking/src/NodeList.h +++ b/libraries/networking/src/NodeList.h @@ -47,6 +47,7 @@ public: NodeType_t getOwnerType() const { return _ownerType; } void setOwnerType(NodeType_t ownerType) { _ownerType = ownerType; } + qint64 sendStats(const QJsonObject& statsObject, HifiSockAddr destination); qint64 sendStatsToDomainServer(const QJsonObject& statsObject); int getNumNoReplyDomainCheckIns() const { return _numNoReplyDomainCheckIns; } diff --git a/libraries/networking/src/PacketHeaders.cpp b/libraries/networking/src/PacketHeaders.cpp index 2eee540fff..db97e216ee 100644 --- a/libraries/networking/src/PacketHeaders.cpp +++ b/libraries/networking/src/PacketHeaders.cpp @@ -70,6 +70,8 @@ PacketVersion versionForPacketType(PacketType type) { return 2; case PacketTypeOctreeStats: return 1; + case PacketTypeStopNode: + return 1; case PacketTypeEntityAddOrEdit: case PacketTypeEntityData: return VERSION_MODEL_ENTITIES_SUPPORT_SHAPE_TYPE; @@ -124,6 +126,7 @@ QString nameForPacketType(PacketType type) { PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityErase); PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityAddResponse); PACKET_TYPE_NAME_LOOKUP(PacketTypeOctreeDataNack); + PACKET_TYPE_NAME_LOOKUP(PacketTypeStopNode); PACKET_TYPE_NAME_LOOKUP(PacketTypeAudioEnvironment); PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityEditNack); PACKET_TYPE_NAME_LOOKUP(PacketTypeSignedTransactionPayment); diff --git a/libraries/networking/src/PacketHeaders.h b/libraries/networking/src/PacketHeaders.h index e593955b51..32f33c01d9 100644 --- a/libraries/networking/src/PacketHeaders.h +++ b/libraries/networking/src/PacketHeaders.h @@ -67,7 +67,7 @@ enum PacketType { PacketTypeEntityErase, PacketTypeEntityAddResponse, PacketTypeOctreeDataNack, // 45 - UNUSED_10, + PacketTypeStopNode, PacketTypeAudioEnvironment, PacketTypeEntityEditNack, PacketTypeSignedTransactionPayment, @@ -86,7 +86,7 @@ const QSet NON_VERIFIED_PACKETS = QSet() << PacketTypeNodeJsonStats << PacketTypeEntityQuery << PacketTypeOctreeDataNack << PacketTypeEntityEditNack << PacketTypeIceServerHeartbeat << PacketTypeIceServerHeartbeatResponse - << PacketTypeUnverifiedPing << PacketTypeUnverifiedPingReply; + << PacketTypeUnverifiedPing << PacketTypeUnverifiedPingReply << PacketTypeStopNode; const int NUM_BYTES_MD5_HASH = 16; const int NUM_STATIC_HEADER_BYTES = sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID; From 599ef68df80d00dd816f2ad41e8a68568c6cca94 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 20 Feb 2015 08:26:11 -0800 Subject: [PATCH 114/261] fix for scratchy audio on windows --- interface/src/audio/AudioScope.h | 2 +- libraries/audio-client/src/AudioClient.cpp | 21 +++++++++------------ libraries/audio-client/src/AudioClient.h | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/interface/src/audio/AudioScope.h b/interface/src/audio/AudioScope.h index df902fe7cd..cc9367e2d5 100644 --- a/interface/src/audio/AudioScope.h +++ b/interface/src/audio/AudioScope.h @@ -75,4 +75,4 @@ private: }; -#endif // hifi_AudioScope_h \ No newline at end of file +#endif // hifi_AudioScope_h diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index b427d5ba42..49dd1e1a35 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -85,16 +85,9 @@ AudioClient::AudioClient() : _isStereoInput(false), _outputStarveDetectionStartTimeMsec(0), _outputStarveDetectionCount(0), - _outputBufferSizeFrames("audioOutputBufferSize", - DEFAULT_MAX_FRAMES_OVER_DESIRED), -#ifdef Q_OS_ANDROID - _outputStarveDetectionEnabled("audioOutputStarveDetectionEnabled", - false), -#else + _outputBufferSizeFrames("audioOutputBufferSize", DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES), _outputStarveDetectionEnabled("audioOutputStarveDetectionEnabled", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED), -#endif - _outputStarveDetectionPeriodMsec("audioOutputStarveDetectionPeriod", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD), _outputStarveDetectionThreshold("audioOutputStarveDetectionThreshold", @@ -1089,12 +1082,16 @@ void AudioClient::outputNotify() { } else { _outputStarveDetectionCount += recentUnfulfilled; if (_outputStarveDetectionCount > _outputStarveDetectionThreshold.get()) { - int newOutputBufferSizeFrames = _outputBufferSizeFrames.get() + 1; - qDebug() << "Starve detection threshold met, increasing buffer size to " << newOutputBufferSizeFrames; - setOutputBufferSize(newOutputBufferSizeFrames); - _outputStarveDetectionStartTimeMsec = now; _outputStarveDetectionCount = 0; + + int oldOutputBufferSizeFrames = _outputBufferSizeFrames.get(); + int newOutputBufferSizeFrames = oldOutputBufferSizeFrames + 1; + setOutputBufferSize(newOutputBufferSizeFrames); + newOutputBufferSizeFrames = _outputBufferSizeFrames.get(); + if (newOutputBufferSizeFrames > oldOutputBufferSizeFrames) { + qDebug() << "Starve detection threshold met, increasing buffer size to " << newOutputBufferSizeFrames; + } } } } diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index 0095a885eb..811282c0a1 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -56,8 +56,18 @@ static const int NUM_AUDIO_CHANNELS = 2; static const int DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 3; static const int MIN_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 1; -static const int MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 20; -static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = true; +#ifdef _WIN32 + // WORKAROUND: Some sound devices on Windows (at least 8.1) will get scratchy if their output + // buffer is set too high so we have to limit the number of frames in the buffer. + static const int MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 5; +#else + static const int MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 20; +#endif +#ifdef Q_OS_ANDROID + static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = false; +#else + static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = true; +#endif static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_THRESHOLD = 3; static const quint64 DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD = 10 * 1000; // 10 Seconds From c3dbae1bd3488cc802c5beac88a211923ba51d64 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 20 Feb 2015 09:00:28 -0800 Subject: [PATCH 115/261] remove warning about signed-unsigned comparison --- libraries/audio-client/src/AudioClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index f7777c26a2..6e068e0635 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -1083,7 +1083,7 @@ void AudioClient::outputNotify() { if (recentUnfulfilled > 0) { if (_outputStarveDetectionEnabled.get()) { quint64 now = usecTimestampNow() / 1000; - quint64 dt = now - _outputStarveDetectionStartTimeMsec; + int dt = (int)(now - _outputStarveDetectionStartTimeMsec); if (dt > _outputStarveDetectionPeriodMsec.get()) { _outputStarveDetectionStartTimeMsec = now; _outputStarveDetectionCount = 0; From 5c3cae471be2e0527abfe8eea8ca8a84193c8a6f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 20 Feb 2015 09:48:04 -0800 Subject: [PATCH 116/261] Fix avatar billboards all rendering as the same billboard --- interface/src/avatar/Avatar.cpp | 21 +++++++++------------ interface/src/avatar/Avatar.h | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index d4c10b2b4a..6dc3d4b339 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -537,18 +537,13 @@ void Avatar::renderBillboard() { return; } if (!_billboardTexture) { - QImage image = QImage::fromData(_billboard); - if (image.format() != QImage::Format_ARGB32) { - image = image.convertToFormat(QImage::Format_ARGB32); - } - _billboardTexture.reset(new Texture()); - glBindTexture(GL_TEXTURE_2D, _billboardTexture->getID()); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, - GL_BGRA, GL_UNSIGNED_BYTE, image.constBits()); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - } else { - glBindTexture(GL_TEXTURE_2D, _billboardTexture->getID()); + // Using a unique URL ensures we don't get another avatar's texture from TextureCache + QUrl uniqueUrl = QUrl(QUuid::createUuid().toString()); + _billboardTexture = DependencyManager::get()->getTexture( + uniqueUrl, DEFAULT_TEXTURE, false, _billboard); + } + if (!_billboardTexture->isLoaded()) { + return; } glEnable(GL_ALPHA_TEST); @@ -556,6 +551,8 @@ void Avatar::renderBillboard() { glEnable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); + + glBindTexture(GL_TEXTURE_2D, _billboardTexture->getID()); glPushMatrix(); glTranslatef(_position.x, _position.y, _position.z); diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index 18e42b7dd7..72b7ecf93a 100644 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -234,7 +234,7 @@ protected: private: bool _initialized; - QScopedPointer _billboardTexture; + NetworkTexturePointer _billboardTexture; bool _shouldRenderBillboard; bool _isLookAtTarget; From 94b3c4a3a89623409a6506996a85fd774915068c Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 20 Feb 2015 11:57:37 -0800 Subject: [PATCH 117/261] simpler less draconian workaround --- libraries/audio-client/src/AudioClient.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index 941fcc6c12..7ac445a7fc 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -56,14 +56,8 @@ static const int NUM_AUDIO_CHANNELS = 2; static const int DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 3; static const int MIN_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 1; -#ifdef _WIN32 - // WORKAROUND: Some sound devices on Windows (at least 8.1) will get scratchy if their output - // buffer is set too high so we have to limit the number of frames in the buffer. - static const int MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 5; -#else - static const int MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 20; -#endif -#ifdef Q_OS_ANDROID +static const int MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 20; +#if defined(Q_OS_ANDROID) || defined(Q_OS_WIN) static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = false; #else static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = true; From abfebf51f541e4c2d08b2cb92deb565f8329c76d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 12:17:42 -0800 Subject: [PATCH 118/261] handle install name change on OS X for TBB --- cmake/externals/tbb/AndroidTBBLibCopy.cmake | 2 +- cmake/externals/tbb/CMakeLists.txt | 11 ++++ .../tbb/OSXTBBInstallNameChange.cmake | 59 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 cmake/externals/tbb/OSXTBBInstallNameChange.cmake diff --git a/cmake/externals/tbb/AndroidTBBLibCopy.cmake b/cmake/externals/tbb/AndroidTBBLibCopy.cmake index 733ee00124..1c7697ab54 100644 --- a/cmake/externals/tbb/AndroidTBBLibCopy.cmake +++ b/cmake/externals/tbb/AndroidTBBLibCopy.cmake @@ -1,6 +1,6 @@ # # AndroidTBBLibCopy.cmake -# cmake/macros +# cmake/externals/tbb # # Copyright 2015 High Fidelity, Inc. # Created by Stephen Birarda on February 18, 2014 diff --git a/cmake/externals/tbb/CMakeLists.txt b/cmake/externals/tbb/CMakeLists.txt index 56997db490..06da60ac04 100644 --- a/cmake/externals/tbb/CMakeLists.txt +++ b/cmake/externals/tbb/CMakeLists.txt @@ -48,6 +48,17 @@ if (APPLE) set(_TBB_LIB_DIR "${SOURCE_DIR}/lib/libc++") set(_LIB_PREFIX "lib") set(_LIB_EXT "dylib") + + ExternalProject_Add_Step( + ${EXTERNAL_NAME} + change-install-name + COMMENT "Calling install_name_tool on TBB libraries to fix install name for dylib linking" + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/OSXTBBInstallNameChange.cmake + DEPENDEES install + WORKING_DIRECTORY + LOG 1 + ) + elseif (WIN32) set(_TBB_LIB_DIR "${SOURCE_DIR}/lib/ia32/vc12") set(_LIB_EXT "lib") diff --git a/cmake/externals/tbb/OSXTBBInstallNameChange.cmake b/cmake/externals/tbb/OSXTBBInstallNameChange.cmake new file mode 100644 index 0000000000..c263ed7d2e --- /dev/null +++ b/cmake/externals/tbb/OSXTBBInstallNameChange.cmake @@ -0,0 +1,59 @@ +# +# OSXTBBInstallNameChange.cmake +# cmake/externals/tbb +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 20, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +# first find the so files in the source dir +set(_TBB_LIBRARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/libc++) +file(GLOB_RECURSE _TBB_LIBRARIES "${_TBB_LIBRARY_DIR}/*.dylib") + +# raise an error if we found none +if (NOT _TBB_LIBRARIES) + message(FATAL_ERROR "Did not find any TBB libraries") +endif () + +# find the install_name_tool command +find_program(INSTALL_NAME_TOOL_COMMAND NAMES install_name_tool DOC "Path to the install_name_tool command") + +# find the lipo command +find_program(LIPO_COMMAND NAMES lipo DOC "Path to the lipo command") + +# enumerate the libraries +foreach(_TBB_LIBRARY ${_TBB_LIBRARIES}) + get_filename_component(_TBB_LIBRARY_FILENAME ${_TBB_LIBRARY} NAME) + + set(_LIPO_ARGS -remove i386 ${_TBB_LIBRARY_FILENAME} -output ${_TBB_LIBRARY_FILENAME}) + message(STATUS "${LIPO_COMMAND} ${_LIPO_ARGS}") + + # first we use lipo to remove i386 from each dylib + execute_process( + COMMAND ${LIPO_COMMAND} ${_LIPO_ARGS} + WORKING_DIRECTORY ${_TBB_LIBRARY_DIR} + ERROR_VARIABLE _LIPO_ERROR + ) + + if (_LIPO_ERROR) + message(FATAL_ERROR "There was an error removing i386 for ${_TBB_LIBRARY_FILENAME} - ${_LIPO_ERROR}") + endif () + + set(_INSTALL_NAME_ARGS ${INSTALL_NAME_TOOL_COMMAND} -id ${_TBB_LIBRARY} ${_TBB_LIBRARY_FILENAME}) + + message(STATUS "${INSTALL_NAME_COMMAND} ${_INSTALL_NAME_ARGS}") + + execute_process( + COMMAND ${INSTALL_NAME_COMMAND} ${_INSTALL_NAME_ARGS} + WORKING_DIRECTORY ${_TBB_LIBRARY_DIR} + ERROR_VARIABLE _INSTALL_NAME_ERROR + ) + + if (_INSTALL_NAME_ERROR) + message(FATAL_ERROR "There was an error changing install name for ${_TBB_LIBRARY_FILENAME} - ${_INSTALL_NAME_ERROR}") + endif () +endforeach() + From 0bad8db1a0f794a1ad9e4c2d0977f2045c95c362 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 12:17:58 -0800 Subject: [PATCH 119/261] fix missing dependencies to external projects --- cmake/macros/AddDependencyExternalProjects.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index f9ba91e1cb..464652a5b7 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -18,7 +18,7 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) # has the user told us they specific don't want this as an external project? if (NOT DEFINED GET_${_PROJ_NAME_UPPER} OR GET_${_PROJ_NAME_UPPER}) # have we already detected we can't have this as external project on this OS? - if (NOT DEFINED ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT OR ${EXTERNAL_NAME_UPPER}_EXTERNAL_PROJECT) + if (NOT DEFINED ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT OR ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT) # have we already setup the target? if (NOT TARGET ${_PROJ_NAME}) add_subdirectory(${EXTERNAL_PROJECT_DIR}/${_PROJ_NAME} ${EXTERNALS_BINARY_DIR}/${_PROJ_NAME}) From a85cb2eeaade9d4f80e929a96b1fcf75a9b483ab Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 12:18:14 -0800 Subject: [PATCH 120/261] don't log glm install so it is shown in log --- assignment-client/CMakeLists.txt | 2 +- cmake/externals/glm/CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 41343f52d0..ada534431a 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -17,4 +17,4 @@ if (UNIX) target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS}) endif (UNIX) -copy_dlls_beside_windows_executable() +copy_dlls_beside_windows_executable() \ No newline at end of file diff --git a/cmake/externals/glm/CMakeLists.txt b/cmake/externals/glm/CMakeLists.txt index eda9e0df98..6e5b1ef870 100644 --- a/cmake/externals/glm/CMakeLists.txt +++ b/cmake/externals/glm/CMakeLists.txt @@ -10,7 +10,6 @@ ExternalProject_Add( LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 - LOG_INSTALL 1 ) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) From b7cc163ca4b6186491c1316641d06f9652c94969 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 12:21:10 -0800 Subject: [PATCH 121/261] lib paths is actually a string --- cmake/macros/AddPathsToLibPaths.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index d92a339ba7..07c143a9dd 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -17,6 +17,6 @@ macro(ADD_PATHS_TO_LIB_PATHS) list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) - set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE LIST FORCE) + set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE STRING FORCE) endforeach() endmacro() \ No newline at end of file From 32fa2e8d31370bd9dab586c5665cce645446642a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 12:24:17 -0800 Subject: [PATCH 122/261] add missing docstring to AddPathsToLibPaths --- cmake/macros/AddPathsToLibPaths.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake index 07c143a9dd..7ac31db83f 100644 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ b/cmake/macros/AddPathsToLibPaths.cmake @@ -17,6 +17,6 @@ macro(ADD_PATHS_TO_LIB_PATHS) list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) - set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE STRING FORCE) + set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE STRING "Paths for external libraries passed to fixup_bundle" FORCE) endforeach() endmacro() \ No newline at end of file From feb0e7ac31a7f6c8950278b35163c01e5079ee64 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 13:26:59 -0800 Subject: [PATCH 123/261] AssignmentClientMonitor doesn't keep a list of its children. Instead it knows about active children due to their entries in the NodeList. Every few seconds, if 2 or more children are idle, the Monitor will ask one to exit --- assignment-client/src/AssignmentClient.cpp | 42 ++++-- assignment-client/src/AssignmentClient.h | 3 +- assignment-client/src/AssignmentClientApp.cpp | 18 +-- assignment-client/src/AssignmentClientApp.h | 2 +- .../src/AssignmentClientMonitor.cpp | 134 +++++++----------- .../src/AssignmentClientMonitor.h | 14 +- libraries/networking/src/AddressManager.cpp | 4 +- 7 files changed, 99 insertions(+), 118 deletions(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index 9098a258e7..a0304acad9 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +// #include #include #include #include @@ -41,7 +41,7 @@ SharedAssignmentPointer AssignmentClient::_currentAssignment; int hifiSockAddrMeta = qRegisterMetaType("HifiSockAddr"); -AssignmentClient::AssignmentClient(int &argc, char **argv, QUuid nodeUUID) : +AssignmentClient::AssignmentClient(int &argc, char **argv) : QCoreApplication(argc, argv), _assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME), _localASPortSharedMem(NULL), @@ -58,8 +58,11 @@ AssignmentClient::AssignmentClient(int &argc, char **argv, QUuid nodeUUID) : DependencyManager::registerInheritance(); auto addressManager = DependencyManager::set(); auto nodeList = DependencyManager::set(NodeType::Unassigned); - auto avatarHashMap = DependencyManager::set(); + // auto avatarHashMap = DependencyManager::set(); + // make up a uuid for this child so the parent can tell us apart. This id will be changed + // when the domain server hands over an assignment. + QUuid nodeUUID = QUuid::createUuid(); nodeList->setSessionUUID(nodeUUID); // setup a shutdown event listener to handle SIGTERM or WM_CLOSE for us @@ -139,11 +142,37 @@ AssignmentClient::AssignmentClient(int &argc, char **argv, QUuid nodeUUID) : // Create Singleton objects on main thread NetworkAccessManager::getInstance(); + // DependencyManager::get(); setUpStatsToMonitor(); } +void AssignmentClient::stopAssignmentClient() { + + // QList threads = QObject::findChildren (); + // foreach(QThread *thread, threads) { // or FileUploader* fileuploader, fileUploaders_ ? + // qDebug() << "thread " << thread->currentThreadId(); + // } + + qDebug() << "Exiting."; + + _requestTimer.stop(); + _statsTimerACM.stop(); + + + // DependencyManager::get()->disconnect(); + // DependencyManager::get()->disconnectNotify(); + // DependencyManager::get()->disconnect(); + // DependencyManager::get()->disconnectNotify(); + + // DependencyManager::destroy(); + // DependencyManager::destroy(); + + quit(); +} + + void AssignmentClient::setUpStatsToMonitor() { // Figure out the address to send out stats to quint16 localMonitorServerPort = DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT; @@ -249,15 +278,12 @@ void AssignmentClient::readPendingDatagrams() { qDebug() << "Received an assignment that could not be unpacked. Re-requesting."; } } else if (packetTypeForPacket(receivedPacket) == PacketTypeStopNode) { - qDebug() << "Network told me to exit"; - quit(); + qDebug() << "Network told me to exit."; + emit stopAssignmentClient(); } else { - qDebug() << "punt"; // have the NodeList attempt to handle it nodeList->processNodeData(senderSockAddr, receivedPacket); } - } else { - qDebug() << "packetVersionAndHashMatch said no"; } } } diff --git a/assignment-client/src/AssignmentClient.h b/assignment-client/src/AssignmentClient.h index 7f0f16e6d6..e105309e10 100644 --- a/assignment-client/src/AssignmentClient.h +++ b/assignment-client/src/AssignmentClient.h @@ -21,7 +21,7 @@ class QSharedMemory; class AssignmentClient : public QCoreApplication { Q_OBJECT public: - AssignmentClient(int &argc, char **argv, QUuid nodeUUID); + AssignmentClient(int &argc, char **argv); static const SharedAssignmentPointer& getCurrentAssignment() { return _currentAssignment; } private slots: @@ -30,6 +30,7 @@ private slots: void assignmentCompleted(); void handleAuthenticationRequest(); void sendStatsPacketToACM(); + void stopAssignmentClient(); private: void setUpStatsToMonitor(); diff --git a/assignment-client/src/AssignmentClientApp.cpp b/assignment-client/src/AssignmentClientApp.cpp index 4541732e2c..8848b59c49 100644 --- a/assignment-client/src/AssignmentClientApp.cpp +++ b/assignment-client/src/AssignmentClientApp.cpp @@ -21,7 +21,7 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) : - QApplication(argc, argv) + QCoreApplication(argc, argv) { # ifndef WIN32 setvbuf(stdout, NULL, _IOLBF, 0); @@ -40,9 +40,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) : const QCommandLineOption numChildsOption("n", "number of children to fork", "child-count"); parser.addOption(numChildsOption); - const QCommandLineOption idOption("i", "assignment client id", "uuid"); - parser.addOption(idOption); - if (!parser.parse(QCoreApplication::arguments())) { qCritical() << parser.errorText() << endl; parser.showHelp(); @@ -54,27 +51,16 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) : Q_UNREACHABLE(); } - if (parser.isSet(numChildsOption) && parser.isSet(idOption)) { - qCritical() << "using both -i and -n doesn't make sense."; - parser.showHelp(); - Q_UNREACHABLE(); - } - unsigned int numForks = 0; if (parser.isSet(numChildsOption)) { numForks = parser.value(numChildsOption).toInt(); } - QUuid nodeUUID = QUuid::createUuid(); - if (parser.isSet(idOption)) { - nodeUUID = QUuid(parser.value(idOption)); - } - if (numForks) { AssignmentClientMonitor monitor(argc, argv, numForks); monitor.exec(); } else { - AssignmentClient client(argc, argv, nodeUUID); + AssignmentClient client(argc, argv); client.exec(); } } diff --git a/assignment-client/src/AssignmentClientApp.h b/assignment-client/src/AssignmentClientApp.h index 6c91fa06a3..09952ad19c 100644 --- a/assignment-client/src/AssignmentClientApp.h +++ b/assignment-client/src/AssignmentClientApp.h @@ -11,7 +11,7 @@ #include -class AssignmentClientApp : public QApplication { +class AssignmentClientApp : public QCoreApplication { Q_OBJECT public: AssignmentClientApp(int argc, char* argv[]); diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 831d50c134..94975b0a4d 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -20,6 +20,7 @@ #include "AssignmentClientMonitor.h" #include "PacketHeaders.h" +#include "SharedUtil.h" const char* NUM_FORKS_PARAMETER = "-n"; @@ -70,85 +71,49 @@ AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, const u AssignmentClientMonitor::~AssignmentClientMonitor() { stopChildProcesses(); - - foreach (AssignmentClientChildData* childStatus, _childStatus) { - delete childStatus; - } } - - void AssignmentClientMonitor::stopChildProcesses() { - - QList >::Iterator it = _childProcesses.begin(); - while (it != _childProcesses.end()) { - if (!it->isNull()) { - qDebug() << "Monitor is terminating child process" << it->data(); - - // don't re-spawn this child when it goes down - disconnect(it->data(), 0, this, 0); - - it->data()->terminate(); - it->data()->waitForFinished(); - } - - it = _childProcesses.erase(it); - } + auto nodeList = DependencyManager::get(); + + nodeList->eachNode([&](const SharedNodePointer& node){ + qDebug() << "asking child" << node->getUUID() << "to exit."; + node->activateLocalSocket(); + QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); + nodeList->writeUnverifiedDatagram(diePacket, *node->getActiveSocket()); + }); } void AssignmentClientMonitor::spawnChildClient() { QProcess *assignmentClient = new QProcess(this); - _childProcesses.append(QPointer(assignmentClient)); - - QUuid childUUID = QUuid::createUuid(); - - // create a Node for this child. this is done so we can idenitfy packets from unknown children - DependencyManager::get()->addOrUpdateNode - (childUUID, NodeType::Unassigned, HifiSockAddr("localhost", 0), HifiSockAddr("localhost", 0), false); - // make sure that the output from the child process appears in our output assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); - QStringList idArgs = QStringList() << "-i" << childUUID.toString(); - assignmentClient->start(applicationFilePath(), _childArguments + idArgs); - - // link the child processes' finished slot to our childProcessFinished slot - connect(assignmentClient, SIGNAL(finished(int, QProcess::ExitStatus)), this, - SLOT(childProcessFinished(int, QProcess::ExitStatus))); - + assignmentClient->start(applicationFilePath(), _childArguments); qDebug() << "Spawned a child client with PID" << assignmentClient->pid(); } -void AssignmentClientMonitor::childProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) { - qDebug("Replacing dead child assignment client with a new one"); - - // remove the old process from our list of child processes - qDebug() << "need to remove" << QPointer(qobject_cast(sender())); - _childProcesses.removeOne(QPointer(qobject_cast(sender()))); - - spawnChildClient(); -} - - void AssignmentClientMonitor::checkSpares() { - qDebug() << "check spares:"; - - QString aSpareId = ""; + auto nodeList = DependencyManager::get(); + QUuid aSpareId = ""; unsigned int spareCount = 0; - QHash::const_iterator i = _childStatus.constBegin(); - while (i != _childStatus.constEnd()) { - qDebug() << " " << i.key() << i.value()->getChildType(); - if (i.value()->getChildType() == "none") { - spareCount ++; - aSpareId = i.key(); - } - ++i; - } + nodeList->removeSilentNodes(); - qDebug() << "spare count is" << spareCount; + qDebug() << "check spares:"; + + nodeList->eachNode([&](const SharedNodePointer& node){ + AssignmentClientChildData *childData = static_cast(node->getLinkedData()); + qDebug() << " " << node->getUUID() << childData->getChildType(); + if (childData->getChildType() == "none") { + spareCount ++; + aSpareId = node->getUUID(); + } + }); + + qDebug() << " spare count is" << spareCount; if (spareCount < 1) { qDebug() << "FORK"; @@ -156,13 +121,16 @@ void AssignmentClientMonitor::checkSpares() { } if (spareCount > 1) { - qDebug() << "KILL"; + // kill aSpareId + qDebug() << "asking child" << aSpareId << "to exit."; + SharedNodePointer childNode = nodeList->nodeWithUUID(aSpareId); + childNode->activateLocalSocket(); + QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); + nodeList->writeUnverifiedDatagram(diePacket, childNode); } } - - void AssignmentClientMonitor::readPendingDatagrams() { auto nodeList = DependencyManager::get(); @@ -176,16 +144,21 @@ void AssignmentClientMonitor::readPendingDatagrams() { if (nodeList->packetVersionAndHashMatch(receivedPacket)) { if (packetTypeForPacket(receivedPacket) == PacketTypeNodeJsonStats) { - QUuid packetUUID = uuidFromPacketHeader(receivedPacket); - // qDebug() << "packetUUID = " << packetUUID; - SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket); if (!matchingNode) { - qDebug() << "got packet from unknown child, id =" << packetUUID.toString(); - // tell unknown assignment-client child to exit. - QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); - nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); + // XXX only do this if from local machine + if (!packetUUID.isNull()) { + matchingNode = DependencyManager::get()->addOrUpdateNode + (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false); + AssignmentClientChildData *childData = new AssignmentClientChildData("unknown"); + matchingNode->setLinkedData(childData); + } else { + // tell unknown assignment-client child to exit. + qDebug() << "asking unknown child to exit."; + QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); + nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); + } } if (matchingNode) { @@ -195,25 +168,18 @@ void AssignmentClientMonitor::readPendingDatagrams() { // push past the packet header QDataStream packetStream(receivedPacket); packetStream.skipRawData(numBytesForPacketHeader(receivedPacket)); - + // decode json QVariantMap unpackedVariantMap; - packetStream >> unpackedVariantMap; - QJsonObject unpackedStatsJSON = QJsonObject::fromVariantMap(unpackedVariantMap); - // qDebug() << "ACM got stats packet, id =" << packetUUID.toString() - // << "type =" << unpackedStatsJSON["assignment_type"]; - - QString key(QString(packetUUID.toString())); - if (_childStatus.contains(key)) { - delete _childStatus[ key ]; - } - + // get child's assignment type out of the decoded json QString childType = unpackedStatsJSON["assignment_type"].toString(); - auto childStatus = new AssignmentClientChildData(childType); - _childStatus[ key ] = childStatus; - + AssignmentClientChildData *childData = + static_cast(matchingNode->getLinkedData()); + childData->setChildType(childType); + // note when this child talked + matchingNode->setLastHeardMicrostamp(usecTimestampNow()); } } else { // have the NodeList attempt to handle it diff --git a/assignment-client/src/AssignmentClientMonitor.h b/assignment-client/src/AssignmentClientMonitor.h index 75d2296533..a91dfa93cc 100644 --- a/assignment-client/src/AssignmentClientMonitor.h +++ b/assignment-client/src/AssignmentClientMonitor.h @@ -15,21 +15,25 @@ #include #include #include +#include #include extern const char* NUM_FORKS_PARAMETER; -class AssignmentClientChildData { +class AssignmentClientChildData : public NodeData { public: AssignmentClientChildData(QString childType); ~AssignmentClientChildData(); QString getChildType() { return _childType; } + void setChildType(QString childType) { _childType = childType; } + + // implement parseData to return 0 so we can be a subclass of NodeData + int parseData(const QByteArray& packet) { return 0; } private: QString _childType; - // ... timestamp }; @@ -41,17 +45,15 @@ public: void stopChildProcesses(); private slots: - void childProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); + // void childProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void readPendingDatagrams(); void checkSpares(); private: void spawnChildClient(); - QList > _childProcesses; + // QList > _childProcesses; QStringList _childArguments; - QHash _childStatus; - QTimer _checkSparesTimer; // every few seconds see if it need fewer or more spare children }; diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 9bcdcbe9a4..f67abdca2b 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -76,7 +76,7 @@ const QString AddressManager::currentPath(bool withOrientation) const { pathString += "/" + orientationString; } else { qDebug() << "Cannot add orientation to path without a getter for position." - << "Call AdressManager::setOrientationGetter to pass a function that will return a glm::quat"; + << "Call AddressManager::setOrientationGetter to pass a function that will return a glm::quat"; } } @@ -84,7 +84,7 @@ const QString AddressManager::currentPath(bool withOrientation) const { return pathString; } else { qDebug() << "Cannot create address path without a getter for position." - << "Call AdressManager::setPositionGetter to pass a function that will return a const glm::vec3&"; + << "Call AddressManager::setPositionGetter to pass a function that will return a const glm::vec3&"; return QString(); } } From 56d237ae8bdaa7df60785b7538ddd42e36cfd8e0 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 13:28:24 -0800 Subject: [PATCH 124/261] cleanups --- assignment-client/src/AssignmentClient.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index a0304acad9..f0461663a7 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -18,7 +18,6 @@ #include #include #include -// #include #include #include #include @@ -149,26 +148,9 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : void AssignmentClient::stopAssignmentClient() { - - // QList threads = QObject::findChildren (); - // foreach(QThread *thread, threads) { // or FileUploader* fileuploader, fileUploaders_ ? - // qDebug() << "thread " << thread->currentThreadId(); - // } - qDebug() << "Exiting."; - _requestTimer.stop(); _statsTimerACM.stop(); - - - // DependencyManager::get()->disconnect(); - // DependencyManager::get()->disconnectNotify(); - // DependencyManager::get()->disconnect(); - // DependencyManager::get()->disconnectNotify(); - - // DependencyManager::destroy(); - // DependencyManager::destroy(); - quit(); } From bd3d7124e299280ef5e2993e7131672873994f67 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 13:31:58 -0800 Subject: [PATCH 125/261] cleanups --- assignment-client/src/AssignmentClient.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index f0461663a7..b9f6afa5d3 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -57,7 +57,6 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : DependencyManager::registerInheritance(); auto addressManager = DependencyManager::set(); auto nodeList = DependencyManager::set(NodeType::Unassigned); - // auto avatarHashMap = DependencyManager::set(); // make up a uuid for this child so the parent can tell us apart. This id will be changed // when the domain server hands over an assignment. @@ -141,8 +140,8 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : // Create Singleton objects on main thread NetworkAccessManager::getInstance(); - // DependencyManager::get(); + // Hook up a timer to send this child's status to the Monitor once per second setUpStatsToMonitor(); } From 907be67135719e4e6ba01c4f10487db8a083e71f Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 13:34:51 -0800 Subject: [PATCH 126/261] cleanups --- assignment-client/src/AssignmentClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index b9f6afa5d3..465078099f 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -193,7 +193,7 @@ void AssignmentClient::sendAssignmentRequest() { localAssignmentServerPort)) { if (localAssignmentServerPort != _assignmentServerSocket.getPort()) { qDebug() << "Port for local assignment server read from shared memory is" - << localAssignmentServerPort; + << localAssignmentServerPort; _assignmentServerSocket.setPort(localAssignmentServerPort); nodeList->setAssignmentServerSocket(_assignmentServerSocket); @@ -203,7 +203,7 @@ void AssignmentClient::sendAssignmentRequest() { qDebug () << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort(); } } - + nodeList->sendAssignment(_requestAssignment); } } From 4bba4fc387ab9c83547d65a4fd2531d3a2334607 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 13:44:37 -0800 Subject: [PATCH 127/261] cleanups --- assignment-client/src/AssignmentClient.cpp | 2 +- assignment-client/src/AssignmentClientMonitor.cpp | 15 +++++---------- assignment-client/src/AssignmentClientMonitor.h | 3 --- domain-server/src/DomainServer.cpp | 2 +- libraries/networking/src/LimitedNodeList.h | 3 +-- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index 465078099f..cf4b305bb0 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -203,7 +203,7 @@ void AssignmentClient::sendAssignmentRequest() { qDebug () << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort(); } } - + nodeList->sendAssignment(_requestAssignment); } } diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 94975b0a4d..32830e2bb3 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -13,10 +13,7 @@ #include #include - - -#include // XXX need this? - +#include #include "AssignmentClientMonitor.h" #include "PacketHeaders.h" @@ -52,7 +49,6 @@ AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, const u // create a NodeList so we can receive stats from children DependencyManager::registerInheritance(); auto addressManager = DependencyManager::set(); - // auto nodeList = DependencyManager::set(NodeType::Unassigned); auto nodeList = DependencyManager::set(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT, DEFAULT_ASSIGNMENT_CLIENT_MONITOR_DTLS_PORT); @@ -89,7 +85,7 @@ void AssignmentClientMonitor::spawnChildClient() { // make sure that the output from the child process appears in our output assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); - + assignmentClient->start(applicationFilePath(), _childArguments); qDebug() << "Spawned a child client with PID" << assignmentClient->pid(); } @@ -102,8 +98,6 @@ void AssignmentClientMonitor::checkSpares() { nodeList->removeSilentNodes(); - qDebug() << "check spares:"; - nodeList->eachNode([&](const SharedNodePointer& node){ AssignmentClientChildData *childData = static_cast(node->getLinkedData()); qDebug() << " " << node->getUUID() << childData->getChildType(); @@ -113,10 +107,11 @@ void AssignmentClientMonitor::checkSpares() { } }); - qDebug() << " spare count is" << spareCount; + if (spareCount != 1) { + qDebug() << " spare count is" << spareCount; + } if (spareCount < 1) { - qDebug() << "FORK"; spawnChildClient(); } diff --git a/assignment-client/src/AssignmentClientMonitor.h b/assignment-client/src/AssignmentClientMonitor.h index a91dfa93cc..8055b5d81f 100644 --- a/assignment-client/src/AssignmentClientMonitor.h +++ b/assignment-client/src/AssignmentClientMonitor.h @@ -45,14 +45,11 @@ public: void stopChildProcesses(); private slots: - // void childProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void readPendingDatagrams(); void checkSpares(); private: void spawnChildClient(); - // QList > _childProcesses; - QStringList _childArguments; QTimer _checkSparesTimer; // every few seconds see if it need fewer or more spare children }; diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 30d6dd4348..64e0d335b1 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -244,7 +244,7 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) { populateStaticScriptedAssignmentsFromSettings(); auto nodeList = DependencyManager::set(domainServerPort, domainServerDTLSPort); - + // no matter the local port, save it to shared mem so that local assignment clients can ask what it is nodeList->putLocalPortIntoSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this); diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index e7ccbe7746..b53287562b 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -25,9 +25,8 @@ #include #include #include -#include - #include +#include #include From 5e264f8241f7e6e8055def0fc1ae0c6604f18339 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 13:47:38 -0800 Subject: [PATCH 128/261] add GLEW as dependency external project --- BUILD_WIN.md | 20 +------------------- cmake/externals/glew/CMakeLists.txt | 26 ++++++++++++++++++++++++++ cmake/modules/FindGLEW.cmake | 15 +++++++++------ interface/CMakeLists.txt | 8 +++----- libraries/gpu/CMakeLists.txt | 8 ++------ libraries/render-utils/CMakeLists.txt | 7 +------ tests/render-utils/CMakeLists.txt | 5 ----- 7 files changed, 42 insertions(+), 47 deletions(-) create mode 100644 cmake/externals/glew/CMakeLists.txt diff --git a/BUILD_WIN.md b/BUILD_WIN.md index f6d484fcd1..6956abbc5f 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -1,9 +1,5 @@ Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only Windows specific instructions are found in this file. -###Windows Specific Dependencies -* [GLEW](http://glew.sourceforge.net/) ~> 1.10.0 -* (remember that you need all other dependencies listed in [BUILD.md](BUILD.md)) - ###Visual Studio 2013 You can use the Community or Professional editions of Visual Studio 2013. @@ -44,18 +40,10 @@ We use CMake's `fixup_bundle` to find the DLLs all of our exectuable targets req The recommended route for CMake to find the external dependencies is to place all of the dependencies in one folder and set one ENV variable - HIFI_LIB_DIR. That ENV variable should point to a directory with the following structure: root_lib_dir - -> glew - -> bin - -> include - -> lib -> openssl -> bin -> include -> lib - -> zlib - -> include - -> lib - -> test For many of the external libraries where precompiled binaries are readily available you should be able to simply copy the extracted folder that you get from the download links provided at the top of the guide. Otherwise you may need to build from source and install the built product to this directory. The `root_lib_dir` in the above example can be wherever you choose on your system - as long as the environment variable HIFI_LIB_DIR is set to it. From here on, whenever you see %HIFI_LIB_DIR% you should substitute the directory that you chose. @@ -79,16 +67,10 @@ To prevent these problems, install OpenSSL yourself. Download the following bina Install OpenSSL into the Windows system directory, to make sure that Qt uses the version that you've just installed, and not some other version. -####GLEW - -Download the binary package: `glew-1.10.0-win32.zip`. Extract to %HIFI_LIB_DIR%\glew (you'll need to rename the default directory name). - -Add to the PATH: `%HIFI_LIB_DIR%\glew\bin\Release\Win32` - ###Build High Fidelity using Visual Studio Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake. - cmake .. -DZLIB_LIBRARY=%ZLIB_LIBRARY% -DZLIB_INCLUDE_DIR=%ZLIB_INCLUDE_DIR% -G "Visual Studio 12" + cmake .. -G "Visual Studio 12" Open %HIFI_DIR%\build\hifi.sln and compile. diff --git a/cmake/externals/glew/CMakeLists.txt b/cmake/externals/glew/CMakeLists.txt new file mode 100644 index 0000000000..ca0311cff5 --- /dev/null +++ b/cmake/externals/glew/CMakeLists.txt @@ -0,0 +1,26 @@ +if (WIN32) + set(EXTERNAL_NAME glm) + + include(ExternalProject) + ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://hifi-public.s3.amazonaws.com/dependencies/glew-1.10.0-win32.zip + URL_MD5 37514e4e595a3b3dc587eee8f7e8ec2f + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD 1 + ) + + ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) + + string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE PATH "List of glew include directories") + + set(_LIB_DIR ${SOURCE_DIR}/lib/Release/Win32) + + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_LIB_DIR}/glew32s.lib CACHE FILEPATH "Location of GLEW release library") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_LIB_DIR}/glew32sd.lib CACHE FILEPATH "Location of GLEW debug library") + + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/bin/Release/Win32 CACHE FILEPATH "Location of GLEW DLL") +endif () \ No newline at end of file diff --git a/cmake/modules/FindGLEW.cmake b/cmake/modules/FindGLEW.cmake index 363f346d09..14ea8e52db 100644 --- a/cmake/modules/FindGLEW.cmake +++ b/cmake/modules/FindGLEW.cmake @@ -27,13 +27,16 @@ if (WIN32) find_library(GLEW_LIBRARY_RELEASE glew32s PATH_SUFFIXES "lib/Release/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS}) find_library(GLEW_LIBRARY_DEBUG glew32sd PATH_SUFFIXES "lib/Debug/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS}) + find_path(GLEW_DLL_PATH glew32.dll PATH_SUFFIXES "bin/Release/Win32" HINTS ${GLEW_SEARCH_DIRS}) + include(SelectLibraryConfigurations) select_library_configurations(GLEW) + + set(GLEW_LIBRARIES ${GLEW_LIBRARY}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDE_DIRS GLEW_LIBRARIES GLEW_DLL_PATH) + + add_paths_to_lib_paths(${GLEW_DLL_PATH}) endif () -set(GLEW_LIBRARIES ${GLEW_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDE_DIRS GLEW_LIBRARIES) - -mark_as_advanced(GLEW_INCLUDE_DIRS GLEW_LIBRARIES GLEW_SEARCH_DIRS) \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index fb29667e09..446a816d1b 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -219,13 +219,11 @@ else (APPLE) # link target to external libraries if (WIN32) + add_dependency_external_projects(glew) find_package(GLEW REQUIRED) - include_directories(${GLEW_INCLUDE_DIRS}) + target_include_directories(${TARGET_NAME} PRIVATE ${GLEW_INCLUDE_DIRS}) - # we're using static GLEW, so define GLEW_STATIC - add_definitions(-DGLEW_STATIC) - - target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARIES} "${NSIGHT_LIBRARIES}" wsock32.lib opengl32.lib Winmm.lib) + target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARIES} ${NSIGHT_LIBRARIES} wsock32.lib opengl32.lib Winmm.lib) # try to find the Nsight package and add it to the build if we find it find_package(NSIGHT) diff --git a/libraries/gpu/CMakeLists.txt b/libraries/gpu/CMakeLists.txt index 6e7a38f594..7b1d6e743a 100644 --- a/libraries/gpu/CMakeLists.txt +++ b/libraries/gpu/CMakeLists.txt @@ -11,15 +11,11 @@ if (APPLE) target_link_libraries(${TARGET_NAME} ${OpenGL}) elseif (WIN32) + add_dependency_external_projects(glew) find_package(GLEW REQUIRED) - include_directories(${GLEW_INCLUDE_DIRS}) - - # we're using static GLEW, so define GLEW_STATIC - add_definitions(-DGLEW_STATIC) + target_include_directories(${TARGET_NAME} PUBLIC ${GLEW_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARIES} opengl32.lib) - - target_include_directories(${TARGET_NAME} PUBLIC ${GLEW_INCLUDE_DIRS}) # try to find the Nsight package and add it to the build if we find it find_package(NSIGHT) diff --git a/libraries/render-utils/CMakeLists.txt b/libraries/render-utils/CMakeLists.txt index b266c001e4..9a08b8c7ed 100644 --- a/libraries/render-utils/CMakeLists.txt +++ b/libraries/render-utils/CMakeLists.txt @@ -12,9 +12,4 @@ add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -link_hifi_libraries(animation fbx shared gpu) - -if (WIN32) - # we're using static GLEW, so define GLEW_STATIC - add_definitions(-DGLEW_STATIC) -endif () +link_hifi_libraries(animation fbx shared gpu) \ No newline at end of file diff --git a/tests/render-utils/CMakeLists.txt b/tests/render-utils/CMakeLists.txt index d55d3c542b..0452fd629c 100644 --- a/tests/render-utils/CMakeLists.txt +++ b/tests/render-utils/CMakeLists.txt @@ -7,9 +7,4 @@ setup_hifi_project(Quick Gui OpenGL) # link in the shared libraries link_hifi_libraries(render-utils gpu shared) -if (WIN32) - # we're using static GLEW, so define GLEW_STATIC - add_definitions(-DGLEW_STATIC) -endif () - copy_dlls_beside_windows_executable() \ No newline at end of file From ef729201d6e44cff8d6adfc5fdaa350994792e19 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 13:51:12 -0800 Subject: [PATCH 129/261] fix external name for GLEW --- cmake/externals/glew/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/glew/CMakeLists.txt b/cmake/externals/glew/CMakeLists.txt index ca0311cff5..dd856cd942 100644 --- a/cmake/externals/glew/CMakeLists.txt +++ b/cmake/externals/glew/CMakeLists.txt @@ -1,5 +1,5 @@ if (WIN32) - set(EXTERNAL_NAME glm) + set(EXTERNAL_NAME glew) include(ExternalProject) ExternalProject_Add( From c242b4e834c2fd2f037b387eecff2ddc7831ac6f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 13:55:40 -0800 Subject: [PATCH 130/261] set GLEW debug version to NOTFOUND --- cmake/externals/glew/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/glew/CMakeLists.txt b/cmake/externals/glew/CMakeLists.txt index dd856cd942..2e198a08f3 100644 --- a/cmake/externals/glew/CMakeLists.txt +++ b/cmake/externals/glew/CMakeLists.txt @@ -20,7 +20,7 @@ if (WIN32) set(_LIB_DIR ${SOURCE_DIR}/lib/Release/Win32) set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_LIB_DIR}/glew32s.lib CACHE FILEPATH "Location of GLEW release library") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${_LIB_DIR}/glew32sd.lib CACHE FILEPATH "Location of GLEW debug library") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Location of GLEW debug library") set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/bin/Release/Win32 CACHE FILEPATH "Location of GLEW DLL") endif () \ No newline at end of file From b23dd28b56e9b134969eacb876d12622d2cdf658 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 14:01:01 -0800 Subject: [PATCH 131/261] don't use static version of GLEW --- cmake/externals/glew/CMakeLists.txt | 2 +- cmake/modules/FindGLEW.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/externals/glew/CMakeLists.txt b/cmake/externals/glew/CMakeLists.txt index 2e198a08f3..e960eb8bcb 100644 --- a/cmake/externals/glew/CMakeLists.txt +++ b/cmake/externals/glew/CMakeLists.txt @@ -19,7 +19,7 @@ if (WIN32) set(_LIB_DIR ${SOURCE_DIR}/lib/Release/Win32) - set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_LIB_DIR}/glew32s.lib CACHE FILEPATH "Location of GLEW release library") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_LIB_DIR}/glew32.lib CACHE FILEPATH "Location of GLEW release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Location of GLEW debug library") set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/bin/Release/Win32 CACHE FILEPATH "Location of GLEW DLL") diff --git a/cmake/modules/FindGLEW.cmake b/cmake/modules/FindGLEW.cmake index 14ea8e52db..7abbe135cb 100644 --- a/cmake/modules/FindGLEW.cmake +++ b/cmake/modules/FindGLEW.cmake @@ -24,8 +24,8 @@ if (WIN32) find_path(GLEW_INCLUDE_DIRS GL/glew.h PATH_SUFFIXES include HINTS ${GLEW_SEARCH_DIRS}) - find_library(GLEW_LIBRARY_RELEASE glew32s PATH_SUFFIXES "lib/Release/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS}) - find_library(GLEW_LIBRARY_DEBUG glew32sd PATH_SUFFIXES "lib/Debug/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS}) + find_library(GLEW_LIBRARY_RELEASE glew32 PATH_SUFFIXES "lib/Release/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS}) + find_library(GLEW_LIBRARY_DEBUG glew32d PATH_SUFFIXES "lib/Debug/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS}) find_path(GLEW_DLL_PATH glew32.dll PATH_SUFFIXES "bin/Release/Win32" HINTS ${GLEW_SEARCH_DIRS}) From 175966cce8ec9a25ca0888c5c0e0df0e660542cf Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 14:19:08 -0800 Subject: [PATCH 132/261] clarify build guide for external projects --- BUILD.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/BUILD.md b/BUILD.md index dd2b65fb3b..a88d5cd22e 100644 --- a/BUILD.md +++ b/BUILD.md @@ -5,9 +5,7 @@ * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. -#### CMake External Project Dependencies - -The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-externals` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. Should you want to force a re-download and re-compile of a specific external, you can simply remove that directory from the appropriate subfolder in `build-externals`. Should you want to force a re-download and re-compile of all externals, just remove the `build-externals` folder. +####CMake External Project Dependencies * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 * [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 @@ -15,7 +13,13 @@ The following dependencies will be downloaded, built, linked and included automa * [gverb](https://github.com/highfidelity/gverb) * [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 -### OS Specific Build Guides +The above dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-ext` directory in each of the subfolders for each external project. + +These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. Should you want to force a re-download and re-compile of a specific external, you can simply remove that directory from the appropriate subfolder in `build-ext`. Should you want to force a re-download and re-compile of all externals, just remove the `build-ext` folder. + +If you would like to use a specific install of a dependency instead of the version that would be grabbed as a CMake ExternalProject, you can pass -DGET_$NAME=0 (where $NAME is the name of the subfolder in [cmake/externals](cmake/externals)) when you run CMake to tell it not to get that dependency as an external project. + +###OS Specific Build Guides * [BUILD_OSX.md](BUILD_OSX.md) - additional instructions for OS X. * [BUILD_LINUX.md](BUILD_LINUX.md) - additional instructions for Linux. * [BUILD_WIN.md](BUILD_WIN.md) - additional instructions for Windows. @@ -50,6 +54,9 @@ For example, to pass the QT_CMAKE_PREFIX_PATH variable during build file generat cmake .. -DQT_CMAKE_PREFIX_PATH=/usr/local/qt/5.3.2/lib/cmake ####Finding Dependencies + +The following applies for dependencies we do not grab via CMake ExternalProject (OpenSSL is an example), or for dependencies you have opted not to grab as a CMake ExternalProject (via -DGET_$NAME=0). The list of dependencies we grab by default as external projects can be found in [the CMake External Project Dependencies section](#CMake External Project Dependencies). + You can point our [Cmake find modules](cmake/modules/) to the correct version of dependencies by setting one of the three following variables to the location of the correct version of the dependency. In the examples below the variable $NAME would be replaced by the name of the dependency in uppercase, and $name would be replaced by the name of the dependency in lowercase (ex: OPENSSL_ROOT_DIR, openssl). From d6105e2e8c503a0f9d5e4192040808738831833c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 14:20:44 -0800 Subject: [PATCH 133/261] fix link to external project dependencies section --- BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index a88d5cd22e..6cfe5229d6 100644 --- a/BUILD.md +++ b/BUILD.md @@ -55,7 +55,7 @@ For example, to pass the QT_CMAKE_PREFIX_PATH variable during build file generat ####Finding Dependencies -The following applies for dependencies we do not grab via CMake ExternalProject (OpenSSL is an example), or for dependencies you have opted not to grab as a CMake ExternalProject (via -DGET_$NAME=0). The list of dependencies we grab by default as external projects can be found in [the CMake External Project Dependencies section](#CMake External Project Dependencies). +The following applies for dependencies we do not grab via CMake ExternalProject (OpenSSL is an example), or for dependencies you have opted not to grab as a CMake ExternalProject (via -DGET_$NAME=0). The list of dependencies we grab by default as external projects can be found in [the CMake External Project Dependencies section](#cmake-external-project-dependencies). You can point our [Cmake find modules](cmake/modules/) to the correct version of dependencies by setting one of the three following variables to the location of the correct version of the dependency. From 70c96e496fdec6bb936102165bbcee80f3e177aa Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 14:25:13 -0800 Subject: [PATCH 134/261] don't print ^a to qDebug for unassigned node type --- libraries/networking/src/Node.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/Node.cpp b/libraries/networking/src/Node.cpp index 2bf792c6ee..2a38799707 100644 --- a/libraries/networking/src/Node.cpp +++ b/libraries/networking/src/Node.cpp @@ -149,7 +149,12 @@ QDataStream& operator>>(QDataStream& in, Node& node) { } QDebug operator<<(QDebug debug, const Node &node) { - debug.nospace() << NodeType::getNodeTypeName(node.getType()) << " (" << node.getType() << ")"; + debug.nospace() << NodeType::getNodeTypeName(node.getType()); + if (node.getType() == NodeType::Unassigned) { + debug.nospace() << " (1)"; + } else { + debug.nospace() << " (" << node.getType() << ")"; + } debug << " " << node.getUUID().toString().toLocal8Bit().constData() << " "; debug.nospace() << node.getPublicSocket() << "/" << node.getLocalSocket(); return debug.nospace(); From 8cee88acb495c3a775276ee579e80a4d616af48b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 14:25:43 -0800 Subject: [PATCH 135/261] network chatter between Monitor and AssignmentClients is expected to be localhost only --- assignment-client/src/AssignmentClient.cpp | 9 ++++-- .../src/AssignmentClientMonitor.cpp | 28 +++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index cf4b305bb0..5fcc380962 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -259,8 +259,13 @@ void AssignmentClient::readPendingDatagrams() { qDebug() << "Received an assignment that could not be unpacked. Re-requesting."; } } else if (packetTypeForPacket(receivedPacket) == PacketTypeStopNode) { - qDebug() << "Network told me to exit."; - emit stopAssignmentClient(); + if (senderSockAddr.getAddress() == QHostAddress::LocalHost || + senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { + qDebug() << "Network told me to exit."; + emit stopAssignmentClient(); + } else { + qDebug() << "Got a stop packet from other than localhost."; + } } else { // have the NodeList attempt to handle it nodeList->processNodeData(senderSockAddr, receivedPacket); diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 32830e2bb3..d601990759 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -87,10 +87,12 @@ void AssignmentClientMonitor::spawnChildClient() { assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); assignmentClient->start(applicationFilePath(), _childArguments); + qDebug() << "Spawned a child client with PID" << assignmentClient->pid(); } + void AssignmentClientMonitor::checkSpares() { auto nodeList = DependencyManager::get(); QUuid aSpareId = ""; @@ -100,7 +102,6 @@ void AssignmentClientMonitor::checkSpares() { nodeList->eachNode([&](const SharedNodePointer& node){ AssignmentClientChildData *childData = static_cast(node->getLinkedData()); - qDebug() << " " << node->getUUID() << childData->getChildType(); if (childData->getChildType() == "none") { spareCount ++; aSpareId = node->getUUID(); @@ -142,17 +143,20 @@ void AssignmentClientMonitor::readPendingDatagrams() { QUuid packetUUID = uuidFromPacketHeader(receivedPacket); SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket); if (!matchingNode) { - // XXX only do this if from local machine - if (!packetUUID.isNull()) { - matchingNode = DependencyManager::get()->addOrUpdateNode - (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false); - AssignmentClientChildData *childData = new AssignmentClientChildData("unknown"); - matchingNode->setLinkedData(childData); - } else { - // tell unknown assignment-client child to exit. - qDebug() << "asking unknown child to exit."; - QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); - nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); + // The parent only expects to be talking with prorams running on this same machine. + if (senderSockAddr.getAddress() == QHostAddress::LocalHost || + senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { + if (!packetUUID.isNull()) { + matchingNode = DependencyManager::get()->addOrUpdateNode + (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false); + AssignmentClientChildData *childData = new AssignmentClientChildData("unknown"); + matchingNode->setLinkedData(childData); + } else { + // tell unknown assignment-client child to exit. + qDebug() << "asking unknown child to exit."; + QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); + nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); + } } } From 270d509a1284c3b8fb3ca07e6ea077e9c7f49eb1 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 20 Feb 2015 14:29:12 -0800 Subject: [PATCH 136/261] cleanups --- assignment-client/src/AssignmentClientMonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index d601990759..2bddab9656 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -62,7 +62,7 @@ AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, const u } connect(&_checkSparesTimer, SIGNAL(timeout()), SLOT(checkSpares())); - _checkSparesTimer.start(5000); + _checkSparesTimer.start(NODE_SILENCE_THRESHOLD_MSECS * 3); } AssignmentClientMonitor::~AssignmentClientMonitor() { @@ -109,7 +109,7 @@ void AssignmentClientMonitor::checkSpares() { }); if (spareCount != 1) { - qDebug() << " spare count is" << spareCount; + qDebug() << "spare count is" << spareCount; } if (spareCount < 1) { From bc0bd462cbe5f4b5ddaa5570137e0328fddc0177 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 15:26:16 -0800 Subject: [PATCH 137/261] add an external project for SDL 2 --- CMakeLists.txt | 3 ++ cmake/externals/sdl2/CMakeLists.txt | 50 +++++++++++++++++++++++++++++ cmake/modules/FindSDL2.cmake | 49 ---------------------------- interface/CMakeLists.txt | 2 ++ 4 files changed, 55 insertions(+), 49 deletions(-) create mode 100644 cmake/externals/sdl2/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 563ece524f..574bf0a344 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,9 @@ set(EXTERNAL_PROJECT_PREFIX "project") set_property(DIRECTORY PROPERTY EP_PREFIX ${EXTERNAL_PROJECT_PREFIX}) setup_externals_binary_dir() +# setup for optional external project dependencies +option(GET_SDL2 "Download SDL2 as external project" 0) + if (WIN32) add_paths_to_lib_paths("${QT_DIR}/bin") endif () diff --git a/cmake/externals/sdl2/CMakeLists.txt b/cmake/externals/sdl2/CMakeLists.txt new file mode 100644 index 0000000000..00936a8320 --- /dev/null +++ b/cmake/externals/sdl2/CMakeLists.txt @@ -0,0 +1,50 @@ +set(EXTERNAL_NAME sdl2) + +include(ExternalProject) + +if (WIN32) + ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip + URL_MD5 30a333bcbe94bc5016e8799c73e86233 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD 1 + ) +else () + if (ANDROID) + set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") + endif () + + ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://www.libsdl.org/release/SDL2-2.0.3.tar.gz + URL_MD5 fe6c61d2e9df9ef570e7e80c6e822537 + CMAKE_ARGS ${ANDROID_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + ) +endif () + +string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) + +if (WIN32) + ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) + set(_ROOT_DIR ${SOURCE_DIR}) + set(_LIB_DIR "${SOURCE_DIR}/lib/x86") + set(_LIB_EXT "lib") + + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${_LIB_DIR} CACHE PATH "Location of SDL2 DLL") +else () + ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) + set(_ROOT_DIR ${INSTALL_DIR}) + + set(_LIB_DIR ${INSTALL_DIR}/lib) + set(_LIB_EXT "so") + set(_LIB_PREFIX "lib") +endif () + +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${_ROOT_DIR}/include/SDL2 CACHE PATH "Location of SDL2 include directory") +set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${_LIB_DIR}/${_LIB_PREFIX}SDL2.${_LIB_EXT} CACHE FILEPATH "Path to SDL2 library") \ No newline at end of file diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake index 55dae82f82..8c7c0c581b 100644 --- a/cmake/modules/FindSDL2.cmake +++ b/cmake/modules/FindSDL2.cmake @@ -163,48 +163,6 @@ ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) endif () ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) -IF(NOT SDL2_BUILDING_LIBRARY) - IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") - # Non-OS X framework versions expect you to also dynamically link to - # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms - # seem to provide SDL2main for compatibility even though they don't - # necessarily need it. - # Lookup the 64 bit libs on x64 - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - FIND_LIBRARY(SDL2MAIN_LIBRARY - NAMES SDL2main - HINTS - ${SDL2_SEARCH_DIRS} - $ENV{SDL2} - PATH_SUFFIXES lib64 lib - lib/x64 - x86_64-w64-mingw32/lib - PATHS - /sw - /opt/local - /opt/csw - /opt - ) - # On 32bit build find the 32bit libs - ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) - FIND_LIBRARY(SDL2MAIN_LIBRARY - NAMES SDL2main - HINTS - ${SDL2_SEARCH_DIRS} - $ENV{SDL2} - PATH_SUFFIXES lib - lib/x86 - i686-w64-mingw32/lib - PATHS - /sw - /opt/local - /opt/csw - /opt - ) - ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) - ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") -ENDIF(NOT SDL2_BUILDING_LIBRARY) - # SDL2 may require threads on your system. # The Apple build may not need an explicit flag because one of the # frameworks may already provide it. @@ -222,13 +180,6 @@ ENDIF(MINGW) SET(SDL2_FOUND "NO") IF(SDL2_LIBRARY_TEMP) - # For SDL2main - IF(NOT SDL2_BUILDING_LIBRARY) - IF(SDL2MAIN_LIBRARY) - SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP}) - ENDIF(SDL2MAIN_LIBRARY) - ENDIF(NOT SDL2_BUILDING_LIBRARY) - # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa. # CMake doesn't display the -framework Cocoa string in the UI even # though it actually is there if I modify a pre-used variable. diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 446a816d1b..0cff232f26 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -119,6 +119,8 @@ link_hifi_libraries(shared octree environment gpu model fbx metavoxels networkin audio audio-client animation script-engine physics render-utils entities-renderer) +add_dependency_external_projects(sdl2) + # perform standard include and linking for found externals foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) From 0b607fa390462ff08e3142df2ac5d5d10523c385 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 20 Feb 2015 15:28:25 -0800 Subject: [PATCH 138/261] first cut at shutting down scripts ahead of other cleanup --- interface/src/Application.cpp | 18 +- .../src/EntityTreeRenderer.cpp | 329 ++++++++++-------- .../src/EntityTreeRenderer.h | 3 + libraries/script-engine/src/ScriptEngine.cpp | 58 ++- libraries/script-engine/src/ScriptEngine.h | 10 + 5 files changed, 270 insertions(+), 148 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1211df3727..ecb74392a6 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -527,12 +527,22 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : } void Application::aboutToQuit() { +qDebug() << "Application::aboutToQuit()"; _aboutToQuit = true; cleanupBeforeQuit(); } void Application::cleanupBeforeQuit() { + qDebug() << "Application::cleanupBeforeQuit() ------------ START -----------------"; + + // stop entities running scripts + _entities.shutdown(); + + // stop all running scripts + ScriptEngine::gracefullyStopAllScripts(); + + // first stop all timers directly or by invokeMethod // depending on what thread they run in locationUpdateTimer->stop(); @@ -572,6 +582,8 @@ void Application::cleanupBeforeQuit() { // destroy the AudioClient so it and its thread have a chance to go down safely DependencyManager::destroy(); + + qDebug() << "Application::cleanupBeforeQuit() ------------ DONE -----------------"; } Application::~Application() { @@ -3432,6 +3444,7 @@ void Application::clearScriptsBeforeRunning() { } void Application::saveScripts() { +qDebug() << "Application::saveScripts()"; // Saves all currently running user-loaded scripts Settings settings; settings.beginWriteArray(SETTINGS_KEY); @@ -3525,7 +3538,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri #endif QThread* workerThread = new QThread(this); - workerThread->setObjectName("Script Engine Thread"); + QString scriptEngineName = QString("Script Thread:") + scriptEngine->getFilename(); + workerThread->setObjectName(scriptEngineName); // when the worker thread is started, call our engine's run.. connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run); @@ -3599,6 +3613,7 @@ void Application::handleScriptLoadError(const QString& scriptFilename) { } void Application::scriptFinished(const QString& scriptName) { + qDebug() << "Application::scriptFinished(), scriptName:" << scriptName; const QString& scriptURLString = QUrl(scriptName).toString(); QHash::iterator it = _scriptEnginesHash.find(scriptURLString); if (it != _scriptEnginesHash.end()) { @@ -3609,6 +3624,7 @@ void Application::scriptFinished(const QString& scriptName) { } void Application::stopAllScripts(bool restart) { + qDebug() << "Application::stopAllScripts()... restart:" << restart; // stops all current running scripts for (QHash::const_iterator it = _scriptEnginesHash.constBegin(); it != _scriptEnginesHash.constEnd(); it++) { diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 975d0f515d..b0396f32d6 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -97,6 +97,27 @@ void EntityTreeRenderer::init() { connect(entityTree, &EntityTree::changingEntityID, this, &EntityTreeRenderer::changingEntityID); } +void EntityTreeRenderer::shutdown() { + _shuttingDown = true; + + /* + if (_entitiesScriptEngine) { + _entitiesScriptEngine->stop(); + + QEventLoop loop; + QObject::connect(_entitiesScriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); + + _entitiesScriptEngine->stop(); + + qDebug() << "waiting on Entities sandbox script to stop... "; + loop.exec(); + qDebug() << "done waiting... "; + + } + */ +} + + QScriptValue EntityTreeRenderer::loadEntityScript(const EntityItemID& entityItemID) { EntityItem* entity = static_cast(_tree)->findEntityByEntityItemID(entityItemID); return loadEntityScript(entity); @@ -156,6 +177,10 @@ QString EntityTreeRenderer::loadScriptContents(const QString& scriptMaybeURLorTe QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity) { + if (_shuttingDown) { + return QScriptValue(); // no entity... + } + if (!entity) { return QScriptValue(); // no entity... } @@ -235,7 +260,7 @@ void EntityTreeRenderer::setTree(Octree* newTree) { } void EntityTreeRenderer::update() { - if (_tree) { + if (_tree && !_shuttingDown) { EntityTree* tree = static_cast(_tree); tree->update(); @@ -258,7 +283,7 @@ void EntityTreeRenderer::update() { } void EntityTreeRenderer::checkEnterLeaveEntities() { - if (_tree) { + if (_tree && !_shuttingDown) { _tree->lockForWrite(); // so that our scripts can do edits if they want glm::vec3 avatarPosition = _viewState->getAvatarPosition() / (float) TREE_SCALE; @@ -309,7 +334,7 @@ void EntityTreeRenderer::checkEnterLeaveEntities() { } void EntityTreeRenderer::leaveAllEntities() { - if (_tree) { + if (_tree && !_shuttingDown) { _tree->lockForWrite(); // so that our scripts can do edits if they want // for all of our previous containing entities, if they are no longer containing then send them a leave event @@ -330,7 +355,7 @@ void EntityTreeRenderer::leaveAllEntities() { } } void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) { - if (_tree) { + if (_tree && !_shuttingDown) { Model::startScene(renderSide); RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -700,179 +725,193 @@ QScriptValueList EntityTreeRenderer::createEntityArgs(const EntityItemID& entity } void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { - PerformanceTimer perfTimer("EntityTreeRenderer::mousePressEvent"); - PickRay ray = _viewState->computePickRay(event->x(), event->y()); + if (_tree && !_shuttingDown) { + PerformanceTimer perfTimer("EntityTreeRenderer::mousePressEvent"); + PickRay ray = _viewState->computePickRay(event->x(), event->y()); - bool precisionPicking = !_dontDoPrecisionPicking; - RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); - if (rayPickResult.intersects) { - //qDebug() << "mousePressEvent over entity:" << rayPickResult.entityID; - emit mousePressOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + bool precisionPicking = !_dontDoPrecisionPicking; + RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); + if (rayPickResult.intersects) { + //qDebug() << "mousePressEvent over entity:" << rayPickResult.entityID; + emit mousePressOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); - QScriptValue entityScript = loadEntityScript(rayPickResult.entity); - if (entityScript.property("mousePressOnEntity").isValid()) { - entityScript.property("mousePressOnEntity").call(entityScript, entityScriptArgs); - } + QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); + QScriptValue entityScript = loadEntityScript(rayPickResult.entity); + if (entityScript.property("mousePressOnEntity").isValid()) { + entityScript.property("mousePressOnEntity").call(entityScript, entityScriptArgs); + } - _currentClickingOnEntityID = rayPickResult.entityID; - emit clickDownOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); - if (entityScript.property("clickDownOnEntity").isValid()) { - entityScript.property("clickDownOnEntity").call(entityScript, entityScriptArgs); + _currentClickingOnEntityID = rayPickResult.entityID; + emit clickDownOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); + if (entityScript.property("clickDownOnEntity").isValid()) { + entityScript.property("clickDownOnEntity").call(entityScript, entityScriptArgs); + } } + _lastMouseEvent = MouseEvent(*event, deviceID); + _lastMouseEventValid = true; } - _lastMouseEvent = MouseEvent(*event, deviceID); - _lastMouseEventValid = true; } void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { - PerformanceTimer perfTimer("EntityTreeRenderer::mouseReleaseEvent"); - PickRay ray = _viewState->computePickRay(event->x(), event->y()); - bool precisionPicking = !_dontDoPrecisionPicking; - RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); - if (rayPickResult.intersects) { - //qDebug() << "mouseReleaseEvent over entity:" << rayPickResult.entityID; - emit mouseReleaseOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + if (_tree && !_shuttingDown) { + PerformanceTimer perfTimer("EntityTreeRenderer::mouseReleaseEvent"); + PickRay ray = _viewState->computePickRay(event->x(), event->y()); + bool precisionPicking = !_dontDoPrecisionPicking; + RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); + if (rayPickResult.intersects) { + //qDebug() << "mouseReleaseEvent over entity:" << rayPickResult.entityID; + emit mouseReleaseOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); - QScriptValue entityScript = loadEntityScript(rayPickResult.entity); - if (entityScript.property("mouseReleaseOnEntity").isValid()) { - entityScript.property("mouseReleaseOnEntity").call(entityScript, entityScriptArgs); + QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); + QScriptValue entityScript = loadEntityScript(rayPickResult.entity); + if (entityScript.property("mouseReleaseOnEntity").isValid()) { + entityScript.property("mouseReleaseOnEntity").call(entityScript, entityScriptArgs); + } } - } - // Even if we're no longer intersecting with an entity, if we started clicking on it, and now - // we're releasing the button, then this is considered a clickOn event - if (!_currentClickingOnEntityID.isInvalidID()) { - emit clickReleaseOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); + // Even if we're no longer intersecting with an entity, if we started clicking on it, and now + // we're releasing the button, then this is considered a clickOn event + if (!_currentClickingOnEntityID.isInvalidID()) { + emit clickReleaseOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); - QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); - QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); - if (currentClickingEntity.property("clickReleaseOnEntity").isValid()) { - currentClickingEntity.property("clickReleaseOnEntity").call(currentClickingEntity, currentClickingEntityArgs); + QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); + QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); + if (currentClickingEntity.property("clickReleaseOnEntity").isValid()) { + currentClickingEntity.property("clickReleaseOnEntity").call(currentClickingEntity, currentClickingEntityArgs); + } } - } - // makes it the unknown ID, we just released so we can't be clicking on anything - _currentClickingOnEntityID = EntityItemID::createInvalidEntityID(); - _lastMouseEvent = MouseEvent(*event, deviceID); - _lastMouseEventValid = true; + // makes it the unknown ID, we just released so we can't be clicking on anything + _currentClickingOnEntityID = EntityItemID::createInvalidEntityID(); + _lastMouseEvent = MouseEvent(*event, deviceID); + _lastMouseEventValid = true; + } } void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { - PerformanceTimer perfTimer("EntityTreeRenderer::mouseMoveEvent"); + if (_tree && !_shuttingDown) { + PerformanceTimer perfTimer("EntityTreeRenderer::mouseMoveEvent"); - PickRay ray = _viewState->computePickRay(event->x(), event->y()); + PickRay ray = _viewState->computePickRay(event->x(), event->y()); - bool precisionPicking = false; // for mouse moves we do not do precision picking - RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking); - if (rayPickResult.intersects) { - QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); + bool precisionPicking = false; // for mouse moves we do not do precision picking + RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking); + if (rayPickResult.intersects) { + QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); - // load the entity script if needed... - QScriptValue entityScript = loadEntityScript(rayPickResult.entity); - if (entityScript.property("mouseMoveEvent").isValid()) { - entityScript.property("mouseMoveEvent").call(entityScript, entityScriptArgs); - } + // load the entity script if needed... + QScriptValue entityScript = loadEntityScript(rayPickResult.entity); + if (entityScript.property("mouseMoveEvent").isValid()) { + entityScript.property("mouseMoveEvent").call(entityScript, entityScriptArgs); + } - //qDebug() << "mouseMoveEvent over entity:" << rayPickResult.entityID; - emit mouseMoveOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - if (entityScript.property("mouseMoveOnEntity").isValid()) { - entityScript.property("mouseMoveOnEntity").call(entityScript, entityScriptArgs); - } + //qDebug() << "mouseMoveEvent over entity:" << rayPickResult.entityID; + emit mouseMoveOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + if (entityScript.property("mouseMoveOnEntity").isValid()) { + entityScript.property("mouseMoveOnEntity").call(entityScript, entityScriptArgs); + } - // handle the hover logic... + // handle the hover logic... - // if we were previously hovering over an entity, and this new entity is not the same as our previous entity - // then we need to send the hover leave. - if (!_currentHoverOverEntityID.isInvalidID() && rayPickResult.entityID != _currentHoverOverEntityID) { - emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); + // if we were previously hovering over an entity, and this new entity is not the same as our previous entity + // then we need to send the hover leave. + if (!_currentHoverOverEntityID.isInvalidID() && rayPickResult.entityID != _currentHoverOverEntityID) { + emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); - QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); + QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); - QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); - if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { - currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); - } - } - - // If the new hover entity does not match the previous hover entity then we are entering the new one - // this is true if the _currentHoverOverEntityID is known or unknown - if (rayPickResult.entityID != _currentHoverOverEntityID) { - emit hoverEnterEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - if (entityScript.property("hoverEnterEntity").isValid()) { - entityScript.property("hoverEnterEntity").call(entityScript, entityScriptArgs); - } - } - - // and finally, no matter what, if we're intersecting an entity then we're definitely hovering over it, and - // we should send our hover over event - emit hoverOverEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - if (entityScript.property("hoverOverEntity").isValid()) { - entityScript.property("hoverOverEntity").call(entityScript, entityScriptArgs); - } - - // remember what we're hovering over - _currentHoverOverEntityID = rayPickResult.entityID; - - } else { - // handle the hover logic... - // if we were previously hovering over an entity, and we're no longer hovering over any entity then we need to - // send the hover leave for our previous entity - if (!_currentHoverOverEntityID.isInvalidID()) { - emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); - - QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); - - QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); - if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { - currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); + QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); + if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { + currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); + } } - _currentHoverOverEntityID = EntityItemID::createInvalidEntityID(); // makes it the unknown ID + // If the new hover entity does not match the previous hover entity then we are entering the new one + // this is true if the _currentHoverOverEntityID is known or unknown + if (rayPickResult.entityID != _currentHoverOverEntityID) { + emit hoverEnterEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + if (entityScript.property("hoverEnterEntity").isValid()) { + entityScript.property("hoverEnterEntity").call(entityScript, entityScriptArgs); + } + } + + // and finally, no matter what, if we're intersecting an entity then we're definitely hovering over it, and + // we should send our hover over event + emit hoverOverEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + if (entityScript.property("hoverOverEntity").isValid()) { + entityScript.property("hoverOverEntity").call(entityScript, entityScriptArgs); + } + + // remember what we're hovering over + _currentHoverOverEntityID = rayPickResult.entityID; + + } else { + // handle the hover logic... + // if we were previously hovering over an entity, and we're no longer hovering over any entity then we need to + // send the hover leave for our previous entity + if (!_currentHoverOverEntityID.isInvalidID()) { + emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); + + QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); + + QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); + if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { + currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); + } + + _currentHoverOverEntityID = EntityItemID::createInvalidEntityID(); // makes it the unknown ID + } } - } - // Even if we're no longer intersecting with an entity, if we started clicking on an entity and we have - // not yet released the hold then this is still considered a holdingClickOnEntity event - if (!_currentClickingOnEntityID.isInvalidID()) { - emit holdingClickOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); + // Even if we're no longer intersecting with an entity, if we started clicking on an entity and we have + // not yet released the hold then this is still considered a holdingClickOnEntity event + if (!_currentClickingOnEntityID.isInvalidID()) { + emit holdingClickOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); - QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); + QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); - QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); - if (currentClickingEntity.property("holdingClickOnEntity").isValid()) { - currentClickingEntity.property("holdingClickOnEntity").call(currentClickingEntity, currentClickingEntityArgs); + QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); + if (currentClickingEntity.property("holdingClickOnEntity").isValid()) { + currentClickingEntity.property("holdingClickOnEntity").call(currentClickingEntity, currentClickingEntityArgs); + } } + _lastMouseEvent = MouseEvent(*event, deviceID); + _lastMouseEventValid = true; } - _lastMouseEvent = MouseEvent(*event, deviceID); - _lastMouseEventValid = true; } void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) { - checkAndCallUnload(entityID); + if (_tree && !_shuttingDown) { + checkAndCallUnload(entityID); + } _entityScripts.remove(entityID); } void EntityTreeRenderer::entitySciptChanging(const EntityItemID& entityID) { - checkAndCallUnload(entityID); + if (_tree && !_shuttingDown) { + checkAndCallUnload(entityID); + } checkAndCallPreload(entityID); } void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID) { - // load the entity script if needed... - QScriptValue entityScript = loadEntityScript(entityID); - if (entityScript.property("preload").isValid()) { - QScriptValueList entityArgs = createEntityArgs(entityID); - entityScript.property("preload").call(entityScript, entityArgs); + if (_tree && !_shuttingDown) { + // load the entity script if needed... + QScriptValue entityScript = loadEntityScript(entityID); + if (entityScript.property("preload").isValid()) { + QScriptValueList entityArgs = createEntityArgs(entityID); + entityScript.property("preload").call(entityScript, entityArgs); + } } } void EntityTreeRenderer::checkAndCallUnload(const EntityItemID& entityID) { - QScriptValue entityScript = getPreviouslyLoadedEntityScript(entityID); - if (entityScript.property("unload").isValid()) { - QScriptValueList entityArgs = createEntityArgs(entityID); - entityScript.property("unload").call(entityScript, entityArgs); + if (_tree && !_shuttingDown) { + QScriptValue entityScript = getPreviouslyLoadedEntityScript(entityID); + if (entityScript.property("unload").isValid()) { + QScriptValueList entityArgs = createEntityArgs(entityID); + entityScript.property("unload").call(entityScript, entityArgs); + } } } @@ -887,22 +926,24 @@ void EntityTreeRenderer::changingEntityID(const EntityItemID& oldEntityID, const void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision) { - QScriptValue entityScriptA = loadEntityScript(idA); - if (entityScriptA.property("collisionWithEntity").isValid()) { - QScriptValueList args; - args << idA.toScriptValue(_entitiesScriptEngine); - args << idB.toScriptValue(_entitiesScriptEngine); - args << collisionToScriptValue(_entitiesScriptEngine, collision); - entityScriptA.property("collisionWithEntity").call(entityScriptA, args); - } + if (_tree && !_shuttingDown) { + QScriptValue entityScriptA = loadEntityScript(idA); + if (entityScriptA.property("collisionWithEntity").isValid()) { + QScriptValueList args; + args << idA.toScriptValue(_entitiesScriptEngine); + args << idB.toScriptValue(_entitiesScriptEngine); + args << collisionToScriptValue(_entitiesScriptEngine, collision); + entityScriptA.property("collisionWithEntity").call(entityScriptA, args); + } - QScriptValue entityScriptB = loadEntityScript(idB); - if (entityScriptB.property("collisionWithEntity").isValid()) { - QScriptValueList args; - args << idB.toScriptValue(_entitiesScriptEngine); - args << idA.toScriptValue(_entitiesScriptEngine); - args << collisionToScriptValue(_entitiesScriptEngine, collision); - entityScriptB.property("collisionWithEntity").call(entityScriptA, args); + QScriptValue entityScriptB = loadEntityScript(idB); + if (entityScriptB.property("collisionWithEntity").isValid()) { + QScriptValueList args; + args << idB.toScriptValue(_entitiesScriptEngine); + args << idA.toScriptValue(_entitiesScriptEngine); + args << collisionToScriptValue(_entitiesScriptEngine, collision); + entityScriptB.property("collisionWithEntity").call(entityScriptA, args); + } } } diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.h b/libraries/entities-renderer/src/EntityTreeRenderer.h index 3826a80238..0da85f360b 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.h +++ b/libraries/entities-renderer/src/EntityTreeRenderer.h @@ -46,6 +46,7 @@ public: virtual int getBoundaryLevelAdjust() const; virtual void setTree(Octree* newTree); + void shutdown(); void update(); EntityTree* getTree() { return static_cast(_tree); } @@ -154,6 +155,8 @@ private: bool _displayModelElementProxy; bool _dontDoPrecisionPicking; + bool _shuttingDown = false; + }; #endif // hifi_EntityTreeRenderer_h diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 0956374238..63ecea4254 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -94,8 +94,45 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam _isUserLoaded(false), _arrayBufferClass(new ArrayBufferClass(this)) { + _allKnownScriptEngines.insert(this); } +ScriptEngine::~ScriptEngine() { + qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::~ScriptEngine() " << getFilename(); + _allKnownScriptEngines.remove(this); +} + +QSet ScriptEngine::_allKnownScriptEngines; + +void ScriptEngine::gracefullyStopAllScripts() { + qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- START ------------------"; + foreach(ScriptEngine* scriptEngine, _allKnownScriptEngines) { + if (scriptEngine->isRunning()) { + qDebug() << "scriptEngine still alive:" << scriptEngine->getFilename() << "[" << scriptEngine << "]"; + + QEventLoop loop; + QObject::connect(scriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); + + scriptEngine->stop(); + + qDebug() << "waiting on script to stop... "; + loop.exec(); + qDebug() << "done waiting... "; + } + } + qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- DONE ------------------"; +} + +QString ScriptEngine::getFilename() const { + QStringList fileNameParts = _fileNameString.split("/"); + QString lastPart; + if (!fileNameParts.isEmpty()) { + lastPart = fileNameParts.last(); + } + return lastPart; +} + + void ScriptEngine::setIsAvatar(bool isAvatar) { _isAvatar = isAvatar; @@ -364,16 +401,18 @@ void ScriptEngine::run() { } if (_isFinished) { + qDebug() << "ScriptEngine::run()... while() about to break " << getFilename(); break; } QCoreApplication::processEvents(); if (_isFinished) { + qDebug() << "ScriptEngine::run()... while() about to break " << getFilename(); break; } - if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) { + if (!_isFinished && _entityScriptingInterface.getEntityPacketSender()->serversExist()) { // release the queue of edit entity messages. _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages(); @@ -383,7 +422,7 @@ void ScriptEngine::run() { } } - if (_isAvatar && _avatarData) { + if (!_isFinished && _isAvatar && _avatarData) { const int SCRIPT_AUDIO_BUFFER_SAMPLES = floor(((SCRIPT_DATA_CALLBACK_USECS * AudioConstants::SAMPLE_RATE) / (1000 * 1000)) + 0.5); @@ -493,9 +532,13 @@ void ScriptEngine::run() { clearExceptions(); } - emit update(deltaTime); + if (!_isFinished) { + //qDebug() << "ScriptEngine::run()... about to emit update() _scriptName:" << _scriptName << "_fileNameString:" << _fileNameString << "_isFinished:" << _isFinished; + emit update(deltaTime); + } lastUpdate = now; } + qDebug() << "ScriptEngine::run()... about to emit scriptEnding() " << getFilename(); emit scriptEnding(); // kill the avatar identity timer @@ -513,16 +556,25 @@ void ScriptEngine::run() { // If we were on a thread, then wait till it's done if (thread()) { + qDebug() << "ScriptEngine::run()... about to call thread()->quit() " << getFilename(); thread()->quit(); } + qDebug() << "ScriptEngine::run()... about to emit finished() " << getFilename(); emit finished(_fileNameString); _isRunning = false; + + qDebug() << "ScriptEngine::run()... about to emit runningStateChanged() " << getFilename(); emit runningStateChanged(); + + qDebug() << "ScriptEngine::run()... about to emit doneRunning() " << getFilename(); + emit doneRunning(); + qDebug() << "ScriptEngine::run()... DONE WITH run()... " << getFilename(); } void ScriptEngine::stop() { + qDebug() << "ScriptEngine::stop()... " << getFilename(); _isFinished = true; emit runningStateChanged(); } diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index f2911842e6..f3289a8c70 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -43,6 +43,8 @@ public: const QString& fileNameString = QString(""), AbstractControllerScriptingInterface* controllerScriptingInterface = NULL); + ~ScriptEngine(); + /// Access the EntityScriptingInterface in order to initialize it with a custom packet sender and jurisdiction listener static EntityScriptingInterface* getEntityScriptingInterface() { return &_entityScriptingInterface; } @@ -88,6 +90,10 @@ public: bool isUserLoaded() const { return _isUserLoaded; } void setParentURL(const QString& parentURL) { _parentURL = parentURL; } + + QString getFilename() const; + + static void gracefullyStopAllScripts(); public slots: void loadURL(const QUrl& scriptURL); @@ -118,6 +124,7 @@ signals: void runningStateChanged(); void evaluationFinished(QScriptValue result, bool isException); void loadScript(const QString& scriptName, bool isUserLoaded); + void doneRunning(); protected: QString _scriptContents; @@ -156,6 +163,9 @@ private: QHash _outgoingScriptAudioSequenceNumbers; private slots: void handleScriptDownload(); + +private: + static QSet _allKnownScriptEngines; }; #endif // hifi_ScriptEngine_h From dc9c4ea43ce1a04b7cdeef0d17f8b710e4c00216 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 15:34:41 -0800 Subject: [PATCH 139/261] add options with default for get of external projects --- CMakeLists.txt | 14 ++++++++++++-- cmake/macros/AddDependencyExternalProjects.cmake | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 574bf0a344..22062caa6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,8 +126,18 @@ set(EXTERNAL_PROJECT_PREFIX "project") set_property(DIRECTORY PROPERTY EP_PREFIX ${EXTERNAL_PROJECT_PREFIX}) setup_externals_binary_dir() -# setup for optional external project dependencies -option(GET_SDL2 "Download SDL2 as external project" 0) +# setup options to grab external project dependencies +option(GET_BULLET "Get Bullet library automatically as external project" 1) +option(GET_GLM "Get GLM library automatically as external project" 1) +option(GET_GVERB "Get Gverb library automatically as external project" 1) +option(GET_SOXR "Get Soxr library automatically as external project" 1) +option(GET_TBB "Get Threading Building Blocks library automatically as external project" 1) + +if (WIN32) + option(GET_GLEW "Get GLEW library automatically as external project" 1) +endif () + +option(GET_SDL2 "Get SDL2 library automatically as external project" 0) if (WIN32) add_paths_to_lib_paths("${QT_DIR}/bin") diff --git a/cmake/macros/AddDependencyExternalProjects.cmake b/cmake/macros/AddDependencyExternalProjects.cmake index 464652a5b7..e859ef2db5 100644 --- a/cmake/macros/AddDependencyExternalProjects.cmake +++ b/cmake/macros/AddDependencyExternalProjects.cmake @@ -16,7 +16,7 @@ macro(ADD_DEPENDENCY_EXTERNAL_PROJECTS) string(TOUPPER ${_PROJ_NAME} _PROJ_NAME_UPPER) # has the user told us they specific don't want this as an external project? - if (NOT DEFINED GET_${_PROJ_NAME_UPPER} OR GET_${_PROJ_NAME_UPPER}) + if (GET_${_PROJ_NAME_UPPER}) # have we already detected we can't have this as external project on this OS? if (NOT DEFINED ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT OR ${_PROJ_NAME_UPPER}_EXTERNAL_PROJECT) # have we already setup the target? From fd8e9bad20d45c646e613478bda811b74cc91dad Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 15:36:59 -0800 Subject: [PATCH 140/261] fix casing in find modules for gverb and soxr --- cmake/modules/FindGverb.cmake | 2 +- cmake/modules/FindSoxr.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindGverb.cmake b/cmake/modules/FindGverb.cmake index e54fba8083..0c149a7ca1 100644 --- a/cmake/modules/FindGverb.cmake +++ b/cmake/modules/FindGverb.cmake @@ -22,4 +22,4 @@ find_path(GVERB_INCLUDE_DIRS gverb.h PATH_SUFFIXES include HINTS ${GVERB_SEARCH_ find_library(GVERB_LIBRARIES gverb PATH_SUFFIXES lib HINTS ${GVERB_SEARCH_DIRS}) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GVERB DEFAULT_MSG GVERB_INCLUDE_DIRS GVERB_LIBRARIES) \ No newline at end of file +find_package_handle_standard_args(Gverb DEFAULT_MSG GVERB_INCLUDE_DIRS GVERB_LIBRARIES) \ No newline at end of file diff --git a/cmake/modules/FindSoxr.cmake b/cmake/modules/FindSoxr.cmake index b36c9465b7..1c67650496 100644 --- a/cmake/modules/FindSoxr.cmake +++ b/cmake/modules/FindSoxr.cmake @@ -34,7 +34,7 @@ if (WIN32) endif () include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SOXR DEFAULT_MSG ${SOXR_REQUIREMENTS}) +find_package_handle_standard_args(Soxr DEFAULT_MSG ${SOXR_REQUIREMENTS}) if (WIN32) add_paths_to_lib_paths(${SOXR_DLL_PATH}) From b219937902d30e706eeb40463a02f5f203b592c8 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 20 Feb 2015 15:46:11 -0800 Subject: [PATCH 141/261] switch known scripts iterator --- libraries/script-engine/src/ScriptEngine.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 63ecea4254..e4401bd4b4 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -106,7 +106,12 @@ QSet ScriptEngine::_allKnownScriptEngines; void ScriptEngine::gracefullyStopAllScripts() { qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- START ------------------"; - foreach(ScriptEngine* scriptEngine, _allKnownScriptEngines) { + + QSet::const_iterator i = _allKnownScriptEngines.constBegin(); + while (i != _allKnownScriptEngines.constEnd()) { + ScriptEngine* scriptEngine = *i; + qDebug() << scriptEngine; + if (scriptEngine->isRunning()) { qDebug() << "scriptEngine still alive:" << scriptEngine->getFilename() << "[" << scriptEngine << "]"; @@ -119,6 +124,8 @@ void ScriptEngine::gracefullyStopAllScripts() { loop.exec(); qDebug() << "done waiting... "; } + + ++i; } qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- DONE ------------------"; } From c64f172311997aedd81cdd97cc307a147b5b32bd Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 20 Feb 2015 16:06:37 -0800 Subject: [PATCH 142/261] add qxmpp as external project --- CMakeLists.txt | 1 + cmake/externals/qxmpp/CMakeLists.txt | 47 ++++++++++++++++++++++++++++ cmake/externals/qxmpp/qxmpp.patch | 13 ++++++++ interface/CMakeLists.txt | 2 +- 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 cmake/externals/qxmpp/CMakeLists.txt create mode 100644 cmake/externals/qxmpp/qxmpp.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 22062caa6c..a79476f17f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,7 @@ if (WIN32) endif () option(GET_SDL2 "Get SDL2 library automatically as external project" 0) +option(GET_QXMPP "GET Qxmpp library automatically as external project" 0) if (WIN32) add_paths_to_lib_paths("${QT_DIR}/bin") diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt new file mode 100644 index 0000000000..ddac75569b --- /dev/null +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -0,0 +1,47 @@ +set(EXTERNAL_NAME qxmpp) + +# we need to find qmake inside QT_DIR +find_program(QMAKE_COMMAND NAME qmake PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) + +if (NOT QMAKE_COMMAND) + message(FATAL_ERROR "Could not find qmake. Qxmpp cannot be compiled without qmake.") +endif () + +if (ANDROID) + set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") +endif () + +include(ExternalProject) +ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://qxmpp.googlecode.com/files/qxmpp-0.7.6.tar.gz + URL_MD5 ee45a97313306ded2ff0f6618a3ed1e1 + BUILD_IN_SOURCE 1 + PATCH_COMMAND patch -p2 -t -N --verbose < ${CMAKE_CURRENT_SOURCE_DIR}/qxmpp.patch + CONFIGURE_COMMAND ${QMAKE_COMMAND} PREFIX= + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 +) + +ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) + +string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE FILEPATH "Path to Qxmpp include directory") + +if (WIN32) + set(_LIB_EXT "lib") + + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${_LIB_DIR} CACHE PATH "Location of QXmpp DLL") +else () + if (APPLE) + set(_LIB_EXT "dylib") + else () + set(_LIB_EXT "so") + endif () + + set(_LIB_PREFIX "lib") +endif () + +set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/${_LIB_PREFIX}qxmpp.${_LIB_EXT} CACHE FILEPATH "Path to QXmpp release library") +set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Path to QXmpp debug library") diff --git a/cmake/externals/qxmpp/qxmpp.patch b/cmake/externals/qxmpp/qxmpp.patch new file mode 100644 index 0000000000..ca2f455817 --- /dev/null +++ b/cmake/externals/qxmpp/qxmpp.patch @@ -0,0 +1,13 @@ +diff --git a/qxmpp-0.7.6/src/src.pro b/qxmpp-0.7.6-patch/src/src.pro +index 954738c..8404c8c 100644 +--- a/qxmpp-0.7.6/src/src.pro ++++ b/qxmpp-0.7.6-patch/src/src.pro +@@ -4,7 +4,7 @@ QT -= gui + + TEMPLATE = lib + +-CONFIG += $$QXMPP_LIBRARY_TYPE ++CONFIG += $$QXMPP_LIBRARY_TYPE c++11 + DEFINES += QXMPP_BUILD + DEFINES += $$QXMPP_INTERNAL_DEFINES + INCLUDEPATH += $$QXMPP_INCLUDEPATH $$QXMPP_INTERNAL_INCLUDES diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 0cff232f26..2e0120dfc8 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -119,7 +119,7 @@ link_hifi_libraries(shared octree environment gpu model fbx metavoxels networkin audio audio-client animation script-engine physics render-utils entities-renderer) -add_dependency_external_projects(sdl2) +add_dependency_external_projects(sdl2 qxmpp) # perform standard include and linking for found externals foreach(EXTERNAL ${OPTIONAL_EXTERNALS}) From 27e6f99debfed792ef0ad4a5fb95e51f3a0e070f Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 20 Feb 2015 16:54:58 -0800 Subject: [PATCH 143/261] use strings for shapeType for JS Entity properties --- examples/html/entityProperties.html | 8 ++-- .../entities/src/EntityItemProperties.cpp | 44 +++++++++++++++++-- libraries/entities/src/EntityItemProperties.h | 3 ++ .../entities/src/EntityItemPropertiesMacros.h | 9 ---- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 84a8d23a74..ad2b359e79 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -406,7 +406,7 @@ elModelAnimationFrame.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFrameIndex')); elModelAnimationSettings.addEventListener('change', createEmitTextPropertyUpdateFunction('animationSettings')); elModelTextures.addEventListener('change', createEmitTextPropertyUpdateFunction('textures')); - elModelShapeType.addEventListener('change', createEmitNumberPropertyUpdateFunction('shapeType')); + elModelShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType')); elTextText.addEventListener('change', createEmitTextPropertyUpdateFunction('text')); elTextLineHeight.addEventListener('change', createEmitNumberPropertyUpdateFunction('lineHeight')); @@ -671,9 +671,9 @@
Shape Type
diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 353aab0a64..7f37799bbc 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -170,6 +171,35 @@ void EntityItemProperties::setLastEdited(quint64 usecTime) { _lastEdited = usecTime > _created ? usecTime : _created; } +const char* shapeTypeNames[] = {"none", "box", "sphere"}; + +QString EntityItemProperties::getShapeTypeString() const { + return QString(shapeTypeNames[_shapeType]); +} + +QHash stringToShapeTypeLookup; + +void buildStringToShapeTypeLookup() { + stringToShapeTypeLookup["none"] = SHAPE_TYPE_NONE; + stringToShapeTypeLookup["box"] = SHAPE_TYPE_BOX; + stringToShapeTypeLookup["sphere"] = SHAPE_TYPE_SPHERE; +} + +void EntityItemProperties::setShapeTypeFromString(const QString& shapeName) { + if (stringToShapeTypeLookup.empty()) { + buildStringToShapeTypeLookup(); + } + auto shapeTypeItr = stringToShapeTypeLookup.find(shapeName.toLower()); + ShapeType newShapeType = SHAPE_TYPE_NONE; + if (shapeTypeItr != stringToShapeTypeLookup.end()) { + newShapeType = shapeTypeItr.value(); + } + if (newShapeType != _shapeType) { + _shapeType = newShapeType; + _shapeTypeChanged = true; + } +} + EntityPropertyFlags EntityItemProperties::getChangedProperties() const { EntityPropertyFlags changedProperties; @@ -270,7 +300,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons COPY_PROPERTY_TO_QSCRIPTVALUE(lineHeight); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(textColor, getTextColor()); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(backgroundColor, getBackgroundColor()); - COPY_PROPERTY_TO_QSCRIPTVALUE(shapeType); + properties.setProperty("shapeType", getShapeTypeString()); // Sitting properties support QScriptValue sittingPoints = engine->newObject(); @@ -303,8 +333,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons } void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) { - - QScriptValue typeScriptValue = object.property("type"); if (typeScriptValue.isValid()) { setType(typeScriptValue.toVariant().toString()); @@ -350,7 +378,15 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) { COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(lineHeight, setLineHeight); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(textColor, setTextColor); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(backgroundColor, setBackgroundColor); - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(shapeType, setShapeType, ShapeType); + + QScriptValue shapeType = object.property("shapeType"); + if (shapeType.isValid()) { + QString newValue = shapeType.toVariant().toString(); + if (_defaultSettings || newValue != getShapeTypeString()) { + setShapeTypeFromString(newValue); + } + } + _lastEdited = usecTimestampNow(); } diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 51779d3f56..070b80f754 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -183,6 +183,9 @@ public: DEFINE_PROPERTY_REF(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, xColor); DEFINE_PROPERTY_REF(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType); + QString getShapeTypeString() const; + void setShapeTypeFromString(const QString& shapeName); + public: float getMaxDimension() const { return glm::max(_dimensions.x, _dimensions.y, _dimensions.z); } diff --git a/libraries/entities/src/EntityItemPropertiesMacros.h b/libraries/entities/src/EntityItemPropertiesMacros.h index 592f808e1a..9cf16c7a05 100644 --- a/libraries/entities/src/EntityItemPropertiesMacros.h +++ b/libraries/entities/src/EntityItemPropertiesMacros.h @@ -180,15 +180,6 @@ #define COPY_PROPERTY_TO_QSCRIPTVALUE(P) \ properties.setProperty(#P, _##P); -#define COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(P, S, E) \ - QScriptValue P = object.property(#P); \ - if (P.isValid()) { \ - E newValue = (E)(P.toVariant().toInt()); \ - if (_defaultSettings || newValue != _##P) { \ - S(newValue); \ - } \ - } - #define COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(P, S) \ QScriptValue P = object.property(#P); \ if (P.isValid()) { \ From 8c4474b2d0a88d083e330f50856b2306d15f6be7 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 20 Feb 2015 17:55:04 -0800 Subject: [PATCH 144/261] more hacking --- interface/src/Application.cpp | 4 ++-- libraries/script-engine/src/ScriptEngine.cpp | 18 +++++++++++------- libraries/script-engine/src/ScriptEngine.h | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ecb74392a6..e7b71afd93 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -540,7 +540,7 @@ void Application::cleanupBeforeQuit() { _entities.shutdown(); // stop all running scripts - ScriptEngine::gracefullyStopAllScripts(); + ScriptEngine::gracefullyStopAllScripts(this); // first stop all timers directly or by invokeMethod @@ -3545,7 +3545,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run); // when the thread is terminated, add both scriptEngine and thread to the deleteLater queue - connect(scriptEngine, SIGNAL(finished(const QString&)), scriptEngine, SLOT(deleteLater())); + connect(scriptEngine, SIGNAL(doneRunning()), scriptEngine, SLOT(deleteLater())); connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater())); // when the application is about to quit, stop our script engine so it unwinds properly diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index e4401bd4b4..5cbf0b1149 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -94,6 +94,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam _isUserLoaded(false), _arrayBufferClass(new ArrayBufferClass(this)) { + qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::ScriptEngine() " << getFilename() << "[" << this << "]"; _allKnownScriptEngines.insert(this); } @@ -104,28 +105,31 @@ ScriptEngine::~ScriptEngine() { QSet ScriptEngine::_allKnownScriptEngines; -void ScriptEngine::gracefullyStopAllScripts() { +void ScriptEngine::gracefullyStopAllScripts(QObject* application) { qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- START ------------------"; - QSet::const_iterator i = _allKnownScriptEngines.constBegin(); - while (i != _allKnownScriptEngines.constEnd()) { - ScriptEngine* scriptEngine = *i; - qDebug() << scriptEngine; + + QSetIterator i(_allKnownScriptEngines); + while (i.hasNext()) { + ScriptEngine* scriptEngine = i.next(); + qDebug() << (void*)scriptEngine; if (scriptEngine->isRunning()) { qDebug() << "scriptEngine still alive:" << scriptEngine->getFilename() << "[" << scriptEngine << "]"; QEventLoop loop; QObject::connect(scriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); + + scriptEngine->disconnect(application); scriptEngine->stop(); qDebug() << "waiting on script to stop... "; loop.exec(); qDebug() << "done waiting... "; + } else { + qDebug() << "WARNING! scriptEngine [" << (void*)scriptEngine << "] still in _allKnownScriptEngines but not running??? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"; } - - ++i; } qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- DONE ------------------"; } diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index f3289a8c70..1bd07ba220 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -93,7 +93,7 @@ public: QString getFilename() const; - static void gracefullyStopAllScripts(); + static void gracefullyStopAllScripts(QObject* application); public slots: void loadURL(const QUrl& scriptURL); From e3de994c4ad9276413a205bbcc55d499e5b2b264 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 20 Feb 2015 18:42:02 -0800 Subject: [PATCH 145/261] more hacking --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 8 ++++++-- libraries/script-engine/src/ScriptEngine.cpp | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index b0396f32d6..c81599dd33 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -61,8 +61,12 @@ EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterf EntityTreeRenderer::~EntityTreeRenderer() { // NOTE: we don't need to delete _entitiesScriptEngine because it's owned by the application and gets cleaned up // automatically but we do need to delete our sandbox script engine. - delete _sandboxScriptEngine; - _sandboxScriptEngine = NULL; + + if (_sandboxScriptEngine) { + qDebug() << "EntityTreeRenderer::~EntityTreeRenderer() delete _sandboxScriptEngine!!!!!"; + delete _sandboxScriptEngine; + _sandboxScriptEngine = NULL; + } } void EntityTreeRenderer::clear() { diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 5cbf0b1149..9ec76e38b2 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -109,7 +109,7 @@ void ScriptEngine::gracefullyStopAllScripts(QObject* application) { qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- START ------------------"; - QSetIterator i(_allKnownScriptEngines); + QMutableSetIterator i(_allKnownScriptEngines); while (i.hasNext()) { ScriptEngine* scriptEngine = i.next(); qDebug() << (void*)scriptEngine; @@ -121,7 +121,6 @@ void ScriptEngine::gracefullyStopAllScripts(QObject* application) { QObject::connect(scriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); scriptEngine->disconnect(application); - scriptEngine->stop(); qDebug() << "waiting on script to stop... "; From 2e7a43a7fb73ee46163083702697a07f880b10fb Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 20 Feb 2015 18:47:47 -0800 Subject: [PATCH 146/261] more hacking --- interface/src/Application.cpp | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e7b71afd93..2fe11608a5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -587,27 +587,51 @@ void Application::cleanupBeforeQuit() { } Application::~Application() { - EntityTree* tree = _entities.getTree(); - tree->lockForWrite(); - _entities.getTree()->setSimulation(NULL); - tree->unlock(); + qDebug() << "Application::~Application() ------------ START -----------------"; + + qDebug() << "Application::~Application() line:" << __LINE__; + EntityTree* tree = _entities.getTree(); + qDebug() << "Application::~Application() line:" << __LINE__; + tree->lockForWrite(); + qDebug() << "Application::~Application() line:" << __LINE__; + _entities.getTree()->setSimulation(NULL); + qDebug() << "Application::~Application() line:" << __LINE__; + tree->unlock(); + qDebug() << "Application::~Application() line:" << __LINE__; + + qDebug() << "Application::~Application() line:" << __LINE__; qInstallMessageHandler(NULL); + qDebug() << "Application::~Application() line:" << __LINE__; // ask the datagram processing thread to quit and wait until it is done + qDebug() << "Application::~Application() line:" << __LINE__; _nodeThread->quit(); + qDebug() << "Application::~Application() line:" << __LINE__; _nodeThread->wait(); + qDebug() << "Application::~Application() line:" << __LINE__; + qDebug() << "Application::~Application() line:" << __LINE__; _octreeProcessor.terminate(); + qDebug() << "Application::~Application() line:" << __LINE__; _entityEditSender.terminate(); + qDebug() << "Application::~Application() line:" << __LINE__; + qDebug() << "Application::~Application() line:" << __LINE__; Menu::getInstance()->deleteLater(); + qDebug() << "Application::~Application() line:" << __LINE__; + qDebug() << "Application::~Application() line:" << __LINE__; _myAvatar = NULL; + qDebug() << "Application::~Application() line:" << __LINE__; + qDebug() << "Application::~Application() line:" << __LINE__; ModelEntityItem::cleanupLoadedAnimations() ; + qDebug() << "Application::~Application() line:" << __LINE__; + qDebug() << "Application::~Application() line:" << __LINE__; DependencyManager::destroy(); + qDebug() << "Application::~Application() line:" << __LINE__; qDebug() << "start destroying ResourceCaches Application::~Application() line:" << __LINE__; DependencyManager::destroy(); @@ -616,6 +640,7 @@ Application::~Application() { DependencyManager::destroy(); DependencyManager::destroy(); qDebug() << "done destroying ResourceCaches Application::~Application() line:" << __LINE__; + qDebug() << "Application::~Application() ------------ DONE -----------------"; } void Application::initializeGL() { From 36b323c6f302e359ec34235b69f53e38b190c245 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Sat, 21 Feb 2015 15:37:09 +0530 Subject: [PATCH 147/261] Added VHACD dependency Provide link to github source. The source tree has necessary cmke changes to allow 32 bit build specific to hifi --- BUILD.md | 2 +- BUILD_WIN.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index f7dc22882a..b956f0e70b 100644 --- a/BUILD.md +++ b/BUILD.md @@ -8,7 +8,7 @@ * [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 * [Gverb](https://github.com/highfidelity/gverb/archive/master.zip) (direct download to latest version) - +* [VHACD](https://github.com/virneo/v-hacd) #### CMake External Project Dependencies The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. diff --git a/BUILD_WIN.md b/BUILD_WIN.md index f5bc3e09b5..0f806f3bf7 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -67,6 +67,9 @@ The recommended route for CMake to find the external dependencies is to place al -> include -> lib -> test + -> vhacd + -> include + -> lib For many of the external libraries where precompiled binaries are readily available you should be able to simply copy the extracted folder that you get from the download links provided at the top of the guide. Otherwise you may need to build from source and install the built product to this directory. The `root_lib_dir` in the above example can be wherever you choose on your system - as long as the environment variable HIFI_LIB_DIR is set to it. From here on, whenever you see %HIFI_LIB_DIR% you should substitute the directory that you chose. @@ -114,6 +117,15 @@ Add to the PATH: `%HIFI_LIB_DIR%\zlib` Important! This should be added at the beginning of the path, not the end (your system likely has many copies of zlib1.dll, and you want High Fidelity to use the correct version). If High Fidelity picks up the wrong zlib1.dll then it might be unable to use it, and that would cause it to fail to start, showing only the cryptic error "The application was unable to start correctly: 0xc0000022". +###vhacd +Download it directly from https://github.com/virneo/v-hacd +cd src\ +mkdir build +cd build +cmake .. +Build using visual studio 2013. Build ALL_BUILD and INSTALL targets both in Release and Debug. This create a output folder with include and lib directory. +Either copy that folder to ENV %HIFI_LIB_DIR%/vhacd or create an environment variable VHACD_ROOT_DIR to this output directory. + ###freeglut Download the binary package: `freeglut-MSVC-2.8.1-1.mp.zip`. Extract to %HIFI_LIB_DIR%\freeglut. From b9befc208bd494abf266b3d1a4e29326b48d6ddd Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Sat, 21 Feb 2015 15:38:16 +0530 Subject: [PATCH 148/261] Cmake module to find VHACD library FindVHACD will look for VHACD_ROOT_DIR env variable or HIFI_LIB_DIR/vhacd folder --- cmake/modules/FindVHACD.cmake | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 cmake/modules/FindVHACD.cmake diff --git a/cmake/modules/FindVHACD.cmake b/cmake/modules/FindVHACD.cmake new file mode 100644 index 0000000000..d84ab30dff --- /dev/null +++ b/cmake/modules/FindVHACD.cmake @@ -0,0 +1,55 @@ +# +# FindVHACD.cmake +# +# Try to find the V-HACD library that decomposes a 3D surface into a set of "near" convex parts. +# +# Once done this will define +# +# VHACD_FOUND - system found V-HACD +# VHACD_INCLUDE_DIRS - the V-HACD include directory +# VHACD_LIBRARIES - link to this to use V-HACD +# +# Created on 2/20/2015 by Virendra Singh +# Copyright 2015 High Fidelity, Inc. +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") +hifi_library_search_hints("vhacd") + +macro(_FIND_VHACD_LIBRARY _var) + set(_${_var}_NAMES ${ARGN}) + find_library(${_var}_LIBRARY_RELEASE + NAMES ${_${_var}_NAMES} + HINTS + ${VHACD_SEARCH_DIRS} + $ENV{VHACD_ROOT_DIR} + PATH_SUFFIXES lib lib/Release + ) + + find_library(${_var}_LIBRARY_DEBUG + NAMES ${_${_var}_NAMES} + HINTS + ${VHACD_SEARCH_DIRS} + $ENV{VHACD_ROOT_DIR} + PATH_SUFFIXES lib lib/Debug + ) + + select_library_configurations(${_var}) + + mark_as_advanced(${_var}_LIBRARY) + mark_as_advanced(${_var}_LIBRARY) +endmacro() + + +find_path(VHACD_INCLUDE_DIRS VHACD.h PATH_SUFFIXES include HINTS ${VHACD_SEARCH_DIRS} $ENV{VHACD_ROOT_DIR}) +_FIND_VHACD_LIBRARY(VHACD VHACD_LIB) +set(VHACD_LIBRARIES ${VHACD_LIBRARY}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VHACD "Could NOT find VHACD, try to set the path to VHACD root folder in the system variable VHACD_ROOT_DIR or create a directory vhacd in HIFI_LIB_DIR and paste the necessary files there" + VHACD_INCLUDE_DIRS VHACD_LIBRARIES) + +mark_as_advanced(VHACD_INCLUDE_DIRS VHACD_LIBRARIES VHACD_SEARCH_DIRS) \ No newline at end of file From ddd137ed60ff96800531a17adee0dc4a8c2921e7 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Sat, 21 Feb 2015 15:39:16 +0530 Subject: [PATCH 149/261] cmake changes for vhacd cmake changes to create a new project vhacd as a seperate executable in tools directory --- tools/CMakeLists.txt | 1 + tools/vhacd/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tools/vhacd/CMakeLists.txt diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index a13933ba5e..57fe18c53f 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -3,3 +3,4 @@ add_subdirectory(bitstream2json) add_subdirectory(json2bitstream) add_subdirectory(mtc) add_subdirectory(scribe) +add_subdirectory(vhacd) diff --git a/tools/vhacd/CMakeLists.txt b/tools/vhacd/CMakeLists.txt new file mode 100644 index 0000000000..ee82cd599d --- /dev/null +++ b/tools/vhacd/CMakeLists.txt @@ -0,0 +1,13 @@ +set(TARGET_NAME vhacd) +setup_hifi_project() +link_hifi_libraries(shared model fbx gpu networking octree) + +find_package(VHACD REQUIRED) +target_include_directories(${TARGET_NAME} PUBLIC ${VHACD_INCLUDE_DIRS}) +target_link_libraries(${TARGET_NAME} ${VHACD_LIBRARIES}) + +add_dependency_external_project(glm) +find_package(GLM REQUIRED) +target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) + +include_dependency_includes() \ No newline at end of file From ce04b1accb2690edcf43cfa1676c34e8fd519e80 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Sat, 21 Feb 2015 15:40:39 +0530 Subject: [PATCH 150/261] vhacd tool this tool is as per joblist #20305. Its provides an executable to test VHACD computation on simple fbx models. --- tools/vhacd/src/VHACDUtil.cpp | 130 ++++++++++++++++++++++++++++++++++ tools/vhacd/src/VHACDUtil.h | 55 ++++++++++++++ tools/vhacd/src/main.cpp | 102 ++++++++++++++++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 tools/vhacd/src/VHACDUtil.cpp create mode 100644 tools/vhacd/src/VHACDUtil.h create mode 100644 tools/vhacd/src/main.cpp diff --git a/tools/vhacd/src/VHACDUtil.cpp b/tools/vhacd/src/VHACDUtil.cpp new file mode 100644 index 0000000000..bfcdb74634 --- /dev/null +++ b/tools/vhacd/src/VHACDUtil.cpp @@ -0,0 +1,130 @@ +// +// VHACDUtil.cpp +// tools/vhacd/src +// +// Created by Virendra Singh on 2/20/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include +#include "VHACDUtil.h" + + +//Read all the meshes from provided FBX file +bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *results) +{ + + // open the fbx file + QFile fbx(filename); + if (!fbx.open(QIODevice::ReadOnly)) { + return false; + } + std::cout << "Reading FBX.....\n"; + + QByteArray fbxContents = fbx.readAll(); + FBXGeometry geometry = readFBX(fbxContents, QVariantHash()); + //results->meshCount = geometry.meshes.count(); + + int count = 0; + foreach(FBXMesh mesh, geometry.meshes) + { + //get vertices for each mesh + QVector vertices = mesh.vertices; + + //get the triangle indices for each mesh + QVector triangles; + foreach(FBXMeshPart part, mesh.parts) + { + QVector indices = part.triangleIndices; + triangles += indices; + } + + //only read meshes with triangles + if (triangles.count() <= 0) + continue; + results->perMeshVertices.append(vertices); + results->perMeshTriangleIndices.append(triangles); + count++; + } + + results->meshCount = count; + return true; +} + +bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const +{ + VHACD::IVHACD * interfaceVHACD = VHACD::CreateVHACD(); + int meshCount = meshes->meshCount; + int count = 0; + std::cout << "Performing V-HACD computation on " << meshCount <<" meshes ..... " << std::endl; + + for (int i = 0; i < meshCount; i++) + { + + std::vector vertices = meshes->perMeshVertices.at(i).toStdVector(); + std::vector triangles = meshes->perMeshTriangleIndices.at(i).toStdVector(); + int nPoints = (unsigned int)vertices.size(); + int nTriangles = (unsigned int)triangles.size() / 3; + std::cout << "Mesh " << i + 1 << " : "; + // compute approximate convex decomposition + bool res = interfaceVHACD->Compute(&vertices[0].x, 3, nPoints, &triangles[0], 3, nTriangles, params); + if (!res) + { + std::cout << "V-HACD computation failed for Mesh : " << i + 1 << std::endl; + continue; + } + count++; //For counting number of successfull computations + + //Number of hulls for the mesh + unsigned int nConvexHulls = interfaceVHACD->GetNConvexHulls(); + results->convexHullsCountList.append(nConvexHulls); + + //get all the convex hulls for this mesh + QVector convexHulls; + for (unsigned int j = 0; j < nConvexHulls; j++) + { + VHACD::IVHACD::ConvexHull hull; + interfaceVHACD->GetConvexHull(j, hull); + convexHulls.append(hull); + } + results->convexHullList.append(convexHulls); + } //end of for loop + + results->meshCount = count; + + //release memory + interfaceVHACD->Clean(); + interfaceVHACD->Release(); + + if (count > 0) + return true; + else + return false; +} + +vhacd::VHACDUtil:: ~VHACDUtil() +{ + //nothing to be cleaned +} + +//ProgressClaback implementation +void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation) +{ + int progress = (int)(overallProgress + 0.5); + + if (progress < 10) + std::cout << "\b\b"; + else + std::cout << "\b\b\b"; + std::cout << progress << "%"; + + if (progress >= 100) + std::cout << std::endl; + +} + +vhacd::ProgressCallback::ProgressCallback(void){} +vhacd::ProgressCallback::~ProgressCallback(){} \ No newline at end of file diff --git a/tools/vhacd/src/VHACDUtil.h b/tools/vhacd/src/VHACDUtil.h new file mode 100644 index 0000000000..a9df5d7f2a --- /dev/null +++ b/tools/vhacd/src/VHACDUtil.h @@ -0,0 +1,55 @@ +// +// VHACDUtil.h +// tools/vhacd/src +// +// Created by Virendra Singh on 2/20/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_VHACDUtil_h +#define hifi_VHACDUtil_h + +#include +#include +#include +#include + +#include +#include +#include + +namespace vhacd{ + + typedef struct{ + int meshCount; + QVector convexHullsCountList; + QVector> convexHullList; + }ComputeResults; + + typedef struct{ + int meshCount; + QVector> perMeshVertices; + QVector> perMeshTriangleIndices; + }LoadFBXResults; + + class VHACDUtil{ + public: + bool loadFBX(const QString filename, vhacd::LoadFBXResults *results); + bool computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const; + ~VHACDUtil(); + }; + + class ProgressCallback : public VHACD::IVHACD::IUserCallback + { + public: + ProgressCallback(void); + ~ProgressCallback(); + + //Couldn't follow coding guideline here due to virtual function declared in IUserCallback + void Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation); + }; +} +#endif //hifi_VHACDUtil_h \ No newline at end of file diff --git a/tools/vhacd/src/main.cpp b/tools/vhacd/src/main.cpp new file mode 100644 index 0000000000..55a152c179 --- /dev/null +++ b/tools/vhacd/src/main.cpp @@ -0,0 +1,102 @@ +// +// main.cpp +// tools/vhacd/src +// +// Created by Virendra Singh on 2/20/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html + +#include +#include +#include +#include +#include +#include +#include "VHACDUtil.h" + +using namespace std; +using namespace VHACD; + +int main(int argc, char * argv[]) +{ + vector triangles; // array of indexes + vector points; // array of coordinates + vhacd::VHACDUtil vUtil; + vhacd::LoadFBXResults fbx; //mesh data from loaded fbx file + vhacd::ComputeResults results; // results after computing vhacd + VHACD::IVHACD::Parameters params; + vhacd::ProgressCallback pCallBack; + + + QString fname = "F:/models/ship/Sample_Ship.fbx"; + + //set parameters for V-HACD + params.m_callback = &pCallBack; //progress callback + params.m_resolution = 50000; + params.m_depth = 10; + params.m_concavity = 0.003; + params.m_alpha = 0.05; // controls the bias toward clipping along symmetry planes + params.m_pca = 1; // enable/disable normalizing the mesh before applying the convex decomposition + params.m_mode = 1; // 0: voxel - based approximate convex decomposition, 1 : tetrahedron - based approximate convex decomposition + params.m_maxNumVerticesPerCH = 128; + params.m_minVolumePerCH = 0.0001; // controls the adaptive sampling of the generated convex - hulls + + // load the mesh + if (!vUtil.loadFBX(fname, &fbx)) + { + cout << "Error in opening FBX file...."; + return 1; + } + + if (!vUtil.computeVHACD(&fbx, params, &results)) + { + cout << "Compute Failed..."; + return 1; + } + + int totalVertices = 0; + for (int i = 0; i < fbx.meshCount; i++) + { + totalVertices += fbx.perMeshVertices.at(i).count(); + } + + int totalTriangles = 0; + for (int i = 0; i < fbx.meshCount; i++) + { + totalTriangles += fbx.perMeshTriangleIndices.at(i).count(); + } + + int totalHulls = 0; + QVector hullCounts = results.convexHullsCountList; + for (int i = 0; i < results.meshCount; i++) + { + totalHulls += hullCounts.at(i); + } + cout << endl << "Summary of V-HACD Computation..................." << endl; + cout << "File Path : " << fname.toStdString() << endl; + cout << "Number Of Meshes : " << fbx.meshCount << endl; + cout << "Processed Meshes : " << results.meshCount << endl; + cout << "Total vertices : " << totalVertices << endl; + cout << "Total Triangles : " << totalTriangles << endl; + cout << "Total Convex Hulls : " << totalHulls << endl; + cout << endl << "Summary per convex hull ........................" << endl < chList = results.convexHullList.at(i); + cout << "\t" << "Number Of Hulls : " << chList.count() << endl; + + for (int j = 0; j < results.convexHullList.at(i).count(); j++) + { + + cout << "\tHUll : " << j + 1 << endl; + cout << "\t\tNumber Of Points : " << chList.at(j).m_nPoints << endl; + cout << "\t\tNumber Of Triangles : " << chList.at(j).m_nTriangles << endl; + } + } + + getchar(); + return 0; +} \ No newline at end of file From 8d9685ee394f37e5d7d8a67ef04a3e9789a7a00c Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 21 Feb 2015 11:01:07 -0800 Subject: [PATCH 151/261] Fix Face Tracking menu operation --- interface/src/Menu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index bd609a6840..c45fc6ed33 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -369,8 +369,8 @@ Menu::Menu() { faceTrackerGroup->addAction(noFaceTracker); #ifdef HAVE_FACESHIFT - QAction* faceshiftFaceTracker = addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Faceshift, - 0, true, + QAction* faceshiftFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::Faceshift, + 0, false, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(faceshiftFaceTracker); #endif @@ -381,7 +381,7 @@ Menu::Menu() { faceTrackerGroup->addAction(ddeFaceTracker); #ifdef HAVE_VISAGE - QAction* visageFaceTracker = addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, + QAction* visageFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::Visage, 0, false, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(visageFaceTracker); From f169ab1238a7547636a6c9508afb40c42da03beb Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 21 Feb 2015 11:26:48 -0800 Subject: [PATCH 152/261] Tidy and document DDE face tracker UDP socket opening and closing --- interface/src/devices/DdeFaceTracker.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index c4797c4018..87a180bd1e 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -93,13 +93,10 @@ void DdeFaceTracker::update() { } void DdeFaceTracker::setEnabled(bool enabled) { + // isOpen() does not work as one might expect on QUdpSocket; don't test isOpen() before closing socket. + _udpSocket.close(); if (enabled) { - if (_udpSocket.isOpen()) { - _udpSocket.close(); - } _udpSocket.bind(_host, _port); - } else { - _udpSocket.close(); } } From 8212f86bfb614fb8fe507dc7bbce18fed98fe4ce Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Mon, 23 Feb 2015 12:19:45 +0530 Subject: [PATCH 153/261] Minor grammar corrections Corrected line breaks. --- BUILD.md | 3 ++- BUILD_WIN.md | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/BUILD.md b/BUILD.md index b956f0e70b..b94ab1ff50 100644 --- a/BUILD.md +++ b/BUILD.md @@ -8,7 +8,8 @@ * [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 * [Gverb](https://github.com/highfidelity/gverb/archive/master.zip) (direct download to latest version) -* [VHACD](https://github.com/virneo/v-hacd) +* [VHACD](https://github.com/virneo/v-hacd)(clone this repository) + #### CMake External Project Dependencies The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 0f806f3bf7..f735936d0a 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -119,11 +119,17 @@ system likely has many copies of zlib1.dll, and you want High Fidelity to use th ###vhacd Download it directly from https://github.com/virneo/v-hacd -cd src\ -mkdir build -cd build -cmake .. -Build using visual studio 2013. Build ALL_BUILD and INSTALL targets both in Release and Debug. This create a output folder with include and lib directory. + +To build it run the following commands + 1. cd src\ + 2. mkdir build + 3. cd build + 4. cmake .. + +Build using visual studio 2013. Build ALL_BUILD and INSTALL targets both in Release and Debug. + +This will create an output folder with include and lib directory inside it. + Either copy that folder to ENV %HIFI_LIB_DIR%/vhacd or create an environment variable VHACD_ROOT_DIR to this output directory. ###freeglut From d08f7d6255cebe54696e7ae715b955b68d88729e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 08:24:52 -0800 Subject: [PATCH 154/261] check if QXmpp is dynamic or static --- cmake/modules/FindQxmpp.cmake | 8 +++++++- interface/CMakeLists.txt | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/modules/FindQxmpp.cmake b/cmake/modules/FindQxmpp.cmake index 8fbc63e9dc..7c1579835d 100644 --- a/cmake/modules/FindQxmpp.cmake +++ b/cmake/modules/FindQxmpp.cmake @@ -26,6 +26,10 @@ find_path(QXMPP_INCLUDE_DIRS QXmppClient.h PATH_SUFFIXES include/qxmpp HINTS ${Q find_library(QXMPP_LIBRARY_RELEASE NAMES qxmpp PATH_SUFFIXES lib HINTS ${QXMPP_SEARCH_DIRS}) find_library(QXMPP_LIBRARY_DEBUG NAMES qxmpp_d PATH_SUFFIXES lib HINTS ${QXMPP_SEARCH_DIRS}) +if (WIN32) + find_path(QXMPP_DLL_PATH NAMES qxmpp.dll PATH_SUFFIXES lib HINTS ${QXMPP_SEARCH_DIRS}) +endif () + find_package(Qt5 COMPONENTS Xml REQUIRED) include(SelectLibraryConfigurations) @@ -36,4 +40,6 @@ set(QXMPP_LIBRARIES "${QXMPP_LIBRARY}" Qt5::Xml) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(QXmpp DEFAULT_MSG QXMPP_INCLUDE_DIRS QXMPP_LIBRARIES QXMPP_LIBRARY) -mark_as_advanced(QXMPP_INCLUDE_DIRS QXMPP_LIBRARIES QXMPP_SEARCH_DIRS) \ No newline at end of file +if (QXMPP_DLL_PATH) + add_paths_to_lib_paths(${QXMPP_DLL_PATH}) +endif () \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 2e0120dfc8..1c27d8f9db 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -175,8 +175,8 @@ if (RTMIDI_FOUND AND NOT DISABLE_RTMIDI AND APPLE) target_link_libraries(${TARGET_NAME} ${CoreMIDI}) endif () -if (QXMPP_FOUND AND NOT DISABLE_QXMPP AND WIN32) - # assume we're linking a static Qt on windows +if (QXMPP_FOUND AND NOT DISABLE_QXMPP AND WIN32 AND NOT QXMPP_DLL_PATH) + # if we have no QXmpp DLL path, assume we're linking a static QXmpp on windows add_definitions(-DQXMPP_STATIC) endif () From 28bcc0a95277ce4b68de862999cb0a5a360ec9ab Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 08:43:18 -0800 Subject: [PATCH 155/261] use nmake on win for QXmpp build --- cmake/externals/qxmpp/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index ddac75569b..e605e2b253 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -11,6 +11,12 @@ if (ANDROID) set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") endif () +if (WIN32) + find_program(PLATFORM_BUILD_COMMAND NAME nmake) +else () + find_program(PLATFORM_BUILD_COMMAND NAME make) +endif () + include(ExternalProject) ExternalProject_Add( ${EXTERNAL_NAME} @@ -19,6 +25,7 @@ ExternalProject_Add( BUILD_IN_SOURCE 1 PATCH_COMMAND patch -p2 -t -N --verbose < ${CMAKE_CURRENT_SOURCE_DIR}/qxmpp.patch CONFIGURE_COMMAND ${QMAKE_COMMAND} PREFIX= + BUILD_COMMAND PLATFORM_BUILD_COMMAND LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 1c707059c58af89bbff47f727ce84199ef6ac586 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 08:46:16 -0800 Subject: [PATCH 156/261] fix for quoted PLATFORM_BUILD_COMMAND for QXmpp --- cmake/externals/qxmpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index e605e2b253..d5ccd0c020 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -25,7 +25,7 @@ ExternalProject_Add( BUILD_IN_SOURCE 1 PATCH_COMMAND patch -p2 -t -N --verbose < ${CMAKE_CURRENT_SOURCE_DIR}/qxmpp.patch CONFIGURE_COMMAND ${QMAKE_COMMAND} PREFIX= - BUILD_COMMAND PLATFORM_BUILD_COMMAND + BUILD_COMMAND ${PLATFORM_BUILD_COMMAND} LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 1b8d421fb3c8fa48b2d5cdf4d031c3964ebff841 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:06:39 -0800 Subject: [PATCH 157/261] add a fatal error if nmake not found --- cmake/externals/qxmpp/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index d5ccd0c020..0273344b30 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -12,9 +12,12 @@ if (ANDROID) endif () if (WIN32) - find_program(PLATFORM_BUILD_COMMAND NAME nmake) + find_program(PLATFORM_BUILD_COMMAND nmake) + if (NOT PLATFORM_BUILD_COMMAND) + message(FATAL_ERROR "You asked us to grap QXmpp and build it, but nmake was not found. Please make sure the folder containing nmake.exe is in your PATH.") + endif () else () - find_program(PLATFORM_BUILD_COMMAND NAME make) + find_program(PLATFORM_BUILD_COMMAND make) endif () include(ExternalProject) From d32fc645e80933634ce7a774f5cc68d8b05b165d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 23 Feb 2015 09:10:15 -0800 Subject: [PATCH 158/261] remove some dead code, added a debugging notes comment --- .../src/EntityTreeRenderer.cpp | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index c81599dd33..7a089eee5f 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -63,6 +63,11 @@ EntityTreeRenderer::~EntityTreeRenderer() { // automatically but we do need to delete our sandbox script engine. if (_sandboxScriptEngine) { + // NOTE: is it possible this is a problem? I think that we hook the script engine object up to a deleteLater() + // call inside of registerScriptEngineWithApplicationServices() but do we not call that for _sandboxScriptEngine??? + // this _sandboxScriptEngine implementation is confusing and potentially error prone because it's not a full fledged + // ScriptEngine that has been fully connected. We did this so that scripts that were ill-formed could be evaluated + // but not execute against the application. qDebug() << "EntityTreeRenderer::~EntityTreeRenderer() delete _sandboxScriptEngine!!!!!"; delete _sandboxScriptEngine; _sandboxScriptEngine = NULL; @@ -103,22 +108,6 @@ void EntityTreeRenderer::init() { void EntityTreeRenderer::shutdown() { _shuttingDown = true; - - /* - if (_entitiesScriptEngine) { - _entitiesScriptEngine->stop(); - - QEventLoop loop; - QObject::connect(_entitiesScriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); - - _entitiesScriptEngine->stop(); - - qDebug() << "waiting on Entities sandbox script to stop... "; - loop.exec(); - qDebug() << "done waiting... "; - - } - */ } From 9e5fb9532bc2d6fb51f660cc2ba7f9ecef4d6613 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:11:06 -0800 Subject: [PATCH 159/261] clear up BUILD guide for optional external projects --- BUILD.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/BUILD.md b/BUILD.md index 6cfe5229d6..98b8cffab1 100644 --- a/BUILD.md +++ b/BUILD.md @@ -13,6 +13,13 @@ * [gverb](https://github.com/highfidelity/gverb) * [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 +The following external projects are optional dependencies. You can indicate to CMake that you would like to include them by passing -DGET_$NAME=1 when running a clean CMake build. For example, to get CMake to download and compile QXmpp you would pass -DGET_QXMPP=1. + +* [SDL2](https://www.libsdl.org/download-2.0.php) ~> 2.0.3 + * Enables game controller support in Interface +* [QXmpp](https://github.com/qxmpp-project/qxmpp) ~> 0.7.6 + * Enables text chat support in Interface + The above dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-ext` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. Should you want to force a re-download and re-compile of a specific external, you can simply remove that directory from the appropriate subfolder in `build-ext`. Should you want to force a re-download and re-compile of all externals, just remove the `build-ext` folder. @@ -67,12 +74,6 @@ In the examples below the variable $NAME would be replaced by the name of the de ###Optional Components -####QXmpp - -You can [find QXmpp here](https://github.com/qxmpp-project/qxmpp), 0.7.6 is the version you want. The inclusion of the QXmpp enables text chat in the Interface client. - -OS X users who tap our [homebrew formulas repository](https://github.com/highfidelity/homebrew-formulas) can install QXmpp via homebrew - `brew install highfidelity/formulas/qxmpp`. - ####Devices You can support external input/output devices such as Oculus Rift, Leap Motion, Faceshift, PrioVR, MIDI, Razr Hydra and more by adding each individual SDK in the visible building path. Refer to the readme file available in each device folder in [interface/external/](interface/external) for the detailed explanation of the requirements to use the device. From e53221e2977f2a4d5b9e2d8840c8eae9efd65588 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:11:17 -0800 Subject: [PATCH 160/261] remove an extra space --- BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index 98b8cffab1..b8d7df0d0c 100644 --- a/BUILD.md +++ b/BUILD.md @@ -43,7 +43,7 @@ For example, a Qt5 5.3.2 installation to /usr/local/qt5 would require that QT_CM The path it needs to be set to will depend on where and how Qt5 was installed. e.g. export QT_CMAKE_PREFIX_PATH=/usr/local/qt/5.3.2/clang_64/lib/cmake/ - export QT_CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.3.2/lib/cmake + export QT_CMAKE_PREFIX_PATH=/usr/localCellar/qt5/5.3.2/lib/cmake export QT_CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake ####Generating build files From c3d98b12899d19d3236056897c641cad615a54f3 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:11:52 -0800 Subject: [PATCH 161/261] use nmake for install of QXmpp on windows --- cmake/externals/qxmpp/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index 0273344b30..c35708daa6 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -14,7 +14,7 @@ endif () if (WIN32) find_program(PLATFORM_BUILD_COMMAND nmake) if (NOT PLATFORM_BUILD_COMMAND) - message(FATAL_ERROR "You asked us to grap QXmpp and build it, but nmake was not found. Please make sure the folder containing nmake.exe is in your PATH.") + message(FATAL_ERROR "You asked CMake to grap QXmpp and build it, but nmake was not found. Please make sure the folder containing nmake.exe is in your PATH.") endif () else () find_program(PLATFORM_BUILD_COMMAND make) @@ -29,6 +29,7 @@ ExternalProject_Add( PATCH_COMMAND patch -p2 -t -N --verbose < ${CMAKE_CURRENT_SOURCE_DIR}/qxmpp.patch CONFIGURE_COMMAND ${QMAKE_COMMAND} PREFIX= BUILD_COMMAND ${PLATFORM_BUILD_COMMAND} + INSTALL_COMMAND ${PLATFORM_BUILD_COMMAND} install LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 9a069f56ab5a97c9537fa110c85d1b75ab517ed1 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:13:59 -0800 Subject: [PATCH 162/261] indicate in win build guide that nmake should be in path --- BUILD_WIN.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 6956abbc5f..290a8b8be6 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -10,10 +10,16 @@ Or you can start a regular command prompt and then run: "%VS120COMNTOOLS%\vsvars32.bat" -#####Windows SDK 8.1 +####Windows SDK 8.1 If using Visual Studio 2013 and building as a Visual Studio 2013 project you need the Windows 8 SDK which you should already have as part of installing Visual Studio 2013. You should be able to see it at `C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86`. +####nmake + +Some of the external projects may require nmake to build and install. Please ensure that nmake is in your PATH so CMake can find it if required. For a typical Visual Studio installation, nmake.exe is located at the following path. + + C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin + ###Qt You can use the online installer or the offline installer. If you use the offline installer, be sure to select the "OpenGL" version. From e5ef61e27ee15b0cd7ad3d0409b374bf7ba3122b Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 23 Feb 2015 09:23:15 -0800 Subject: [PATCH 163/261] simplifying the change --- .../src/EntityTreeRenderer.cpp | 334 +++++++++--------- 1 file changed, 173 insertions(+), 161 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 7a089eee5f..18813de519 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -718,159 +718,168 @@ QScriptValueList EntityTreeRenderer::createEntityArgs(const EntityItemID& entity } void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { - if (_tree && !_shuttingDown) { - PerformanceTimer perfTimer("EntityTreeRenderer::mousePressEvent"); - PickRay ray = _viewState->computePickRay(event->x(), event->y()); - - bool precisionPicking = !_dontDoPrecisionPicking; - RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); - if (rayPickResult.intersects) { - //qDebug() << "mousePressEvent over entity:" << rayPickResult.entityID; - emit mousePressOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - - QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); - QScriptValue entityScript = loadEntityScript(rayPickResult.entity); - if (entityScript.property("mousePressOnEntity").isValid()) { - entityScript.property("mousePressOnEntity").call(entityScript, entityScriptArgs); - } - - _currentClickingOnEntityID = rayPickResult.entityID; - emit clickDownOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); - if (entityScript.property("clickDownOnEntity").isValid()) { - entityScript.property("clickDownOnEntity").call(entityScript, entityScriptArgs); - } - } - _lastMouseEvent = MouseEvent(*event, deviceID); - _lastMouseEventValid = true; + // If we don't have a tree, or we're in the process of shutting down, then don't + // process these events. + if (!_tree || _shuttingDown) { + return; } + PerformanceTimer perfTimer("EntityTreeRenderer::mousePressEvent"); + PickRay ray = _viewState->computePickRay(event->x(), event->y()); + + bool precisionPicking = !_dontDoPrecisionPicking; + RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); + if (rayPickResult.intersects) { + //qDebug() << "mousePressEvent over entity:" << rayPickResult.entityID; + emit mousePressOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + + QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); + QScriptValue entityScript = loadEntityScript(rayPickResult.entity); + if (entityScript.property("mousePressOnEntity").isValid()) { + entityScript.property("mousePressOnEntity").call(entityScript, entityScriptArgs); + } + + _currentClickingOnEntityID = rayPickResult.entityID; + emit clickDownOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); + if (entityScript.property("clickDownOnEntity").isValid()) { + entityScript.property("clickDownOnEntity").call(entityScript, entityScriptArgs); + } + } + _lastMouseEvent = MouseEvent(*event, deviceID); + _lastMouseEventValid = true; } void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { - if (_tree && !_shuttingDown) { - PerformanceTimer perfTimer("EntityTreeRenderer::mouseReleaseEvent"); - PickRay ray = _viewState->computePickRay(event->x(), event->y()); - bool precisionPicking = !_dontDoPrecisionPicking; - RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); - if (rayPickResult.intersects) { - //qDebug() << "mouseReleaseEvent over entity:" << rayPickResult.entityID; - emit mouseReleaseOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - - QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); - QScriptValue entityScript = loadEntityScript(rayPickResult.entity); - if (entityScript.property("mouseReleaseOnEntity").isValid()) { - entityScript.property("mouseReleaseOnEntity").call(entityScript, entityScriptArgs); - } - } - - // Even if we're no longer intersecting with an entity, if we started clicking on it, and now - // we're releasing the button, then this is considered a clickOn event - if (!_currentClickingOnEntityID.isInvalidID()) { - emit clickReleaseOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); - - QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); - QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); - if (currentClickingEntity.property("clickReleaseOnEntity").isValid()) { - currentClickingEntity.property("clickReleaseOnEntity").call(currentClickingEntity, currentClickingEntityArgs); - } - } - - // makes it the unknown ID, we just released so we can't be clicking on anything - _currentClickingOnEntityID = EntityItemID::createInvalidEntityID(); - _lastMouseEvent = MouseEvent(*event, deviceID); - _lastMouseEventValid = true; + // If we don't have a tree, or we're in the process of shutting down, then don't + // process these events. + if (!_tree || _shuttingDown) { + return; } + PerformanceTimer perfTimer("EntityTreeRenderer::mouseReleaseEvent"); + PickRay ray = _viewState->computePickRay(event->x(), event->y()); + bool precisionPicking = !_dontDoPrecisionPicking; + RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); + if (rayPickResult.intersects) { + //qDebug() << "mouseReleaseEvent over entity:" << rayPickResult.entityID; + emit mouseReleaseOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + + QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); + QScriptValue entityScript = loadEntityScript(rayPickResult.entity); + if (entityScript.property("mouseReleaseOnEntity").isValid()) { + entityScript.property("mouseReleaseOnEntity").call(entityScript, entityScriptArgs); + } + } + + // Even if we're no longer intersecting with an entity, if we started clicking on it, and now + // we're releasing the button, then this is considered a clickOn event + if (!_currentClickingOnEntityID.isInvalidID()) { + emit clickReleaseOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); + + QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); + QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); + if (currentClickingEntity.property("clickReleaseOnEntity").isValid()) { + currentClickingEntity.property("clickReleaseOnEntity").call(currentClickingEntity, currentClickingEntityArgs); + } + } + + // makes it the unknown ID, we just released so we can't be clicking on anything + _currentClickingOnEntityID = EntityItemID::createInvalidEntityID(); + _lastMouseEvent = MouseEvent(*event, deviceID); + _lastMouseEventValid = true; } void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { - if (_tree && !_shuttingDown) { - PerformanceTimer perfTimer("EntityTreeRenderer::mouseMoveEvent"); - - PickRay ray = _viewState->computePickRay(event->x(), event->y()); - - bool precisionPicking = false; // for mouse moves we do not do precision picking - RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking); - if (rayPickResult.intersects) { - QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); - - // load the entity script if needed... - QScriptValue entityScript = loadEntityScript(rayPickResult.entity); - if (entityScript.property("mouseMoveEvent").isValid()) { - entityScript.property("mouseMoveEvent").call(entityScript, entityScriptArgs); - } - - //qDebug() << "mouseMoveEvent over entity:" << rayPickResult.entityID; - emit mouseMoveOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - if (entityScript.property("mouseMoveOnEntity").isValid()) { - entityScript.property("mouseMoveOnEntity").call(entityScript, entityScriptArgs); - } - - // handle the hover logic... - - // if we were previously hovering over an entity, and this new entity is not the same as our previous entity - // then we need to send the hover leave. - if (!_currentHoverOverEntityID.isInvalidID() && rayPickResult.entityID != _currentHoverOverEntityID) { - emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); - - QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); - - QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); - if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { - currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); - } - } - - // If the new hover entity does not match the previous hover entity then we are entering the new one - // this is true if the _currentHoverOverEntityID is known or unknown - if (rayPickResult.entityID != _currentHoverOverEntityID) { - emit hoverEnterEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - if (entityScript.property("hoverEnterEntity").isValid()) { - entityScript.property("hoverEnterEntity").call(entityScript, entityScriptArgs); - } - } - - // and finally, no matter what, if we're intersecting an entity then we're definitely hovering over it, and - // we should send our hover over event - emit hoverOverEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); - if (entityScript.property("hoverOverEntity").isValid()) { - entityScript.property("hoverOverEntity").call(entityScript, entityScriptArgs); - } - - // remember what we're hovering over - _currentHoverOverEntityID = rayPickResult.entityID; - - } else { - // handle the hover logic... - // if we were previously hovering over an entity, and we're no longer hovering over any entity then we need to - // send the hover leave for our previous entity - if (!_currentHoverOverEntityID.isInvalidID()) { - emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); - - QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); - - QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); - if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { - currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); - } - - _currentHoverOverEntityID = EntityItemID::createInvalidEntityID(); // makes it the unknown ID - } - } - - // Even if we're no longer intersecting with an entity, if we started clicking on an entity and we have - // not yet released the hold then this is still considered a holdingClickOnEntity event - if (!_currentClickingOnEntityID.isInvalidID()) { - emit holdingClickOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); - - QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); - - QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); - if (currentClickingEntity.property("holdingClickOnEntity").isValid()) { - currentClickingEntity.property("holdingClickOnEntity").call(currentClickingEntity, currentClickingEntityArgs); - } - } - _lastMouseEvent = MouseEvent(*event, deviceID); - _lastMouseEventValid = true; + // If we don't have a tree, or we're in the process of shutting down, then don't + // process these events. + if (!_tree || _shuttingDown) { + return; } + PerformanceTimer perfTimer("EntityTreeRenderer::mouseMoveEvent"); + + PickRay ray = _viewState->computePickRay(event->x(), event->y()); + + bool precisionPicking = false; // for mouse moves we do not do precision picking + RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::TryLock, precisionPicking); + if (rayPickResult.intersects) { + QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID); + + // load the entity script if needed... + QScriptValue entityScript = loadEntityScript(rayPickResult.entity); + if (entityScript.property("mouseMoveEvent").isValid()) { + entityScript.property("mouseMoveEvent").call(entityScript, entityScriptArgs); + } + + //qDebug() << "mouseMoveEvent over entity:" << rayPickResult.entityID; + emit mouseMoveOnEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + if (entityScript.property("mouseMoveOnEntity").isValid()) { + entityScript.property("mouseMoveOnEntity").call(entityScript, entityScriptArgs); + } + + // handle the hover logic... + + // if we were previously hovering over an entity, and this new entity is not the same as our previous entity + // then we need to send the hover leave. + if (!_currentHoverOverEntityID.isInvalidID() && rayPickResult.entityID != _currentHoverOverEntityID) { + emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); + + QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); + + QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); + if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { + currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); + } + } + + // If the new hover entity does not match the previous hover entity then we are entering the new one + // this is true if the _currentHoverOverEntityID is known or unknown + if (rayPickResult.entityID != _currentHoverOverEntityID) { + emit hoverEnterEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + if (entityScript.property("hoverEnterEntity").isValid()) { + entityScript.property("hoverEnterEntity").call(entityScript, entityScriptArgs); + } + } + + // and finally, no matter what, if we're intersecting an entity then we're definitely hovering over it, and + // we should send our hover over event + emit hoverOverEntity(rayPickResult.entityID, MouseEvent(*event, deviceID)); + if (entityScript.property("hoverOverEntity").isValid()) { + entityScript.property("hoverOverEntity").call(entityScript, entityScriptArgs); + } + + // remember what we're hovering over + _currentHoverOverEntityID = rayPickResult.entityID; + + } else { + // handle the hover logic... + // if we were previously hovering over an entity, and we're no longer hovering over any entity then we need to + // send the hover leave for our previous entity + if (!_currentHoverOverEntityID.isInvalidID()) { + emit hoverLeaveEntity(_currentHoverOverEntityID, MouseEvent(*event, deviceID)); + + QScriptValueList currentHoverEntityArgs = createMouseEventArgs(_currentHoverOverEntityID, event, deviceID); + + QScriptValue currentHoverEntity = loadEntityScript(_currentHoverOverEntityID); + if (currentHoverEntity.property("hoverLeaveEntity").isValid()) { + currentHoverEntity.property("hoverLeaveEntity").call(currentHoverEntity, currentHoverEntityArgs); + } + + _currentHoverOverEntityID = EntityItemID::createInvalidEntityID(); // makes it the unknown ID + } + } + + // Even if we're no longer intersecting with an entity, if we started clicking on an entity and we have + // not yet released the hold then this is still considered a holdingClickOnEntity event + if (!_currentClickingOnEntityID.isInvalidID()) { + emit holdingClickOnEntity(_currentClickingOnEntityID, MouseEvent(*event, deviceID)); + + QScriptValueList currentClickingEntityArgs = createMouseEventArgs(_currentClickingOnEntityID, event, deviceID); + + QScriptValue currentClickingEntity = loadEntityScript(_currentClickingOnEntityID); + if (currentClickingEntity.property("holdingClickOnEntity").isValid()) { + currentClickingEntity.property("holdingClickOnEntity").call(currentClickingEntity, currentClickingEntityArgs); + } + } + _lastMouseEvent = MouseEvent(*event, deviceID); + _lastMouseEventValid = true; } void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) { @@ -919,24 +928,27 @@ void EntityTreeRenderer::changingEntityID(const EntityItemID& oldEntityID, const void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision) { - if (_tree && !_shuttingDown) { - QScriptValue entityScriptA = loadEntityScript(idA); - if (entityScriptA.property("collisionWithEntity").isValid()) { - QScriptValueList args; - args << idA.toScriptValue(_entitiesScriptEngine); - args << idB.toScriptValue(_entitiesScriptEngine); - args << collisionToScriptValue(_entitiesScriptEngine, collision); - entityScriptA.property("collisionWithEntity").call(entityScriptA, args); - } + // If we don't have a tree, or we're in the process of shutting down, then don't + // process these events. + if (!_tree || _shuttingDown) { + return; + } + QScriptValue entityScriptA = loadEntityScript(idA); + if (entityScriptA.property("collisionWithEntity").isValid()) { + QScriptValueList args; + args << idA.toScriptValue(_entitiesScriptEngine); + args << idB.toScriptValue(_entitiesScriptEngine); + args << collisionToScriptValue(_entitiesScriptEngine, collision); + entityScriptA.property("collisionWithEntity").call(entityScriptA, args); + } - QScriptValue entityScriptB = loadEntityScript(idB); - if (entityScriptB.property("collisionWithEntity").isValid()) { - QScriptValueList args; - args << idB.toScriptValue(_entitiesScriptEngine); - args << idA.toScriptValue(_entitiesScriptEngine); - args << collisionToScriptValue(_entitiesScriptEngine, collision); - entityScriptB.property("collisionWithEntity").call(entityScriptA, args); - } + QScriptValue entityScriptB = loadEntityScript(idB); + if (entityScriptB.property("collisionWithEntity").isValid()) { + QScriptValueList args; + args << idB.toScriptValue(_entitiesScriptEngine); + args << idA.toScriptValue(_entitiesScriptEngine); + args << collisionToScriptValue(_entitiesScriptEngine, collision); + entityScriptB.property("collisionWithEntity").call(entityScriptA, args); } } From 437d5c7bdf57febff22cd039c5102c8e5fdbde69 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:26:35 -0800 Subject: [PATCH 164/261] repairs to include locations for QXmpp and SDL2 --- cmake/externals/sdl2/CMakeLists.txt | 4 +++- cmake/modules/FindQxmpp.cmake | 2 +- interface/src/XmppClient.h | 4 ++-- interface/src/scripting/GlobalServicesScriptingInterface.h | 4 ++-- interface/src/ui/ChatWindow.h | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/externals/sdl2/CMakeLists.txt b/cmake/externals/sdl2/CMakeLists.txt index 00936a8320..5b60e60af1 100644 --- a/cmake/externals/sdl2/CMakeLists.txt +++ b/cmake/externals/sdl2/CMakeLists.txt @@ -33,6 +33,7 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) if (WIN32) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) set(_ROOT_DIR ${SOURCE_DIR}) + set(_INCLUDE_DIR ${_ROOT_DIR}/include) set(_LIB_DIR "${SOURCE_DIR}/lib/x86") set(_LIB_EXT "lib") @@ -40,11 +41,12 @@ if (WIN32) else () ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) set(_ROOT_DIR ${INSTALL_DIR}) + set(_INCLUDE_DIR ${_ROOT_DIR}/include/SDL2) set(_LIB_DIR ${INSTALL_DIR}/lib) set(_LIB_EXT "so") set(_LIB_PREFIX "lib") endif () -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${_ROOT_DIR}/include/SDL2 CACHE PATH "Location of SDL2 include directory") +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${_INCLUDE_DIR} CACHE PATH "Location of SDL2 include directory") set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${_LIB_DIR}/${_LIB_PREFIX}SDL2.${_LIB_EXT} CACHE FILEPATH "Path to SDL2 library") \ No newline at end of file diff --git a/cmake/modules/FindQxmpp.cmake b/cmake/modules/FindQxmpp.cmake index 7c1579835d..489936688e 100644 --- a/cmake/modules/FindQxmpp.cmake +++ b/cmake/modules/FindQxmpp.cmake @@ -21,7 +21,7 @@ include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") hifi_library_search_hints("qxmpp") -find_path(QXMPP_INCLUDE_DIRS QXmppClient.h PATH_SUFFIXES include/qxmpp HINTS ${QXMPP_SEARCH_DIRS}) +find_path(QXMPP_INCLUDE_DIRS qxmpp/QXmppClient.h PATH_SUFFIXES include HINTS ${QXMPP_SEARCH_DIRS}) find_library(QXMPP_LIBRARY_RELEASE NAMES qxmpp PATH_SUFFIXES lib HINTS ${QXMPP_SEARCH_DIRS}) find_library(QXMPP_LIBRARY_DEBUG NAMES qxmpp_d PATH_SUFFIXES lib HINTS ${QXMPP_SEARCH_DIRS}) diff --git a/interface/src/XmppClient.h b/interface/src/XmppClient.h index 91c10c4055..2b7a831ff3 100644 --- a/interface/src/XmppClient.h +++ b/interface/src/XmppClient.h @@ -15,8 +15,8 @@ #include #ifdef HAVE_QXMPP -#include -#include +#include +#include #endif /// Generalized threaded processor for handling received inbound packets. diff --git a/interface/src/scripting/GlobalServicesScriptingInterface.h b/interface/src/scripting/GlobalServicesScriptingInterface.h index 657cb945c5..d8b436a6e6 100644 --- a/interface/src/scripting/GlobalServicesScriptingInterface.h +++ b/interface/src/scripting/GlobalServicesScriptingInterface.h @@ -21,8 +21,8 @@ #ifdef HAVE_QXMPP -#include -#include +#include +#include #endif // HAVE_QXMPP diff --git a/interface/src/ui/ChatWindow.h b/interface/src/ui/ChatWindow.h index 2338ab280d..b2ee113637 100644 --- a/interface/src/ui/ChatWindow.h +++ b/interface/src/ui/ChatWindow.h @@ -25,8 +25,8 @@ #ifdef HAVE_QXMPP -#include -#include +#include +#include #endif From a8d48e592f596ca116daa9ead613838fe65fb727 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 23 Feb 2015 09:44:18 -0800 Subject: [PATCH 165/261] removing debug messages --- .../src/EntityTreeRenderer.cpp | 3 +- libraries/script-engine/src/ScriptEngine.cpp | 39 +++++-------------- libraries/script-engine/src/ScriptEngine.h | 2 +- 3 files changed, 11 insertions(+), 33 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 18813de519..fdaaa6422b 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -68,7 +68,6 @@ EntityTreeRenderer::~EntityTreeRenderer() { // this _sandboxScriptEngine implementation is confusing and potentially error prone because it's not a full fledged // ScriptEngine that has been fully connected. We did this so that scripts that were ill-formed could be evaluated // but not execute against the application. - qDebug() << "EntityTreeRenderer::~EntityTreeRenderer() delete _sandboxScriptEngine!!!!!"; delete _sandboxScriptEngine; _sandboxScriptEngine = NULL; } @@ -171,7 +170,7 @@ QString EntityTreeRenderer::loadScriptContents(const QString& scriptMaybeURLorTe QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity) { if (_shuttingDown) { - return QScriptValue(); // no entity... + return QScriptValue(); // since we're shutting down, we don't load any more scripts } if (!entity) { diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 9ec76e38b2..6cae9fcfa4 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -94,43 +94,33 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam _isUserLoaded(false), _arrayBufferClass(new ArrayBufferClass(this)) { - qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::ScriptEngine() " << getFilename() << "[" << this << "]"; _allKnownScriptEngines.insert(this); } ScriptEngine::~ScriptEngine() { - qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::~ScriptEngine() " << getFilename(); _allKnownScriptEngines.remove(this); } QSet ScriptEngine::_allKnownScriptEngines; -void ScriptEngine::gracefullyStopAllScripts(QObject* application) { - qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- START ------------------"; - - +void ScriptEngine::stopAllScripts(QObject* application) { QMutableSetIterator i(_allKnownScriptEngines); while (i.hasNext()) { ScriptEngine* scriptEngine = i.next(); - qDebug() << (void*)scriptEngine; - - if (scriptEngine->isRunning()) { - qDebug() << "scriptEngine still alive:" << scriptEngine->getFilename() << "[" << scriptEngine << "]"; + // NOTE: typically all script engines are running. But there's at least one known exception to this, the + // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using + // them. We don't need to stop scripts that aren't running. + if (scriptEngine->isRunning()) { QEventLoop loop; QObject::connect(scriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); scriptEngine->disconnect(application); scriptEngine->stop(); - qDebug() << "waiting on script to stop... "; loop.exec(); - qDebug() << "done waiting... "; - } else { - qDebug() << "WARNING! scriptEngine [" << (void*)scriptEngine << "] still in _allKnownScriptEngines but not running??? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"; } } - qDebug() << "[" << QThread::currentThread() << "]" << "ScriptEngine::gracefullyStopAllScripts() ----------- DONE ------------------"; } QString ScriptEngine::getFilename() const { @@ -411,14 +401,12 @@ void ScriptEngine::run() { } if (_isFinished) { - qDebug() << "ScriptEngine::run()... while() about to break " << getFilename(); break; } QCoreApplication::processEvents(); if (_isFinished) { - qDebug() << "ScriptEngine::run()... while() about to break " << getFilename(); break; } @@ -548,7 +536,6 @@ void ScriptEngine::run() { } lastUpdate = now; } - qDebug() << "ScriptEngine::run()... about to emit scriptEnding() " << getFilename(); emit scriptEnding(); // kill the avatar identity timer @@ -566,25 +553,19 @@ void ScriptEngine::run() { // If we were on a thread, then wait till it's done if (thread()) { - qDebug() << "ScriptEngine::run()... about to call thread()->quit() " << getFilename(); thread()->quit(); } - qDebug() << "ScriptEngine::run()... about to emit finished() " << getFilename(); emit finished(_fileNameString); _isRunning = false; - qDebug() << "ScriptEngine::run()... about to emit runningStateChanged() " << getFilename(); emit runningStateChanged(); - qDebug() << "ScriptEngine::run()... about to emit doneRunning() " << getFilename(); emit doneRunning(); - qDebug() << "ScriptEngine::run()... DONE WITH run()... " << getFilename(); } void ScriptEngine::stop() { - qDebug() << "ScriptEngine::stop()... " << getFilename(); _isFinished = true; emit runningStateChanged(); } @@ -666,12 +647,10 @@ void ScriptEngine::print(const QString& message) { emit printedMessage(message); } -/** - * If a callback is specified, the included files will be loaded asynchronously and the callback will be called - * when all of the files have finished loading. - * If no callback is specified, the included files will be loaded synchronously and will block execution until - * all of the files have finished loading. - */ +// If a callback is specified, the included files will be loaded asynchronously and the callback will be called +// when all of the files have finished loading. +// If no callback is specified, the included files will be loaded synchronously and will block execution until +// all of the files have finished loading. void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) { QList urls; for (QString file : includeFiles) { diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index 1bd07ba220..ab32f2c0a5 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -93,7 +93,7 @@ public: QString getFilename() const; - static void gracefullyStopAllScripts(QObject* application); + static void stopAllScripts(QObject* application); public slots: void loadURL(const QUrl& scriptURL); From 85cec79ff5566125a1721ac61420e7ba142c0a23 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 23 Feb 2015 09:44:22 -0800 Subject: [PATCH 166/261] removing debug messages --- interface/src/Application.cpp | 44 +++-------------------------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2fe11608a5..25ee53f187 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -527,21 +527,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : } void Application::aboutToQuit() { -qDebug() << "Application::aboutToQuit()"; _aboutToQuit = true; cleanupBeforeQuit(); } void Application::cleanupBeforeQuit() { - qDebug() << "Application::cleanupBeforeQuit() ------------ START -----------------"; - - // stop entities running scripts - _entities.shutdown(); - - // stop all running scripts - ScriptEngine::gracefullyStopAllScripts(this); - + + _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts + ScriptEngine::stopAllScripts(this); // stop all currently running global scripts // first stop all timers directly or by invokeMethod // depending on what thread they run in @@ -582,65 +576,36 @@ void Application::cleanupBeforeQuit() { // destroy the AudioClient so it and its thread have a chance to go down safely DependencyManager::destroy(); - - qDebug() << "Application::cleanupBeforeQuit() ------------ DONE -----------------"; } Application::~Application() { - qDebug() << "Application::~Application() ------------ START -----------------"; - - - qDebug() << "Application::~Application() line:" << __LINE__; EntityTree* tree = _entities.getTree(); - qDebug() << "Application::~Application() line:" << __LINE__; tree->lockForWrite(); - qDebug() << "Application::~Application() line:" << __LINE__; _entities.getTree()->setSimulation(NULL); - qDebug() << "Application::~Application() line:" << __LINE__; tree->unlock(); - qDebug() << "Application::~Application() line:" << __LINE__; - qDebug() << "Application::~Application() line:" << __LINE__; qInstallMessageHandler(NULL); - qDebug() << "Application::~Application() line:" << __LINE__; // ask the datagram processing thread to quit and wait until it is done - qDebug() << "Application::~Application() line:" << __LINE__; _nodeThread->quit(); - qDebug() << "Application::~Application() line:" << __LINE__; _nodeThread->wait(); - qDebug() << "Application::~Application() line:" << __LINE__; - qDebug() << "Application::~Application() line:" << __LINE__; _octreeProcessor.terminate(); - qDebug() << "Application::~Application() line:" << __LINE__; _entityEditSender.terminate(); - qDebug() << "Application::~Application() line:" << __LINE__; - qDebug() << "Application::~Application() line:" << __LINE__; Menu::getInstance()->deleteLater(); - qDebug() << "Application::~Application() line:" << __LINE__; - qDebug() << "Application::~Application() line:" << __LINE__; _myAvatar = NULL; - qDebug() << "Application::~Application() line:" << __LINE__; - qDebug() << "Application::~Application() line:" << __LINE__; ModelEntityItem::cleanupLoadedAnimations() ; - qDebug() << "Application::~Application() line:" << __LINE__; - qDebug() << "Application::~Application() line:" << __LINE__; DependencyManager::destroy(); - qDebug() << "Application::~Application() line:" << __LINE__; - qDebug() << "start destroying ResourceCaches Application::~Application() line:" << __LINE__; DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); - qDebug() << "done destroying ResourceCaches Application::~Application() line:" << __LINE__; - qDebug() << "Application::~Application() ------------ DONE -----------------"; } void Application::initializeGL() { @@ -3469,7 +3434,6 @@ void Application::clearScriptsBeforeRunning() { } void Application::saveScripts() { -qDebug() << "Application::saveScripts()"; // Saves all currently running user-loaded scripts Settings settings; settings.beginWriteArray(SETTINGS_KEY); @@ -3638,7 +3602,6 @@ void Application::handleScriptLoadError(const QString& scriptFilename) { } void Application::scriptFinished(const QString& scriptName) { - qDebug() << "Application::scriptFinished(), scriptName:" << scriptName; const QString& scriptURLString = QUrl(scriptName).toString(); QHash::iterator it = _scriptEnginesHash.find(scriptURLString); if (it != _scriptEnginesHash.end()) { @@ -3649,7 +3612,6 @@ void Application::scriptFinished(const QString& scriptName) { } void Application::stopAllScripts(bool restart) { - qDebug() << "Application::stopAllScripts()... restart:" << restart; // stops all current running scripts for (QHash::const_iterator it = _scriptEnginesHash.constBegin(); it != _scriptEnginesHash.constEnd(); it++) { From 82a798ef15e7e71cc8f1b7de426b4cb163bc296f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:47:35 -0800 Subject: [PATCH 167/261] use SDL2 framework on OS X --- cmake/externals/sdl2/CMakeLists.txt | 48 +++++++++++++++++++---------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/cmake/externals/sdl2/CMakeLists.txt b/cmake/externals/sdl2/CMakeLists.txt index 5b60e60af1..49bb68891d 100644 --- a/cmake/externals/sdl2/CMakeLists.txt +++ b/cmake/externals/sdl2/CMakeLists.txt @@ -12,6 +12,16 @@ if (WIN32) INSTALL_COMMAND "" LOG_DOWNLOAD 1 ) +elseif (APPLE) + ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://hifi-public.s3.amazonaws.com/dependencies/SDL2-2.0.3-OSX.tar.gz + URL_MD5 64f888886268bdf1656ef1b4b7d7756d + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD 1 + ) else () if (ANDROID) set(ANDROID_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DANDROID_NATIVE_API_LEVEL=19") @@ -30,23 +40,29 @@ endif () string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) -if (WIN32) +if (APPLE) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) - set(_ROOT_DIR ${SOURCE_DIR}) - set(_INCLUDE_DIR ${_ROOT_DIR}/include) - set(_LIB_DIR "${SOURCE_DIR}/lib/x86") - set(_LIB_EXT "lib") - - set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${_LIB_DIR} CACHE PATH "Location of SDL2 DLL") + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/SDL2.framework/Headers CACHE PATH "Location of SDL2 include directory") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${SOURCE_DIR}/SDL2.framework CACHE PATH "Location of SDL2 framework") else () - ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) - set(_ROOT_DIR ${INSTALL_DIR}) - set(_INCLUDE_DIR ${_ROOT_DIR}/include/SDL2) + if (WIN32) + ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) + set(_ROOT_DIR ${SOURCE_DIR}) + set(_INCLUDE_DIR ${_ROOT_DIR}/include) + set(_LIB_DIR "${SOURCE_DIR}/lib/x86") + set(_LIB_EXT "lib") - set(_LIB_DIR ${INSTALL_DIR}/lib) - set(_LIB_EXT "so") - set(_LIB_PREFIX "lib") -endif () + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${_LIB_DIR} CACHE PATH "Location of SDL2 DLL") + else () + ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) + set(_ROOT_DIR ${INSTALL_DIR}) + set(_INCLUDE_DIR ${_ROOT_DIR}/include/SDL2) + + set(_LIB_DIR ${INSTALL_DIR}/lib) + set(_LIB_EXT "so") + set(_LIB_PREFIX "lib") + endif () -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${_INCLUDE_DIR} CACHE PATH "Location of SDL2 include directory") -set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${_LIB_DIR}/${_LIB_PREFIX}SDL2.${_LIB_EXT} CACHE FILEPATH "Path to SDL2 library") \ No newline at end of file + set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${_INCLUDE_DIR} CACHE PATH "Location of SDL2 include directory") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${_LIB_DIR}/${_LIB_PREFIX}SDL2.${_LIB_EXT} CACHE FILEPATH "Path to SDL2 library") +endif () \ No newline at end of file From e71a8258d6a7ec9e3e4cb2ef1b551bb0a7cc34fb Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 09:52:35 -0800 Subject: [PATCH 168/261] fix SDL2 framework link on OS X --- cmake/externals/sdl2/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/sdl2/CMakeLists.txt b/cmake/externals/sdl2/CMakeLists.txt index 49bb68891d..3d59af4c06 100644 --- a/cmake/externals/sdl2/CMakeLists.txt +++ b/cmake/externals/sdl2/CMakeLists.txt @@ -43,7 +43,7 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) if (APPLE) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/SDL2.framework/Headers CACHE PATH "Location of SDL2 include directory") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${SOURCE_DIR}/SDL2.framework CACHE PATH "Location of SDL2 framework") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP "-framework ${SOURCE_DIR}/SDL2.framework" CACHE STRING "Link string for SDL2 framework") else () if (WIN32) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) From 24632923391c5a497d15f161b7b4ca4361c0bfd9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 10:00:44 -0800 Subject: [PATCH 169/261] link SDL2 as a downloaded framework on OS X --- cmake/externals/sdl2/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/sdl2/CMakeLists.txt b/cmake/externals/sdl2/CMakeLists.txt index 3d59af4c06..d2a021e833 100644 --- a/cmake/externals/sdl2/CMakeLists.txt +++ b/cmake/externals/sdl2/CMakeLists.txt @@ -43,7 +43,7 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) if (APPLE) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/SDL2.framework/Headers CACHE PATH "Location of SDL2 include directory") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP "-framework ${SOURCE_DIR}/SDL2.framework" CACHE STRING "Link string for SDL2 framework") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${SOURCE_DIR}/SDL2.framework/SDL2 CACHE STRING "Path to SDL2 library") else () if (WIN32) ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) From 1efa7b28b06643da311212dcd059fcddf88bc573 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 23 Feb 2015 10:04:14 -0800 Subject: [PATCH 170/261] removed dead code --- libraries/script-engine/src/ScriptEngine.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 6cae9fcfa4..17237d7843 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -531,7 +531,6 @@ void ScriptEngine::run() { } if (!_isFinished) { - //qDebug() << "ScriptEngine::run()... about to emit update() _scriptName:" << _scriptName << "_fileNameString:" << _fileNameString << "_isFinished:" << _isFinished; emit update(deltaTime); } lastUpdate = now; From 0fc4c732f7c339e7fe06bfa5e34ee1504f69c3b3 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 23 Feb 2015 10:13:47 -0800 Subject: [PATCH 171/261] use macro for copying shapeType string to script --- libraries/entities/src/EntityItemProperties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 7f37799bbc..923eef667c 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -300,7 +300,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons COPY_PROPERTY_TO_QSCRIPTVALUE(lineHeight); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(textColor, getTextColor()); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(backgroundColor, getBackgroundColor()); - properties.setProperty("shapeType", getShapeTypeString()); + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(shapeType, getShapeTypeString()); // Sitting properties support QScriptValue sittingPoints = engine->newObject(); From 16c557a9c7a947d0fce6af9e1db9c5f81f882989 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 10:32:06 -0800 Subject: [PATCH 172/261] copy over /tmp/hifi.dst dir for xcode qxmpp install --- cmake/externals/qxmpp/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index c35708daa6..06b215845a 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -37,6 +37,19 @@ ExternalProject_Add( ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) +if (CMAKE_GENERATOR STREQUAL Xcode) + find_program(DITTO_COMMAND ditto) + + ExternalProject_Add_Step( + ${EXTERNAL_NAME} + copy-from-xcode-install + COMMENT "Copying from /tmp/hifi.dst${INSTALL_DIR} to move install to proper location" + COMMAND ${DITTO_COMMAND} /tmp/hifi.dst${INSTALL_DIR} ${INSTALL_DIR} + DEPENDEES install + LOG 1 + ) +endif () + string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE FILEPATH "Path to Qxmpp include directory") From 6042ba6cf21b3a31fa7c2cddb4569524cab2c5e4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 10:36:20 -0800 Subject: [PATCH 173/261] fix for qxmpp name on win and lib location --- cmake/externals/qxmpp/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index 06b215845a..4d76c6901f 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -54,18 +54,18 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE FILEPATH "Path to Qxmpp include directory") if (WIN32) - set(_LIB_EXT "lib") + set(_LIB_EXT "0.lib") set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${_LIB_DIR} CACHE PATH "Location of QXmpp DLL") else () if (APPLE) set(_LIB_EXT "dylib") else () - set(_LIB_EXT "so") + set(_LIB_EXT ".so") endif () set(_LIB_PREFIX "lib") endif () -set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/${_LIB_PREFIX}qxmpp.${_LIB_EXT} CACHE FILEPATH "Path to QXmpp release library") +set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/${_LIB_PREFIX}qxmpp${_LIB_EXT} CACHE FILEPATH "Path to QXmpp release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Path to QXmpp debug library") From 0990910ed2c24949431a88adb83d21e2f48afcba Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 10:41:48 -0800 Subject: [PATCH 174/261] add a missing period for apple qxmpp ext --- cmake/externals/qxmpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index 4d76c6901f..25ec409efb 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -59,7 +59,7 @@ if (WIN32) set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${_LIB_DIR} CACHE PATH "Location of QXmpp DLL") else () if (APPLE) - set(_LIB_EXT "dylib") + set(_LIB_EXT ".dylib") else () set(_LIB_EXT ".so") endif () From 353f7e2f96d1f2fb1bc67d8d430f4bb110932032 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 10:59:54 -0800 Subject: [PATCH 175/261] set qxmpp debug library to empty string --- cmake/externals/qxmpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index 25ec409efb..451ee19be4 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -68,4 +68,4 @@ else () endif () set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/${_LIB_PREFIX}qxmpp${_LIB_EXT} CACHE FILEPATH "Path to QXmpp release library") -set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Path to QXmpp debug library") +set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG "" CACHE FILEPATH "Path to QXmpp debug library") From 80da0a17029e973e9ffe20c44da7c4af9b486d51 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 11:11:35 -0800 Subject: [PATCH 176/261] use empty string for not present debug libraries --- cmake/externals/bullet/CMakeLists.txt | 8 ++++---- cmake/externals/glew/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 4fb8b0a5d1..3c83b84fcd 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -52,16 +52,16 @@ endif () if (DEFINED BULLET_LIB_EXT) set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics release library location") - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet dynamics debug library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet dynamics debug library location") set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision release library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet collision debug library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet collision debug library location") set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math release library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet math debug library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet math debug library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody release library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Bullet softbody debug library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet softbody debug library location") endif () if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) diff --git a/cmake/externals/glew/CMakeLists.txt b/cmake/externals/glew/CMakeLists.txt index e960eb8bcb..0d80e7a789 100644 --- a/cmake/externals/glew/CMakeLists.txt +++ b/cmake/externals/glew/CMakeLists.txt @@ -20,7 +20,7 @@ if (WIN32) set(_LIB_DIR ${SOURCE_DIR}/lib/Release/Win32) set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_LIB_DIR}/glew32.lib CACHE FILEPATH "Location of GLEW release library") - set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG NOTFOUND CACHE FILEPATH "Location of GLEW debug library") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG "" CACHE FILEPATH "Location of GLEW debug library") set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/bin/Release/Win32 CACHE FILEPATH "Location of GLEW DLL") endif () \ No newline at end of file From 0b9b7f06cc8088b530b3b99d9d23d0f74322ed93 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 23 Feb 2015 11:12:19 -0800 Subject: [PATCH 177/261] address various comments from code review --- assignment-client/src/AssignmentClient.cpp | 8 ++--- assignment-client/src/AssignmentClientApp.cpp | 4 --- assignment-client/src/AssignmentClientApp.h | 1 - .../src/AssignmentClientChildData.cpp | 8 +++++ .../src/AssignmentClientChildData.h | 32 +++++++++++++++++ .../src/AssignmentClientMonitor.cpp | 34 ++++++++----------- .../src/AssignmentClientMonitor.h | 17 ++-------- libraries/networking/src/LimitedNodeList.cpp | 4 +-- libraries/networking/src/LimitedNodeList.h | 2 +- 9 files changed, 63 insertions(+), 47 deletions(-) create mode 100644 assignment-client/src/AssignmentClientChildData.cpp create mode 100644 assignment-client/src/AssignmentClientChildData.h diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index 5fcc380962..2dfc3787de 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -159,8 +159,8 @@ void AssignmentClient::setUpStatsToMonitor() { quint16 localMonitorServerPort = DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT; auto nodeList = DependencyManager::get(); - nodeList->getLocalPortFromSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, - _localACMPortSharedMem, localMonitorServerPort); + nodeList->getLocalServerPortFromSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, + _localACMPortSharedMem, localMonitorServerPort); _assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, localMonitorServerPort, true); // send a stats packet every 1 seconds @@ -189,8 +189,8 @@ void AssignmentClient::sendAssignmentRequest() { if (_assignmentServerHostname == "localhost") { // we want to check again for the local domain-server port in case the DS has restarted quint16 localAssignmentServerPort; - if (nodeList->getLocalPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, _localASPortSharedMem, - localAssignmentServerPort)) { + if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, _localASPortSharedMem, + localAssignmentServerPort)) { if (localAssignmentServerPort != _assignmentServerSocket.getPort()) { qDebug() << "Port for local assignment server read from shared memory is" << localAssignmentServerPort; diff --git a/assignment-client/src/AssignmentClientApp.cpp b/assignment-client/src/AssignmentClientApp.cpp index 8848b59c49..477f1a2cf8 100644 --- a/assignment-client/src/AssignmentClientApp.cpp +++ b/assignment-client/src/AssignmentClientApp.cpp @@ -64,7 +64,3 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) : client.exec(); } } - - -AssignmentClientApp::~AssignmentClientApp() { -} diff --git a/assignment-client/src/AssignmentClientApp.h b/assignment-client/src/AssignmentClientApp.h index 09952ad19c..c5099ff25c 100644 --- a/assignment-client/src/AssignmentClientApp.h +++ b/assignment-client/src/AssignmentClientApp.h @@ -15,5 +15,4 @@ class AssignmentClientApp : public QCoreApplication { Q_OBJECT public: AssignmentClientApp(int argc, char* argv[]); - ~AssignmentClientApp(); }; diff --git a/assignment-client/src/AssignmentClientChildData.cpp b/assignment-client/src/AssignmentClientChildData.cpp new file mode 100644 index 0000000000..de34613ec9 --- /dev/null +++ b/assignment-client/src/AssignmentClientChildData.cpp @@ -0,0 +1,8 @@ + +#include "AssignmentClientChildData.h" + + +AssignmentClientChildData::AssignmentClientChildData(QString childType) : + _childType(childType) +{ +} diff --git a/assignment-client/src/AssignmentClientChildData.h b/assignment-client/src/AssignmentClientChildData.h new file mode 100644 index 0000000000..6fd5f72f7f --- /dev/null +++ b/assignment-client/src/AssignmentClientChildData.h @@ -0,0 +1,32 @@ +// +// AssignmentClientChildData.h +// assignment-client/src +// +// Created by Seth Alves on 2/23/2015. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_AssignmentClientChildData_h +#define hifi_AssignmentClientChildData_h + +#include + + +class AssignmentClientChildData : public NodeData { + public: + AssignmentClientChildData(QString childType); + + QString getChildType() { return _childType; } + void setChildType(QString childType) { _childType = childType; } + + // implement parseData to return 0 so we can be a subclass of NodeData + int parseData(const QByteArray& packet) { return 0; } + + private: + QString _childType; +}; + +#endif // hifi_AssignmentClientChildData_h diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 2bddab9656..803c7fd5c7 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -16,6 +16,7 @@ #include #include "AssignmentClientMonitor.h" +#include "AssignmentClientChildData.h" #include "PacketHeaders.h" #include "SharedUtil.h" @@ -72,12 +73,12 @@ AssignmentClientMonitor::~AssignmentClientMonitor() { void AssignmentClientMonitor::stopChildProcesses() { auto nodeList = DependencyManager::get(); - nodeList->eachNode([&](const SharedNodePointer& node){ - qDebug() << "asking child" << node->getUUID() << "to exit."; - node->activateLocalSocket(); - QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); - nodeList->writeUnverifiedDatagram(diePacket, *node->getActiveSocket()); - }); + nodeList->eachNode([&](const SharedNodePointer& node) { + qDebug() << "asking child" << node->getUUID() << "to exit."; + node->activateLocalSocket(); + QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); + nodeList->writeUnverifiedDatagram(diePacket, *node->getActiveSocket()); + }); } void AssignmentClientMonitor::spawnChildClient() { @@ -100,13 +101,13 @@ void AssignmentClientMonitor::checkSpares() { nodeList->removeSilentNodes(); - nodeList->eachNode([&](const SharedNodePointer& node){ - AssignmentClientChildData *childData = static_cast(node->getLinkedData()); - if (childData->getChildType() == "none") { - spareCount ++; - aSpareId = node->getUUID(); - } - }); + nodeList->eachNode([&](const SharedNodePointer& node) { + AssignmentClientChildData *childData = static_cast(node->getLinkedData()); + if (childData->getChildType() == "none") { + spareCount ++; + aSpareId = node->getUUID(); + } + }); if (spareCount != 1) { qDebug() << "spare count is" << spareCount; @@ -189,10 +190,3 @@ void AssignmentClientMonitor::readPendingDatagrams() { } -AssignmentClientChildData::AssignmentClientChildData(QString childType) { - _childType = childType; -} - - -AssignmentClientChildData::~AssignmentClientChildData() { -} diff --git a/assignment-client/src/AssignmentClientMonitor.h b/assignment-client/src/AssignmentClientMonitor.h index 8055b5d81f..71ae34bc8c 100644 --- a/assignment-client/src/AssignmentClientMonitor.h +++ b/assignment-client/src/AssignmentClientMonitor.h @@ -19,23 +19,10 @@ #include +#include "AssignmentClientChildData.h" + extern const char* NUM_FORKS_PARAMETER; -class AssignmentClientChildData : public NodeData { - public: - AssignmentClientChildData(QString childType); - ~AssignmentClientChildData(); - - QString getChildType() { return _childType; } - void setChildType(QString childType) { _childType = childType; } - - // implement parseData to return 0 so we can be a subclass of NodeData - int parseData(const QByteArray& packet) { return 0; } - - private: - QString _childType; -}; - class AssignmentClientMonitor : public QCoreApplication { Q_OBJECT diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 075fd5a44b..4fc0648c4d 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -688,8 +688,8 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p } -bool LimitedNodeList::getLocalPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, - quint16& localPort) { +bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, + quint16& localPort) { if (!sharedMem) { sharedMem = new QSharedMemory(key, this); diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index b53287562b..27cddb4b24 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -176,7 +176,7 @@ public: } void putLocalPortIntoSharedMemory(const QString key, QObject* parent); - bool getLocalPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, quint16& localPort); + bool getLocalServerPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, quint16& localPort); public slots: void reset(); From 9878a9333866c3dcd52dbb95bf22d7e8e4b4d49b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 11:13:10 -0800 Subject: [PATCH 178/261] add a definition for shared QXmpp on win --- interface/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 1c27d8f9db..92d34972d5 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -175,9 +175,14 @@ if (RTMIDI_FOUND AND NOT DISABLE_RTMIDI AND APPLE) target_link_libraries(${TARGET_NAME} ${CoreMIDI}) endif () -if (QXMPP_FOUND AND NOT DISABLE_QXMPP AND WIN32 AND NOT QXMPP_DLL_PATH) - # if we have no QXmpp DLL path, assume we're linking a static QXmpp on windows - add_definitions(-DQXMPP_STATIC) +if (QXMPP_FOUND AND NOT DISABLE_QXMPP AND WIN32) + if (NOT QXMPP_DLL_PATH) + # if we have no QXmpp DLL path, assume we're linking a static QXmpp on windows + add_definitions(-DQXMPP_STATIC) + else () + # otherwise assume we are linking a dynamic QXmpp + add_definitions(-DQXMPP_SHARED) + endif () endif () # include headers for interface and InterfaceConfig. From 1372436e6340f39b23352efececce29c3bdeec5c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 11:20:50 -0800 Subject: [PATCH 179/261] handle possibility that bullet builds debug libraries --- cmake/externals/bullet/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 3c83b84fcd..bdc7740020 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -52,16 +52,16 @@ endif () if (DEFINED BULLET_LIB_EXT) set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics release library location") - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet dynamics debug library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics debug library location") set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision release library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet collision debug library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision debug library location") set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math release library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet math debug library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math debug library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody release library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet softbody debug library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody debug library location") endif () if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) From 6803aa8d913bc6b4670544c46b8e1ed536a05afc Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 11:22:21 -0800 Subject: [PATCH 180/261] fix copy paste typos --- cmake/externals/bullet/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index bdc7740020..3680bf459f 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -55,13 +55,13 @@ if (DEFINED BULLET_LIB_EXT) set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics debug library location") set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision release library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision debug library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision debug library location") set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math release library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math debug library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math debug library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody release library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody debug library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody debug library location") endif () if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) From 5983a94c7f7773bd000a4d556d4348a50622961f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 11:29:42 -0800 Subject: [PATCH 181/261] force bullet cmake build to be RelWithDebInfo --- cmake/externals/bullet/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 3680bf459f..f9e812b119 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -25,7 +25,7 @@ ExternalProject_Add( ${EXTERNAL_NAME} URL ${DOWNLOAD_URL} URL_MD5 ${DOWNLOAD_MD5} - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 @@ -52,16 +52,16 @@ endif () if (DEFINED BULLET_LIB_EXT) set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics release library location") - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics debug library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet dynamics debug library location") set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision release library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision debug library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet collision debug library location") set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math release library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math debug library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet math debug library location") set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody release library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody_Debug.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody debug library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet softbody debug library location") endif () if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) From 2e1c1229152735f3b77a8e16b7c8324cd1d54579 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 23 Feb 2015 11:38:56 -0800 Subject: [PATCH 182/261] moved ShapeType boilerplate stuff macos --- .../entities/src/EntityItemProperties.cpp | 20 ++++++------------- libraries/entities/src/EntityItemProperties.h | 5 +---- .../entities/src/EntityItemPropertiesMacros.h | 20 +++++++++++++++++++ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 923eef667c..8a809dee72 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -173,10 +173,6 @@ void EntityItemProperties::setLastEdited(quint64 usecTime) { const char* shapeTypeNames[] = {"none", "box", "sphere"}; -QString EntityItemProperties::getShapeTypeString() const { - return QString(shapeTypeNames[_shapeType]); -} - QHash stringToShapeTypeLookup; void buildStringToShapeTypeLookup() { @@ -185,6 +181,10 @@ void buildStringToShapeTypeLookup() { stringToShapeTypeLookup["sphere"] = SHAPE_TYPE_SPHERE; } +QString EntityItemProperties::getShapeTypeAsString() const { + return QString(shapeTypeNames[_shapeType]); +} + void EntityItemProperties::setShapeTypeFromString(const QString& shapeName) { if (stringToShapeTypeLookup.empty()) { buildStringToShapeTypeLookup(); @@ -300,7 +300,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons COPY_PROPERTY_TO_QSCRIPTVALUE(lineHeight); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(textColor, getTextColor()); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(backgroundColor, getBackgroundColor()); - COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(shapeType, getShapeTypeString()); + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(shapeType, getShapeTypeAsString()); // Sitting properties support QScriptValue sittingPoints = engine->newObject(); @@ -378,15 +378,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) { COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(lineHeight, setLineHeight); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(textColor, setTextColor); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(backgroundColor, setBackgroundColor); - - QScriptValue shapeType = object.property("shapeType"); - if (shapeType.isValid()) { - QString newValue = shapeType.toVariant().toString(); - if (_defaultSettings || newValue != getShapeTypeString()) { - setShapeTypeFromString(newValue); - } - } - + COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(shapeType, ShapeType); _lastEdited = usecTimestampNow(); } diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 070b80f754..2391bcde84 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -181,10 +181,7 @@ public: DEFINE_PROPERTY(PROP_LINE_HEIGHT, LineHeight, lineHeight, float); DEFINE_PROPERTY_REF(PROP_TEXT_COLOR, TextColor, textColor, xColor); DEFINE_PROPERTY_REF(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, xColor); - DEFINE_PROPERTY_REF(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType); - - QString getShapeTypeString() const; - void setShapeTypeFromString(const QString& shapeName); + DEFINE_PROPERTY_REF_ENUM(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType); public: float getMaxDimension() const { return glm::max(_dimensions.x, _dimensions.y, _dimensions.z); } diff --git a/libraries/entities/src/EntityItemPropertiesMacros.h b/libraries/entities/src/EntityItemPropertiesMacros.h index 9cf16c7a05..5e04614656 100644 --- a/libraries/entities/src/EntityItemPropertiesMacros.h +++ b/libraries/entities/src/EntityItemPropertiesMacros.h @@ -271,6 +271,15 @@ } \ } \ } + +#define COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(P, S) \ + QScriptValue P = object.property(#P); \ + if (P.isValid()) { \ + QString newValue = P.toVariant().toString(); \ + if (_defaultSettings || newValue != get##S##AsString()) { \ + set##S##FromString(newValue); \ + } \ + } #define CONSTRUCT_PROPERTY(n, V) \ _##n(V), \ @@ -312,6 +321,17 @@ T _##n; \ bool _##n##Changed; +#define DEFINE_PROPERTY_REF_ENUM(P, N, n, T) \ + public: \ + const T& get##N() const { return _##n; } \ + void set##N(const T& value) { _##n = value; _##n##Changed = true; } \ + bool n##Changed() const { return _##n##Changed; } \ + QString get##N##AsString() const; \ + void set##N##FromString(const QString& name); \ + private: \ + T _##n; \ + bool _##n##Changed; + #define DEBUG_PROPERTY_IF_CHANGED(D, P, N, n, x) \ if (P.n##Changed()) { \ D << " " << #n << ":" << P.get##N() << x << "\n"; \ From 7e2d355b56b2cc0cc594151b210e9f4bdfb7d410 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 23 Feb 2015 11:40:30 -0800 Subject: [PATCH 183/261] first cut at properly shutting down timers while shutting down scripts --- libraries/script-engine/src/ScriptEngine.cpp | 14 ++++++++++++++ libraries/script-engine/src/ScriptEngine.h | 1 + 2 files changed, 15 insertions(+) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 17237d7843..0919dc5d59 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -535,6 +535,9 @@ void ScriptEngine::run() { } lastUpdate = now; } + + stopAllTimers(); // make sure all our timers are stopped if the script is ending + emit scriptEnding(); // kill the avatar identity timer @@ -564,6 +567,17 @@ void ScriptEngine::run() { emit doneRunning(); } +// NOTE: This is private because it must be called on the same thread that created the timers, which is why +// we want to only call it in our own run "shutdown" processing. +void ScriptEngine::stopAllTimers() { + QMutableHashIterator i(_timerFunctionMap); + while (i.hasNext()) { + i.next(); + QTimer* timer = i.key(); + stopTimer(timer); + } +} + void ScriptEngine::stop() { _isFinished = true; emit runningStateChanged(); diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index ab32f2c0a5..8963a1e0f6 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -141,6 +141,7 @@ protected: int _numAvatarSoundSentBytes; private: + void stopAllTimers(); void sendAvatarIdentityPacket(); void sendAvatarBillboardPacket(); From 2f4adbc2f7981fcd362252cd393c671bb37b79cf Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 11:40:38 -0800 Subject: [PATCH 184/261] also use release icon for RelWithDebInfo --- interface/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 92d34972d5..37887f5e14 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -76,7 +76,7 @@ if (APPLE) set(MACOSX_BUNDLE_BUNDLE_NAME Interface) set(MACOSX_BUNDLE_GUI_IDENTIFIER io.highfidelity.Interface) - if (CMAKE_BUILD_TYPE STREQUAL "Release") + if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") set(ICON_FILENAME "interface.icns") else () set(ICON_FILENAME "interface-beta.icns") From f2fc7815232a7ebbc2dcd6241a357cf661fb64fe Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 23 Feb 2015 11:42:36 -0800 Subject: [PATCH 185/261] change shapeType to use strings in billiards.js --- examples/example/games/billiards.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/example/games/billiards.js b/examples/example/games/billiards.js index cb30cc631f..d4bc71ba37 100644 --- a/examples/example/games/billiards.js +++ b/examples/example/games/billiards.js @@ -122,7 +122,7 @@ function makeBalls(pos) { gravity: { x: 0, y: GRAVITY, z: 0 }, ignoreCollisions: false, damping: 0.50, - shapeType: 2, + shapeType: "sphere", collisionsWillMove: true })); ballPosition.z += (BALL_SIZE + BALL_GAP) * SCALE; ballNumber++; @@ -143,7 +143,7 @@ function makeBalls(pos) { velocity: {x: 0, y: 0, z: 0 }, ignoreCollisions: false, damping: 0.50, - shapeType: 2, + shapeType: "sphere", collisionsWillMove: true }); } From e60d91e4cee8f101f639cc0dfca83f3166f6c053 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 12:00:19 -0800 Subject: [PATCH 186/261] fix for bullet debug or release build on windows --- cmake/externals/bullet/CMakeLists.txt | 51 +++++++++++++++++---------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index f9e812b119..efcb2f99bc 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -12,25 +12,40 @@ else () endif() endif () -if (WIN32) - set(DOWNLOAD_URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip) - set(DOWNLOAD_MD5 f5e8914fc9064ad32e0d62d19d33d977) -else () - set(DOWNLOAD_URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz) - set(DOWNLOAD_MD5 70b3c8d202dee91a0854b4cbc88173e8) -endif () - include(ExternalProject) -ExternalProject_Add( - ${EXTERNAL_NAME} - URL ${DOWNLOAD_URL} - URL_MD5 ${DOWNLOAD_MD5} - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 - LOG_DOWNLOAD 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build -) + +if (WIN32) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(MSBUILD_CONFIGURATION Debug) + else () + set(MSBUILD_CONFIGURATION Release) + endif () + + find_program(MSBUILD_COMMAND msbuild) + + ExternalProject_Add( + ${EXTERNAL_NAME} + URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip + URL_MD5 f5e8914fc9064ad32e0d62d19d33d977 + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 + BUILD_COMMAND ${MSBUILD_COMMAND} bullet.vcxproj /t:Build /p:Configuration=${MSBUILD_CONFIGURATION} + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build + ) +else () + ExternalProject_Add( + ${EXTERNAL_NAME} + URL http://bullet.googlecode.com/files/bullet-2.82-r2704.tgz + URL_MD5 70b3c8d202dee91a0854b4cbc88173e8 + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build + ) +endif () ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) From 793116b90cff736102f74f0a90137faaad4fe463 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Mon, 23 Feb 2015 21:00:26 +0100 Subject: [PATCH 187/261] ability to mute all notifications or just certain types --- examples/notifications.js | 135 ++++++++++++++++++++++++++++---------- 1 file changed, 102 insertions(+), 33 deletions(-) diff --git a/examples/notifications.js b/examples/notifications.js index f9d2ba83ed..27192ed789 100644 --- a/examples/notifications.js +++ b/examples/notifications.js @@ -38,11 +38,13 @@ // function onIncomingMessage(user, message) { // //do stuff here; // var text = "This is a notification"; -// wordWrap(text); +// var wrappedText = wordWrap(text); +// createNotification(wrappedText, NotificationType.SNAPSHOT); // } // // This new function must call wordWrap(text) if the length of message is longer than 42 chars or unknown. -// wordWrap() will format the text to fit the notifications overlay and send it to createNotification(text). +// wordWrap() will format the text to fit the notifications overlay and return it +// after that we will send it to createNotification(text). // If the message is 42 chars or less you should bypass wordWrap() and call createNotification() directly. @@ -50,12 +52,12 @@ // // 1. Add a key to the keyPressEvent(key). // 2. Declare a text string. -// 3. Call createNotifications(text) parsing the text. +// 3. Call createNotifications(text, NotificationType) parsing the text. // example: // var welcome; // if (key.text == "q") { //queries number of users online // var welcome = "There are " + GlobalServices.onlineUsers.length + " users online now."; -// createNotification(welcome); +// createNotification(welcome, NotificationType.USERS_ONLINE); // } Script.include("./libraries/globals.js"); Script.include("./libraries/soundArray.js"); @@ -83,6 +85,46 @@ var last_users = GlobalServices.onlineUsers; var users = []; var ctrlIsPressed = false; var ready = true; +var MENU_NAME = 'Tools > Notifications'; +var PLAY_NOTIFICATION_SOUNDS_MENU_ITEM = "Play Notification Sounds"; +var NOTIFICATION_MENU_ITEM_POST = " Notifications"; +var PLAY_NOTIFICATION_SOUNDS_SETTING = "play_notification_sounds"; +var PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE = "play_notification_sounds_type_"; + +var NotificationType = { + UNKNOWN: 0, + USER_JOINS: 1, + USER_LEAVES: 2, + MUTE_TOGGLE: 3, + CHAT_MENTION: 4, + USERS_ONLINE: 5, + SNAPSHOT: 6, + WINDOW_RESIZE: 7, + properties: [ + { text: "User Join" }, + { text: "User Leave" }, + { text: "Mute Toggle" }, + { text: "Chat Mention" }, + { text: "Users Online" }, + { text: "Snapshot" }, + { text: "Window Resize" } + ], + getTypeFromMenuItem: function(menuItemName) { + if (menuItemName.substr(menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length) !== NOTIFICATION_MENU_ITEM_POST) { + return NotificationType.UNKNOWN; + } + var preMenuItemName = menuItemName.substr(0, menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length); + for (type in this.properties) { + if (this.properties[type].text === preMenuItemName) { + return parseInt(type) + 1; + } + } + return NotificationType.UNKNOWN; + }, + getMenuString: function(type) { + return this.properties[type - 1].text + NOTIFICATION_MENU_ITEM_POST; + } +}; var randomSounds = new SoundArray({ localOnly: true }, true); var numberOfSounds = 2; @@ -90,15 +132,6 @@ for (var i = 1; i <= numberOfSounds; i++) { randomSounds.addSound(HIFI_PUBLIC_BUCKET + "sounds/UI/notification-general" + i + ".raw"); } -// When our script shuts down, we should clean up all of our overlays -function scriptEnding() { - for (i = 0; i < notifications.length; i++) { - Overlays.deleteOverlay(notifications[i]); - Overlays.deleteOverlay(buttons[i]); - } -} -Script.scriptEnding.connect(scriptEnding); - var notifications = []; var buttons = []; var times = []; @@ -211,8 +244,6 @@ function notify(notice, button, height) { positions, last; - randomSounds.playRandom(); - if (isOnHMD) { // Calculate 3D values from 2D overlay properties. @@ -257,7 +288,7 @@ function notify(notice, button, height) { } // This function creates and sizes the overlays -function createNotification(text) { +function createNotification(text, notificationType) { var count = (text.match(/\n/g) || []).length, breakPoint = 43.0, // length when new line is added extraLine = 0, @@ -307,6 +338,12 @@ function createNotification(text) { alpha: backgroundAlpha }; + if (Menu.isOptionChecked(PLAY_NOTIFICATION_SOUNDS_MENU_ITEM) && + Menu.isOptionChecked(NotificationType.getMenuString(notificationType))) + { + randomSounds.playRandom(); + } + notify(noticeProperties, buttonProperties, height); } @@ -345,8 +382,7 @@ function stringDivider(str, slotWidth, spaceReplacer) { // formats string to add newline every 43 chars function wordWrap(str) { - var result = stringDivider(str, 43.0, "\n"); - createNotification(result); + return stringDivider(str, 43.0, "\n"); } // This fires a notification on window resize @@ -358,7 +394,7 @@ function checkSize() { windowDimensions = Controller.getViewportDimensions(); overlayLocationX = (windowDimensions.x - (width + 60.0)); buttonLocationX = overlayLocationX + (width - 35.0); - createNotification(windowResize); + createNotification(windowResize, NotificationType.WINDOW_RESIZE); } } @@ -442,10 +478,7 @@ var STARTUP_TIMEOUT = 500, // ms // This reports the number of users online at startup function reportUsers() { - var welcome; - - welcome = "Welcome! There are " + GlobalServices.onlineUsers.length + " users online now."; - createNotification(welcome); + createNotification("Welcome! There are " + GlobalServices.onlineUsers.length + " users online now.", NotificationType.USERS_ONLINE); } function finishStartup() { @@ -472,13 +505,13 @@ function onOnlineUsersChanged(users) { if (!isStartingUp()) { // Skip user notifications at startup. for (i = 0; i < users.length; i += 1) { if (last_users.indexOf(users[i]) === -1.0) { - createNotification(users[i] + " has joined"); + createNotification(users[i] + " has joined", NotificationType.USER_JOINS); } } for (i = 0; i < last_users.length; i += 1) { if (users.indexOf(last_users[i]) === -1.0) { - createNotification(last_users[i] + " has left"); + createNotification(last_users[i] + " has left", NotificationType.USER_LEAVES); } } } @@ -497,7 +530,7 @@ function onIncomingMessage(user, message) { thisAlert = user + ": " + myMessage; if (myMessage.indexOf(alertMe) > -1.0) { - wordWrap(thisAlert); + CreateNotification(wordWrap(thisAlert), NotificationType.CHAT_MENTION); } } @@ -506,9 +539,9 @@ function onMuteStateChanged() { var muteState, muteString; - muteState = AudioDevice.getMuted() ? "muted" : "unmuted"; + muteState = AudioDevice.getMuted() ? "muted" : "unmuted"; muteString = "Microphone is now " + muteState; - createNotification(muteString); + createNotification(muteString, NotificationType.MUTE_TOGGLE); } // handles mouse clicks on buttons @@ -551,25 +584,58 @@ function keyPressEvent(key) { if (key.text === "q") { //queries number of users online numUsers = GlobalServices.onlineUsers.length; welcome = "There are " + numUsers + " users online now."; - createNotification(welcome); + createNotification(welcome, NotificationType.USERS_ONLINE); } if (key.text === "s") { if (ctrlIsPressed === true) { noteString = "Snapshot taken."; - createNotification(noteString); + createNotification(noteString, NotificationType.SNAPSHOT); } } } +function setup() { + Menu.addMenu(MENU_NAME); + var checked = Settings.getValue(PLAY_NOTIFICATION_SOUNDS_SETTING); + checked = checked === '' ? true : checked; + Menu.addMenuItem({ + menuName: MENU_NAME, + menuItemName: PLAY_NOTIFICATION_SOUNDS_MENU_ITEM, + isCheckable: true, + isChecked: Settings.getValue(PLAY_NOTIFICATION_SOUNDS_SETTING) + }); + Menu.addSeparator(MENU_NAME, "Play sounds for:"); + for (type in NotificationType.properties) { + checked = Settings.getValue(PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE + (parseInt(type) + 1)); + checked = checked === '' ? true : checked; + Menu.addMenuItem({ + menuName: MENU_NAME, + menuItemName: NotificationType.properties[type].text + NOTIFICATION_MENU_ITEM_POST, + isCheckable: true, + isChecked: checked + }); + } +} + // When our script shuts down, we should clean up all of our overlays function scriptEnding() { - var i; - - for (i = 0; i < notifications.length; i += 1) { + for (var i = 0; i < notifications.length; i++) { Overlays.deleteOverlay(notifications[i]); Overlays.deleteOverlay(buttons[i]); } + Menu.removeMenu(MENU_NAME); +} + +function menuItemEvent(menuItem) { + if (menuItem === PLAY_NOTIFICATION_SOUNDS_MENU_ITEM) { + Settings.setValue(PLAY_NOTIFICATION_SOUNDS_SETTING, Menu.isOptionChecked(PLAY_NOTIFICATION_SOUNDS_MENU_ITEM)); + return; + } + var notificationType = NotificationType.getTypeFromMenuItem(menuItem); + if (notificationType !== notificationType.UNKNOWN) { + Settings.setValue(PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE + notificationType, Menu.isOptionChecked(menuItem)); + } } AudioDevice.muteToggled.connect(onMuteStateChanged); @@ -580,3 +646,6 @@ GlobalServices.incomingMessage.connect(onIncomingMessage); Controller.keyReleaseEvent.connect(keyReleaseEvent); Script.update.connect(update); Script.scriptEnding.connect(scriptEnding); +Menu.menuItemEvent.connect(menuItemEvent); + +setup(); From ded0b1461b6427207272afb39317ff2315e5477d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 12:04:35 -0800 Subject: [PATCH 188/261] help cmake find msbuild --- cmake/externals/bullet/CMakeLists.txt | 2 +- cmake/externals/qxmpp/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index efcb2f99bc..71bb6c7a83 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -21,7 +21,7 @@ if (WIN32) set(MSBUILD_CONFIGURATION Release) endif () - find_program(MSBUILD_COMMAND msbuild) + find_program(MSBUILD_COMMAND msbuild PATHS "C:/Program Files (x86)/MSBUILD/12.0/Bin") ExternalProject_Add( ${EXTERNAL_NAME} diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index 451ee19be4..f3f92be71e 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -12,7 +12,8 @@ if (ANDROID) endif () if (WIN32) - find_program(PLATFORM_BUILD_COMMAND nmake) + find_program(PLATFORM_BUILD_COMMAND nmake PATHS "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin") + if (NOT PLATFORM_BUILD_COMMAND) message(FATAL_ERROR "You asked CMake to grap QXmpp and build it, but nmake was not found. Please make sure the folder containing nmake.exe is in your PATH.") endif () From 9e1a890ff293ad24f009b943e48d9072aa117f18 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 12:09:00 -0800 Subject: [PATCH 189/261] fix for msbuild target command --- cmake/externals/bullet/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 71bb6c7a83..ff39716512 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -28,7 +28,7 @@ if (WIN32) URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip URL_MD5 f5e8914fc9064ad32e0d62d19d33d977 CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 - BUILD_COMMAND ${MSBUILD_COMMAND} bullet.vcxproj /t:Build /p:Configuration=${MSBUILD_CONFIGURATION} + BUILD_COMMAND ${MSBUILD_COMMAND} bullet.vcxproj /p:Configuration=${MSBUILD_CONFIGURATION} LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 8d97107acf258cecda7f2e3021decf4dca934621 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 12:12:36 -0800 Subject: [PATCH 190/261] use ALL_BUILD for bullet msbuild --- cmake/externals/bullet/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index ff39716512..7c5c7967d3 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -27,8 +27,8 @@ if (WIN32) ${EXTERNAL_NAME} URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip URL_MD5 f5e8914fc9064ad32e0d62d19d33d977 - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 - BUILD_COMMAND ${MSBUILD_COMMAND} bullet.vcxproj /p:Configuration=${MSBUILD_CONFIGURATION} + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 + BUILD_COMMAND ${MSBUILD_COMMAND} ALL_BUILD.vcxproj /p:Configuration=${MSBUILD_CONFIGURATION} LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 88130feb11016c27d46b8698a85c732c08a5b8b9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 12:19:54 -0800 Subject: [PATCH 191/261] force release build of bullet on win32 --- cmake/externals/bullet/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 7c5c7967d3..3e1b932a4f 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -27,8 +27,8 @@ if (WIN32) ${EXTERNAL_NAME} URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip URL_MD5 f5e8914fc9064ad32e0d62d19d33d977 - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 - BUILD_COMMAND ${MSBUILD_COMMAND} ALL_BUILD.vcxproj /p:Configuration=${MSBUILD_CONFIGURATION} + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 + BUILD_COMMAND ${MSBUILD_COMMAND} ALL_BUILD.vcxproj /p:Configuration=Release LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From b32fa0f33d4570e0ce4db1bf6a85623d77768678 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 12:27:30 -0800 Subject: [PATCH 192/261] pass correct configuration to bullet install target --- cmake/externals/bullet/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 3e1b932a4f..9d8da889c6 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -29,6 +29,7 @@ if (WIN32) URL_MD5 f5e8914fc9064ad32e0d62d19d33d977 CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 BUILD_COMMAND ${MSBUILD_COMMAND} ALL_BUILD.vcxproj /p:Configuration=Release + INSTALL_COMMAND ${MSBUILD_COMMAND} INSTALL.vcxproj /p:Configuration=Release LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 From 2ad8ac866df3c82fa24e88e1430d846075ada5ce Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 12:50:53 -0800 Subject: [PATCH 193/261] make correct version of bullet for windows --- CMakeLists.txt | 6 ++++ cmake/android/QtCreateAPK.cmake | 2 +- cmake/externals/bullet/CMakeLists.txt | 34 ++++++++++++------- .../CopyDllsBesideWindowsExecutable.cmake | 2 +- interface/CMakeLists.txt | 2 +- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a79476f17f..25c18fc058 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,12 @@ set(HIFI_LIBRARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries") # setup for find modules set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") +if (CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE) +else () + set(UPPER_CMAKE_BUILD_TYPE DEBUG) +endif () + set(HIFI_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(MACRO_DIR "${HIFI_CMAKE_DIR}/macros") set(EXTERNAL_PROJECT_DIR "${HIFI_CMAKE_DIR}/externals") diff --git a/cmake/android/QtCreateAPK.cmake b/cmake/android/QtCreateAPK.cmake index c3a4a48ac7..30ee2f57bd 100644 --- a/cmake/android/QtCreateAPK.cmake +++ b/cmake/android/QtCreateAPK.cmake @@ -26,7 +26,7 @@ macro(qt_create_apk) set(ANDROID_APK_THEME "") endif() - if (CMAKE_BUILD_TYPE MATCHES RELEASE) + if (UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE) set(ANDROID_APK_DEBUGGABLE "false") set(ANDROID_APK_RELEASE_LOCAL ${ANDROID_APK_RELEASE}) else () diff --git a/cmake/externals/bullet/CMakeLists.txt b/cmake/externals/bullet/CMakeLists.txt index 9d8da889c6..d08ceb11b9 100644 --- a/cmake/externals/bullet/CMakeLists.txt +++ b/cmake/externals/bullet/CMakeLists.txt @@ -15,7 +15,7 @@ endif () include(ExternalProject) if (WIN32) - if (CMAKE_BUILD_TYPE STREQUAL "Debug") + if (UPPER_CMAKE_BUILD_TYPE MATCHES DEBUG) set(MSBUILD_CONFIGURATION Debug) else () set(MSBUILD_CONFIGURATION Release) @@ -27,9 +27,8 @@ if (WIN32) ${EXTERNAL_NAME} URL https://bullet.googlecode.com/files/bullet-2.82-r2704.zip URL_MD5 f5e8914fc9064ad32e0d62d19d33d977 - CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 - BUILD_COMMAND ${MSBUILD_COMMAND} ALL_BUILD.vcxproj /p:Configuration=Release - INSTALL_COMMAND ${MSBUILD_COMMAND} INSTALL.vcxproj /p:Configuration=Release + CMAKE_ARGS ${PLATFORM_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_EXTRAS=0 -DINSTALL_LIBS=1 -DBUILD_DEMOS=0 -DUSE_GLUT=0 + BUILD_COMMAND ${MSBUILD_COMMAND} ALL_BUILD.vcxproj /p:Configuration=${MSBUILD_CONFIGURATION} LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 @@ -67,19 +66,28 @@ elseif (WIN32) endif () if (DEFINED BULLET_LIB_EXT) - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics release library location") - set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet dynamics debug library location") + if (NOT WIN32 OR UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE) + set(_PRESENT_LIB_TYPE RELEASE) + set(_MISSING_LIB_TYPE DEBUG) + else () + set(_PRESENT_LIB_TYPE DEBUG) + set(_MISSING_LIB_TYPE RELEASE) + set(_LIB_NAME_SUFFIX _Debug) + endif () + + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletDynamics${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet dynamics ${_PRESENT_LIB_TYPE} library location") + set(${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet dynamics ${_MISSING_LIB_TYPE} library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision release library location") - set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet collision debug library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletCollision${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet collision ${_PRESENT_LIB_TYPE} library location") + set(${EXTERNAL_NAME_UPPER}_COLLISION_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet collision ${_MISSING_LIB_TYPE} library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math release library location") - set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet math debug library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}LinearMath${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet math ${_PRESENT_LIB_TYPE} library location") + set(${EXTERNAL_NAME_UPPER}_MATH_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet math ${_MISSING_LIB_TYPE} library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_RELEASE ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody release library location") - set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_DEBUG "" CACHE FILEPATH "Bullet softbody debug library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_${_PRESENT_LIB_TYPE} ${BULLET_LIB_DIR}/${LIB_PREFIX}BulletSoftBody${_LIB_NAME_SUFFIX}.${BULLET_LIB_EXT} CACHE FILEPATH "Bullet softbody ${_PRESENT_LIB_TYPE} library location") + set(${EXTERNAL_NAME_UPPER}_SOFTBODY_LIBRARY_${_MISSING_LIB_TYPE} "" CACHE FILEPATH "Bullet softbody ${_MISSING_LIB_TYPE} library location") endif () -if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_RELEASE) +if (DEFINED ${EXTERNAL_NAME_UPPER}_DYNAMICS_LIBRARY_${_PRESENT_LIB_TYPE}) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/bullet CACHE PATH "Path to bullet include directory") endif () \ No newline at end of file diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 2498c0dcf3..0ec7b50fd8 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -10,7 +10,7 @@ # macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) - if (WIN32 AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") + if (WIN32 AND NOT UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE) configure_file( ${HIFI_CMAKE_DIR}/templates/FixupBundlePostBuild.cmake.in diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 37887f5e14..ee41648758 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -76,7 +76,7 @@ if (APPLE) set(MACOSX_BUNDLE_BUNDLE_NAME Interface) set(MACOSX_BUNDLE_GUI_IDENTIFIER io.highfidelity.Interface) - if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + if (UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE OR UPPER_CMAKE_BUILD_TYPE MATCHES RELWITHDEBINFO) set(ICON_FILENAME "interface.icns") else () set(ICON_FILENAME "interface-beta.icns") From 954a298dc4632889f44d42d0666b7049e782ee2b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 13:04:12 -0800 Subject: [PATCH 194/261] correct QXmpp DLL path for windows --- cmake/externals/qxmpp/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/externals/qxmpp/CMakeLists.txt b/cmake/externals/qxmpp/CMakeLists.txt index f3f92be71e..c8bbdba6ba 100644 --- a/cmake/externals/qxmpp/CMakeLists.txt +++ b/cmake/externals/qxmpp/CMakeLists.txt @@ -54,6 +54,8 @@ endif () string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${INSTALL_DIR}/include CACHE FILEPATH "Path to Qxmpp include directory") +set(_LIB_DIR ${INSTALL_DIR}/lib) + if (WIN32) set(_LIB_EXT "0.lib") @@ -68,5 +70,5 @@ else () set(_LIB_PREFIX "lib") endif () -set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/${_LIB_PREFIX}qxmpp${_LIB_EXT} CACHE FILEPATH "Path to QXmpp release library") +set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${_LIB_DIR}/${_LIB_PREFIX}qxmpp${_LIB_EXT} CACHE FILEPATH "Path to QXmpp release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG "" CACHE FILEPATH "Path to QXmpp debug library") From bae5d987f91bff9086d0136bb90654266391d5cb Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 13:21:45 -0800 Subject: [PATCH 195/261] add OpenSSL lib path to paths for fixup --- cmake/modules/FindOpenSSL.cmake | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cmake/modules/FindOpenSSL.cmake b/cmake/modules/FindOpenSSL.cmake index 8298cc75b4..1d749a910c 100644 --- a/cmake/modules/FindOpenSSL.cmake +++ b/cmake/modules/FindOpenSSL.cmake @@ -98,6 +98,9 @@ if (WIN32 AND NOT CYGWIN) select_library_configurations(SSL_EAY) set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY}) + + find_path(OPENSSL_DLL_PATH NAMES ssleay32.dll PATH_SUFFIXES "bin" ${_OPENSSL_ROOT_HINTS_AND_PATHS}) + elseif (MINGW) # same player, for MinGW set(LIB_EAY_NAMES libeay32) @@ -218,11 +221,15 @@ endif () include(FindPackageHandleStandardArgs) +set(OPENSSL_REQUIREMENTS OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR) +if (WIN32) + list(APPEND OPENSSL_REQUIREMENTS OPENSSL_DLL_PATH) +endif () + if (OPENSSL_VERSION) find_package_handle_standard_args(OpenSSL REQUIRED_VARS - OPENSSL_LIBRARIES - OPENSSL_INCLUDE_DIR + ${OPENSSL_REQUIREMENTS} VERSION_VAR OPENSSL_VERSION FAIL_MESSAGE @@ -230,9 +237,12 @@ if (OPENSSL_VERSION) ) else () find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" - OPENSSL_LIBRARIES - OPENSSL_INCLUDE_DIR + ${OPENSSL_REQUIREMENTS} ) endif () +if (WIN32) + add_paths_to_lib_paths(${OPENSSL_DLL_PATH}) +endif () + mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES OPENSSL_SEARCH_DIRS) From 8be707f63f62482158abaa5864d36f2334e4c61a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 13:24:17 -0800 Subject: [PATCH 196/261] rename add paths macro for fixup_bundle --- CMakeLists.txt | 2 +- cmake/macros/AddPathsToLibPaths.cmake | 22 ------------------- cmake/modules/FindGLEW.cmake | 2 +- cmake/modules/FindLeapMotion.cmake | 2 +- cmake/modules/FindOpenSSL.cmake | 2 +- cmake/modules/FindQxmpp.cmake | 2 +- cmake/modules/FindSDL2.cmake | 2 +- cmake/modules/FindSixense.cmake | 2 +- cmake/modules/FindSoxr.cmake | 2 +- cmake/modules/FindTBB.cmake | 2 +- cmake/templates/FixupBundlePostBuild.cmake.in | 4 ++-- 11 files changed, 11 insertions(+), 33 deletions(-) delete mode 100644 cmake/macros/AddPathsToLibPaths.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c18fc058..f036a9c91f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,7 @@ option(GET_SDL2 "Get SDL2 library automatically as external project" 0) option(GET_QXMPP "GET Qxmpp library automatically as external project" 0) if (WIN32) - add_paths_to_lib_paths("${QT_DIR}/bin") + add_paths_to_fixup_libs("${QT_DIR}/bin") endif () # add subdirectories for all targets diff --git a/cmake/macros/AddPathsToLibPaths.cmake b/cmake/macros/AddPathsToLibPaths.cmake deleted file mode 100644 index 7ac31db83f..0000000000 --- a/cmake/macros/AddPathsToLibPaths.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -# AddPathsToLibPaths.cmake -# cmake/macros -# -# Copyright 2015 High Fidelity, Inc. -# Created by Stephen Birarda on February 17, 2014 -# -# Distributed under the Apache License, Version 2.0. -# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -# - -macro(ADD_PATHS_TO_LIB_PATHS) - foreach(_PATH ${ARGN}) - set(_TEMP_LIB_PATHS ${LIB_PATHS}) - - list(APPEND _TEMP_LIB_PATHS ${_PATH}) - - list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) - - set(LIB_PATHS ${_TEMP_LIB_PATHS} CACHE STRING "Paths for external libraries passed to fixup_bundle" FORCE) - endforeach() -endmacro() \ No newline at end of file diff --git a/cmake/modules/FindGLEW.cmake b/cmake/modules/FindGLEW.cmake index 7abbe135cb..e86db3fdac 100644 --- a/cmake/modules/FindGLEW.cmake +++ b/cmake/modules/FindGLEW.cmake @@ -37,6 +37,6 @@ if (WIN32) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDE_DIRS GLEW_LIBRARIES GLEW_DLL_PATH) - add_paths_to_lib_paths(${GLEW_DLL_PATH}) + add_paths_to_fixup_libs(${GLEW_DLL_PATH}) endif () diff --git a/cmake/modules/FindLeapMotion.cmake b/cmake/modules/FindLeapMotion.cmake index 6f177cd3d7..eafb031a07 100644 --- a/cmake/modules/FindLeapMotion.cmake +++ b/cmake/modules/FindLeapMotion.cmake @@ -40,7 +40,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LeapMotion DEFAULT_MSG ${LEAPMOTION_REQUIREMENTS}) if (WIN32) - add_paths_to_lib_paths(${LEAPMOTION_DLL_PATH}) + add_paths_to_fixup_libs(${LEAPMOTION_DLL_PATH}) endif () mark_as_advanced(LEAPMOTION_INCLUDE_DIRS LEAPMOTION_LIBRARIES LEAPMOTION_SEARCH_DIRS) diff --git a/cmake/modules/FindOpenSSL.cmake b/cmake/modules/FindOpenSSL.cmake index 1d749a910c..db3b2ba477 100644 --- a/cmake/modules/FindOpenSSL.cmake +++ b/cmake/modules/FindOpenSSL.cmake @@ -242,7 +242,7 @@ else () endif () if (WIN32) - add_paths_to_lib_paths(${OPENSSL_DLL_PATH}) + add_paths_to_fixup_libs(${OPENSSL_DLL_PATH}) endif () mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES OPENSSL_SEARCH_DIRS) diff --git a/cmake/modules/FindQxmpp.cmake b/cmake/modules/FindQxmpp.cmake index 489936688e..5caa929427 100644 --- a/cmake/modules/FindQxmpp.cmake +++ b/cmake/modules/FindQxmpp.cmake @@ -41,5 +41,5 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(QXmpp DEFAULT_MSG QXMPP_INCLUDE_DIRS QXMPP_LIBRARIES QXMPP_LIBRARY) if (QXMPP_DLL_PATH) - add_paths_to_lib_paths(${QXMPP_DLL_PATH}) + add_paths_to_fixup_libs(${QXMPP_DLL_PATH}) endif () \ No newline at end of file diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake index 8c7c0c581b..1a089bcb60 100644 --- a/cmake/modules/FindSDL2.cmake +++ b/cmake/modules/FindSDL2.cmake @@ -220,5 +220,5 @@ endif () FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS ${SDL2_REQUIREMENTS}) if (WIN32) - add_paths_to_lib_paths(${SDL2_DLL_PATH}) + add_paths_to_fixup_libs(${SDL2_DLL_PATH}) endif () diff --git a/cmake/modules/FindSixense.cmake b/cmake/modules/FindSixense.cmake index f47cfa65ad..0f4346c53d 100644 --- a/cmake/modules/FindSixense.cmake +++ b/cmake/modules/FindSixense.cmake @@ -52,7 +52,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Sixense DEFAULT_MSG ${SIXENSE_REQUIREMENTS}) if (WIN32) - add_paths_to_lib_paths(${SIXENSE_DEBUG_DLL_PATH} ${SIXENSE_RELEASE_DLL_PATH} ${SIXENSE_DEVICE_DLL_PATH}) + add_paths_to_fixup_libs(${SIXENSE_DEBUG_DLL_PATH} ${SIXENSE_RELEASE_DLL_PATH} ${SIXENSE_DEVICE_DLL_PATH}) endif () mark_as_advanced(SIXENSE_LIBRARIES SIXENSE_INCLUDE_DIRS SIXENSE_SEARCH_DIRS) diff --git a/cmake/modules/FindSoxr.cmake b/cmake/modules/FindSoxr.cmake index 1c67650496..df6ad8050e 100644 --- a/cmake/modules/FindSoxr.cmake +++ b/cmake/modules/FindSoxr.cmake @@ -37,7 +37,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Soxr DEFAULT_MSG ${SOXR_REQUIREMENTS}) if (WIN32) - add_paths_to_lib_paths(${SOXR_DLL_PATH}) + add_paths_to_fixup_libs(${SOXR_DLL_PATH}) endif () mark_as_advanced(SOXR_INCLUDE_DIRS SOXR_LIBRARIES SOXR_SEARCH_DIRS) \ No newline at end of file diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake index 9781154c1a..4d4b3ca504 100644 --- a/cmake/modules/FindTBB.cmake +++ b/cmake/modules/FindTBB.cmake @@ -88,7 +88,7 @@ endif () find_package_handle_standard_args(TBB DEFAULT_MSG ${TBB_REQUIREMENTS}) if (WIN32) - add_paths_to_lib_paths(${TBB_DLL_PATH}) + add_paths_to_fixup_libs(${TBB_DLL_PATH}) endif () set(TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY}) diff --git a/cmake/templates/FixupBundlePostBuild.cmake.in b/cmake/templates/FixupBundlePostBuild.cmake.in index f72ba577b9..7d98e9796c 100644 --- a/cmake/templates/FixupBundlePostBuild.cmake.in +++ b/cmake/templates/FixupBundlePostBuild.cmake.in @@ -10,5 +10,5 @@ # include(BundleUtilities) -message(STATUS "LIB_PATHS for fixup_bundle called for bundle ${BUNDLE_EXECUTABLE} are @LIB_PATHS@") -fixup_bundle("${BUNDLE_EXECUTABLE}" "" "@LIB_PATHS@") \ No newline at end of file +message(STATUS "FIXUP_LIBS for fixup_bundle called for bundle ${BUNDLE_EXECUTABLE} are @FIXUP_LIBS@") +fixup_bundle("${BUNDLE_EXECUTABLE}" "" "@FIXUP_LIBS@") \ No newline at end of file From 87ce55cc42b218cce7497b4a0f12b6693d7879d6 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 13:24:53 -0800 Subject: [PATCH 197/261] add new macro file for fixup libs --- cmake/macros/AddPathsToFixupLibs.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cmake/macros/AddPathsToFixupLibs.cmake diff --git a/cmake/macros/AddPathsToFixupLibs.cmake b/cmake/macros/AddPathsToFixupLibs.cmake new file mode 100644 index 0000000000..913fcb7ee7 --- /dev/null +++ b/cmake/macros/AddPathsToFixupLibs.cmake @@ -0,0 +1,22 @@ +# +# AddPathsToFixupLibs.cmake +# cmake/macros +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 17, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(add_paths_to_fixup_libs) + foreach(_PATH ${ARGN}) + set(_TEMP_LIB_PATHS ${FIXUP_LIBS}) + + list(APPEND _TEMP_LIB_PATHS ${_PATH}) + + list(REMOVE_DUPLICATES _TEMP_LIB_PATHS) + + set(FIXUP_LIBS ${_TEMP_LIB_PATHS} CACHE STRING "Paths for external libraries passed to fixup_bundle" FORCE) + endforeach() +endmacro() \ No newline at end of file From 3cd0a70641da47813a643b7cd29d78b54826b60f Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 23 Feb 2015 14:35:44 -0800 Subject: [PATCH 198/261] store shapeType whenever it is explicitly changed --- libraries/entities/src/EntityItemProperties.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 8a809dee72..f3f84876ba 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -190,12 +190,8 @@ void EntityItemProperties::setShapeTypeFromString(const QString& shapeName) { buildStringToShapeTypeLookup(); } auto shapeTypeItr = stringToShapeTypeLookup.find(shapeName.toLower()); - ShapeType newShapeType = SHAPE_TYPE_NONE; if (shapeTypeItr != stringToShapeTypeLookup.end()) { - newShapeType = shapeTypeItr.value(); - } - if (newShapeType != _shapeType) { - _shapeType = newShapeType; + _shapeType = shapeTypeItr.value(); _shapeTypeChanged = true; } } From 71dd443ae291732c6e5a8ccd4ff80bcdf6d44c6d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 15:29:43 -0800 Subject: [PATCH 199/261] also call fixup_bundle for release builds on win --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 0ec7b50fd8..4a1bc35fb7 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -10,7 +10,7 @@ # macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) - if (WIN32 AND NOT UPPER_CMAKE_BUILD_TYPE MATCHES RELEASE) + if (WIN32) configure_file( ${HIFI_CMAKE_DIR}/templates/FixupBundlePostBuild.cmake.in From 086960f8aff112a938f2fd4b12f4898751f16535 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 23 Feb 2015 16:10:42 -0800 Subject: [PATCH 200/261] clarify the build guide for nmake and msbuild --- BUILD_WIN.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 290a8b8be6..212dd31f98 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -14,12 +14,18 @@ Or you can start a regular command prompt and then run: If using Visual Studio 2013 and building as a Visual Studio 2013 project you need the Windows 8 SDK which you should already have as part of installing Visual Studio 2013. You should be able to see it at `C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86`. -####nmake +####nmake & msbuild -Some of the external projects may require nmake to build and install. Please ensure that nmake is in your PATH so CMake can find it if required. For a typical Visual Studio installation, nmake.exe is located at the following path. +Some of the external projects may require nmake and msbuild to compile and install. If they are not installed at the locations listed below, please ensure that both are in your PATH so CMake can find them when required. + +We expect nmake.exe to be located at the following path. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin +We exepect msbuild.exe to be located at the following path. + + C:\Program Files (x86)\MSBUILD\12.0\Bin + ###Qt You can use the online installer or the offline installer. If you use the offline installer, be sure to select the "OpenGL" version. From 6be8f4c0ec8dcffe07e99f22ecec501e1f07d7a0 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 23 Feb 2015 17:32:31 -0800 Subject: [PATCH 201/261] more work on improving shutdown behavior --- interface/src/Application.cpp | 11 ++- .../src/EntityTreeRenderer.cpp | 2 + libraries/script-engine/src/ScriptEngine.cpp | 81 ++++++++++++++++--- libraries/script-engine/src/ScriptEngine.h | 4 + 4 files changed, 86 insertions(+), 12 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 25ee53f187..32854a1781 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3538,7 +3538,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater())); // when the application is about to quit, stop our script engine so it unwinds properly - connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); + //connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); auto nodeList = DependencyManager::get(); connect(nodeList.data(), &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled); @@ -3550,7 +3550,14 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri } ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUserLoaded, - bool loadScriptFromEditor, bool activateMainWindow) { + bool loadScriptFromEditor, bool activateMainWindow) { + + qDebug() << "Application::loadScript() " << scriptFilename << "line:" << __LINE__; + if (isAboutToQuit()) { + qDebug() << "Application::loadScript() WHILE QUITTING.... what to do????" << scriptFilename << "line:" << __LINE__; + return NULL; + } + QUrl scriptUrl(scriptFilename); const QString& scriptURLString = scriptUrl.toString(); if (_scriptEnginesHash.contains(scriptURLString) && loadScriptFromEditor diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index fdaaa6422b..9deafe17da 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -59,6 +59,7 @@ EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterf } EntityTreeRenderer::~EntityTreeRenderer() { + qDebug() << "EntityTreeRenderer::~EntityTreeRenderer() -------- BEGIN -----------"; // NOTE: we don't need to delete _entitiesScriptEngine because it's owned by the application and gets cleaned up // automatically but we do need to delete our sandbox script engine. @@ -71,6 +72,7 @@ EntityTreeRenderer::~EntityTreeRenderer() { delete _sandboxScriptEngine; _sandboxScriptEngine = NULL; } + qDebug() << "EntityTreeRenderer::~EntityTreeRenderer() -------- DONE -----------"; } void EntityTreeRenderer::clear() { diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 0919dc5d59..fe568ab077 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -94,33 +94,78 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam _isUserLoaded(false), _arrayBufferClass(new ArrayBufferClass(this)) { + qDebug() << "ScriptEngine::ScriptEngine() " << getFilename() << "[" << ((void*)this) << "]" << " -------- BEGIN -----------"; + _allScriptsMutex.lock(); _allKnownScriptEngines.insert(this); + _allScriptsMutex.unlock(); + qDebug() << "ScriptEngine::ScriptEngine() " << getFilename() << " -------- DONE -----------"; } ScriptEngine::~ScriptEngine() { - _allKnownScriptEngines.remove(this); + qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << "[" << ((void*)this) << "]" << " -------- BEGIN -----------"; + if (!_stoppingAllScripts) { + _allScriptsMutex.lock(); + qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << " removing from list of scripts"; + _allKnownScriptEngines.remove(this); + _allScriptsMutex.unlock(); + } else { + qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << " NOT removing from list of scripts here..."; + } + qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << " -------- DONE -----------"; } QSet ScriptEngine::_allKnownScriptEngines; +QMutex ScriptEngine::_allScriptsMutex; +bool ScriptEngine::_stoppingAllScripts = false; void ScriptEngine::stopAllScripts(QObject* application) { + + qDebug() << "ScriptEngine::stopAllScripts() -------- BEGIN -----------"; + _allScriptsMutex.lock(); + _stoppingAllScripts = true; + QMutableSetIterator i(_allKnownScriptEngines); while (i.hasNext()) { ScriptEngine* scriptEngine = i.next(); + qDebug() << "ScriptEngine::stopAllScripts() scriptEngine: " << (void*)scriptEngine; + + QString scriptName = scriptEngine->getFilename(); + + qDebug() << "ScriptEngine::stopAllScripts() considering script: " << scriptName << "evaluatePending:" << scriptEngine->evaluatePending(); + // NOTE: typically all script engines are running. But there's at least one known exception to this, the // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using // them. We don't need to stop scripts that aren't running. if (scriptEngine->isRunning()) { + if (scriptEngine->evaluatePending()) { + qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__ << "waiting for evaluation to complete...."; + QEventLoop loop; + QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit); + loop.exec(); + qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__ << "evaluation complete...."; + } + + qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; + QEventLoop loop; QObject::connect(scriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); - - scriptEngine->disconnect(application); - scriptEngine->stop(); + qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; + scriptEngine->disconnect(application); + qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; + scriptEngine->stop(); + qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; loop.exec(); + qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; + i.remove(); + } else { + qDebug() << "ScriptEngine::stopAllScripts() script: " << scriptName << " was not running... skipping it's stop() call."; } } + _stoppingAllScripts = false; + _allScriptsMutex.unlock(); + qDebug() << "ScriptEngine::stopAllScripts() -------- DONE -----------"; } QString ScriptEngine::getFilename() const { @@ -347,6 +392,8 @@ void ScriptEngine::evaluate() { } QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileName, int lineNumber) { + qDebug() << "ScriptEngine::evaluate() " << getFilename() << " line:" << __LINE__; + _evaluatePending = true; QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber); if (hasUncaughtException()) { int line = uncaughtExceptionLineNumber(); @@ -354,6 +401,8 @@ QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileN } emit evaluationFinished(result, hasUncaughtException()); clearExceptions(); + _evaluatePending = false; + qDebug() << "ScriptEngine::evaluate() " << getFilename() << " line:" << __LINE__; return result; } @@ -370,30 +419,36 @@ void ScriptEngine::sendAvatarBillboardPacket() { } void ScriptEngine::run() { + qDebug() << "ScriptEngine::run() " << getFilename() << " -------- BEGIN -----------"; + if (!_isInitialized) { + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; init(); + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; } + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; _isRunning = true; _isFinished = false; + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; emit runningStateChanged(); + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; QScriptValue result = evaluate(_scriptContents); - if (hasUncaughtException()) { - int line = uncaughtExceptionLineNumber(); - qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString(); - emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString()); - clearExceptions(); - } + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; QElapsedTimer startTime; startTime.start(); int thisFrame = 0; + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; auto nodeList = DependencyManager::get(); qint64 lastUpdate = usecTimestampNow(); + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; while (!_isFinished) { int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec if (usecToSleep > 0) { @@ -535,6 +590,7 @@ void ScriptEngine::run() { } lastUpdate = now; } + qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; stopAllTimers(); // make sure all our timers are stopped if the script is ending @@ -565,6 +621,7 @@ void ScriptEngine::run() { emit runningStateChanged(); emit doneRunning(); + qDebug() << "ScriptEngine::run() " << getFilename() << " -------- DONE -----------" << " line:" << __LINE__; } // NOTE: This is private because it must be called on the same thread that created the timers, which is why @@ -579,6 +636,7 @@ void ScriptEngine::stopAllTimers() { } void ScriptEngine::stop() { + qDebug() << "ScriptEngine::stop() " << getFilename() << "[" << ((void*)this) << "]"; _isFinished = true; emit runningStateChanged(); } @@ -710,8 +768,11 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { } void ScriptEngine::load(const QString& loadFile) { + qDebug() << "ScriptEngine::load() " << getFilename() << "[" << ((void*)this) << "]" << "line:" << __LINE__; QUrl url = resolvePath(loadFile); + qDebug() << "ScriptEngine::load() " << getFilename() << "[" << ((void*)this) << "]" << "line:" << __LINE__; emit loadScript(url.toString(), false); + qDebug() << "ScriptEngine::load() " << getFilename() << "[" << ((void*)this) << "]" << "line:" << __LINE__; } void ScriptEngine::nodeKilled(SharedNodePointer node) { diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index 8963a1e0f6..a672646c79 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -85,6 +85,7 @@ public: bool isFinished() const { return _isFinished; } bool isRunning() const { return _isRunning; } + bool evaluatePending() const { return _evaluatePending; } void setUserLoaded(bool isUserLoaded) { _isUserLoaded = isUserLoaded; } bool isUserLoaded() const { return _isUserLoaded; } @@ -131,6 +132,7 @@ protected: QString _parentURL; bool _isFinished; bool _isRunning; + bool _evaluatePending = false; bool _isInitialized; bool _isAvatar; QTimer* _avatarIdentityTimer; @@ -167,6 +169,8 @@ private slots: private: static QSet _allKnownScriptEngines; + static QMutex _allScriptsMutex; + static bool _stoppingAllScripts; }; #endif // hifi_ScriptEngine_h From ab590440be3f3fa70e99a762579b2d43cc6da19e Mon Sep 17 00:00:00 2001 From: Seefo Date: Mon, 23 Feb 2015 22:15:24 -0500 Subject: [PATCH 202/261] Cleaned up warnings on Windows --- libraries/metavoxels/src/Spanner.cpp | 12 ++++++------ tests/jitter/src/main.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/metavoxels/src/Spanner.cpp b/libraries/metavoxels/src/Spanner.cpp index fbd0d311f5..fd5a59fdfb 100644 --- a/libraries/metavoxels/src/Spanner.cpp +++ b/libraries/metavoxels/src/Spanner.cpp @@ -1959,7 +1959,7 @@ HeightfieldNode* HeightfieldNode::fillHeight(const glm::vec3& translation, const } else { colorWidth = innerHeightWidth + HeightfieldData::SHARED_EDGE; colorHeight = innerHeightHeight + HeightfieldData::SHARED_EDGE; - newColorContents = QByteArray(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFF); + newColorContents = QByteArray(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFFu); } int innerColorWidth = colorWidth - HeightfieldData::SHARED_EDGE; int innerColorHeight = colorHeight - HeightfieldData::SHARED_EDGE; @@ -2185,7 +2185,7 @@ HeightfieldNode* HeightfieldNode::setMaterial(const glm::vec3& translation, cons } else { colorWidth = innerHeightWidth + HeightfieldData::SHARED_EDGE; colorHeight = innerHeightHeight + HeightfieldData::SHARED_EDGE; - newColorContents = QByteArray(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFF); + newColorContents = QByteArray(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFFu); } int innerColorWidth = colorWidth - HeightfieldData::SHARED_EDGE; int innerColorHeight = colorHeight - HeightfieldData::SHARED_EDGE; @@ -2428,7 +2428,7 @@ HeightfieldNode* HeightfieldNode::setMaterial(const glm::vec3& translation, cons } } } - bool nextAlphaY = stackDest->getEntryAlpha(y + 1, voxelHeight); + int nextAlphaY = stackDest->getEntryAlpha(y + 1, voxelHeight); if (nextAlphaY == currentAlpha) { entryDest->hermiteY = 0; @@ -2447,7 +2447,7 @@ HeightfieldNode* HeightfieldNode::setMaterial(const glm::vec3& translation, cons } int nextStackZ = (int)stackZ + 1; if (nextStackZ <= innerStackHeight) { - bool nextAlphaZ = newStackContents.at(nextStackZ * stackWidth + (int)stackX).getEntryAlpha( + int nextAlphaZ = newStackContents.at(nextStackZ * stackWidth + (int)stackX).getEntryAlpha( y, nextVoxelHeightZ); if (nextAlphaZ == currentAlpha) { entryDest->hermiteZ = 0; @@ -2828,7 +2828,7 @@ void HeightfieldNode::mergeChildren(bool height, bool colorMaterial) { _height.reset(); } if (colorWidth > 0 && colorMaterial) { - QByteArray colorContents(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFF); + QByteArray colorContents(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFFu); for (int i = 0; i < CHILD_COUNT; i++) { HeightfieldColorPointer childColor = _children[i]->getColor(); if (!childColor) { @@ -3266,7 +3266,7 @@ HeightfieldNode* HeightfieldNode::subdivide(const QVector& heightConten } for (int i = 0; i < CHILD_COUNT; i++) { QVector childHeightContents(heightWidth * heightHeight); - QByteArray childColorContents(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFF); + QByteArray childColorContents(colorWidth * colorHeight * DataBlock::COLOR_BYTES, 0xFFu); QByteArray childMaterialContents(materialWidth * materialHeight, 0); QVector childStackContents(stackWidth * stackHeight); diff --git a/tests/jitter/src/main.cpp b/tests/jitter/src/main.cpp index baaa2d08d6..788ae89c6f 100644 --- a/tests/jitter/src/main.cpp +++ b/tests/jitter/src/main.cpp @@ -8,7 +8,7 @@ #include #ifdef _WINDOWS -#include +#include #else #include #include @@ -76,7 +76,7 @@ void runSend(const char* addressOption, int port, int gap, int size, int report) memset(&servaddr, 0, sizeof(servaddr)); servaddr.sin_family = AF_INET; - servaddr.sin_addr.s_addr = inet_addr(addressOption); + inet_pton(AF_INET, addressOption, &servaddr.sin_addr); servaddr.sin_port = htons(port); const int SAMPLES_FOR_SECOND = 1000000 / gap; From f5a7a19bc3f239e04836f98d7c8fc0d24cfe78de Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 24 Feb 2015 10:41:20 -0800 Subject: [PATCH 203/261] coding convention --- libraries/networking/src/LimitedNodeList.cpp | 2 +- libraries/networking/src/LimitedNodeList.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 4fc0648c4d..b240f0df9e 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -688,7 +688,7 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p } -bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, +bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, QSharedMemory*& sharedMem, quint16& localPort) { if (!sharedMem) { sharedMem = new QSharedMemory(key, this); diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index 27cddb4b24..02234ee4f7 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -176,7 +176,7 @@ public: } void putLocalPortIntoSharedMemory(const QString key, QObject* parent); - bool getLocalServerPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, quint16& localPort); + bool getLocalServerPortFromSharedMemory(const QString key, QSharedMemory*& sharedMem, quint16& localPort); public slots: void reset(); From 5f9af610c268eab27c303a229743d48b974a1306 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 24 Feb 2015 10:41:58 -0800 Subject: [PATCH 204/261] coding convention --- libraries/networking/src/LimitedNodeList.cpp | 2 +- libraries/networking/src/LimitedNodeList.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 4fc0648c4d..b240f0df9e 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -688,7 +688,7 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p } -bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, +bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, QSharedMemory*& sharedMem, quint16& localPort) { if (!sharedMem) { sharedMem = new QSharedMemory(key, this); diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index 27cddb4b24..02234ee4f7 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -176,7 +176,7 @@ public: } void putLocalPortIntoSharedMemory(const QString key, QObject* parent); - bool getLocalServerPortFromSharedMemory(const QString key, QSharedMemory* &sharedMem, quint16& localPort); + bool getLocalServerPortFromSharedMemory(const QString key, QSharedMemory*& sharedMem, quint16& localPort); public slots: void reset(); From 4641bd0cd99176192ec03e5a7a3facb8a41cdd24 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 24 Feb 2015 10:47:37 -0800 Subject: [PATCH 205/261] Add Window.domainChanged signal for scripting --- interface/src/scripting/WindowScriptingInterface.cpp | 3 +++ interface/src/scripting/WindowScriptingInterface.h | 1 + 2 files changed, 4 insertions(+) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index c4b288347d..fc3eefe260 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -18,6 +18,7 @@ #include #include "Application.h" +#include "DomainHandler.h" #include "MainWindow.h" #include "Menu.h" #include "ui/ModelsBrowser.h" @@ -34,6 +35,8 @@ WindowScriptingInterface::WindowScriptingInterface() : _nonBlockingFormActive(false), _formResult(QDialog::Rejected) { + const DomainHandler& domainHandler = DependencyManager::get()->getDomainHandler(); + connect(&domainHandler, &DomainHandler::hostnameChanged, this, &WindowScriptingInterface::domainChanged); } WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title, const QString& url, int width, int height) { diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 66d0ab9306..5c0aa4f0a8 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -57,6 +57,7 @@ public slots: QScriptValue peekNonBlockingFormResult(QScriptValue array); signals: + void domainChanged(const QString& domainHostname); void inlineButtonClicked(const QString& name); void nonBlockingFormClosed(); From c9818c184a41fb9835e28d58d141c85c8e03b0d5 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 24 Feb 2015 10:47:55 -0800 Subject: [PATCH 206/261] Update editEntities to turn off when switching domains --- examples/editEntities.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/editEntities.js b/examples/editEntities.js index 61100b4556..9b13b167e7 100644 --- a/examples/editEntities.js +++ b/examples/editEntities.js @@ -396,6 +396,10 @@ var toolBar = (function () { return handled; } + Window.domainChanged.connect(function() { + that.setActive(false); + }); + that.cleanup = function () { toolBar.cleanup(); }; From d74856e01b50737a44d900299974187b901ab925 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 24 Feb 2015 11:21:04 -0800 Subject: [PATCH 207/261] add angularVelocity to controller --- interface/src/devices/SixenseManager.cpp | 12 ++++++++++++ .../scripting/ControllerScriptingInterface.cpp | 15 +++++++++++++++ .../src/scripting/ControllerScriptingInterface.h | 1 + libraries/avatars/src/HandData.cpp | 2 +- libraries/avatars/src/HandData.h | 4 +++- 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index ffaa5260db..609ac7b349 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -260,6 +260,18 @@ void SixenseManager::update(float deltaTime) { float sign = (i == 0) ? -1.0f : 1.0f; rotation *= glm::angleAxis(sign * PI/4.0f, glm::vec3(0.0f, 0.0f, 1.0f)); + // Angular Velocity of Palm + glm::quat deltaRotation = rotation * glm::inverse(palm->getRawRotation()); + glm::vec3 angularVelocity(0.0f); + float rotationAngle = glm::angle(deltaRotation); + if ((rotationAngle > EPSILON) && (deltaTime > 0.0f)) { + angularVelocity = glm::normalize(glm::axis(deltaRotation)); + angularVelocity *= (rotationAngle / deltaTime); + palm->setRawAngularVelocity(angularVelocity); + } else { + palm->setRawAngularVelocity(glm::vec3(0.0f)); + } + if (_lowVelocityFilter) { // Use a velocity sensitive filter to damp small motions and preserve large ones with // no latency. diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index 929a763e70..2188f45374 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -208,6 +208,21 @@ glm::quat ControllerScriptingInterface::getSpatialControlRawRotation(int control } return glm::quat(); // bad index } + +glm::vec3 ControllerScriptingInterface::getSpatialControlRawAngularVelocity(int controlIndex) const { + int palmIndex = controlIndex / NUMBER_OF_SPATIALCONTROLS_PER_PALM; + int controlOfPalm = controlIndex % NUMBER_OF_SPATIALCONTROLS_PER_PALM; + const PalmData* palmData = getActivePalm(palmIndex); + if (palmData) { + switch (controlOfPalm) { + case PALM_SPATIALCONTROL: + return palmData->getRawAngularVelocity(); + case TIP_SPATIALCONTROL: + return palmData->getRawAngularVelocity(); // Tip = palm angular velocity + } + } + return glm::vec3(0); // bad index +} glm::vec3 ControllerScriptingInterface::getSpatialControlNormal(int controlIndex) const { int palmIndex = controlIndex / NUMBER_OF_SPATIALCONTROLS_PER_PALM; diff --git a/interface/src/scripting/ControllerScriptingInterface.h b/interface/src/scripting/ControllerScriptingInterface.h index d56d159c06..c088dd6c9a 100644 --- a/interface/src/scripting/ControllerScriptingInterface.h +++ b/interface/src/scripting/ControllerScriptingInterface.h @@ -96,6 +96,7 @@ public slots: virtual glm::vec3 getSpatialControlVelocity(int controlIndex) const; virtual glm::vec3 getSpatialControlNormal(int controlIndex) const; virtual glm::quat getSpatialControlRawRotation(int controlIndex) const; + virtual glm::vec3 getSpatialControlRawAngularVelocity(int controlIndex) const; virtual void captureKeyEvents(const KeyEvent& event); virtual void releaseKeyEvents(const KeyEvent& event); diff --git a/libraries/avatars/src/HandData.cpp b/libraries/avatars/src/HandData.cpp index 5d850d06d0..9a9b51c1c8 100644 --- a/libraries/avatars/src/HandData.cpp +++ b/libraries/avatars/src/HandData.cpp @@ -67,7 +67,7 @@ PalmData::PalmData(HandData* owningHandData) : _rawRotation(0.0f, 0.0f, 0.0f, 1.0f), _rawPosition(0.0f), _rawVelocity(0.0f), -_rotationalVelocity(0.0f), +_rawAngularVelocity(0.0f), _totalPenetration(0.0f), _controllerButtons(0), _isActive(false), diff --git a/libraries/avatars/src/HandData.h b/libraries/avatars/src/HandData.h index 534ea67726..a5e2b2907e 100644 --- a/libraries/avatars/src/HandData.h +++ b/libraries/avatars/src/HandData.h @@ -98,6 +98,8 @@ public: void setRawPosition(const glm::vec3& pos) { _rawPosition = pos; } void setRawVelocity(const glm::vec3& velocity) { _rawVelocity = velocity; } const glm::vec3& getRawVelocity() const { return _rawVelocity; } + void setRawAngularVelocity(const glm::vec3& angularVelocity) { _rawAngularVelocity = angularVelocity; } + const glm::vec3& getRawAngularVelocity() const { return _rawAngularVelocity; } void addToPosition(const glm::vec3& delta); void addToPenetration(const glm::vec3& penetration) { _totalPenetration += penetration; } @@ -148,7 +150,7 @@ private: glm::quat _rawRotation; glm::vec3 _rawPosition; glm::vec3 _rawVelocity; - glm::vec3 _rotationalVelocity; + glm::vec3 _rawAngularVelocity; glm::quat _lastRotation; glm::vec3 _tipPosition; From 7489b468f3a4f473ed6825ac5c81d12242330c01 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 24 Feb 2015 11:48:35 -0800 Subject: [PATCH 208/261] give angular velocity to the thrown ball --- examples/controllers/hydra/toyball.js | 72 +++++++++++++++++++-------- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/examples/controllers/hydra/toyball.js b/examples/controllers/hydra/toyball.js index b2ce6c1463..06e7f5a2e7 100644 --- a/examples/controllers/hydra/toyball.js +++ b/examples/controllers/hydra/toyball.js @@ -29,15 +29,21 @@ var RIGHT_BUTTON_FWD = 11; var RIGHT_BUTTON_3 = 9; var BALL_RADIUS = 0.08; -var GRAVITY_STRENGTH = 1.0; +var GRAVITY_STRENGTH = 3.0; var HELD_COLOR = { red: 240, green: 0, blue: 0 }; var THROWN_COLOR = { red: 128, green: 0, blue: 0 }; +var averageLinearVelocity = [ { x: 0, y: 0, z : 0 }, { x: 0, y: 0, z : 0 } ]; + +var LIFETIME_SECONDS = 600; + +var BALL_MODEL_URL = "https://hifi-public.s3.amazonaws.com/ryan/baseball4.fbx"; + var leftBallAlreadyInHand = false; var rightBallAlreadyInHand = false; -var leftHandEntity; -var rightHandEntity; +var leftHandEntity = false; +var rightHandEntity = false; var newSound = SoundCache.getSound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/throw.raw"); var catchSound = SoundCache.getSound("https://dl.dropboxusercontent.com/u/1864924/hifi-sounds/catch.raw"); @@ -67,31 +73,55 @@ function checkControllerSide(whichSide) { var BUTTON_3; var TRIGGER; var palmPosition; + var palmRotation; var ballAlreadyInHand; var handMessage; + var linearVelocity; + var angularVelocity; + var AVERAGE_FACTOR = 0.33; if (whichSide == LEFT_PALM) { BUTTON_FWD = LEFT_BUTTON_FWD; BUTTON_3 = LEFT_BUTTON_3; TRIGGER = 0; palmPosition = Controller.getSpatialControlPosition(LEFT_PALM); + palmRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(LEFT_PALM)); ballAlreadyInHand = leftBallAlreadyInHand; handMessage = "LEFT"; + averageLinearVelocity[0] = Vec3.sum(Vec3.multiply(AVERAGE_FACTOR, Controller.getSpatialControlVelocity(LEFT_TIP)), + Vec3.multiply(1.0 - AVERAGE_FACTOR, averageLinearVelocity[0])); + linearVelocity = averageLinearVelocity[0]; + angularVelocity = Vec3.multiplyQbyV(MyAvatar.orientation, Controller.getSpatialControlRawAngularVelocity(LEFT_TIP)); + angularVelocity = Vec3.multiply(180.0 / Math.PI, angularVelocity); } else { BUTTON_FWD = RIGHT_BUTTON_FWD; BUTTON_3 = RIGHT_BUTTON_3; TRIGGER = 1; palmPosition = Controller.getSpatialControlPosition(RIGHT_PALM); + palmRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(RIGHT_PALM)); ballAlreadyInHand = rightBallAlreadyInHand; + averageLinearVelocity[1] = Vec3.sum(Vec3.multiply(AVERAGE_FACTOR, Controller.getSpatialControlVelocity(RIGHT_TIP)), + Vec3.multiply(1.0 - AVERAGE_FACTOR, averageLinearVelocity[1])); + linearVelocity = averageLinearVelocity[1]; + angularVelocity = Vec3.multiplyQbyV(MyAvatar.orientation, Controller.getSpatialControlRawAngularVelocity(RIGHT_TIP)); + angularVelocity = Vec3.multiply(180.0 / Math.PI, angularVelocity); handMessage = "RIGHT"; } var grabButtonPressed = (Controller.isButtonPressed(BUTTON_FWD) || Controller.isButtonPressed(BUTTON_3) || (Controller.getTriggerValue(TRIGGER) > 0.5)); // If I don't currently have a ball in my hand, then try to catch closest one + if (leftHandEntity && !leftHandEntity.isKnownID) { + leftHandEntity = Entities.identifyEntity(leftHandEntity); + } + if (rightHandEntity && !rightHandEntity.isKnownID) { + rightHandEntity = Entities.identifyEntity(rightHandEntity); + } + if (!ballAlreadyInHand && grabButtonPressed) { var closestEntity = Entities.findClosestEntity(palmPosition, targetRadius); + //if (closestEntity.isKnownID && ((leftHandEntity && (closestEntity.id == leftHandEntity.id)) || (rightHandEntity && (closestEntity.id == rightHandEntity.id)))) { if (closestEntity.isKnownID) { debugPrint(handMessage + " HAND- CAUGHT SOMETHING!!"); @@ -107,13 +137,14 @@ function checkControllerSide(whichSide) { var properties = { position: { x: ballPosition.x, y: ballPosition.y, z: ballPosition.z }, - color: HELD_COLOR, + rotation: palmRotation, + color: HELD_COLOR, velocity : { x: 0, y: 0, z: 0}, - lifetime : 600, - inHand: true }; + gravity: { x: 0, y: 0, z: 0} + }; Entities.editEntity(closestEntity, properties); - Audio.playSound(catchSound, { position: ballPosition }); + Audio.playSound(catchSound, { position: ballPosition }); return; // exit early } @@ -129,18 +160,20 @@ function checkControllerSide(whichSide) { if (grabButtonPressed && !ballAlreadyInHand) { var ballPosition = getBallHoldPosition(whichSide); var properties = { - type: "Sphere", + type: "Model", + modelURL: BALL_MODEL_URL, position: { x: ballPosition.x, y: ballPosition.y, - z: ballPosition.z }, + z: ballPosition.z }, + rotation: palmRotation, velocity: { x: 0, y: 0, z: 0}, gravity: { x: 0, y: 0, z: 0}, - inHand: true, dimensions: { x: BALL_RADIUS * 2, y: BALL_RADIUS * 2, z: BALL_RADIUS * 2 }, damping: 0.00001, + shapeType: "sphere", + collisionsWillMove: false, color: HELD_COLOR, - - lifetime: 600 // 10 seconds - same as default, not needed but here as an example + lifetime: LIFETIME_SECONDS }; newEntity = Entities.addEntity(properties); @@ -174,21 +207,20 @@ function checkControllerSide(whichSide) { var properties = { position: { x: ballPosition.x, y: ballPosition.y, z: ballPosition.z }, + rotation: palmRotation, + velocity: { x: 0, y: 0, z: 0}, + gravity: { x: 0, y: 0, z: 0}, }; Entities.editEntity(handEntity, properties); } else { debugPrint(">>>>> " + handMessage + "-BALL IN HAND, not grabbing, THROW!!!"); // If toy ball just released, add velocity to it! - var tipVelocity = Controller.getSpatialControlVelocity(whichTip); - var THROWN_VELOCITY_SCALING = 1.5; var properties = { - velocity: { x: tipVelocity.x * THROWN_VELOCITY_SCALING, - y: tipVelocity.y * THROWN_VELOCITY_SCALING, - z: tipVelocity.z * THROWN_VELOCITY_SCALING } , + velocity: linearVelocity, + rotation: palmRotation, + angularVelocity: angularVelocity, collisionsWillMove: true, - inHand: false, color: THROWN_COLOR, - lifetime: 10, gravity: { x: 0, y: -GRAVITY_STRENGTH, z: 0}, }; @@ -216,7 +248,7 @@ function checkController(deltaTime) { // this is expected for hydras if (!(numberOfButtons==12 && numberOfTriggers == 2 && controllersPerTrigger == 2)) { - debugPrint("no hydra connected?"); + debugPrint("total buttons = " + numberOfButtons + ", Triggers = " + numberOfTriggers + ", controllers/trigger = " + controllersPerTrigger); return; // bail if no hydra } From 9d021a1a1ee166e65c71ec003791cbb1fca5b5b3 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 24 Feb 2015 11:49:12 -0800 Subject: [PATCH 209/261] remove unused line --- examples/controllers/hydra/toyball.js | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/controllers/hydra/toyball.js b/examples/controllers/hydra/toyball.js index 06e7f5a2e7..5306769e95 100644 --- a/examples/controllers/hydra/toyball.js +++ b/examples/controllers/hydra/toyball.js @@ -121,7 +121,6 @@ function checkControllerSide(whichSide) { if (!ballAlreadyInHand && grabButtonPressed) { var closestEntity = Entities.findClosestEntity(palmPosition, targetRadius); - //if (closestEntity.isKnownID && ((leftHandEntity && (closestEntity.id == leftHandEntity.id)) || (rightHandEntity && (closestEntity.id == rightHandEntity.id)))) { if (closestEntity.isKnownID) { debugPrint(handMessage + " HAND- CAUGHT SOMETHING!!"); From 573390b42960b394adb75cd16b6d48930288354c Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 24 Feb 2015 11:55:41 -0800 Subject: [PATCH 210/261] fix dice for collision shapes, add angular velocity --- examples/dice.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/dice.js b/examples/dice.js index d33da576c1..1205f38ee1 100644 --- a/examples/dice.js +++ b/examples/dice.js @@ -53,8 +53,10 @@ function shootDice(position, velocity) { position: position, velocity: velocity, rotation: Quat.fromPitchYawRollDegrees(Math.random() * 360, Math.random() * 360, Math.random() * 360), + angularVelocity: { x: Math.random() * 100, y: Math.random() * 100, z: Math.random() * 100 }, lifetime: LIFETIME, gravity: { x: 0, y: GRAVITY, z: 0 }, + shapeType: "box", collisionsWillMove: true })); position = Vec3.sum(position, Vec3.multiply(DIE_SIZE, Vec3.normalize(Quat.getRight(Camera.getOrientation())))); From 09ffcbb2e88f35a48ba7e46138cabbe4fa08e2c9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 24 Feb 2015 12:30:40 -0800 Subject: [PATCH 211/261] Revert "Merge pull request #4324 from sethalves/assignment-client-keep-a-spare" This reverts commit 087e2babde1329c242484e0e7f4ffbfa3e3206ea, reversing changes made to 5202d2136a0adfb2cf2558847b85a1f7ec94457d. --- assignment-client/src/AssignmentClient.cpp | 87 +++------- assignment-client/src/AssignmentClient.h | 11 +- assignment-client/src/AssignmentClientApp.cpp | 66 -------- assignment-client/src/AssignmentClientApp.h | 18 -- .../src/AssignmentClientChildData.cpp | 8 - .../src/AssignmentClientChildData.h | 32 ---- .../src/AssignmentClientMonitor.cpp | 158 ++++-------------- .../src/AssignmentClientMonitor.h | 13 +- assignment-client/src/main.cpp | 30 +++- domain-server/src/DomainServer.cpp | 14 +- libraries/networking/src/AddressManager.cpp | 4 +- libraries/networking/src/LimitedNodeList.cpp | 38 ----- libraries/networking/src/LimitedNodeList.h | 9 - libraries/networking/src/Node.cpp | 7 +- libraries/networking/src/NodeList.cpp | 8 +- libraries/networking/src/NodeList.h | 1 - libraries/networking/src/PacketHeaders.cpp | 3 - libraries/networking/src/PacketHeaders.h | 4 +- 18 files changed, 108 insertions(+), 403 deletions(-) delete mode 100644 assignment-client/src/AssignmentClientApp.cpp delete mode 100644 assignment-client/src/AssignmentClientApp.h delete mode 100644 assignment-client/src/AssignmentClientChildData.cpp delete mode 100644 assignment-client/src/AssignmentClientChildData.h diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index 2dfc3787de..bf67d4d597 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -18,10 +18,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -43,8 +43,7 @@ int hifiSockAddrMeta = qRegisterMetaType("HifiSockAddr"); AssignmentClient::AssignmentClient(int &argc, char **argv) : QCoreApplication(argc, argv), _assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME), - _localASPortSharedMem(NULL), - _localACMPortSharedMem(NULL) + _localASPortSharedMem(NULL) { LogUtils::init(); @@ -57,11 +56,7 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : DependencyManager::registerInheritance(); auto addressManager = DependencyManager::set(); auto nodeList = DependencyManager::set(NodeType::Unassigned); - - // make up a uuid for this child so the parent can tell us apart. This id will be changed - // when the domain server hands over an assignment. - QUuid nodeUUID = QUuid::createUuid(); - nodeList->setSessionUUID(nodeUUID); + auto avatarHashMap = DependencyManager::set(); // setup a shutdown event listener to handle SIGTERM or WM_CLOSE for us #ifdef _WIN32 @@ -128,8 +123,9 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : // call a timer function every ASSIGNMENT_REQUEST_INTERVAL_MSECS to ask for assignment, if required qDebug() << "Waiting for assignment -" << _requestAssignment; - connect(&_requestTimer, SIGNAL(timeout()), SLOT(sendAssignmentRequest())); - _requestTimer.start(ASSIGNMENT_REQUEST_INTERVAL_MSECS); + QTimer* timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), SLOT(sendAssignmentRequest())); + timer->start(ASSIGNMENT_REQUEST_INTERVAL_MSECS); // connect our readPendingDatagrams method to the readyRead() signal of the socket connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClient::readPendingDatagrams); @@ -140,45 +136,6 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) : // Create Singleton objects on main thread NetworkAccessManager::getInstance(); - - // Hook up a timer to send this child's status to the Monitor once per second - setUpStatsToMonitor(); -} - - -void AssignmentClient::stopAssignmentClient() { - qDebug() << "Exiting."; - _requestTimer.stop(); - _statsTimerACM.stop(); - quit(); -} - - -void AssignmentClient::setUpStatsToMonitor() { - // Figure out the address to send out stats to - quint16 localMonitorServerPort = DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT; - auto nodeList = DependencyManager::get(); - - nodeList->getLocalServerPortFromSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, - _localACMPortSharedMem, localMonitorServerPort); - _assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, localMonitorServerPort, true); - - // send a stats packet every 1 seconds - connect(&_statsTimerACM, &QTimer::timeout, this, &AssignmentClient::sendStatsPacketToACM); - _statsTimerACM.start(1000); -} - -void AssignmentClient::sendStatsPacketToACM() { - // tell the assignment client monitor what this assignment client is doing (if anything) - QJsonObject statsObject; - auto nodeList = DependencyManager::get(); - - if (_currentAssignment) { - statsObject["assignment_type"] = _currentAssignment->getTypeName(); - } else { - statsObject["assignment_type"] = "none"; - } - nodeList->sendStats(statsObject, _assignmentClientMonitorSocket); } void AssignmentClient::sendAssignmentRequest() { @@ -188,9 +145,23 @@ void AssignmentClient::sendAssignmentRequest() { if (_assignmentServerHostname == "localhost") { // we want to check again for the local domain-server port in case the DS has restarted - quint16 localAssignmentServerPort; - if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, _localASPortSharedMem, - localAssignmentServerPort)) { + if (!_localASPortSharedMem) { + _localASPortSharedMem = new QSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this); + + if (!_localASPortSharedMem->attach(QSharedMemory::ReadOnly)) { + qWarning() << "Could not attach to shared memory at key" << DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY + << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort(); + } + } + + if (_localASPortSharedMem->isAttached()) { + _localASPortSharedMem->lock(); + + quint16 localAssignmentServerPort; + memcpy(&localAssignmentServerPort, _localASPortSharedMem->data(), sizeof(localAssignmentServerPort)); + + _localASPortSharedMem->unlock(); + if (localAssignmentServerPort != _assignmentServerSocket.getPort()) { qDebug() << "Port for local assignment server read from shared memory is" << localAssignmentServerPort; @@ -199,9 +170,7 @@ void AssignmentClient::sendAssignmentRequest() { nodeList->setAssignmentServerSocket(_assignmentServerSocket); } } - else { - qDebug () << "- will attempt to connect to domain-server on" << _assignmentServerSocket.getPort(); - } + } nodeList->sendAssignment(_requestAssignment); @@ -258,14 +227,6 @@ void AssignmentClient::readPendingDatagrams() { } else { qDebug() << "Received an assignment that could not be unpacked. Re-requesting."; } - } else if (packetTypeForPacket(receivedPacket) == PacketTypeStopNode) { - if (senderSockAddr.getAddress() == QHostAddress::LocalHost || - senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { - qDebug() << "Network told me to exit."; - emit stopAssignmentClient(); - } else { - qDebug() << "Got a stop packet from other than localhost."; - } } else { // have the NodeList attempt to handle it nodeList->processNodeData(senderSockAddr, receivedPacket); diff --git a/assignment-client/src/AssignmentClient.h b/assignment-client/src/AssignmentClient.h index e105309e10..053458f136 100644 --- a/assignment-client/src/AssignmentClient.h +++ b/assignment-client/src/AssignmentClient.h @@ -29,22 +29,13 @@ private slots: void readPendingDatagrams(); void assignmentCompleted(); void handleAuthenticationRequest(); - void sendStatsPacketToACM(); - void stopAssignmentClient(); private: - void setUpStatsToMonitor(); Assignment _requestAssignment; static SharedAssignmentPointer _currentAssignment; QString _assignmentServerHostname; HifiSockAddr _assignmentServerSocket; - QSharedMemory* _localASPortSharedMem; // memory shared with domain server - QSharedMemory* _localACMPortSharedMem; // memory shared with assignment client monitor - QTimer _requestTimer; // timer for requesting and assignment - QTimer _statsTimerACM; // timer for sending stats to assignment client monitor - - protected: - HifiSockAddr _assignmentClientMonitorSocket; + QSharedMemory* _localASPortSharedMem; }; #endif // hifi_AssignmentClient_h diff --git a/assignment-client/src/AssignmentClientApp.cpp b/assignment-client/src/AssignmentClientApp.cpp deleted file mode 100644 index 477f1a2cf8..0000000000 --- a/assignment-client/src/AssignmentClientApp.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// -// AssignmentClientapp.cpp -// assignment-client/src -// -// Created by Seth Alves on 2/19/15. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -#include -#include - -#include "Assignment.h" -#include "AssignmentClient.h" -#include "AssignmentClientMonitor.h" -#include "AssignmentClientApp.h" - - -AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) : - QCoreApplication(argc, argv) -{ -# ifndef WIN32 - setvbuf(stdout, NULL, _IOLBF, 0); -# endif - - // use the verbose message handler in Logging - qInstallMessageHandler(LogHandler::verboseMessageHandler); - - // parse command-line - QCommandLineParser parser; - parser.setApplicationDescription("High Fidelity Assignment Client"); - parser.addHelpOption(); - - const QCommandLineOption helpOption = parser.addHelpOption(); - - const QCommandLineOption numChildsOption("n", "number of children to fork", "child-count"); - parser.addOption(numChildsOption); - - if (!parser.parse(QCoreApplication::arguments())) { - qCritical() << parser.errorText() << endl; - parser.showHelp(); - Q_UNREACHABLE(); - } - - if (parser.isSet(helpOption)) { - parser.showHelp(); - Q_UNREACHABLE(); - } - - unsigned int numForks = 0; - if (parser.isSet(numChildsOption)) { - numForks = parser.value(numChildsOption).toInt(); - } - - if (numForks) { - AssignmentClientMonitor monitor(argc, argv, numForks); - monitor.exec(); - } else { - AssignmentClient client(argc, argv); - client.exec(); - } -} diff --git a/assignment-client/src/AssignmentClientApp.h b/assignment-client/src/AssignmentClientApp.h deleted file mode 100644 index c5099ff25c..0000000000 --- a/assignment-client/src/AssignmentClientApp.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AssignmentClientapp.h -// assignment-client/src -// -// Created by Seth Alves on 2/19/15. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -class AssignmentClientApp : public QCoreApplication { - Q_OBJECT -public: - AssignmentClientApp(int argc, char* argv[]); -}; diff --git a/assignment-client/src/AssignmentClientChildData.cpp b/assignment-client/src/AssignmentClientChildData.cpp deleted file mode 100644 index de34613ec9..0000000000 --- a/assignment-client/src/AssignmentClientChildData.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "AssignmentClientChildData.h" - - -AssignmentClientChildData::AssignmentClientChildData(QString childType) : - _childType(childType) -{ -} diff --git a/assignment-client/src/AssignmentClientChildData.h b/assignment-client/src/AssignmentClientChildData.h deleted file mode 100644 index 6fd5f72f7f..0000000000 --- a/assignment-client/src/AssignmentClientChildData.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// AssignmentClientChildData.h -// assignment-client/src -// -// Created by Seth Alves on 2/23/2015. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_AssignmentClientChildData_h -#define hifi_AssignmentClientChildData_h - -#include - - -class AssignmentClientChildData : public NodeData { - public: - AssignmentClientChildData(QString childType); - - QString getChildType() { return _childType; } - void setChildType(QString childType) { _childType = childType; } - - // implement parseData to return 0 so we can be a subclass of NodeData - int parseData(const QByteArray& packet) { return 0; } - - private: - QString _childType; -}; - -#endif // hifi_AssignmentClientChildData_h diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 803c7fd5c7..45e1f56d53 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -13,18 +13,14 @@ #include #include -#include #include "AssignmentClientMonitor.h" -#include "AssignmentClientChildData.h" -#include "PacketHeaders.h" -#include "SharedUtil.h" const char* NUM_FORKS_PARAMETER = "-n"; const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor"; -AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, const unsigned int numAssignmentClientForks) : +AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, int numAssignmentClientForks) : QCoreApplication(argc, argv) { // start the Logging class with the parent's target name @@ -45,25 +41,11 @@ AssignmentClientMonitor::AssignmentClientMonitor(int &argc, char **argv, const u // this removes both the "-n" parameter and the number of forks passed _childArguments.removeAt(forksParameterIndex); _childArguments.removeAt(forksParameterIndex); - - - // create a NodeList so we can receive stats from children - DependencyManager::registerInheritance(); - auto addressManager = DependencyManager::set(); - auto nodeList = DependencyManager::set(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT, - DEFAULT_ASSIGNMENT_CLIENT_MONITOR_DTLS_PORT); - - connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClientMonitor::readPendingDatagrams); - - nodeList->putLocalPortIntoSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, this); // use QProcess to fork off a process for each of the child assignment clients - for (unsigned int i = 0; i < numAssignmentClientForks; i++) { + for (int i = 0; i < numAssignmentClientForks; i++) { spawnChildClient(); } - - connect(&_checkSparesTimer, SIGNAL(timeout()), SLOT(checkSpares())); - _checkSparesTimer.start(NODE_SILENCE_THRESHOLD_MSECS * 3); } AssignmentClientMonitor::~AssignmentClientMonitor() { @@ -71,122 +53,46 @@ AssignmentClientMonitor::~AssignmentClientMonitor() { } void AssignmentClientMonitor::stopChildProcesses() { - auto nodeList = DependencyManager::get(); - - nodeList->eachNode([&](const SharedNodePointer& node) { - qDebug() << "asking child" << node->getUUID() << "to exit."; - node->activateLocalSocket(); - QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); - nodeList->writeUnverifiedDatagram(diePacket, *node->getActiveSocket()); - }); + + QList >::Iterator it = _childProcesses.begin(); + while (it != _childProcesses.end()) { + if (!it->isNull()) { + qDebug() << "Monitor is terminating child process" << it->data(); + + // don't re-spawn this child when it goes down + disconnect(it->data(), 0, this, 0); + + it->data()->terminate(); + it->data()->waitForFinished(); + } + + it = _childProcesses.erase(it); + } } void AssignmentClientMonitor::spawnChildClient() { QProcess *assignmentClient = new QProcess(this); + _childProcesses.append(QPointer(assignmentClient)); + // make sure that the output from the child process appears in our output assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); assignmentClient->start(applicationFilePath(), _childArguments); - + + // link the child processes' finished slot to our childProcessFinished slot + connect(assignmentClient, SIGNAL(finished(int, QProcess::ExitStatus)), this, + SLOT(childProcessFinished(int, QProcess::ExitStatus))); + qDebug() << "Spawned a child client with PID" << assignmentClient->pid(); } - - -void AssignmentClientMonitor::checkSpares() { - auto nodeList = DependencyManager::get(); - QUuid aSpareId = ""; - unsigned int spareCount = 0; - - nodeList->removeSilentNodes(); - - nodeList->eachNode([&](const SharedNodePointer& node) { - AssignmentClientChildData *childData = static_cast(node->getLinkedData()); - if (childData->getChildType() == "none") { - spareCount ++; - aSpareId = node->getUUID(); - } - }); - - if (spareCount != 1) { - qDebug() << "spare count is" << spareCount; - } - - if (spareCount < 1) { - spawnChildClient(); - } - - if (spareCount > 1) { - // kill aSpareId - qDebug() << "asking child" << aSpareId << "to exit."; - SharedNodePointer childNode = nodeList->nodeWithUUID(aSpareId); - childNode->activateLocalSocket(); - QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); - nodeList->writeUnverifiedDatagram(diePacket, childNode); - } +void AssignmentClientMonitor::childProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) { + qDebug("Replacing dead child assignment client with a new one"); + + // remove the old process from our list of child processes + qDebug() << "need to remove" << QPointer(qobject_cast(sender())); + _childProcesses.removeOne(QPointer(qobject_cast(sender()))); + + spawnChildClient(); } - - -void AssignmentClientMonitor::readPendingDatagrams() { - auto nodeList = DependencyManager::get(); - - QByteArray receivedPacket; - HifiSockAddr senderSockAddr; - - while (nodeList->getNodeSocket().hasPendingDatagrams()) { - receivedPacket.resize(nodeList->getNodeSocket().pendingDatagramSize()); - nodeList->getNodeSocket().readDatagram(receivedPacket.data(), receivedPacket.size(), - senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer()); - - if (nodeList->packetVersionAndHashMatch(receivedPacket)) { - if (packetTypeForPacket(receivedPacket) == PacketTypeNodeJsonStats) { - QUuid packetUUID = uuidFromPacketHeader(receivedPacket); - SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket); - if (!matchingNode) { - // The parent only expects to be talking with prorams running on this same machine. - if (senderSockAddr.getAddress() == QHostAddress::LocalHost || - senderSockAddr.getAddress() == QHostAddress::LocalHostIPv6) { - if (!packetUUID.isNull()) { - matchingNode = DependencyManager::get()->addOrUpdateNode - (packetUUID, NodeType::Unassigned, senderSockAddr, senderSockAddr, false); - AssignmentClientChildData *childData = new AssignmentClientChildData("unknown"); - matchingNode->setLinkedData(childData); - } else { - // tell unknown assignment-client child to exit. - qDebug() << "asking unknown child to exit."; - QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode); - nodeList->writeUnverifiedDatagram(diePacket, senderSockAddr); - } - } - } - - if (matchingNode) { - // update our records about how to reach this child - matchingNode->setLocalSocket(senderSockAddr); - - // push past the packet header - QDataStream packetStream(receivedPacket); - packetStream.skipRawData(numBytesForPacketHeader(receivedPacket)); - // decode json - QVariantMap unpackedVariantMap; - packetStream >> unpackedVariantMap; - QJsonObject unpackedStatsJSON = QJsonObject::fromVariantMap(unpackedVariantMap); - - // get child's assignment type out of the decoded json - QString childType = unpackedStatsJSON["assignment_type"].toString(); - AssignmentClientChildData *childData = - static_cast(matchingNode->getLinkedData()); - childData->setChildType(childType); - // note when this child talked - matchingNode->setLastHeardMicrostamp(usecTimestampNow()); - } - } else { - // have the NodeList attempt to handle it - nodeList->processNodeData(senderSockAddr, receivedPacket); - } - } - } -} - - diff --git a/assignment-client/src/AssignmentClientMonitor.h b/assignment-client/src/AssignmentClientMonitor.h index 71ae34bc8c..9a7bca9cb3 100644 --- a/assignment-client/src/AssignmentClientMonitor.h +++ b/assignment-client/src/AssignmentClientMonitor.h @@ -15,30 +15,25 @@ #include #include #include -#include #include -#include "AssignmentClientChildData.h" - extern const char* NUM_FORKS_PARAMETER; - class AssignmentClientMonitor : public QCoreApplication { Q_OBJECT public: - AssignmentClientMonitor(int &argc, char **argv, const unsigned int numAssignmentClientForks); + AssignmentClientMonitor(int &argc, char **argv, int numAssignmentClientForks); ~AssignmentClientMonitor(); void stopChildProcesses(); private slots: - void readPendingDatagrams(); - void checkSpares(); - + void childProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); private: void spawnChildClient(); + QList > _childProcesses; + QStringList _childArguments; - QTimer _checkSparesTimer; // every few seconds see if it need fewer or more spare children }; #endif // hifi_AssignmentClientMonitor_h diff --git a/assignment-client/src/main.cpp b/assignment-client/src/main.cpp index 81a12526bf..3bf6990a74 100644 --- a/assignment-client/src/main.cpp +++ b/assignment-client/src/main.cpp @@ -9,10 +9,34 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include +#include -#include "AssignmentClientApp.h" +#include "Assignment.h" +#include "AssignmentClient.h" +#include "AssignmentClientMonitor.h" int main(int argc, char* argv[]) { - AssignmentClientApp app(argc, argv); - return 0; +#ifndef WIN32 + setvbuf(stdout, NULL, _IOLBF, 0); +#endif + + // use the verbose message handler in Logging + qInstallMessageHandler(LogHandler::verboseMessageHandler); + + const char* numForksString = getCmdOption(argc, (const char**)argv, NUM_FORKS_PARAMETER); + + int numForks = 0; + + if (numForksString) { + numForks = atoi(numForksString); + } + + if (numForks) { + AssignmentClientMonitor monitor(argc, argv, numForks); + return monitor.exec(); + } else { + AssignmentClient client(argc, argv); + return client.exec(); + } } diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 64e0d335b1..f84722a438 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -246,7 +246,19 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) { auto nodeList = DependencyManager::set(domainServerPort, domainServerDTLSPort); // no matter the local port, save it to shared mem so that local assignment clients can ask what it is - nodeList->putLocalPortIntoSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this); + QSharedMemory* sharedPortMem = new QSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this); + quint16 localPort = nodeList->getNodeSocket().localPort(); + + // attempt to create the shared memory segment + if (sharedPortMem->create(sizeof(localPort)) || sharedPortMem->attach()) { + sharedPortMem->lock(); + memcpy(sharedPortMem->data(), &localPort, sizeof(localPort)); + sharedPortMem->unlock(); + + qDebug() << "Wrote local listening port" << localPort << "to shared memory at key" << DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY; + } else { + qWarning() << "Failed to create and attach to shared memory to share local port with assignment-client children."; + } // set our LimitedNodeList UUID to match the UUID from our config // nodes will currently use this to add resources to data-web that relate to our domain diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index f67abdca2b..9bcdcbe9a4 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -76,7 +76,7 @@ const QString AddressManager::currentPath(bool withOrientation) const { pathString += "/" + orientationString; } else { qDebug() << "Cannot add orientation to path without a getter for position." - << "Call AddressManager::setOrientationGetter to pass a function that will return a glm::quat"; + << "Call AdressManager::setOrientationGetter to pass a function that will return a glm::quat"; } } @@ -84,7 +84,7 @@ const QString AddressManager::currentPath(bool withOrientation) const { return pathString; } else { qDebug() << "Cannot create address path without a getter for position." - << "Call AddressManager::setPositionGetter to pass a function that will return a const glm::vec3&"; + << "Call AdressManager::setPositionGetter to pass a function that will return a const glm::vec3&"; return QString(); } } diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index b240f0df9e..c8c454ff14 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -669,41 +669,3 @@ void LimitedNodeList::sendHeartbeatToIceServer(const HifiSockAddr& iceServerSock writeUnverifiedDatagram(iceRequestByteArray, iceServerSockAddr); } - -void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* parent) { - // save our local port to shared memory so that assignment client children know how to talk to this parent - QSharedMemory* sharedPortMem = new QSharedMemory(key, parent); - quint16 localPort = getNodeSocket().localPort(); - - // attempt to create the shared memory segment - if (sharedPortMem->create(sizeof(localPort)) || sharedPortMem->attach()) { - sharedPortMem->lock(); - memcpy(sharedPortMem->data(), &localPort, sizeof(localPort)); - sharedPortMem->unlock(); - - qDebug() << "Wrote local listening port" << localPort << "to shared memory at key" << key; - } else { - qWarning() << "Failed to create and attach to shared memory to share local port with assignment-client children."; - } -} - - -bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, QSharedMemory*& sharedMem, - quint16& localPort) { - if (!sharedMem) { - sharedMem = new QSharedMemory(key, this); - - if (!sharedMem->attach(QSharedMemory::ReadOnly)) { - qWarning() << "Could not attach to shared memory at key" << key; - } - } - - if (sharedMem->isAttached()) { - sharedMem->lock(); - memcpy(&localPort, sharedMem->data(), sizeof(localPort)); - sharedMem->unlock(); - return true; - } - - return false; -} diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index 02234ee4f7..72aefdb2b3 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -26,7 +26,6 @@ #include #include #include -#include #include @@ -50,11 +49,6 @@ const char STUN_SERVER_HOSTNAME[] = "stun.highfidelity.io"; const unsigned short STUN_SERVER_PORT = 3478; const QString DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY = "domain-server.local-port"; -const QString ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY = "assignment-client-monitor.local-port"; - -const char DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME[] = "localhost"; -const unsigned short DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT = 40104; -const unsigned short DEFAULT_ASSIGNMENT_CLIENT_MONITOR_DTLS_PORT = 40105; class HifiSockAddr; @@ -174,9 +168,6 @@ public: return SharedNodePointer(); } - - void putLocalPortIntoSharedMemory(const QString key, QObject* parent); - bool getLocalServerPortFromSharedMemory(const QString key, QSharedMemory*& sharedMem, quint16& localPort); public slots: void reset(); diff --git a/libraries/networking/src/Node.cpp b/libraries/networking/src/Node.cpp index 2a38799707..2bf792c6ee 100644 --- a/libraries/networking/src/Node.cpp +++ b/libraries/networking/src/Node.cpp @@ -149,12 +149,7 @@ QDataStream& operator>>(QDataStream& in, Node& node) { } QDebug operator<<(QDebug debug, const Node &node) { - debug.nospace() << NodeType::getNodeTypeName(node.getType()); - if (node.getType() == NodeType::Unassigned) { - debug.nospace() << " (1)"; - } else { - debug.nospace() << " (" << node.getType() << ")"; - } + debug.nospace() << NodeType::getNodeTypeName(node.getType()) << " (" << node.getType() << ")"; debug << " " << node.getUUID().toString().toLocal8Bit().constData() << " "; debug.nospace() << node.getPublicSocket() << "/" << node.getLocalSocket(); return debug.nospace(); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index e63f230f6e..f70c2d9b3c 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -62,17 +62,13 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned connect(&AccountManager::getInstance(), &AccountManager::logoutComplete , this, &NodeList::reset); } -qint64 NodeList::sendStats(const QJsonObject& statsObject, HifiSockAddr destination) { +qint64 NodeList::sendStatsToDomainServer(const QJsonObject& statsObject) { QByteArray statsPacket = byteArrayWithPopulatedHeader(PacketTypeNodeJsonStats); QDataStream statsPacketStream(&statsPacket, QIODevice::Append); statsPacketStream << statsObject.toVariantMap(); - return writeUnverifiedDatagram(statsPacket, destination); -} - -qint64 NodeList::sendStatsToDomainServer(const QJsonObject& statsObject) { - return sendStats(statsObject, _domainHandler.getSockAddr()); + return writeUnverifiedDatagram(statsPacket, _domainHandler.getSockAddr()); } void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer& sendingNode) { diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h index 1c6de4bb6c..907fccfcac 100644 --- a/libraries/networking/src/NodeList.h +++ b/libraries/networking/src/NodeList.h @@ -47,7 +47,6 @@ public: NodeType_t getOwnerType() const { return _ownerType; } void setOwnerType(NodeType_t ownerType) { _ownerType = ownerType; } - qint64 sendStats(const QJsonObject& statsObject, HifiSockAddr destination); qint64 sendStatsToDomainServer(const QJsonObject& statsObject); int getNumNoReplyDomainCheckIns() const { return _numNoReplyDomainCheckIns; } diff --git a/libraries/networking/src/PacketHeaders.cpp b/libraries/networking/src/PacketHeaders.cpp index db97e216ee..2eee540fff 100644 --- a/libraries/networking/src/PacketHeaders.cpp +++ b/libraries/networking/src/PacketHeaders.cpp @@ -70,8 +70,6 @@ PacketVersion versionForPacketType(PacketType type) { return 2; case PacketTypeOctreeStats: return 1; - case PacketTypeStopNode: - return 1; case PacketTypeEntityAddOrEdit: case PacketTypeEntityData: return VERSION_MODEL_ENTITIES_SUPPORT_SHAPE_TYPE; @@ -126,7 +124,6 @@ QString nameForPacketType(PacketType type) { PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityErase); PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityAddResponse); PACKET_TYPE_NAME_LOOKUP(PacketTypeOctreeDataNack); - PACKET_TYPE_NAME_LOOKUP(PacketTypeStopNode); PACKET_TYPE_NAME_LOOKUP(PacketTypeAudioEnvironment); PACKET_TYPE_NAME_LOOKUP(PacketTypeEntityEditNack); PACKET_TYPE_NAME_LOOKUP(PacketTypeSignedTransactionPayment); diff --git a/libraries/networking/src/PacketHeaders.h b/libraries/networking/src/PacketHeaders.h index 32f33c01d9..e593955b51 100644 --- a/libraries/networking/src/PacketHeaders.h +++ b/libraries/networking/src/PacketHeaders.h @@ -67,7 +67,7 @@ enum PacketType { PacketTypeEntityErase, PacketTypeEntityAddResponse, PacketTypeOctreeDataNack, // 45 - PacketTypeStopNode, + UNUSED_10, PacketTypeAudioEnvironment, PacketTypeEntityEditNack, PacketTypeSignedTransactionPayment, @@ -86,7 +86,7 @@ const QSet NON_VERIFIED_PACKETS = QSet() << PacketTypeNodeJsonStats << PacketTypeEntityQuery << PacketTypeOctreeDataNack << PacketTypeEntityEditNack << PacketTypeIceServerHeartbeat << PacketTypeIceServerHeartbeatResponse - << PacketTypeUnverifiedPing << PacketTypeUnverifiedPingReply << PacketTypeStopNode; + << PacketTypeUnverifiedPing << PacketTypeUnverifiedPingReply; const int NUM_BYTES_MD5_HASH = 16; const int NUM_STATIC_HEADER_BYTES = sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID; From d52ba5e95870f07cd6b4e3e23024b222cc0576d4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 24 Feb 2015 13:20:17 -0800 Subject: [PATCH 212/261] call windeployqt after fixup_bundle for qt plugins --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 4a1bc35fb7..4f144c4315 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -18,7 +18,7 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) @ONLY ) - # add a post-build command to copy DLLs beside the interface executable + # add a post-build command to copy DLLs beside the executable add_custom_command( TARGET ${TARGET_NAME} POST_BUILD @@ -26,5 +26,15 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) -DBUNDLE_EXECUTABLE=$ -P ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake ) + + find_program(${WINDEPLOYQT_COMMAND} windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) + + # add a post-build command to call windeployqt to copy Qt plugins + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND SET PATH=%PATH%;${QT_DIR}/bin + COMMAND ${WINDEPLOYQT_COMMAND} --no-libraries --force $ + ) endif () endmacro() \ No newline at end of file From fd93b99f03fc3e8a8ccb0b19b93377ab8c98122e Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 14:02:46 -0800 Subject: [PATCH 213/261] more hacking on script shutdown behavior --- interface/src/Application.cpp | 12 +- .../src/EntityTreeRenderer.cpp | 3 - libraries/script-engine/src/ScriptEngine.cpp | 264 ++++++++++++++---- libraries/script-engine/src/ScriptEngine.h | 9 +- 4 files changed, 231 insertions(+), 57 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 32854a1781..7184021239 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3552,9 +3552,11 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUserLoaded, bool loadScriptFromEditor, bool activateMainWindow) { - qDebug() << "Application::loadScript() " << scriptFilename << "line:" << __LINE__; + qDebug() << "Application::loadScript() ---- BEGIN ---- Script:" << scriptFilename; + if (isAboutToQuit()) { - qDebug() << "Application::loadScript() WHILE QUITTING.... what to do????" << scriptFilename << "line:" << __LINE__; + qDebug() << "Requests to load scripts while quitting are ignored. Script:" << scriptFilename; + qDebug() << "Application::loadScript() ---- END ---- Script:" << scriptFilename; return NULL; } @@ -3563,6 +3565,8 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser if (_scriptEnginesHash.contains(scriptURLString) && loadScriptFromEditor && !_scriptEnginesHash[scriptURLString]->isFinished()) { + qDebug() << "Application::loadScript() from _scriptEnginesHash[scriptURLString].... Script:" << scriptFilename; + qDebug() << "Application::loadScript() ---- END ---- Script:" << scriptFilename; return _scriptEnginesHash[scriptURLString]; } @@ -3581,6 +3585,7 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser connect(scriptEngine, &ScriptEngine::errorLoadingScript, this, &Application::handleScriptLoadError); // get the script engine object to load the script at the designated script URL + qDebug() << "Application::loadScript() about to call loadURL() scriptUrl:" << scriptUrl; scriptEngine->loadURL(scriptUrl); } @@ -3589,6 +3594,9 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser _window->activateWindow(); } + qDebug() << "Application::loadScript() newly created scriptEngine.... Script:" << scriptFilename; + qDebug() << "Application::loadScript() ---- END ---- Script:" << scriptFilename; + return scriptEngine; } diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 9deafe17da..8648cea285 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -59,10 +59,8 @@ EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterf } EntityTreeRenderer::~EntityTreeRenderer() { - qDebug() << "EntityTreeRenderer::~EntityTreeRenderer() -------- BEGIN -----------"; // NOTE: we don't need to delete _entitiesScriptEngine because it's owned by the application and gets cleaned up // automatically but we do need to delete our sandbox script engine. - if (_sandboxScriptEngine) { // NOTE: is it possible this is a problem? I think that we hook the script engine object up to a deleteLater() // call inside of registerScriptEngineWithApplicationServices() but do we not call that for _sandboxScriptEngine??? @@ -72,7 +70,6 @@ EntityTreeRenderer::~EntityTreeRenderer() { delete _sandboxScriptEngine; _sandboxScriptEngine = NULL; } - qDebug() << "EntityTreeRenderer::~EntityTreeRenderer() -------- DONE -----------"; } void EntityTreeRenderer::clear() { diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index fe568ab077..e99cbea0e5 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -94,33 +94,32 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam _isUserLoaded(false), _arrayBufferClass(new ArrayBufferClass(this)) { - qDebug() << "ScriptEngine::ScriptEngine() " << getFilename() << "[" << ((void*)this) << "]" << " -------- BEGIN -----------"; _allScriptsMutex.lock(); _allKnownScriptEngines.insert(this); _allScriptsMutex.unlock(); - qDebug() << "ScriptEngine::ScriptEngine() " << getFilename() << " -------- DONE -----------"; } ScriptEngine::~ScriptEngine() { - qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << "[" << ((void*)this) << "]" << " -------- BEGIN -----------"; + qDebug() << "ScriptEngine::~ScriptEngine() ------- BEGIN ------- script:" << getFilename(); + // If we're not already in the middle of stopping all scripts, then we should remove ourselves + // from the list of running scripts. We don't do this if we're in the process of stopping all scripts + // because that method removes scripts from its list as it iterates them if (!_stoppingAllScripts) { _allScriptsMutex.lock(); - qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << " removing from list of scripts"; _allKnownScriptEngines.remove(this); _allScriptsMutex.unlock(); - } else { - qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << " NOT removing from list of scripts here..."; } - qDebug() << "ScriptEngine::~ScriptEngine() " << getFilename() << " -------- DONE -----------"; + qDebug() << "ScriptEngine::~ScriptEngine() ------- END ------- script:" << getFilename(); } QSet ScriptEngine::_allKnownScriptEngines; QMutex ScriptEngine::_allScriptsMutex; bool ScriptEngine::_stoppingAllScripts = false; +bool ScriptEngine::_doneRunningThisScript = false; void ScriptEngine::stopAllScripts(QObject* application) { + qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------"; - qDebug() << "ScriptEngine::stopAllScripts() -------- BEGIN -----------"; _allScriptsMutex.lock(); _stoppingAllScripts = true; @@ -128,44 +127,92 @@ void ScriptEngine::stopAllScripts(QObject* application) { while (i.hasNext()) { ScriptEngine* scriptEngine = i.next(); - qDebug() << "ScriptEngine::stopAllScripts() scriptEngine: " << (void*)scriptEngine; - QString scriptName = scriptEngine->getFilename(); - qDebug() << "ScriptEngine::stopAllScripts() considering script: " << scriptName << "evaluatePending:" << scriptEngine->evaluatePending(); + qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName + << "isRunning():" << scriptEngine->isRunning() + << "evaluatePending():" << scriptEngine->evaluatePending(); // NOTE: typically all script engines are running. But there's at least one known exception to this, the // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using // them. We don't need to stop scripts that aren't running. if (scriptEngine->isRunning()) { + + // If the script is running, but still evaluating then we need to wait for its evaluation step to + // complete. After that we can handle the stop process appropriately if (scriptEngine->evaluatePending()) { - qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__ << "waiting for evaluation to complete...."; - QEventLoop loop; - QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit); - loop.exec(); - qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__ << "evaluation complete...."; + while (scriptEngine->evaluatePending()) { + QEventLoop loop; + QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit); + qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) STARTING loop.exec() script:" << scriptName; + loop.exec(); + qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) AFTER loop.exec() script:" << scriptName; + } } - qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; - - QEventLoop loop; - QObject::connect(scriptEngine, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); - - qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; scriptEngine->disconnect(application); - qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; scriptEngine->stop(); - qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; - loop.exec(); - qDebug() << "ScriptEngine::stopAllScripts() handling script: " << scriptName << "line:" << __LINE__; + + qDebug() << "ScriptEngine::stopAllScripts() -- WAITING for waitTillDoneRunning() script:" << scriptName; + scriptEngine->waitTillDoneRunning(); + qDebug() << "ScriptEngine::stopAllScripts() -- AFTER waitTillDoneRunning() script:" << scriptName; i.remove(); } else { - qDebug() << "ScriptEngine::stopAllScripts() script: " << scriptName << " was not running... skipping it's stop() call."; } } _stoppingAllScripts = false; _allScriptsMutex.unlock(); - qDebug() << "ScriptEngine::stopAllScripts() -------- DONE -----------"; + qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------"; +} + + +void ScriptEngine::waitTillDoneRunning() { + QString scriptName = getFilename(); + qDebug() << "ScriptEngine::waitTillDoneRunning() ------- BEGIN ------- script:" << scriptName; + qDebug() << " _isFinished:" << _isFinished; + qDebug() << " _isRunning:" << _isRunning; + qDebug() << " _isInitialized:" << _isInitialized; + qDebug() << " _evaluatesPending:" << _evaluatesPending; + + if (_isRunning) { + qDebug() << "ScriptEngine::waitTillDoneRunning() SETTING _doneRunningThisScript = false ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + _doneRunningThisScript = false; + _isWaitingForDoneRunning = true; + + // What can we do here??? + // we will be calling this on the main Application thread, inside of stopAllScripts() + // we want the application thread to continue to process events, because the script will + // likely need to marshall messages across to the main thread. + while (!_doneRunningThisScript && _isRunning) { + + // and run a QEventLoop??? + QEventLoop loop; + QObject::connect(this, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); + qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING loop.exec() script:" << scriptName; + qDebug() << " _doneRunningThisScript:" << _doneRunningThisScript; + qDebug() << " _isRunning:" << _isRunning; + qDebug() << " _isWaitingForDoneRunning:" << _isWaitingForDoneRunning; + qDebug() << " _isFinished:" << _isFinished; + qDebug() << " _isInitialized:" << _isInitialized; + qDebug() << " _evaluatesPending:" << _evaluatesPending; + loop.exec(); + qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER loop.exec() script:" << scriptName; + + // process events + qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING QCoreApplication::processEvents() script:" << scriptName; + QCoreApplication::processEvents(); + qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER QCoreApplication::processEvents() script:" << scriptName; + + if (_doneRunningThisScript) { + qDebug() << "ScriptEngine::waitTillDoneRunning() _doneRunningThisScript after processEvents... breaking!!! script:" << scriptName; + break; + } + } + + _isWaitingForDoneRunning = false; + } + + qDebug() << "ScriptEngine::waitTillDoneRunning() ------- DONE ------- script:" << scriptName; } QString ScriptEngine::getFilename() const { @@ -377,12 +424,23 @@ void ScriptEngine::registerGetterSetter(const QString& name, QScriptEngine::Func } void ScriptEngine::evaluate() { + if (_stoppingAllScripts) { + qDebug() << "ScriptEngine::evaluate() while shutting down is ignored..."; + qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + return; // bail early + } + + qDebug() << "ScriptEngine::evaluate() -- BEGIN script:" << getFilename() << "[" << this << "]"; if (!_isInitialized) { init(); } + qDebug() << "ScriptEngine::evaluate() -- about to call own evaluate(program) script:" << getFilename() << "[" << this << "]"; QScriptValue result = evaluate(_scriptContents); + qDebug() << "ScriptEngine::evaluate() -- AFTER own evaluate(program) script:" << getFilename() << "[" << this << "]"; + // TODO: why do we check this twice? It seems like the call to clearExcpetions() in the lower level evaluate call + // will cause this code to never actually run... if (hasUncaughtException()) { int line = uncaughtExceptionLineNumber(); qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString(); @@ -392,17 +450,30 @@ void ScriptEngine::evaluate() { } QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileName, int lineNumber) { - qDebug() << "ScriptEngine::evaluate() " << getFilename() << " line:" << __LINE__; - _evaluatePending = true; + if (_stoppingAllScripts) { + qDebug() << "ScriptEngine::evaluate(program) while shutting down is ignored..."; + qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + return QScriptValue(); // bail early + } + + qDebug() << "ScriptEngine::evaluate(program) -- BEGIN script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + _evaluatesPending++; + qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending++ script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + qDebug() << "ScriptEngine::evaluate(program) -- BEFORE QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber); + qDebug() << "ScriptEngine::evaluate(program) -- AFTER QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; if (hasUncaughtException()) { int line = uncaughtExceptionLineNumber(); qDebug() << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString(); } + _evaluatesPending--; + qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending-- script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + + qDebug() << "ScriptEngine::evaluate(program) -- ABOUT TO emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; emit evaluationFinished(result, hasUncaughtException()); + qDebug() << "ScriptEngine::evaluate(program) -- AFTER emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; clearExceptions(); - _evaluatePending = false; - qDebug() << "ScriptEngine::evaluate() " << getFilename() << " line:" << __LINE__; + qDebug() << "ScriptEngine::evaluate(program) -- DONE script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; return result; } @@ -419,49 +490,60 @@ void ScriptEngine::sendAvatarBillboardPacket() { } void ScriptEngine::run() { - qDebug() << "ScriptEngine::run() " << getFilename() << " -------- BEGIN -----------"; + // TODO: can we add a short circuit for _stoppingAllScripts here? What does it mean to not start running if + // we're in the process of stopping? + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; if (!_isInitialized) { - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; init(); - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; } - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; _isRunning = true; _isFinished = false; - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; emit runningStateChanged(); - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; QScriptValue result = evaluate(_scriptContents); - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; QElapsedTimer startTime; startTime.start(); int thisFrame = 0; - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; auto nodeList = DependencyManager::get(); qint64 lastUpdate = usecTimestampNow(); - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + while (!_isFinished) { + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec if (usecToSleep > 0) { usleep(usecToSleep); } if (_isFinished) { + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; break; } + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + QCoreApplication::processEvents(); + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + if (_isFinished) { + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; break; } @@ -589,16 +671,38 @@ void ScriptEngine::run() { emit update(deltaTime); } lastUpdate = now; + + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + } - qDebug() << "ScriptEngine::run() " << getFilename() << " line:" << __LINE__; + + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; stopAllTimers(); // make sure all our timers are stopped if the script is ending + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename(); + + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } emit scriptEnding(); + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; // kill the avatar identity timer delete _avatarIdentityTimer; + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) { // release the queue of edit entity messages. _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages(); @@ -609,19 +713,44 @@ void ScriptEngine::run() { } } + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + // If we were on a thread, then wait till it's done if (thread()) { + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; thread()->quit(); + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + + qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; } emit finished(_fileNameString); - _isRunning = false; + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + _isRunning = false; emit runningStateChanged(); + qDebug() << "ABOUT TO emit doneRunning() script:" << getFilename() << "[" << this << "]"; emit doneRunning(); - qDebug() << "ScriptEngine::run() " << getFilename() << " -------- DONE -----------" << " line:" << __LINE__; + qDebug() << "AFTER emit doneRunning() script:" << getFilename() << "[" << this << "]"; + + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } + + qDebug() << "ScriptEngine::run() SETTING _doneRunningThisScript = true ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + _doneRunningThisScript = true; + + if (_isWaitingForDoneRunning) { + qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + } } // NOTE: This is private because it must be called on the same thread that created the timers, which is why @@ -636,9 +765,10 @@ void ScriptEngine::stopAllTimers() { } void ScriptEngine::stop() { - qDebug() << "ScriptEngine::stop() " << getFilename() << "[" << ((void*)this) << "]"; + qDebug() << "ScriptEngine::stop() -- START -- line:" << __LINE__ << " script:" << getFilename(); _isFinished = true; emit runningStateChanged(); + qDebug() << "ScriptEngine::stop() -- DONE -- line:" << __LINE__ << " script:" << getFilename(); } void ScriptEngine::timerFired() { @@ -674,10 +804,22 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int } QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) { + if (_stoppingAllScripts) { + qDebug() << "Script.setInterval() while shutting down is ignored..."; + qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + return NULL; // bail early + } + return setupTimerWithInterval(function, intervalMS, false); } QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) { + if (_stoppingAllScripts) { + qDebug() << "Script.setTimeout() while shutting down is ignored..."; + qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + return NULL; // bail early + } + return setupTimerWithInterval(function, timeoutMS, true); } @@ -723,6 +865,12 @@ void ScriptEngine::print(const QString& message) { // If no callback is specified, the included files will be loaded synchronously and will block execution until // all of the files have finished loading. void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) { + if (_stoppingAllScripts) { + qDebug() << "Script.include() while shutting down is ignored..."; + qDebug() << " includeFiles:" << includeFiles; + qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + return; // bail early + } QList urls; for (QString file : includeFiles) { urls.append(resolvePath(file)); @@ -736,7 +884,9 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac if (contents.isNull()) { qDebug() << "Error loading file: " << url; } else { + qDebug() << "ScriptEngine::include() BEFORE evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending; QScriptValue result = evaluate(contents, url.toString()); + qDebug() << "ScriptEngine::include() AFTER evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending; } } @@ -762,17 +912,31 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac } void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { + if (_stoppingAllScripts) { + qDebug() << "Script.include() while shutting down is ignored..."; + qDebug() << " includeFile:" << includeFile; + qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + return; // bail early + } + QStringList urls; urls.append(includeFile); include(urls, callback); } +// NOTE: The load() command is similar to the include() command except that it loads the script +// as a stand-alone script. To accomplish this, the ScriptEngine class just emits a signal which +// the Application or other context will connect to in order to know to actually load the script void ScriptEngine::load(const QString& loadFile) { - qDebug() << "ScriptEngine::load() " << getFilename() << "[" << ((void*)this) << "]" << "line:" << __LINE__; + if (_stoppingAllScripts) { + qDebug() << "Script.load() while shutting down is ignored..."; + qDebug() << " loadFile:" << loadFile; + qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + return; // bail early + } + QUrl url = resolvePath(loadFile); - qDebug() << "ScriptEngine::load() " << getFilename() << "[" << ((void*)this) << "]" << "line:" << __LINE__; emit loadScript(url.toString(), false); - qDebug() << "ScriptEngine::load() " << getFilename() << "[" << ((void*)this) << "]" << "line:" << __LINE__; } void ScriptEngine::nodeKilled(SharedNodePointer node) { diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index a672646c79..51cacd5e58 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -85,7 +86,7 @@ public: bool isFinished() const { return _isFinished; } bool isRunning() const { return _isRunning; } - bool evaluatePending() const { return _evaluatePending; } + bool evaluatePending() const { return _evaluatesPending > 0; } void setUserLoaded(bool isUserLoaded) { _isUserLoaded = isUserLoaded; } bool isUserLoaded() const { return _isUserLoaded; } @@ -95,6 +96,8 @@ public: QString getFilename() const; static void stopAllScripts(QObject* application); + + void waitTillDoneRunning(); public slots: void loadURL(const QUrl& scriptURL); @@ -132,7 +135,8 @@ protected: QString _parentURL; bool _isFinished; bool _isRunning; - bool _evaluatePending = false; + int _evaluatesPending = 0; + bool _isWaitingForDoneRunning = false; bool _isInitialized; bool _isAvatar; QTimer* _avatarIdentityTimer; @@ -171,6 +175,7 @@ private: static QSet _allKnownScriptEngines; static QMutex _allScriptsMutex; static bool _stoppingAllScripts; + static bool _doneRunningThisScript; }; #endif // hifi_ScriptEngine_h From 89c10ca2ece60d44f330a4b4d410f8f92a7eafef Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 24 Feb 2015 14:36:24 -0800 Subject: [PATCH 214/261] Fix BillboardOverlay::findRayIntersection --- .../src/ui/overlays/BillboardOverlay.cpp | 50 ++++++++++++++++--- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/interface/src/ui/overlays/BillboardOverlay.cpp b/interface/src/ui/overlays/BillboardOverlay.cpp index 27bd0c9102..4ea0e55710 100644 --- a/interface/src/ui/overlays/BillboardOverlay.cpp +++ b/interface/src/ui/overlays/BillboardOverlay.cpp @@ -12,6 +12,7 @@ #include "Application.h" #include "BillboardOverlay.h" +#include BillboardOverlay::BillboardOverlay() : _fromImage(), @@ -191,18 +192,51 @@ bool BillboardOverlay::findRayIntersection(const glm::vec3& origin, const glm::v float& distance, BoxFace& face) { if (_texture) { + // This is taken from Planar3DOverlay. Although it probably makes more sense for this + // overlay type to extend from Planar3DOverlay, the interfaces are different enough (scale vs. dimensions) + // that it would break existing scripts and would require other changes to make up for unique + // features like `isFacingAvatar`. + + RayIntersectionInfo rayInfo; + rayInfo._rayStart = origin; + rayInfo._rayDirection = direction; + rayInfo._rayLength = std::numeric_limits::max(); + bool isNull = _fromImage.isNull(); float width = isNull ? _texture->getWidth() : _fromImage.width(); float height = isNull ? _texture->getHeight() : _fromImage.height(); - float maxSize = glm::max(width, height); - float x = width / (2.0f * maxSize); - float y = -height / (2.0f * maxSize); - float maxDimension = glm::max(x,y); - float scaledDimension = maxDimension * _scale; - glm::vec3 corner = getCenter() - glm::vec3(scaledDimension, scaledDimension, scaledDimension) ; - AACube myCube(corner, scaledDimension * 2.0f); - return myCube.findRayIntersection(origin, direction, distance, face); + PlaneShape plane; + + const glm::vec3 UNROTATED_NORMAL(0.0f, 0.0f, -1.0f); + glm::quat rotation; + if (_isFacingAvatar) { + // rotate about vertical to face the camera + rotation = Application::getInstance()->getCamera()->getRotation(); + rotation *= glm::angleAxis(glm::pi(), glm::vec3(0.0f, 1.0f, 0.0f)); + } else { + rotation = _rotation; + } + glm::vec3 normal = rotation * UNROTATED_NORMAL; + plane.setNormal(normal); + plane.setPoint(_position); // the position is definitely a point on our plane + + bool intersects = plane.findRayIntersection(rayInfo); + + if (intersects) { + distance = rayInfo._hitDistance; + + glm::vec3 hitPosition = origin + (distance * direction); + glm::vec3 localHitPosition = glm::inverse(rotation) * (hitPosition - _position); + + // Produce the dimensions of the billboard based on the image's aspect ratio and the overlay's scale. + float maxSize = glm::max(width, height); + glm::vec2 halfDimensions = 0.5f * _scale * glm::vec2(width / maxSize, height / maxSize); + + intersects = -halfDimensions.x <= localHitPosition.x && localHitPosition.x <= halfDimensions.x + && -halfDimensions.y <= localHitPosition.y && localHitPosition.y <= halfDimensions.y; + } + return intersects; } return false; } From e7e7323ff01684262c9ea9fd09913f558dace2e0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 24 Feb 2015 15:00:41 -0800 Subject: [PATCH 215/261] pass 10.9 SDK as CMAKE_OSX_SYSROOT --- CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc67d622de..5deecb4be5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,8 +88,17 @@ endif () set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) -# set our OS X deployment target to -set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) +if (APPLE) + # set our OS X deployment target + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) + + # find the 10.9 SDK path + execute_process(COMMAND xcodebuild -sdk -version OUTPUT_VARIABLE XCODE_SDK_VERSIONS) + string(REGEX MATCH \\/.+MacOSX10.9.sdk OSX_SDK_PATH ${XCODE_SDK_VERSIONS}) + + # set that as the SDK to use + set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH}) +endif () # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) From 8757600a5eeac4199f607992770b118f79b079ee Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 15:57:13 -0800 Subject: [PATCH 216/261] ifdef around massive debug output --- libraries/script-engine/src/ScriptEngine.cpp | 149 ++++++++++--------- 1 file changed, 76 insertions(+), 73 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index e99cbea0e5..cbdd59146b 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -41,6 +41,13 @@ #include "MIDIEvent.h" + +#ifdef WANT_DEBUG_SCRIPT_ENDING +#define DEBUG_SCRIPT_ENDING(X) X +#else +#define DEBUG_SCRIPT_ENDING(x) +#endif + EntityScriptingInterface ScriptEngine::_entityScriptingInterface; static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){ @@ -100,7 +107,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam } ScriptEngine::~ScriptEngine() { - qDebug() << "ScriptEngine::~ScriptEngine() ------- BEGIN ------- script:" << getFilename(); + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::~ScriptEngine() ------- BEGIN ------- script:" << getFilename();) // If we're not already in the middle of stopping all scripts, then we should remove ourselves // from the list of running scripts. We don't do this if we're in the process of stopping all scripts // because that method removes scripts from its list as it iterates them @@ -109,7 +116,7 @@ ScriptEngine::~ScriptEngine() { _allKnownScriptEngines.remove(this); _allScriptsMutex.unlock(); } - qDebug() << "ScriptEngine::~ScriptEngine() ------- END ------- script:" << getFilename(); + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::~ScriptEngine() ------- END ------- script:" << getFilename();) } QSet ScriptEngine::_allKnownScriptEngines; @@ -118,7 +125,7 @@ bool ScriptEngine::_stoppingAllScripts = false; bool ScriptEngine::_doneRunningThisScript = false; void ScriptEngine::stopAllScripts(QObject* application) { - qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------";) _allScriptsMutex.lock(); _stoppingAllScripts = true; @@ -129,9 +136,9 @@ void ScriptEngine::stopAllScripts(QObject* application) { QString scriptName = scriptEngine->getFilename(); - qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName << "isRunning():" << scriptEngine->isRunning() - << "evaluatePending():" << scriptEngine->evaluatePending(); + << "evaluatePending():" << scriptEngine->evaluatePending();) // NOTE: typically all script engines are running. But there's at least one known exception to this, the // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using @@ -144,38 +151,34 @@ void ScriptEngine::stopAllScripts(QObject* application) { while (scriptEngine->evaluatePending()) { QEventLoop loop; QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit); - qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) STARTING loop.exec() script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) STARTING loop.exec() script:" << scriptName;) loop.exec(); - qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) AFTER loop.exec() script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) AFTER loop.exec() script:" << scriptName;) } } scriptEngine->disconnect(application); scriptEngine->stop(); - qDebug() << "ScriptEngine::stopAllScripts() -- WAITING for waitTillDoneRunning() script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() -- WAITING for waitTillDoneRunning() script:" << scriptName;) scriptEngine->waitTillDoneRunning(); - qDebug() << "ScriptEngine::stopAllScripts() -- AFTER waitTillDoneRunning() script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() -- AFTER waitTillDoneRunning() script:" << scriptName;) i.remove(); } else { } } _stoppingAllScripts = false; _allScriptsMutex.unlock(); - qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------";) } void ScriptEngine::waitTillDoneRunning() { QString scriptName = getFilename(); - qDebug() << "ScriptEngine::waitTillDoneRunning() ------- BEGIN ------- script:" << scriptName; - qDebug() << " _isFinished:" << _isFinished; - qDebug() << " _isRunning:" << _isRunning; - qDebug() << " _isInitialized:" << _isInitialized; - qDebug() << " _evaluatesPending:" << _evaluatesPending; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() ------- BEGIN ------- script:" << scriptName;) if (_isRunning) { - qDebug() << "ScriptEngine::waitTillDoneRunning() SETTING _doneRunningThisScript = false ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() SETTING _doneRunningThisScript = false ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) _doneRunningThisScript = false; _isWaitingForDoneRunning = true; @@ -188,23 +191,23 @@ void ScriptEngine::waitTillDoneRunning() { // and run a QEventLoop??? QEventLoop loop; QObject::connect(this, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); - qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING loop.exec() script:" << scriptName; - qDebug() << " _doneRunningThisScript:" << _doneRunningThisScript; - qDebug() << " _isRunning:" << _isRunning; - qDebug() << " _isWaitingForDoneRunning:" << _isWaitingForDoneRunning; - qDebug() << " _isFinished:" << _isFinished; - qDebug() << " _isInitialized:" << _isInitialized; - qDebug() << " _evaluatesPending:" << _evaluatesPending; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING loop.exec() script:" << scriptName;) + DEBUG_SCRIPT_ENDING(qDebug() << " _doneRunningThisScript:" << _doneRunningThisScript;) + DEBUG_SCRIPT_ENDING(qDebug() << " _isRunning:" << _isRunning;) + DEBUG_SCRIPT_ENDING(qDebug() << " _isWaitingForDoneRunning:" << _isWaitingForDoneRunning;) + DEBUG_SCRIPT_ENDING(qDebug() << " _isFinished:" << _isFinished;) + DEBUG_SCRIPT_ENDING(qDebug() << " _isInitialized:" << _isInitialized;) + DEBUG_SCRIPT_ENDING(qDebug() << " _evaluatesPending:" << _evaluatesPending;) loop.exec(); - qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER loop.exec() script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER loop.exec() script:" << scriptName;) // process events - qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING QCoreApplication::processEvents() script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING QCoreApplication::processEvents() script:" << scriptName;) QCoreApplication::processEvents(); - qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER QCoreApplication::processEvents() script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER QCoreApplication::processEvents() script:" << scriptName;) if (_doneRunningThisScript) { - qDebug() << "ScriptEngine::waitTillDoneRunning() _doneRunningThisScript after processEvents... breaking!!! script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() _doneRunningThisScript after processEvents... breaking!!! script:" << scriptName;) break; } } @@ -212,7 +215,7 @@ void ScriptEngine::waitTillDoneRunning() { _isWaitingForDoneRunning = false; } - qDebug() << "ScriptEngine::waitTillDoneRunning() ------- DONE ------- script:" << scriptName; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() ------- DONE ------- script:" << scriptName;) } QString ScriptEngine::getFilename() const { @@ -430,20 +433,20 @@ void ScriptEngine::evaluate() { return; // bail early } - qDebug() << "ScriptEngine::evaluate() -- BEGIN script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- BEGIN script:" << getFilename() << "[" << this << "]";) if (!_isInitialized) { init(); } - qDebug() << "ScriptEngine::evaluate() -- about to call own evaluate(program) script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- about to call own evaluate(program) script:" << getFilename() << "[" << this << "]";) QScriptValue result = evaluate(_scriptContents); - qDebug() << "ScriptEngine::evaluate() -- AFTER own evaluate(program) script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- AFTER own evaluate(program) script:" << getFilename() << "[" << this << "]";) // TODO: why do we check this twice? It seems like the call to clearExcpetions() in the lower level evaluate call // will cause this code to never actually run... if (hasUncaughtException()) { int line = uncaughtExceptionLineNumber(); - qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString(); + DEBUG_SCRIPT_ENDING(qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();) emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString()); clearExceptions(); } @@ -456,24 +459,24 @@ QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileN return QScriptValue(); // bail early } - qDebug() << "ScriptEngine::evaluate(program) -- BEGIN script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- BEGIN script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) _evaluatesPending++; - qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending++ script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; - qDebug() << "ScriptEngine::evaluate(program) -- BEFORE QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending++ script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- BEFORE QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber); - qDebug() << "ScriptEngine::evaluate(program) -- AFTER QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- AFTER QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) if (hasUncaughtException()) { int line = uncaughtExceptionLineNumber(); qDebug() << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString(); } _evaluatesPending--; - qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending-- script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending-- script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) - qDebug() << "ScriptEngine::evaluate(program) -- ABOUT TO emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- ABOUT TO emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) emit evaluationFinished(result, hasUncaughtException()); - qDebug() << "ScriptEngine::evaluate(program) -- AFTER emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- AFTER emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) clearExceptions(); - qDebug() << "ScriptEngine::evaluate(program) -- DONE script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- DONE script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) return result; } @@ -493,18 +496,18 @@ void ScriptEngine::run() { // TODO: can we add a short circuit for _stoppingAllScripts here? What does it mean to not start running if // we're in the process of stopping? - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) if (!_isInitialized) { init(); } - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) _isRunning = true; _isFinished = false; emit runningStateChanged(); - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) QScriptValue result = evaluate(_scriptContents); - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) QElapsedTimer startTime; startTime.start(); @@ -515,11 +518,11 @@ void ScriptEngine::run() { qint64 lastUpdate = usecTimestampNow(); - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) while (!_isFinished) { if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec @@ -528,22 +531,22 @@ void ScriptEngine::run() { } if (_isFinished) { - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) break; } if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } QCoreApplication::processEvents(); if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } if (_isFinished) { - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) break; } @@ -673,34 +676,34 @@ void ScriptEngine::run() { lastUpdate = now; if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } } if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) stopAllTimers(); // make sure all our timers are stopped if the script is ending - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename(); + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename();) if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } emit scriptEnding(); - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) // kill the avatar identity timer delete _avatarIdentityTimer; - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) { @@ -713,43 +716,43 @@ void ScriptEngine::run() { } } - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) // If we were on a thread, then wait till it's done if (thread()) { - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) thread()->quit(); - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } - qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } emit finished(_fileNameString); if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } _isRunning = false; emit runningStateChanged(); - qDebug() << "ABOUT TO emit doneRunning() script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ABOUT TO emit doneRunning() script:" << getFilename() << "[" << this << "]";) emit doneRunning(); - qDebug() << "AFTER emit doneRunning() script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "AFTER emit doneRunning() script:" << getFilename() << "[" << this << "]";) if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } - qDebug() << "ScriptEngine::run() SETTING _doneRunningThisScript = true ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() SETTING _doneRunningThisScript = true ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) _doneRunningThisScript = true; if (_isWaitingForDoneRunning) { - qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } } @@ -765,10 +768,10 @@ void ScriptEngine::stopAllTimers() { } void ScriptEngine::stop() { - qDebug() << "ScriptEngine::stop() -- START -- line:" << __LINE__ << " script:" << getFilename(); + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stop() -- START -- line:" << __LINE__ << " script:" << getFilename();) _isFinished = true; emit runningStateChanged(); - qDebug() << "ScriptEngine::stop() -- DONE -- line:" << __LINE__ << " script:" << getFilename(); + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stop() -- DONE -- line:" << __LINE__ << " script:" << getFilename();) } void ScriptEngine::timerFired() { @@ -884,9 +887,9 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac if (contents.isNull()) { qDebug() << "Error loading file: " << url; } else { - qDebug() << "ScriptEngine::include() BEFORE evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::include() BEFORE evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;) QScriptValue result = evaluate(contents, url.toString()); - qDebug() << "ScriptEngine::include() AFTER evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::include() AFTER evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;) } } From 89f7f2da2e93df6469d425ff01d7dd38b05043c8 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 15:57:34 -0800 Subject: [PATCH 217/261] don't do idle process and painting if we're shutting down the application --- interface/src/Application.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 998e2065dc..537d3d2a75 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1471,6 +1471,10 @@ void Application::checkFPS() { void Application::idle() { PerformanceTimer perfTimer("idle"); + + if (_aboutToQuit) { + return; // bail early, nothing to do here. + } // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing // details if we're in ExtraDebugging mode. However, the ::update() and it's subcomponents will show their timing From 9dcea38b2b661bf38255e6a133a4929deb07db90 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 16:23:39 -0800 Subject: [PATCH 218/261] tweak some debugging --- libraries/script-engine/src/ScriptEngine.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index cbdd59146b..a6b0b8dc1f 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -125,7 +125,7 @@ bool ScriptEngine::_stoppingAllScripts = false; bool ScriptEngine::_doneRunningThisScript = false; void ScriptEngine::stopAllScripts(QObject* application) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------";) + qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------"; _allScriptsMutex.lock(); _stoppingAllScripts = true; @@ -136,9 +136,7 @@ void ScriptEngine::stopAllScripts(QObject* application) { QString scriptName = scriptEngine->getFilename(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName - << "isRunning():" << scriptEngine->isRunning() - << "evaluatePending():" << scriptEngine->evaluatePending();) + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName << "isRunning():" << scriptEngine->isRunning() << "evaluatePending():" << scriptEngine->evaluatePending();) // NOTE: typically all script engines are running. But there's at least one known exception to this, the // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using @@ -165,11 +163,13 @@ void ScriptEngine::stopAllScripts(QObject* application) { DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() -- AFTER waitTillDoneRunning() script:" << scriptName;) i.remove(); } else { + qDebug() << "ScriptEngine::stopAllScripts() " << scriptName << " - will be freed on it's own."; } } _stoppingAllScripts = false; _allScriptsMutex.unlock(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------";) + qDebug() << "ScriptEngine::stopAllScripts() _allKnownScriptEngines.count:" << _allKnownScriptEngines.count(); + qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------"; } @@ -428,8 +428,8 @@ void ScriptEngine::registerGetterSetter(const QString& name, QScriptEngine::Func void ScriptEngine::evaluate() { if (_stoppingAllScripts) { - qDebug() << "ScriptEngine::evaluate() while shutting down is ignored..."; - qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() while shutting down is ignored...";) + DEBUG_SCRIPT_ENDING(qDebug() << " parent script:" << getFilename() << "[" << this << "]";) return; // bail early } @@ -454,8 +454,8 @@ void ScriptEngine::evaluate() { QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileName, int lineNumber) { if (_stoppingAllScripts) { - qDebug() << "ScriptEngine::evaluate(program) while shutting down is ignored..."; - qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) while shutting down is ignored...";) + DEBUG_SCRIPT_ENDING(qDebug() << " parent script:" << getFilename() << "[" << this << "]";) return QScriptValue(); // bail early } From 03b10b6cb02fbf281844b02dc3e3b41242e5d0c6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 24 Feb 2015 17:00:30 -0800 Subject: [PATCH 219/261] Add findRayRectangleIntersection --- libraries/shared/src/GeometryUtil.cpp | 35 ++++++++++++++++++++++++++- libraries/shared/src/GeometryUtil.h | 3 +++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/libraries/shared/src/GeometryUtil.cpp b/libraries/shared/src/GeometryUtil.cpp index aaec8b3e4a..cf15830a10 100644 --- a/libraries/shared/src/GeometryUtil.cpp +++ b/libraries/shared/src/GeometryUtil.cpp @@ -12,8 +12,10 @@ #include #include -#include "SharedUtil.h" #include "GeometryUtil.h" +#include "PlaneShape.h" +#include "RayIntersectionInfo.h" +#include "SharedUtil.h" glm::vec3 computeVectorFromPointToSegment(const glm::vec3& point, const glm::vec3& start, const glm::vec3& end) { // compute the projection of the point vector onto the segment vector @@ -491,3 +493,34 @@ void PolygonClip::copyCleanArray(int& lengthA, glm::vec2* vertexArrayA, int& len } } } + +bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, + const glm::quat& rotation, const glm::vec3& position, const glm::vec2& dimensions) { + RayIntersectionInfo rayInfo; + rayInfo._rayStart = origin; + rayInfo._rayDirection = direction; + rayInfo._rayLength = std::numeric_limits::max(); + + PlaneShape plane; + + const glm::vec3 UNROTATED_NORMAL(0.0f, 0.0f, -1.0f); + glm::vec3 normal = rotation * UNROTATED_NORMAL; + plane.setNormal(normal); + plane.setPoint(position); // the position is definitely a point on our plane + + bool intersects = plane.findRayIntersection(rayInfo); + + if (intersects) { + float distance = rayInfo._hitDistance; + + glm::vec3 hitPosition = origin + (distance * direction); + glm::vec3 localHitPosition = glm::inverse(rotation) * (hitPosition - position); + + glm::vec2 halfDimensions = 0.5f * dimensions; + + intersects = -halfDimensions.x <= localHitPosition.x && localHitPosition.x <= halfDimensions.x + && -halfDimensions.y <= localHitPosition.y && localHitPosition.y <= halfDimensions.y; + } + + return intersects; +} diff --git a/libraries/shared/src/GeometryUtil.h b/libraries/shared/src/GeometryUtil.h index a6889ef73e..e0de536e97 100644 --- a/libraries/shared/src/GeometryUtil.h +++ b/libraries/shared/src/GeometryUtil.h @@ -76,6 +76,9 @@ bool findRaySphereIntersection(const glm::vec3& origin, const glm::vec3& directi bool findRayCapsuleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::vec3& start, const glm::vec3& end, float radius, float& distance); +bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, + const glm::quat& rotation, const glm::vec3& position, const glm::vec2& dimensions); + bool findRayTriangleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2, float& distance); From be7959bbcddb1f45c8e92989ed7cceee18cc4251 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 24 Feb 2015 17:00:55 -0800 Subject: [PATCH 220/261] Fix BillboardOverlay findRayIntersection implementation --- .../src/ui/overlays/BillboardOverlay.cpp | 46 ++++--------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/interface/src/ui/overlays/BillboardOverlay.cpp b/interface/src/ui/overlays/BillboardOverlay.cpp index 4ea0e55710..a82da0ee5f 100644 --- a/interface/src/ui/overlays/BillboardOverlay.cpp +++ b/interface/src/ui/overlays/BillboardOverlay.cpp @@ -10,9 +10,10 @@ // #include "Application.h" +#include "GeometryUtil.h" +#include "PlaneShape.h" #include "BillboardOverlay.h" -#include BillboardOverlay::BillboardOverlay() : _fromImage(), @@ -192,23 +193,6 @@ bool BillboardOverlay::findRayIntersection(const glm::vec3& origin, const glm::v float& distance, BoxFace& face) { if (_texture) { - // This is taken from Planar3DOverlay. Although it probably makes more sense for this - // overlay type to extend from Planar3DOverlay, the interfaces are different enough (scale vs. dimensions) - // that it would break existing scripts and would require other changes to make up for unique - // features like `isFacingAvatar`. - - RayIntersectionInfo rayInfo; - rayInfo._rayStart = origin; - rayInfo._rayDirection = direction; - rayInfo._rayLength = std::numeric_limits::max(); - - bool isNull = _fromImage.isNull(); - float width = isNull ? _texture->getWidth() : _fromImage.width(); - float height = isNull ? _texture->getHeight() : _fromImage.height(); - - PlaneShape plane; - - const glm::vec3 UNROTATED_NORMAL(0.0f, 0.0f, -1.0f); glm::quat rotation; if (_isFacingAvatar) { // rotate about vertical to face the camera @@ -217,27 +201,17 @@ bool BillboardOverlay::findRayIntersection(const glm::vec3& origin, const glm::v } else { rotation = _rotation; } - glm::vec3 normal = rotation * UNROTATED_NORMAL; - plane.setNormal(normal); - plane.setPoint(_position); // the position is definitely a point on our plane - bool intersects = plane.findRayIntersection(rayInfo); + // Produce the dimensions of the billboard based on the image's aspect ratio and the overlay's scale. + bool isNull = _fromImage.isNull(); + float width = isNull ? _texture->getWidth() : _fromImage.width(); + float height = isNull ? _texture->getHeight() : _fromImage.height(); + float maxSize = glm::max(width, height); + glm::vec2 dimensions = _scale * glm::vec2(width / maxSize, height / maxSize); - if (intersects) { - distance = rayInfo._hitDistance; - - glm::vec3 hitPosition = origin + (distance * direction); - glm::vec3 localHitPosition = glm::inverse(rotation) * (hitPosition - _position); - - // Produce the dimensions of the billboard based on the image's aspect ratio and the overlay's scale. - float maxSize = glm::max(width, height); - glm::vec2 halfDimensions = 0.5f * _scale * glm::vec2(width / maxSize, height / maxSize); - - intersects = -halfDimensions.x <= localHitPosition.x && localHitPosition.x <= halfDimensions.x - && -halfDimensions.y <= localHitPosition.y && localHitPosition.y <= halfDimensions.y; - } - return intersects; + return findRayRectangleIntersection(origin, direction, rotation, _position, dimensions); } + return false; } From eb21b7443989000e1eb495985c12de686e4120d7 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 24 Feb 2015 17:01:24 -0800 Subject: [PATCH 221/261] Replace Planar3DOverlay::findRayIntersection with GeometryUtil::findRayRectangleIntersection --- interface/src/ui/overlays/Planar3DOverlay.cpp | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/interface/src/ui/overlays/Planar3DOverlay.cpp b/interface/src/ui/overlays/Planar3DOverlay.cpp index 508b5c4227..925725d261 100644 --- a/interface/src/ui/overlays/Planar3DOverlay.cpp +++ b/interface/src/ui/overlays/Planar3DOverlay.cpp @@ -17,6 +17,8 @@ #include #include +#include "GeometryUtil.h" + #include "Planar3DOverlay.h" const float DEFAULT_SIZE = 1.0f; @@ -93,29 +95,5 @@ QScriptValue Planar3DOverlay::getProperty(const QString& property) { bool Planar3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face) { - RayIntersectionInfo rayInfo; - rayInfo._rayStart = origin; - rayInfo._rayDirection = direction; - rayInfo._rayLength = std::numeric_limits::max(); - - PlaneShape plane; - - const glm::vec3 UNROTATED_NORMAL(0.0f, 0.0f, -1.0f); - glm::vec3 normal = _rotation * UNROTATED_NORMAL; - plane.setNormal(normal); - plane.setPoint(_position); // the position is definitely a point on our plane - - bool intersects = plane.findRayIntersection(rayInfo); - - if (intersects) { - distance = rayInfo._hitDistance; - - glm::vec3 hitPosition = origin + (distance * direction); - glm::vec3 localHitPosition = glm::inverse(_rotation) * (hitPosition - _position); - glm::vec2 halfDimensions = _dimensions / 2.0f; - - intersects = -halfDimensions.x <= localHitPosition.x && localHitPosition.x <= halfDimensions.x - && -halfDimensions.y <= localHitPosition.y && localHitPosition.y <= halfDimensions.y; - } - return intersects; + return findRayRectangleIntersection(origin, direction, _rotation, _position, _dimensions); } From 25ae001d3b874330d3bd538fffab8e66b8fd23eb Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 17:05:44 -0800 Subject: [PATCH 222/261] removed extra debugging --- libraries/script-engine/src/ScriptEngine.cpp | 119 +------------------ 1 file changed, 1 insertion(+), 118 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index a6b0b8dc1f..9a88476e8c 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -42,12 +42,6 @@ #include "MIDIEvent.h" -#ifdef WANT_DEBUG_SCRIPT_ENDING -#define DEBUG_SCRIPT_ENDING(X) X -#else -#define DEBUG_SCRIPT_ENDING(x) -#endif - EntityScriptingInterface ScriptEngine::_entityScriptingInterface; static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){ @@ -107,7 +101,6 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam } ScriptEngine::~ScriptEngine() { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::~ScriptEngine() ------- BEGIN ------- script:" << getFilename();) // If we're not already in the middle of stopping all scripts, then we should remove ourselves // from the list of running scripts. We don't do this if we're in the process of stopping all scripts // because that method removes scripts from its list as it iterates them @@ -116,7 +109,6 @@ ScriptEngine::~ScriptEngine() { _allKnownScriptEngines.remove(this); _allScriptsMutex.unlock(); } - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::~ScriptEngine() ------- END ------- script:" << getFilename();) } QSet ScriptEngine::_allKnownScriptEngines; @@ -136,8 +128,6 @@ void ScriptEngine::stopAllScripts(QObject* application) { QString scriptName = scriptEngine->getFilename(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() considering:" << scriptName << "isRunning():" << scriptEngine->isRunning() << "evaluatePending():" << scriptEngine->evaluatePending();) - // NOTE: typically all script engines are running. But there's at least one known exception to this, the // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using // them. We don't need to stop scripts that aren't running. @@ -149,18 +139,14 @@ void ScriptEngine::stopAllScripts(QObject* application) { while (scriptEngine->evaluatePending()) { QEventLoop loop; QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) STARTING loop.exec() script:" << scriptName;) loop.exec(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() while(evaluatePending()) AFTER loop.exec() script:" << scriptName;) } } scriptEngine->disconnect(application); scriptEngine->stop(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() -- WAITING for waitTillDoneRunning() script:" << scriptName;) scriptEngine->waitTillDoneRunning(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stopAllScripts() -- AFTER waitTillDoneRunning() script:" << scriptName;) i.remove(); } else { qDebug() << "ScriptEngine::stopAllScripts() " << scriptName << " - will be freed on it's own."; @@ -175,10 +161,8 @@ void ScriptEngine::stopAllScripts(QObject* application) { void ScriptEngine::waitTillDoneRunning() { QString scriptName = getFilename(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() ------- BEGIN ------- script:" << scriptName;) if (_isRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() SETTING _doneRunningThisScript = false ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) _doneRunningThisScript = false; _isWaitingForDoneRunning = true; @@ -191,31 +175,18 @@ void ScriptEngine::waitTillDoneRunning() { // and run a QEventLoop??? QEventLoop loop; QObject::connect(this, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING loop.exec() script:" << scriptName;) - DEBUG_SCRIPT_ENDING(qDebug() << " _doneRunningThisScript:" << _doneRunningThisScript;) - DEBUG_SCRIPT_ENDING(qDebug() << " _isRunning:" << _isRunning;) - DEBUG_SCRIPT_ENDING(qDebug() << " _isWaitingForDoneRunning:" << _isWaitingForDoneRunning;) - DEBUG_SCRIPT_ENDING(qDebug() << " _isFinished:" << _isFinished;) - DEBUG_SCRIPT_ENDING(qDebug() << " _isInitialized:" << _isInitialized;) - DEBUG_SCRIPT_ENDING(qDebug() << " _evaluatesPending:" << _evaluatesPending;) loop.exec(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER loop.exec() script:" << scriptName;) // process events - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() STARTING QCoreApplication::processEvents() script:" << scriptName;) QCoreApplication::processEvents(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() AFTER QCoreApplication::processEvents() script:" << scriptName;) if (_doneRunningThisScript) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() _doneRunningThisScript after processEvents... breaking!!! script:" << scriptName;) break; } } _isWaitingForDoneRunning = false; } - - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::waitTillDoneRunning() ------- DONE ------- script:" << scriptName;) } QString ScriptEngine::getFilename() const { @@ -428,25 +399,20 @@ void ScriptEngine::registerGetterSetter(const QString& name, QScriptEngine::Func void ScriptEngine::evaluate() { if (_stoppingAllScripts) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() while shutting down is ignored...";) - DEBUG_SCRIPT_ENDING(qDebug() << " parent script:" << getFilename() << "[" << this << "]";) return; // bail early } - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- BEGIN script:" << getFilename() << "[" << this << "]";) if (!_isInitialized) { init(); } - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- about to call own evaluate(program) script:" << getFilename() << "[" << this << "]";) QScriptValue result = evaluate(_scriptContents); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate() -- AFTER own evaluate(program) script:" << getFilename() << "[" << this << "]";) // TODO: why do we check this twice? It seems like the call to clearExcpetions() in the lower level evaluate call // will cause this code to never actually run... if (hasUncaughtException()) { int line = uncaughtExceptionLineNumber(); - DEBUG_SCRIPT_ENDING(qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();) + qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString(); emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString()); clearExceptions(); } @@ -454,29 +420,18 @@ void ScriptEngine::evaluate() { QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileName, int lineNumber) { if (_stoppingAllScripts) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) while shutting down is ignored...";) - DEBUG_SCRIPT_ENDING(qDebug() << " parent script:" << getFilename() << "[" << this << "]";) return QScriptValue(); // bail early } - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- BEGIN script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) _evaluatesPending++; - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending++ script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- BEFORE QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- AFTER QScriptEngine::evaluate() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) if (hasUncaughtException()) { int line = uncaughtExceptionLineNumber(); qDebug() << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString(); } _evaluatesPending--; - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- after _evaluatesPending-- script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) - - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- ABOUT TO emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) emit evaluationFinished(result, hasUncaughtException()); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- AFTER emit evaluationFinished() script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) clearExceptions(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::evaluate(program) -- DONE script:" << getFilename() << "_evaluatesPending:" << _evaluatesPending << "[" << this << "]";) return result; } @@ -496,18 +451,14 @@ void ScriptEngine::run() { // TODO: can we add a short circuit for _stoppingAllScripts here? What does it mean to not start running if // we're in the process of stopping? - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) if (!_isInitialized) { init(); } - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) _isRunning = true; _isFinished = false; emit runningStateChanged(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) QScriptValue result = evaluate(_scriptContents); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) QElapsedTimer startTime; startTime.start(); @@ -518,35 +469,19 @@ void ScriptEngine::run() { qint64 lastUpdate = usecTimestampNow(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - while (!_isFinished) { - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - int usecToSleep = (thisFrame++ * SCRIPT_DATA_CALLBACK_USECS) - startTime.nsecsElapsed() / 1000; // nsec to usec if (usecToSleep > 0) { usleep(usecToSleep); } if (_isFinished) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) break; } - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - QCoreApplication::processEvents(); - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - if (_isFinished) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) break; } @@ -675,37 +610,14 @@ void ScriptEngine::run() { } lastUpdate = now; - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - } - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - stopAllTimers(); // make sure all our timers are stopped if the script is ending - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename();) - - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - emit scriptEnding(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) // kill the avatar identity timer delete _avatarIdentityTimer; - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) { // release the queue of edit entity messages. _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages(); @@ -716,44 +628,19 @@ void ScriptEngine::run() { } } - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - // If we were on a thread, then wait till it's done if (thread()) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) thread()->quit(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) } emit finished(_fileNameString); - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - _isRunning = false; emit runningStateChanged(); - DEBUG_SCRIPT_ENDING(qDebug() << "ABOUT TO emit doneRunning() script:" << getFilename() << "[" << this << "]";) emit doneRunning(); - DEBUG_SCRIPT_ENDING(qDebug() << "AFTER emit doneRunning() script:" << getFilename() << "[" << this << "]";) - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } - - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() SETTING _doneRunningThisScript = true ################################### line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) _doneRunningThisScript = true; - - if (_isWaitingForDoneRunning) { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::run() ** _isWaitingForDoneRunning == true ** line:" << __LINE__ << " script:" << getFilename() << "[" << this << "]";) - } } // NOTE: This is private because it must be called on the same thread that created the timers, which is why @@ -768,10 +655,8 @@ void ScriptEngine::stopAllTimers() { } void ScriptEngine::stop() { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stop() -- START -- line:" << __LINE__ << " script:" << getFilename();) _isFinished = true; emit runningStateChanged(); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::stop() -- DONE -- line:" << __LINE__ << " script:" << getFilename();) } void ScriptEngine::timerFired() { @@ -887,9 +772,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac if (contents.isNull()) { qDebug() << "Error loading file: " << url; } else { - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::include() BEFORE evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;) QScriptValue result = evaluate(contents, url.toString()); - DEBUG_SCRIPT_ENDING(qDebug() << "ScriptEngine::include() AFTER evaluate() line:" << __LINE__ << " parent script:" << getFilename() << "[" << this << "]" << " url:" << url << "_evaluatesPending:" << _evaluatesPending;) } } From eab09eaf2885de695dc9780f95c63d916085f3b4 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 17:15:58 -0800 Subject: [PATCH 223/261] removed extra debugging --- interface/src/Application.cpp | 14 ++-------- libraries/script-engine/src/ScriptEngine.cpp | 27 ++++++-------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 537d3d2a75..390b42eaa7 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3567,11 +3567,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUserLoaded, bool loadScriptFromEditor, bool activateMainWindow) { - qDebug() << "Application::loadScript() ---- BEGIN ---- Script:" << scriptFilename; - if (isAboutToQuit()) { - qDebug() << "Requests to load scripts while quitting are ignored. Script:" << scriptFilename; - qDebug() << "Application::loadScript() ---- END ---- Script:" << scriptFilename; return NULL; } @@ -3580,8 +3576,6 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser if (_scriptEnginesHash.contains(scriptURLString) && loadScriptFromEditor && !_scriptEnginesHash[scriptURLString]->isFinished()) { - qDebug() << "Application::loadScript() from _scriptEnginesHash[scriptURLString].... Script:" << scriptFilename; - qDebug() << "Application::loadScript() ---- END ---- Script:" << scriptFilename; return _scriptEnginesHash[scriptURLString]; } @@ -3600,7 +3594,6 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser connect(scriptEngine, &ScriptEngine::errorLoadingScript, this, &Application::handleScriptLoadError); // get the script engine object to load the script at the designated script URL - qDebug() << "Application::loadScript() about to call loadURL() scriptUrl:" << scriptUrl; scriptEngine->loadURL(scriptUrl); } @@ -3609,9 +3602,6 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser _window->activateWindow(); } - qDebug() << "Application::loadScript() newly created scriptEngine.... Script:" << scriptFilename; - qDebug() << "Application::loadScript() ---- END ---- Script:" << scriptFilename; - return scriptEngine; } @@ -3771,8 +3761,8 @@ void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject voxelWalletUUID = QUuid(voxelObject[VOXEL_WALLET_UUID].toString()); } - qDebug() << "Voxel costs are" << satoshisPerVoxel << "per voxel and" << satoshisPerMeterCubed << "per meter cubed"; - qDebug() << "Destination wallet UUID for voxel payments is" << voxelWalletUUID; + qDebug() << "Octree edits costs are" << satoshisPerVoxel << "per octree cell and" << satoshisPerMeterCubed << "per meter cubed"; + qDebug() << "Destination wallet UUID for edit payments is" << voxelWalletUUID; } QString Application::getPreviousScriptLocation() { diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 9a88476e8c..d090fc0ac6 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -117,8 +117,6 @@ bool ScriptEngine::_stoppingAllScripts = false; bool ScriptEngine::_doneRunningThisScript = false; void ScriptEngine::stopAllScripts(QObject* application) { - qDebug() << "ScriptEngine::stopAllScripts() ------- BEGIN -------"; - _allScriptsMutex.lock(); _stoppingAllScripts = true; @@ -148,14 +146,10 @@ void ScriptEngine::stopAllScripts(QObject* application) { scriptEngine->waitTillDoneRunning(); i.remove(); - } else { - qDebug() << "ScriptEngine::stopAllScripts() " << scriptName << " - will be freed on it's own."; } } _stoppingAllScripts = false; _allScriptsMutex.unlock(); - qDebug() << "ScriptEngine::stopAllScripts() _allKnownScriptEngines.count:" << _allKnownScriptEngines.count(); - qDebug() << "ScriptEngine::stopAllScripts() ------- DONE -------"; } @@ -693,8 +687,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) { if (_stoppingAllScripts) { - qDebug() << "Script.setInterval() while shutting down is ignored..."; - qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + qDebug() << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename(); return NULL; // bail early } @@ -703,8 +696,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) { if (_stoppingAllScripts) { - qDebug() << "Script.setTimeout() while shutting down is ignored..."; - qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + qDebug() << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename(); return NULL; // bail early } @@ -754,9 +746,8 @@ void ScriptEngine::print(const QString& message) { // all of the files have finished loading. void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) { if (_stoppingAllScripts) { - qDebug() << "Script.include() while shutting down is ignored..."; - qDebug() << " includeFiles:" << includeFiles; - qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + qDebug() << "Script.include() while shutting down is ignored..." + << "includeFiles:" << includeFiles << "parent script:" << getFilename(); return; // bail early } QList urls; @@ -799,9 +790,8 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { if (_stoppingAllScripts) { - qDebug() << "Script.include() while shutting down is ignored..."; - qDebug() << " includeFile:" << includeFile; - qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + qDebug() << "Script.include() while shutting down is ignored... " + << "includeFile:" << includeFile << "parent script:" << getFilename(); return; // bail early } @@ -815,9 +805,8 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { // the Application or other context will connect to in order to know to actually load the script void ScriptEngine::load(const QString& loadFile) { if (_stoppingAllScripts) { - qDebug() << "Script.load() while shutting down is ignored..."; - qDebug() << " loadFile:" << loadFile; - qDebug() << " parent script:" << getFilename() << "[" << this << "]"; + qDebug() << "Script.load() while shutting down is ignored... " + << "loadFile:" << loadFile << "parent script:" << getFilename(); return; // bail early } From 0456cb298f35070346e9d9572b9d786f7bda0bac Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 24 Feb 2015 17:16:00 -0800 Subject: [PATCH 224/261] lower threshold for ignoring rotation updates one hundred fold smaller --- libraries/entities/src/EntityItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 15d46603b5..d6a3aab970 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1002,7 +1002,7 @@ void EntityItem::computeShapeInfo(ShapeInfo& info) const { } const float MIN_POSITION_DELTA = 0.0001f; -const float MIN_ALIGNMENT_DOT = 0.9999f; +const float MIN_ALIGNMENT_DOT = 0.999999f; const float MIN_VELOCITY_DELTA = 0.01f; const float MIN_DAMPING_DELTA = 0.001f; const float MIN_GRAVITY_DELTA = 0.001f; From 310654831c6f663e5745a6f66f7642ebeb3dac9e Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 17:34:19 -0800 Subject: [PATCH 225/261] clean up comments remove dead code --- interface/src/Application.cpp | 6 ++--- .../src/EntityTreeRenderer.cpp | 14 ++++++------ libraries/script-engine/src/ScriptEngine.cpp | 22 +++++++++++++++---- libraries/script-engine/src/ScriptEngine.h | 1 - 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 390b42eaa7..d3161ebf51 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3541,6 +3541,9 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri scriptEngine->registerGlobalObject("MIDI", &MIDIManager::getInstance()); #endif + // TODO: Consider moving some of this functionality into the ScriptEngine class instead. It seems wrong that this + // work is being done in the Application class when really these dependencies are more related to the ScriptEngine's + // implementation QThread* workerThread = new QThread(this); QString scriptEngineName = QString("Script Thread:") + scriptEngine->getFilename(); workerThread->setObjectName(scriptEngineName); @@ -3552,9 +3555,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri connect(scriptEngine, SIGNAL(doneRunning()), scriptEngine, SLOT(deleteLater())); connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater())); - // when the application is about to quit, stop our script engine so it unwinds properly - //connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop())); - auto nodeList = DependencyManager::get(); connect(nodeList.data(), &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled); diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 8648cea285..70e1054c39 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -59,14 +59,14 @@ EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterf } EntityTreeRenderer::~EntityTreeRenderer() { - // NOTE: we don't need to delete _entitiesScriptEngine because it's owned by the application and gets cleaned up - // automatically but we do need to delete our sandbox script engine. + // NOTE: we don't need to delete _entitiesScriptEngine because it is registered with the application and has a + // signal tied to call it's deleteLater on doneRunning if (_sandboxScriptEngine) { - // NOTE: is it possible this is a problem? I think that we hook the script engine object up to a deleteLater() - // call inside of registerScriptEngineWithApplicationServices() but do we not call that for _sandboxScriptEngine??? - // this _sandboxScriptEngine implementation is confusing and potentially error prone because it's not a full fledged - // ScriptEngine that has been fully connected. We did this so that scripts that were ill-formed could be evaluated - // but not execute against the application. + // TODO: consider reworking how _sandboxScriptEngine is managed. It's treated differently than _entitiesScriptEngine + // because we don't call registerScriptEngineWithApplicationServices() for it. This implementation is confusing and + // potentially error prone because it's not a full fledged ScriptEngine that has been fully connected to the + // application. We did this so that scripts that were ill-formed could be evaluated but not execute against the + // application services. But this means it's shutdown behavior is different from other ScriptEngines delete _sandboxScriptEngine; _sandboxScriptEngine = NULL; } diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index d090fc0ac6..b41331450b 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -135,16 +135,31 @@ void ScriptEngine::stopAllScripts(QObject* application) { // complete. After that we can handle the stop process appropriately if (scriptEngine->evaluatePending()) { while (scriptEngine->evaluatePending()) { + + // This event loop allows any started, but not yet finished evaluate() calls to complete + // we need to let these complete so that we can be guaranteed that the script engine isn't + // in a partially setup state, which can confuse our shutdown unwinding. QEventLoop loop; QObject::connect(scriptEngine, &ScriptEngine::evaluationFinished, &loop, &QEventLoop::quit); loop.exec(); } } + // We disconnect any script engine signals from the application because we don't want to do any + // extra stopScript/loadScript processing that the Application normally does when scripts start + // and stop. We can safely short circuit this because we know we're in the "quitting" process scriptEngine->disconnect(application); + + // Calling stop on the script engine will set it's internal _isFinished state to true, and result + // in the ScriptEngine gracefully ending it's run() method. scriptEngine->stop(); + // We need to wait for the engine to be done running before we proceed, because we don't + // want any of the scripts final "scriptEnding()" or pending "update()" methods from accessing + // any application state after we leave this stopAllScripts() method scriptEngine->waitTillDoneRunning(); + + // If the script is stopped, we can remove it from our set i.remove(); } } @@ -156,10 +171,11 @@ void ScriptEngine::stopAllScripts(QObject* application) { void ScriptEngine::waitTillDoneRunning() { QString scriptName = getFilename(); + // If the script never started running or finished running before we got here, we don't need to wait for it if (_isRunning) { - _doneRunningThisScript = false; - _isWaitingForDoneRunning = true; + _doneRunningThisScript = false; // NOTE: this is static, we serialize our waiting for scripts to finish + // What can we do here??? // we will be calling this on the main Application thread, inside of stopAllScripts() // we want the application thread to continue to process events, because the script will @@ -178,8 +194,6 @@ void ScriptEngine::waitTillDoneRunning() { break; } } - - _isWaitingForDoneRunning = false; } } diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index 51cacd5e58..154fdb88e3 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -136,7 +136,6 @@ protected: bool _isFinished; bool _isRunning; int _evaluatesPending = 0; - bool _isWaitingForDoneRunning = false; bool _isInitialized; bool _isAvatar; QTimer* _avatarIdentityTimer; From f1017f8a5d56cbaab111f7609623163b0eb0b69f Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 24 Feb 2015 17:45:22 -0800 Subject: [PATCH 226/261] simplify waitTillDoneRunning --- libraries/script-engine/src/ScriptEngine.cpp | 21 ++++++-------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index b41331450b..d201c1568c 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -176,23 +176,14 @@ void ScriptEngine::waitTillDoneRunning() { _doneRunningThisScript = false; // NOTE: this is static, we serialize our waiting for scripts to finish - // What can we do here??? - // we will be calling this on the main Application thread, inside of stopAllScripts() - // we want the application thread to continue to process events, because the script will - // likely need to marshall messages across to the main thread. - while (!_doneRunningThisScript && _isRunning) { + // NOTE: waitTillDoneRunning() will be called on the main Application thread, inside of stopAllScripts() + // we want the application thread to continue to process events, because the scripts will likely need to + // marshall messages across to the main thread. For example if they access Settings or Meny in any of their + // shutdown code. + while (!_doneRunningThisScript) { - // and run a QEventLoop??? - QEventLoop loop; - QObject::connect(this, &ScriptEngine::doneRunning, &loop, &QEventLoop::quit); - loop.exec(); - - // process events + // process events for the main application thread, allowing invokeMethod calls to pass between threads QCoreApplication::processEvents(); - - if (_doneRunningThisScript) { - break; - } } } } From c15c549881c8e6c5aaace851a37142d361b4effd Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Wed, 25 Feb 2015 07:47:00 +0530 Subject: [PATCH 227/261] Code formatting --- tools/vhacd/src/VHACDUtil.cpp | 29 ++++++++++------------------- tools/vhacd/src/VHACDUtil.h | 3 +-- tools/vhacd/src/main.cpp | 24 ++++++++---------------- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/tools/vhacd/src/VHACDUtil.cpp b/tools/vhacd/src/VHACDUtil.cpp index bfcdb74634..dcfd7e447f 100644 --- a/tools/vhacd/src/VHACDUtil.cpp +++ b/tools/vhacd/src/VHACDUtil.cpp @@ -9,13 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include #include "VHACDUtil.h" //Read all the meshes from provided FBX file -bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *results) -{ +bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *results){ // open the fbx file QFile fbx(filename); @@ -29,15 +28,13 @@ bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *re //results->meshCount = geometry.meshes.count(); int count = 0; - foreach(FBXMesh mesh, geometry.meshes) - { + foreach(FBXMesh mesh, geometry.meshes) { //get vertices for each mesh QVector vertices = mesh.vertices; //get the triangle indices for each mesh QVector triangles; - foreach(FBXMeshPart part, mesh.parts) - { + foreach(FBXMeshPart part, mesh.parts) { QVector indices = part.triangleIndices; triangles += indices; } @@ -54,15 +51,13 @@ bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *re return true; } -bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const -{ +bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const{ VHACD::IVHACD * interfaceVHACD = VHACD::CreateVHACD(); int meshCount = meshes->meshCount; int count = 0; std::cout << "Performing V-HACD computation on " << meshCount <<" meshes ..... " << std::endl; - for (int i = 0; i < meshCount; i++) - { + for (int i = 0; i < meshCount; i++){ std::vector vertices = meshes->perMeshVertices.at(i).toStdVector(); std::vector triangles = meshes->perMeshTriangleIndices.at(i).toStdVector(); @@ -71,8 +66,7 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD std::cout << "Mesh " << i + 1 << " : "; // compute approximate convex decomposition bool res = interfaceVHACD->Compute(&vertices[0].x, 3, nPoints, &triangles[0], 3, nTriangles, params); - if (!res) - { + if (!res){ std::cout << "V-HACD computation failed for Mesh : " << i + 1 << std::endl; continue; } @@ -84,8 +78,7 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD //get all the convex hulls for this mesh QVector convexHulls; - for (unsigned int j = 0; j < nConvexHulls; j++) - { + for (unsigned int j = 0; j < nConvexHulls; j++){ VHACD::IVHACD::ConvexHull hull; interfaceVHACD->GetConvexHull(j, hull); convexHulls.append(hull); @@ -105,14 +98,12 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD return false; } -vhacd::VHACDUtil:: ~VHACDUtil() -{ +vhacd::VHACDUtil:: ~VHACDUtil(){ //nothing to be cleaned } //ProgressClaback implementation -void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation) -{ +void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation){ int progress = (int)(overallProgress + 0.5); if (progress < 10) diff --git a/tools/vhacd/src/VHACDUtil.h b/tools/vhacd/src/VHACDUtil.h index a9df5d7f2a..aaabcdf904 100644 --- a/tools/vhacd/src/VHACDUtil.h +++ b/tools/vhacd/src/VHACDUtil.h @@ -42,8 +42,7 @@ namespace vhacd{ ~VHACDUtil(); }; - class ProgressCallback : public VHACD::IVHACD::IUserCallback - { + class ProgressCallback : public VHACD::IVHACD::IUserCallback{ public: ProgressCallback(void); ~ProgressCallback(); diff --git a/tools/vhacd/src/main.cpp b/tools/vhacd/src/main.cpp index 55a152c179..a80a57bb3e 100644 --- a/tools/vhacd/src/main.cpp +++ b/tools/vhacd/src/main.cpp @@ -19,8 +19,7 @@ using namespace std; using namespace VHACD; -int main(int argc, char * argv[]) -{ +int main(int argc, char * argv[]){ vector triangles; // array of indexes vector points; // array of coordinates vhacd::VHACDUtil vUtil; @@ -44,34 +43,29 @@ int main(int argc, char * argv[]) params.m_minVolumePerCH = 0.0001; // controls the adaptive sampling of the generated convex - hulls // load the mesh - if (!vUtil.loadFBX(fname, &fbx)) - { + if (!vUtil.loadFBX(fname, &fbx)){ cout << "Error in opening FBX file...."; return 1; } - if (!vUtil.computeVHACD(&fbx, params, &results)) - { + if (!vUtil.computeVHACD(&fbx, params, &results)){ cout << "Compute Failed..."; return 1; } int totalVertices = 0; - for (int i = 0; i < fbx.meshCount; i++) - { + for (int i = 0; i < fbx.meshCount; i++){ totalVertices += fbx.perMeshVertices.at(i).count(); } int totalTriangles = 0; - for (int i = 0; i < fbx.meshCount; i++) - { + for (int i = 0; i < fbx.meshCount; i++){ totalTriangles += fbx.perMeshTriangleIndices.at(i).count(); } int totalHulls = 0; QVector hullCounts = results.convexHullsCountList; - for (int i = 0; i < results.meshCount; i++) - { + for (int i = 0; i < results.meshCount; i++){ totalHulls += hullCounts.at(i); } cout << endl << "Summary of V-HACD Computation..................." << endl; @@ -82,14 +76,12 @@ int main(int argc, char * argv[]) cout << "Total Triangles : " << totalTriangles << endl; cout << "Total Convex Hulls : " << totalHulls << endl; cout << endl << "Summary per convex hull ........................" << endl < chList = results.convexHullList.at(i); cout << "\t" << "Number Of Hulls : " << chList.count() << endl; - for (int j = 0; j < results.convexHullList.at(i).count(); j++) - { + for (int j = 0; j < results.convexHullList.at(i).count(); j++){ cout << "\tHUll : " << j + 1 << endl; cout << "\t\tNumber Of Points : " << chList.at(j).m_nPoints << endl; From 9a153a6506cb6a70da655176daaf58a36261b595 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Wed, 25 Feb 2015 08:36:58 +0530 Subject: [PATCH 228/261] Time measurement Used c++11 chrono class to measure elapsed time. --- tools/vhacd/src/VHACDUtil.h | 2 +- tools/vhacd/src/main.cpp | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/vhacd/src/VHACDUtil.h b/tools/vhacd/src/VHACDUtil.h index aaabcdf904..036d4ce526 100644 --- a/tools/vhacd/src/VHACDUtil.h +++ b/tools/vhacd/src/VHACDUtil.h @@ -16,7 +16,7 @@ #include #include #include - +#include //c++11 feature #include #include #include diff --git a/tools/vhacd/src/main.cpp b/tools/vhacd/src/main.cpp index a80a57bb3e..31866a7cfc 100644 --- a/tools/vhacd/src/main.cpp +++ b/tools/vhacd/src/main.cpp @@ -27,9 +27,14 @@ int main(int argc, char * argv[]){ vhacd::ComputeResults results; // results after computing vhacd VHACD::IVHACD::Parameters params; vhacd::ProgressCallback pCallBack; - - QString fname = "F:/models/ship/Sample_Ship.fbx"; + string filename(argv[1]); + if (filename.empty()){ + cout << "please provide a FBX file as argument\n "; + return 1; + } + + QString fname = QString::fromStdString(filename); //set parameters for V-HACD params.m_callback = &pCallBack; //progress callback @@ -43,15 +48,23 @@ int main(int argc, char * argv[]){ params.m_minVolumePerCH = 0.0001; // controls the adaptive sampling of the generated convex - hulls // load the mesh + + auto begin = std::chrono::high_resolution_clock::now(); if (!vUtil.loadFBX(fname, &fbx)){ cout << "Error in opening FBX file...."; return 1; } + auto end = std::chrono::high_resolution_clock::now(); + auto loadDuration = std::chrono::duration_cast(end - begin).count(); + //perform vhacd computation + begin = std::chrono::high_resolution_clock::now(); if (!vUtil.computeVHACD(&fbx, params, &results)){ cout << "Compute Failed..."; return 1; } + end = std::chrono::high_resolution_clock::now(); + auto computeDuration = std::chrono::duration_cast(end - begin).count(); int totalVertices = 0; for (int i = 0; i < fbx.meshCount; i++){ @@ -75,6 +88,8 @@ int main(int argc, char * argv[]){ cout << "Total vertices : " << totalVertices << endl; cout << "Total Triangles : " << totalTriangles << endl; cout << "Total Convex Hulls : " << totalHulls << endl; + cout << "Total FBX load time: " << (double)loadDuration / 1000000000.00 << " seconds" << endl; + cout << "V-HACD Compute time: " << (double)computeDuration / 1000000000.00 << " seconds" << endl; cout << endl << "Summary per convex hull ........................" << endl < Date: Wed, 25 Feb 2015 08:45:00 +0530 Subject: [PATCH 229/261] cmake changes for building on linux --- cmake/modules/FindVHACD.cmake | 4 ++-- tools/vhacd/CMakeLists.txt | 14 +++++++++++++- tools/vhacd/src/VHACDUtil.cpp | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cmake/modules/FindVHACD.cmake b/cmake/modules/FindVHACD.cmake index d84ab30dff..f7eee44737 100644 --- a/cmake/modules/FindVHACD.cmake +++ b/cmake/modules/FindVHACD.cmake @@ -45,11 +45,11 @@ endmacro() find_path(VHACD_INCLUDE_DIRS VHACD.h PATH_SUFFIXES include HINTS ${VHACD_SEARCH_DIRS} $ENV{VHACD_ROOT_DIR}) -_FIND_VHACD_LIBRARY(VHACD VHACD_LIB) +_FIND_VHACD_LIBRARY(VHACD libVHACD.a) set(VHACD_LIBRARIES ${VHACD_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(VHACD "Could NOT find VHACD, try to set the path to VHACD root folder in the system variable VHACD_ROOT_DIR or create a directory vhacd in HIFI_LIB_DIR and paste the necessary files there" VHACD_INCLUDE_DIRS VHACD_LIBRARIES) -mark_as_advanced(VHACD_INCLUDE_DIRS VHACD_LIBRARIES VHACD_SEARCH_DIRS) \ No newline at end of file +mark_as_advanced(VHACD_INCLUDE_DIRS VHACD_LIBRARIES VHACD_SEARCH_DIRS) diff --git a/tools/vhacd/CMakeLists.txt b/tools/vhacd/CMakeLists.txt index ee82cd599d..51e15c8239 100644 --- a/tools/vhacd/CMakeLists.txt +++ b/tools/vhacd/CMakeLists.txt @@ -6,8 +6,20 @@ find_package(VHACD REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${VHACD_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${VHACD_LIBRARIES}) +if(NOT WIN32) + find_package( Threads) + target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT}) + + include(FindOpenMP) + if(OPENMP_FOUND) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") + endif() +endif() + add_dependency_external_project(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) -include_dependency_includes() \ No newline at end of file +include_dependency_includes() diff --git a/tools/vhacd/src/VHACDUtil.cpp b/tools/vhacd/src/VHACDUtil.cpp index bfcdb74634..71ee2740c1 100644 --- a/tools/vhacd/src/VHACDUtil.cpp +++ b/tools/vhacd/src/VHACDUtil.cpp @@ -9,7 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include #include "VHACDUtil.h" @@ -127,4 +127,4 @@ void vhacd::ProgressCallback::Update(const double overallProgress, const double } vhacd::ProgressCallback::ProgressCallback(void){} -vhacd::ProgressCallback::~ProgressCallback(){} \ No newline at end of file +vhacd::ProgressCallback::~ProgressCallback(){} From ed09b619d14a50de8c3c741851dad969e80f92e2 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Wed, 25 Feb 2015 09:12:19 +0530 Subject: [PATCH 230/261] OS check check OS for different filenames --- cmake/modules/FindVHACD.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/modules/FindVHACD.cmake b/cmake/modules/FindVHACD.cmake index f7eee44737..03e30b41d4 100644 --- a/cmake/modules/FindVHACD.cmake +++ b/cmake/modules/FindVHACD.cmake @@ -45,7 +45,11 @@ endmacro() find_path(VHACD_INCLUDE_DIRS VHACD.h PATH_SUFFIXES include HINTS ${VHACD_SEARCH_DIRS} $ENV{VHACD_ROOT_DIR}) +if(NOT WIN32) _FIND_VHACD_LIBRARY(VHACD libVHACD.a) +else() +_FIND_VHACD_LIBRARY(VHACD VHACD_LIB) +endif() set(VHACD_LIBRARIES ${VHACD_LIBRARY}) include(FindPackageHandleStandardArgs) From e87df0017a0769ed6d8a4a86ac59cc9c7814e1d3 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 08:26:54 -0800 Subject: [PATCH 231/261] code review feedback --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 70e1054c39..46f9ff6f55 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -890,8 +890,8 @@ void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) { void EntityTreeRenderer::entitySciptChanging(const EntityItemID& entityID) { if (_tree && !_shuttingDown) { checkAndCallUnload(entityID); + checkAndCallPreload(entityID); } - checkAndCallPreload(entityID); } void EntityTreeRenderer::checkAndCallPreload(const EntityItemID& entityID) { From 14ec9b431e8f0283b08b3b3e535b7f31b7f52b9b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 25 Feb 2015 10:26:44 -0800 Subject: [PATCH 232/261] Update findRayRectangleIntersection to set out variable distance --- libraries/shared/src/GeometryUtil.cpp | 6 +++--- libraries/shared/src/GeometryUtil.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/shared/src/GeometryUtil.cpp b/libraries/shared/src/GeometryUtil.cpp index cf15830a10..13d78ec8b3 100644 --- a/libraries/shared/src/GeometryUtil.cpp +++ b/libraries/shared/src/GeometryUtil.cpp @@ -494,8 +494,8 @@ void PolygonClip::copyCleanArray(int& lengthA, glm::vec2* vertexArrayA, int& len } } -bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, - const glm::quat& rotation, const glm::vec3& position, const glm::vec2& dimensions) { +bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::quat& rotation, + const glm::vec3& position, const glm::vec2& dimensions, float& distance) { RayIntersectionInfo rayInfo; rayInfo._rayStart = origin; rayInfo._rayDirection = direction; @@ -511,7 +511,7 @@ bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& dire bool intersects = plane.findRayIntersection(rayInfo); if (intersects) { - float distance = rayInfo._hitDistance; + distance = rayInfo._hitDistance; glm::vec3 hitPosition = origin + (distance * direction); glm::vec3 localHitPosition = glm::inverse(rotation) * (hitPosition - position); diff --git a/libraries/shared/src/GeometryUtil.h b/libraries/shared/src/GeometryUtil.h index e0de536e97..657a06a604 100644 --- a/libraries/shared/src/GeometryUtil.h +++ b/libraries/shared/src/GeometryUtil.h @@ -76,8 +76,8 @@ bool findRaySphereIntersection(const glm::vec3& origin, const glm::vec3& directi bool findRayCapsuleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::vec3& start, const glm::vec3& end, float radius, float& distance); -bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, - const glm::quat& rotation, const glm::vec3& position, const glm::vec2& dimensions); +bool findRayRectangleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::quat& rotation, + const glm::vec3& position, const glm::vec2& dimensions, float& distance); bool findRayTriangleIntersection(const glm::vec3& origin, const glm::vec3& direction, const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2, float& distance); From c499352ad8eaded4abe879ec63cfd05c9571042f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 25 Feb 2015 10:27:11 -0800 Subject: [PATCH 233/261] Update billboard and planar overlays to use new findRayRectangleIntersection signature --- interface/src/ui/overlays/BillboardOverlay.cpp | 2 +- interface/src/ui/overlays/Planar3DOverlay.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/ui/overlays/BillboardOverlay.cpp b/interface/src/ui/overlays/BillboardOverlay.cpp index a82da0ee5f..88c097575b 100644 --- a/interface/src/ui/overlays/BillboardOverlay.cpp +++ b/interface/src/ui/overlays/BillboardOverlay.cpp @@ -209,7 +209,7 @@ bool BillboardOverlay::findRayIntersection(const glm::vec3& origin, const glm::v float maxSize = glm::max(width, height); glm::vec2 dimensions = _scale * glm::vec2(width / maxSize, height / maxSize); - return findRayRectangleIntersection(origin, direction, rotation, _position, dimensions); + return findRayRectangleIntersection(origin, direction, rotation, _position, dimensions, distance); } return false; diff --git a/interface/src/ui/overlays/Planar3DOverlay.cpp b/interface/src/ui/overlays/Planar3DOverlay.cpp index 925725d261..aea6585fc4 100644 --- a/interface/src/ui/overlays/Planar3DOverlay.cpp +++ b/interface/src/ui/overlays/Planar3DOverlay.cpp @@ -95,5 +95,5 @@ QScriptValue Planar3DOverlay::getProperty(const QString& property) { bool Planar3DOverlay::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, BoxFace& face) { - return findRayRectangleIntersection(origin, direction, _rotation, _position, _dimensions); + return findRayRectangleIntersection(origin, direction, _rotation, _position, _dimensions, distance); } From 660d9ad499ffc372741f281c4e49f1003409c234 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 25 Feb 2015 10:28:45 -0800 Subject: [PATCH 234/261] Make KeyEvent objects equal even if they have differing isAutoRepeat values --- libraries/script-engine/src/KeyEvent.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/script-engine/src/KeyEvent.cpp b/libraries/script-engine/src/KeyEvent.cpp index b7564db1b6..febc8fc21f 100644 --- a/libraries/script-engine/src/KeyEvent.cpp +++ b/libraries/script-engine/src/KeyEvent.cpp @@ -121,8 +121,7 @@ bool KeyEvent::operator==(const KeyEvent& other) const { && other.isControl == isControl && other.isMeta == isMeta && other.isAlt == isAlt - && other.isKeypad == isKeypad - && other.isAutoRepeat == isAutoRepeat; + && other.isKeypad == isKeypad; } From fd8240669b52be4e18fff1ce30744e6b4c8a06aa Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 10:39:44 -0800 Subject: [PATCH 235/261] fix for windeployqt for executables --- .../CopyDllsBesideWindowsExecutable.cmake | 27 +++++++++++++------ tools/scribe/CMakeLists.txt | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 4f144c4315..61d35d93b1 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -10,6 +10,13 @@ # macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) + + if (NOT ${ARGN}) + set(USES_QT TRUE) + else () + set(USES_QT ${ARGN}) + endif () + if (WIN32) configure_file( @@ -27,14 +34,18 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) -P ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake ) - find_program(${WINDEPLOYQT_COMMAND} windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) + if (NOT USES_QT) + + find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) + + # add a post-build command to call windeployqt to copy Qt plugins + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND CMD /C "SET PATH=%PATH%;${QT_DIR}/bin && ${WINDEPLOYQT_COMMAND} --no-libraries $" + ) + + endif () - # add a post-build command to call windeployqt to copy Qt plugins - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND SET PATH=%PATH%;${QT_DIR}/bin - COMMAND ${WINDEPLOYQT_COMMAND} --no-libraries --force $ - ) endif () endmacro() \ No newline at end of file diff --git a/tools/scribe/CMakeLists.txt b/tools/scribe/CMakeLists.txt index bc07fec230..4196909043 100755 --- a/tools/scribe/CMakeLists.txt +++ b/tools/scribe/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME scribe) setup_hifi_project() -copy_dlls_beside_windows_executable() \ No newline at end of file +copy_dlls_beside_windows_executable(false) \ No newline at end of file From 66ab2ba9f908c489f7448b5959056702bf55adc2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 10:44:02 -0800 Subject: [PATCH 236/261] fix for flipped conditional for dll fixup --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 61d35d93b1..43373d9da0 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -18,7 +18,6 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) endif () if (WIN32) - configure_file( ${HIFI_CMAKE_DIR}/templates/FixupBundlePostBuild.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake @@ -34,8 +33,7 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) -P ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake ) - if (NOT USES_QT) - + if (USES_QT) find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) # add a post-build command to call windeployqt to copy Qt plugins @@ -46,6 +44,5 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) ) endif () - endif () endmacro() \ No newline at end of file From e66f12f95873728e773db1be8b46089b6df4735a Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 10:56:08 -0800 Subject: [PATCH 237/261] add shutdown short circuiting to datagram processor --- interface/src/Application.cpp | 5 +++-- interface/src/DatagramProcessor.cpp | 4 ++++ interface/src/DatagramProcessor.h | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d3161ebf51..eb228f2874 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -534,6 +534,7 @@ void Application::aboutToQuit() { void Application::cleanupBeforeQuit() { + _datagramProcessor.shutdown(); // tell the datagram processor we're shutting down, so it can short circuit _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts ScriptEngine::stopAllScripts(this); // stop all currently running global scripts @@ -584,8 +585,6 @@ Application::~Application() { _entities.getTree()->setSimulation(NULL); tree->unlock(); - qInstallMessageHandler(NULL); - // ask the datagram processing thread to quit and wait until it is done _nodeThread->quit(); _nodeThread->wait(); @@ -606,6 +605,8 @@ Application::~Application() { DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); + + qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages } void Application::initializeGL() { diff --git a/interface/src/DatagramProcessor.cpp b/interface/src/DatagramProcessor.cpp index 02d3c62765..a491f9444d 100644 --- a/interface/src/DatagramProcessor.cpp +++ b/interface/src/DatagramProcessor.cpp @@ -30,6 +30,10 @@ DatagramProcessor::DatagramProcessor(QObject* parent) : void DatagramProcessor::processDatagrams() { PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "DatagramProcessor::processDatagrams()"); + + if (_isShuttingDown) { + return; // bail early... we're shutting down. + } HifiSockAddr senderSockAddr; diff --git a/interface/src/DatagramProcessor.h b/interface/src/DatagramProcessor.h index 4ce090e52e..7fc192ee2d 100644 --- a/interface/src/DatagramProcessor.h +++ b/interface/src/DatagramProcessor.h @@ -25,14 +25,17 @@ public: int getOutByteCount() const { return _outByteCount; } void resetCounters() { _inPacketCount = 0; _outPacketCount = 0; _inByteCount = 0; _outByteCount = 0; } + + void shutdown() { _isShuttingDown = true; } public slots: void processDatagrams(); private: - int _inPacketCount; - int _outPacketCount; - int _inByteCount; - int _outByteCount; + int _inPacketCount = 0; + int _outPacketCount = 0; + int _inByteCount = 0; + int _outByteCount = 0; + bool _isShuttingDown = false; }; #endif // hifi_DatagramProcessor_h From 33b0fd24a6a86e4282555da5811aaba8ebf7ba5a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 11:02:05 -0800 Subject: [PATCH 238/261] don't call copy dll step for scribe --- .../CopyDllsBesideWindowsExecutable.cmake | 25 ++++++------------- tools/scribe/CMakeLists.txt | 4 +-- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index 43373d9da0..a97603a6ca 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -11,12 +11,6 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) - if (NOT ${ARGN}) - set(USES_QT TRUE) - else () - set(USES_QT ${ARGN}) - endif () - if (WIN32) configure_file( ${HIFI_CMAKE_DIR}/templates/FixupBundlePostBuild.cmake.in @@ -33,16 +27,13 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) -P ${CMAKE_CURRENT_BINARY_DIR}/FixupBundlePostBuild.cmake ) - if (USES_QT) - find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) - - # add a post-build command to call windeployqt to copy Qt plugins - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND CMD /C "SET PATH=%PATH%;${QT_DIR}/bin && ${WINDEPLOYQT_COMMAND} --no-libraries $" - ) - - endif () + find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) + + # add a post-build command to call windeployqt to copy Qt plugins + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND CMD /C "SET PATH=%PATH%;${QT_DIR}/bin && ${WINDEPLOYQT_COMMAND} --no-libraries $" + ) endif () endmacro() \ No newline at end of file diff --git a/tools/scribe/CMakeLists.txt b/tools/scribe/CMakeLists.txt index 4196909043..b71a287e46 100755 --- a/tools/scribe/CMakeLists.txt +++ b/tools/scribe/CMakeLists.txt @@ -1,4 +1,2 @@ set(TARGET_NAME scribe) -setup_hifi_project() - -copy_dlls_beside_windows_executable(false) \ No newline at end of file +setup_hifi_project() \ No newline at end of file From 5776df10122322b25bc59f4d9aa527f5eb7bcf1d Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 25 Feb 2015 12:07:19 -0800 Subject: [PATCH 239/261] load dynamic obj as inactive when not moving --- libraries/physics/src/EntityMotionState.cpp | 4 ++++ libraries/physics/src/EntityMotionState.h | 26 +++++++++++---------- libraries/physics/src/ObjectMotionState.h | 2 ++ libraries/physics/src/PhysicsEngine.cpp | 4 ++++ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 810bf9a6a8..699b4cc386 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -63,6 +63,10 @@ void EntityMotionState::stepKinematicSimulation(quint64 now) { _entity->simulate(now); } +bool EntityMotionState::isMoving() const { + return _entity->isMoving(); +} + // This callback is invoked by the physics simulation in two cases: // (1) when the RigidBody is first added to the world // (irregardless of MotionType: STATIC, DYNAMIC, or KINEMATIC) diff --git a/libraries/physics/src/EntityMotionState.h b/libraries/physics/src/EntityMotionState.h index 5d98e545d9..7214626fc4 100644 --- a/libraries/physics/src/EntityMotionState.h +++ b/libraries/physics/src/EntityMotionState.h @@ -36,28 +36,30 @@ public: virtual ~EntityMotionState(); /// \return MOTION_TYPE_DYNAMIC or MOTION_TYPE_STATIC based on params set in EntityItem - MotionType computeMotionType() const; + virtual MotionType computeMotionType() const; - void updateKinematicState(uint32_t substep); - void stepKinematicSimulation(quint64 now); + virtual void updateKinematicState(uint32_t substep); + virtual void stepKinematicSimulation(quint64 now); + + virtual bool isMoving() const; // this relays incoming position/rotation to the RigidBody - void getWorldTransform(btTransform& worldTrans) const; + virtual void getWorldTransform(btTransform& worldTrans) const; // this relays outgoing position/rotation to the EntityItem - void setWorldTransform(const btTransform& worldTrans); + virtual void setWorldTransform(const btTransform& worldTrans); // these relay incoming values to the RigidBody - void updateObjectEasy(uint32_t flags, uint32_t frame); - void updateObjectVelocities(); + virtual void updateObjectEasy(uint32_t flags, uint32_t frame); + virtual void updateObjectVelocities(); - void computeShapeInfo(ShapeInfo& shapeInfo); - float computeMass(const ShapeInfo& shapeInfo) const; + virtual void computeShapeInfo(ShapeInfo& shapeInfo); + virtual float computeMass(const ShapeInfo& shapeInfo) const; - void sendUpdate(OctreeEditPacketSender* packetSender, uint32_t frame); + virtual void sendUpdate(OctreeEditPacketSender* packetSender, uint32_t frame); - uint32_t getIncomingDirtyFlags() const; - void clearIncomingDirtyFlags(uint32_t flags) { _entity->clearDirtyFlags(flags); } + virtual uint32_t getIncomingDirtyFlags() const; + virtual void clearIncomingDirtyFlags(uint32_t flags) { _entity->clearDirtyFlags(flags); } EntityItem* getEntity() const { return _entity; } diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index ceeea219cf..fb402a178d 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -101,6 +101,8 @@ public: void setKinematic(bool kinematic, uint32_t substep); virtual void stepKinematicSimulation(quint64 now) = 0; + virtual bool isMoving() const = 0; + friend class PhysicsEngine; protected: void setRigidBody(btRigidBody* body); diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 461d15114c..10c7f42546 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -439,6 +439,10 @@ void PhysicsEngine::addObject(const ShapeInfo& shapeInfo, btCollisionShape* shap const float DYNAMIC_LINEAR_VELOCITY_THRESHOLD = 0.05f; // 5 cm/sec const float DYNAMIC_ANGULAR_VELOCITY_THRESHOLD = 0.087266f; // ~5 deg/sec body->setSleepingThresholds(DYNAMIC_LINEAR_VELOCITY_THRESHOLD, DYNAMIC_ANGULAR_VELOCITY_THRESHOLD); + if (!motionState->isMoving()) { + // try to initialize this object as inactive + body->forceActivationState(ISLAND_SLEEPING); + } break; } case MOTION_TYPE_STATIC: From a89691fc6652521f03d99c7cb4b6fbf8f7f4f69d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 12:11:35 -0800 Subject: [PATCH 240/261] switch GLCanvas back to being owned by Application --- interface/src/Application.cpp | 77 +++++++++---------- interface/src/Application.h | 13 ++-- interface/src/Camera.cpp | 2 +- interface/src/GLCanvas.h | 18 ++--- interface/src/UIUtil.cpp | 5 +- interface/src/audio/AudioToolBox.cpp | 3 +- interface/src/devices/OculusManager.cpp | 4 +- interface/src/devices/PrioVR.cpp | 2 +- interface/src/devices/SixenseManager.cpp | 2 +- interface/src/devices/TV3DManager.cpp | 4 +- .../ControllerScriptingInterface.cpp | 3 +- .../scripting/WindowScriptingInterface.cpp | 2 +- interface/src/ui/ApplicationOverlay.cpp | 30 ++++---- interface/src/ui/MetavoxelEditor.cpp | 2 +- interface/src/ui/PreferencesDialog.cpp | 2 +- interface/src/ui/Snapshot.cpp | 3 +- interface/src/ui/Stats.cpp | 8 +- 17 files changed, 93 insertions(+), 87 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index eb228f2874..772c314783 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -215,7 +215,7 @@ bool setupEssentials(int& argc, char** argv) { DependencyManager::registerInheritance(); // Set dependencies - auto glCanvas = DependencyManager::set(); + //auto glCanvasGlobal = DependencyManager::set(); auto addressManager = DependencyManager::set(); auto nodeList = DependencyManager::set(NodeType::Agent, listenPort); auto geometryCache = DependencyManager::set(); @@ -307,7 +307,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us - auto glCanvas = DependencyManager::get(); auto nodeList = DependencyManager::get(); _myAvatar = DependencyManager::get()->getMyAvatar(); @@ -447,16 +446,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : ResourceCache::setRequestLimit(3); - _window->setCentralWidget(glCanvas.data()); + _window->setCentralWidget(_glWidget); _window->restoreGeometry(); _window->setVisible(true); - glCanvas->setFocusPolicy(Qt::StrongFocus); - glCanvas->setFocus(); + _glWidget->setFocusPolicy(Qt::StrongFocus); + _glWidget->setFocus(); // enable mouse tracking; otherwise, we only get drag events - glCanvas->setMouseTracking(true); + _glWidget->setMouseTracking(true); _toolWindow = new ToolWindow(); _toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint); @@ -474,7 +473,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : checkVersion(); - _overlays.init(glCanvas.data()); // do this before scripts load + _overlays.init(_glWidget); // do this before scripts load _runningScriptsWidget->setRunningScripts(getRunningScripts()); connect(_runningScriptsWidget, &RunningScriptsWidget::stopScriptName, this, &Application::stopScript); @@ -533,6 +532,7 @@ void Application::aboutToQuit() { } void Application::cleanupBeforeQuit() { + qDebug() << "Application::cleanupBeforeQuit() ------------ BEGIN --------------"; _datagramProcessor.shutdown(); // tell the datagram processor we're shutting down, so it can short circuit _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts @@ -577,9 +577,12 @@ void Application::cleanupBeforeQuit() { // destroy the AudioClient so it and its thread have a chance to go down safely DependencyManager::destroy(); + + qDebug() << "Application::cleanupBeforeQuit() ------------ END --------------"; } Application::~Application() { + qDebug() << "Application::~Application() ------------ BEGIN --------------"; EntityTree* tree = _entities.getTree(); tree->lockForWrite(); _entities.getTree()->setSimulation(NULL); @@ -598,15 +601,19 @@ Application::~Application() { ModelEntityItem::cleanupLoadedAnimations() ; - DependencyManager::destroy(); + //DependencyManager::destroy(); + qDebug() << "Application::~Application() ------------ BEGIN CACHE CLEANUP --------------"; DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); + qDebug() << "Application::~Application() ------------ END CACHE CLEANUP --------------"; qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages + + qDebug() << "Application::~Application() ------------ END --------------"; } void Application::initializeGL() { @@ -691,7 +698,7 @@ void Application::paintGL() { if (OculusManager::isConnected()) { DependencyManager::get()->setFrameBufferSize(OculusManager::getRenderTargetSize()); } else { - QSize fbSize = DependencyManager::get()->getDeviceSize() * getRenderResolutionScale(); + QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale(); DependencyManager::get()->setFrameBufferSize(fbSize); } @@ -1058,8 +1065,7 @@ void Application::keyPressEvent(QKeyEvent* event) { if (isShifted) { _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f); if (TV3DManager::isConnected()) { - auto glCanvas = DependencyManager::get(); - TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); + TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); } } else { _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0)); @@ -1071,8 +1077,7 @@ void Application::keyPressEvent(QKeyEvent* event) { if (isShifted) { _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f); if (TV3DManager::isConnected()) { - auto glCanvas = DependencyManager::get(); - TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); + TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); } } else { @@ -1501,7 +1506,7 @@ void Application::idle() { { PerformanceTimer perfTimer("updateGL"); PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); - DependencyManager::get()->updateGL(); + _glWidget->updateGL(); } { PerformanceTimer perfTimer("rest"); @@ -1542,8 +1547,7 @@ void Application::setFullscreen(bool fullscreen) { } void Application::setEnable3DTVMode(bool enable3DTVMode) { - auto glCanvas = DependencyManager::get(); - resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); + resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); } void Application::setEnableVRMode(bool enableVRMode) { @@ -1568,8 +1572,7 @@ void Application::setEnableVRMode(bool enableVRMode) { _myCamera.setHmdRotation(glm::quat()); } - auto glCanvas = DependencyManager::get(); - resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); + resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); updateCursorVisibility(); } @@ -1580,9 +1583,8 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) { bool Application::mouseOnScreen() const { if (OculusManager::isConnected()) { - auto glCanvas = DependencyManager::get(); - return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() && - getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight(); + return getMouseX() >= 0 && getMouseX() <= _glWidget->getDeviceWidth() && + getMouseY() >= 0 && getMouseY() <= _glWidget->getDeviceHeight(); } return true; } @@ -1792,8 +1794,7 @@ void Application::init() { _metavoxels.init(); - auto glCanvas = DependencyManager::get(); - _rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect); + _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect); connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); @@ -1801,10 +1802,10 @@ void Application::init() { connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); // make sure our texture cache knows about window size changes - DependencyManager::get()->associateWithWidget(glCanvas.data()); + DependencyManager::get()->associateWithWidget(_glWidget); // initialize the GlowEffect with our widget - DependencyManager::get()->init(glCanvas.data(), + DependencyManager::get()->init(_glWidget, Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)); } @@ -2058,9 +2059,9 @@ void Application::updateCursor(float deltaTime) { void Application::updateCursorVisibility() { if (!_cursorVisible || Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) { - DependencyManager::get()->setCursor(Qt::BlankCursor); + _glWidget->setCursor(Qt::BlankCursor); } else { - DependencyManager::get()->unsetCursor(); + _glWidget->unsetCursor(); } } @@ -2650,8 +2651,7 @@ void Application::updateShadowMap() { fbo->release(); - auto glCanvas = DependencyManager::get(); - glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); + glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); } const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; @@ -2701,7 +2701,7 @@ QImage Application::renderAvatarBillboard() { Glower glower; const int BILLBOARD_SIZE = 64; - renderRearViewMirror(QRect(0, DependencyManager::get()->getDeviceHeight() - BILLBOARD_SIZE, + renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE, BILLBOARD_SIZE, BILLBOARD_SIZE), true); @@ -2993,9 +2993,8 @@ bool Application::getCascadeShadowsEnabled() { } glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { - auto glCanvas = DependencyManager::get(); - float horizontalScale = glCanvas->getDeviceWidth() / 2.0f; - float verticalScale = glCanvas->getDeviceHeight() / 2.0f; + float horizontalScale = _glWidget->getDeviceWidth() / 2.0f; + float verticalScale = _glWidget->getDeviceHeight() / 2.0f; // -1,-1 is 0,windowHeight // 1,1 is windowWidth,0 @@ -3014,7 +3013,7 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { // -1,-1 1,-1 glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale, - ((projectedPoint.y + 1.0) * -verticalScale) + glCanvas->getDeviceHeight()); + ((projectedPoint.y + 1.0) * -verticalScale) + _glWidget->getDeviceHeight()); return screenPoint; } @@ -3150,7 +3149,7 @@ void Application::resetSensors() { QScreen* currentScreen = _window->windowHandle()->screen(); QWindow* mainWindow = _window->windowHandle(); QPoint windowCenter = mainWindow->geometry().center(); - DependencyManager::get()->cursor().setPos(currentScreen, windowCenter); + _glWidget->cursor().setPos(currentScreen, windowCenter); _myAvatar->reset(); @@ -3786,7 +3785,7 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio void Application::loadDialog() { - QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get().data(), + QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Open Script"), getPreviousScriptLocation(), tr("JavaScript Files (*.js)")); @@ -3827,7 +3826,7 @@ void Application::setScriptsLocation(const QString& scriptsLocation) { void Application::toggleLogDialog() { if (! _logDialog) { - _logDialog = new LogDialog(DependencyManager::get().data(), getLogger()); + _logDialog = new LogDialog(_glWidget, getLogger()); } if (_logDialog->isVisible()) { @@ -3884,7 +3883,7 @@ void Application::parseVersionXml() { } if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { - new UpdateDialog(DependencyManager::get().data(), releaseNotes, latestVersion, downloadUrl); + new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl); } sender->deleteLater(); } @@ -3917,7 +3916,7 @@ void Application::takeSnapshot() { } if (!_snapshotShareDialog) { - _snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get().data()); + _snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget); } _snapshotShareDialog->show(); } diff --git a/interface/src/Application.h b/interface/src/Application.h index 669187138c..9cd19c8259 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -171,7 +171,8 @@ public: bool event(QEvent* event); bool eventFilter(QObject* object, QEvent* event); - bool isThrottleRendering() const { return DependencyManager::get()->isThrottleRendering(); } + GLCanvas* getGLWidget() { return _glWidget; } + bool isThrottleRendering() const { return _glWidget->isThrottleRendering(); } Camera* getCamera() { return &_myCamera; } ViewFrustum* getViewFrustum() { return &_viewFrustum; } @@ -195,8 +196,8 @@ public: bool mouseOnScreen() const; int getMouseX() const; int getMouseY() const; - int getTrueMouseX() const { return DependencyManager::get()->mapFromGlobal(QCursor::pos()).x(); } - int getTrueMouseY() const { return DependencyManager::get()->mapFromGlobal(QCursor::pos()).y(); } + int getTrueMouseX() const { return _glWidget->mapFromGlobal(QCursor::pos()).x(); } + int getTrueMouseY() const { return _glWidget->mapFromGlobal(QCursor::pos()).y(); } int getMouseDragStartedX() const; int getMouseDragStartedY() const; int getTrueMouseDragStartedX() const { return _mouseDragStartedX; } @@ -270,8 +271,8 @@ public: FileLogger* getLogger() { return _logger; } - glm::vec2 getViewportDimensions() const { return glm::vec2(DependencyManager::get()->getDeviceWidth(), - DependencyManager::get()->getDeviceHeight()); } + glm::vec2 getViewportDimensions() const { return glm::vec2(_glWidget->getDeviceWidth(), + _glWidget->getDeviceHeight()); } NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; } void skipVersion(QString latestVersion); @@ -593,6 +594,8 @@ private: QThread _settingsThread; QTimer _settingsTimer; + + GLCanvas* _glWidget = new GLCanvas(); // our GLCanvas has a couple extra features }; #endif // hifi_Application_h diff --git a/interface/src/Camera.cpp b/interface/src/Camera.cpp index 5019599641..e334fd7c65 100644 --- a/interface/src/Camera.cpp +++ b/interface/src/Camera.cpp @@ -122,7 +122,7 @@ void Camera::setFarClip(float f) { } PickRay Camera::computePickRay(float x, float y) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); return computeViewPickRay(x / glCanvas->width(), y / glCanvas->height()); } diff --git a/interface/src/GLCanvas.h b/interface/src/GLCanvas.h index ee101743cf..9e75d92b42 100644 --- a/interface/src/GLCanvas.h +++ b/interface/src/GLCanvas.h @@ -16,14 +16,18 @@ #include #include -#include +//#include /// customized canvas that simply forwards requests/events to the singleton application -class GLCanvas : public QGLWidget, public Dependency { +class GLCanvas : public QGLWidget { Q_OBJECT - SINGLETON_DEPENDENCY public: + GLCanvas(); + virtual ~GLCanvas() { + qDebug() << "Deleting GLCanvas"; + } + bool isThrottleRendering() const; int getDeviceWidth() const; @@ -60,12 +64,8 @@ private slots: void activeChanged(Qt::ApplicationState state); void throttleRender(); bool eventFilter(QObject*, QEvent* event); - -private: - GLCanvas(); - ~GLCanvas() { - qDebug() << "Deleting GLCanvas"; - } + }; + #endif // hifi_GLCanvas_h diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 19d3a51917..03195c5e75 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -12,7 +12,8 @@ #include #include -#include "DependencyManager.h" +//#include "DependencyManager.h" +#include "Application.h" #include "GLCanvas.h" #include "UIUtil.h" @@ -44,7 +45,7 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) { // this function at all. If you mix both you will end up with inconsistent results // across platforms. void UIUtil::scaleWidgetFontSizes(QWidget* widget) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); // This is the base dpi that we are targetting. This is based on Mac OSXs default DPI, // and is the basis for all font sizes. diff --git a/interface/src/audio/AudioToolBox.cpp b/interface/src/audio/AudioToolBox.cpp index 924c8105ea..e12b7bcbb0 100644 --- a/interface/src/audio/AudioToolBox.cpp +++ b/interface/src/audio/AudioToolBox.cpp @@ -16,6 +16,7 @@ #include #include +#include "Application.h" #include "AudioToolBox.h" // Mute icon configration @@ -37,7 +38,7 @@ bool AudioToolBox::mousePressEvent(int x, int y) { void AudioToolBox::render(int x, int y, bool boxed) { glEnable(GL_TEXTURE_2D); - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); if (_micTextureId == 0) { _micTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic.svg")); } diff --git a/interface/src/devices/OculusManager.cpp b/interface/src/devices/OculusManager.cpp index 14d1939198..4d864d8cec 100644 --- a/interface/src/devices/OculusManager.cpp +++ b/interface/src/devices/OculusManager.cpp @@ -566,7 +566,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p } // restore our normal viewport - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); glMatrixMode(GL_PROJECTION); @@ -585,7 +585,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p void OculusManager::renderDistortionMesh(ovrPosef eyeRenderPose[ovrEye_Count]) { glLoadIdentity(); - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); glOrtho(0, glCanvas->getDeviceWidth(), 0, glCanvas->getDeviceHeight(), -1.0, 1.0); glDisable(GL_DEPTH_TEST); diff --git a/interface/src/devices/PrioVR.cpp b/interface/src/devices/PrioVR.cpp index b3342ac2bd..428c223eb7 100644 --- a/interface/src/devices/PrioVR.cpp +++ b/interface/src/devices/PrioVR.cpp @@ -216,7 +216,7 @@ void PrioVR::renderCalibrationCountdown() { static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold, false, TextRenderer::OUTLINE_EFFECT, 2); QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "..."; - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); textRenderer->draw((glCanvas->width() - textRenderer->computeExtent(text.constData()).x) / 2, glCanvas->height() / 2, text, glm::vec4(1,1,1,1)); diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index 609ac7b349..ce6ca57c69 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -472,7 +472,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers) //Injecting mouse movements and clicks void SixenseManager::emulateMouse(PalmData* palm, int index) { MyAvatar* avatar = DependencyManager::get()->getMyAvatar(); - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); QPoint pos; Qt::MouseButton bumperButton; diff --git a/interface/src/devices/TV3DManager.cpp b/interface/src/devices/TV3DManager.cpp index 9af13c461e..205ebfd29d 100644 --- a/interface/src/devices/TV3DManager.cpp +++ b/interface/src/devices/TV3DManager.cpp @@ -35,7 +35,7 @@ bool TV3DManager::isConnected() { } void TV3DManager::connect() { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); int width = glCanvas->getDeviceWidth(); int height = glCanvas->getDeviceHeight(); Camera& camera = *Application::getInstance()->getCamera(); @@ -93,7 +93,7 @@ void TV3DManager::display(Camera& whichCamera) { // left eye portal int portalX = 0; int portalY = 0; - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); QSize deviceSize = glCanvas->getDeviceSize() * Application::getInstance()->getRenderResolutionScale(); int portalW = deviceSize.width() / 2; diff --git a/interface/src/scripting/ControllerScriptingInterface.cpp b/interface/src/scripting/ControllerScriptingInterface.cpp index 2188f45374..35c24346d2 100644 --- a/interface/src/scripting/ControllerScriptingInterface.cpp +++ b/interface/src/scripting/ControllerScriptingInterface.cpp @@ -15,6 +15,7 @@ #include #include +#include "Application.h" #include "devices/MotionTracker.h" #include "devices/SixenseManager.h" #include "ControllerScriptingInterface.h" @@ -285,7 +286,7 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) { } glm::vec2 ControllerScriptingInterface::getViewportDimensions() const { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); return glm::vec2(glCanvas->width(), glCanvas->height()); } diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index fc3eefe260..8ec9fbbb82 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -44,7 +44,7 @@ WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title } QScriptValue WindowScriptingInterface::hasFocus() { - return DependencyManager::get()->hasFocus(); + return Application::getInstance()->getGLWidget()->hasFocus(); } void WindowScriptingInterface::setFocus() { diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index 632e76c840..0c5941366f 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -170,7 +170,7 @@ ApplicationOverlay::~ApplicationOverlay() { void ApplicationOverlay::renderOverlay(bool renderToTexture) { PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()"); Overlays& overlays = qApp->getOverlays(); - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); _textureFov = glm::radians(_oculusUIAngularSize); _textureAspectRatio = (float)glCanvas->getDeviceWidth() / (float)glCanvas->getDeviceHeight(); @@ -239,7 +239,7 @@ void ApplicationOverlay::displayOverlayTexture() { if (_alpha == 0.0f) { return; } - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); glEnable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); @@ -401,7 +401,7 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as glm::vec2(1.0f, 0.0f), glm::vec2(0.0f, 0.0f), overlayColor); - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); if (_crosshairTexture == 0) { _crosshairTexture = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png")); } @@ -451,7 +451,7 @@ void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& origi //Caculate the click location using one of the sixense controllers. Scale is not applied QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); MyAvatar* myAvatar = DependencyManager::get()->getMyAvatar(); glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm); @@ -528,7 +528,7 @@ bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position, //Renders optional pointers void ApplicationOverlay::renderPointers() { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); //lazily load crosshair texture if (_crosshairTexture == 0) { @@ -575,7 +575,7 @@ void ApplicationOverlay::renderPointers() { } void ApplicationOverlay::renderControllerPointers() { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); MyAvatar* myAvatar = DependencyManager::get()->getMyAvatar(); //Static variables used for storing controller state @@ -722,7 +722,7 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool if (!_magnifier) { return; } - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); const int widgetWidth = glCanvas->width(); const int widgetHeight = glCanvas->height(); @@ -787,7 +787,7 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool } void ApplicationOverlay::renderAudioMeter() { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); auto audio = DependencyManager::get(); // Audio VU Meter and Mute Icon @@ -905,7 +905,7 @@ void ApplicationOverlay::renderStatsAndLogs() { Application* application = Application::getInstance(); QSharedPointer bandwidthRecorder = DependencyManager::get(); - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor(); NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay(); @@ -943,7 +943,7 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder() { auto nodeList = DependencyManager::get(); if (nodeList && !nodeList->getDomainHandler().isConnected()) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); auto geometryCache = DependencyManager::get(); int width = glCanvas->width(); int height = glCanvas->height(); @@ -1087,7 +1087,7 @@ void ApplicationOverlay::TexturedHemisphere::cleanupVBO() { } void ApplicationOverlay::TexturedHemisphere::buildFramebufferObject() { - QSize size = DependencyManager::get()->getDeviceSize(); + QSize size = Application::getInstance()->getGLWidget()->getDeviceSize(); if (_framebufferObject != NULL && size == _framebufferObject->size()) { // Already build return; @@ -1138,7 +1138,7 @@ void ApplicationOverlay::TexturedHemisphere::render() { glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const { - QSize screenSize = DependencyManager::get()->getDeviceSize(); + QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize(); float yaw = -(screenPos.x / screenSize.width() - 0.5f) * MOUSE_YAW_RANGE; float pitch = (screenPos.y / screenSize.height() - 0.5f) * MOUSE_PITCH_RANGE; @@ -1146,7 +1146,7 @@ glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const { } glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const { - QSize screenSize = DependencyManager::get()->getDeviceSize(); + QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize(); float x = (-sphericalPos.x / MOUSE_YAW_RANGE + 0.5f) * screenSize.width(); float y = (sphericalPos.y / MOUSE_PITCH_RANGE + 0.5f) * screenSize.height(); @@ -1154,7 +1154,7 @@ glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const { } glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const { - QSize screenSize = DependencyManager::get()->getDeviceSize(); + QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize(); float x = (-sphericalPos.x / (_textureFov * _textureAspectRatio) + 0.5f) * screenSize.width(); float y = (sphericalPos.y / _textureFov + 0.5f) * screenSize.height(); @@ -1162,7 +1162,7 @@ glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const { } glm::vec2 ApplicationOverlay::overlayToSpherical(glm::vec2 overlayPos) const { - QSize screenSize = DependencyManager::get()->getDeviceSize(); + QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize(); float yaw = -(overlayPos.x / screenSize.width() - 0.5f) * _textureFov * _textureAspectRatio; float pitch = (overlayPos.y / screenSize.height() - 0.5f) * _textureFov; diff --git a/interface/src/ui/MetavoxelEditor.cpp b/interface/src/ui/MetavoxelEditor.cpp index bead5c743f..34c6ec9a30 100644 --- a/interface/src/ui/MetavoxelEditor.cpp +++ b/interface/src/ui/MetavoxelEditor.cpp @@ -140,7 +140,7 @@ MetavoxelEditor::MetavoxelEditor(QWidget* parent) : connect(Application::getInstance()->getMetavoxels(), &MetavoxelSystem::rendering, this, &MetavoxelEditor::renderPreview); - DependencyManager::get()->installEventFilter(this); + Application::getInstance()->getGLWidget()->installEventFilter(this); show(); diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 1a3ad541c9..fa63079290 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -235,7 +235,7 @@ void PreferencesDialog::savePreferences() { myAvatar->setLeanScale(ui.leanScaleSpin->value()); myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value()); - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height()); DependencyManager::get()->getMyAvatar()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value()); diff --git a/interface/src/ui/Snapshot.cpp b/interface/src/ui/Snapshot.cpp index 9f8603e2ca..5a3109ff64 100644 --- a/interface/src/ui/Snapshot.cpp +++ b/interface/src/ui/Snapshot.cpp @@ -23,6 +23,7 @@ #include #include +#include "Application.h" #include "Snapshot.h" // filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg @@ -93,7 +94,7 @@ QTemporaryFile* Snapshot::saveTempSnapshot() { } QFile* Snapshot::savedFileForSnapshot(bool isTemporary) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); QImage shot = glCanvas->grabFrameBuffer(); Avatar* avatar = DependencyManager::get()->getMyAvatar(); diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index 7617adf01c..a4bb60bf7c 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -62,7 +62,7 @@ Stats::Stats(): _metavoxelReceiveProgress(0), _metavoxelReceiveTotal(0) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); resetWidth(glCanvas->width(), 0); } @@ -73,7 +73,7 @@ void Stats::toggleExpanded() { // called on mouse click release // check for clicks over stats in order to expand or contract them void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) { // not worried about dragging on stats @@ -128,7 +128,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD } void Stats::resetWidth(int width, int horizontalOffset) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); int extraSpace = glCanvas->width() - horizontalOffset -2 - STATS_GENERAL_MIN_WIDTH - (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0) @@ -202,7 +202,7 @@ void Stats::display( int outKbitsPerSecond, int voxelPacketsToProcess) { - auto glCanvas = DependencyManager::get(); + auto glCanvas = Application::getInstance()->getGLWidget(); unsigned int backgroundColor = 0x33333399; int verticalOffset = 0, lines = 0; From d1e648b39234084fac6fca18c196778a3fdab181 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 12:34:38 -0800 Subject: [PATCH 241/261] remove unused references to QGLWidget* parent in Overlay and Overlays --- interface/src/Application.cpp | 2 +- interface/src/UIUtil.cpp | 4 ---- interface/src/ui/overlays/Overlay.cpp | 5 +---- interface/src/ui/overlays/Overlay.h | 3 +-- interface/src/ui/overlays/Overlays.cpp | 5 ++--- interface/src/ui/overlays/Overlays.h | 3 +-- 6 files changed, 6 insertions(+), 16 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 772c314783..5c6b370cfb 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -473,7 +473,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : checkVersion(); - _overlays.init(_glWidget); // do this before scripts load + _overlays.init(); // do this before scripts load _runningScriptsWidget->setRunningScripts(getRunningScripts()); connect(_runningScriptsWidget, &RunningScriptsWidget::stopScriptName, this, &Application::stopScript); diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 03195c5e75..8951ada5a6 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -12,8 +12,6 @@ #include #include -//#include "DependencyManager.h" -#include "Application.h" #include "GLCanvas.h" #include "UIUtil.h" @@ -45,8 +43,6 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) { // this function at all. If you mix both you will end up with inconsistent results // across platforms. void UIUtil::scaleWidgetFontSizes(QWidget* widget) { - auto glCanvas = Application::getInstance()->getGLWidget(); - // This is the base dpi that we are targetting. This is based on Mac OSXs default DPI, // and is the basis for all font sizes. const float BASE_DPI = 72.0f; diff --git a/interface/src/ui/overlays/Overlay.cpp b/interface/src/ui/overlays/Overlay.cpp index fd7aaca717..b7700d8299 100644 --- a/interface/src/ui/overlays/Overlay.cpp +++ b/interface/src/ui/overlays/Overlay.cpp @@ -20,7 +20,6 @@ Overlay::Overlay() : - _parent(NULL), _isLoaded(true), _alpha(DEFAULT_ALPHA), _glowLevel(0.0f), @@ -40,7 +39,6 @@ Overlay::Overlay() : } Overlay::Overlay(const Overlay* overlay) : - _parent(NULL), _isLoaded(overlay->_isLoaded), _alpha(overlay->_alpha), _glowLevel(overlay->_glowLevel), @@ -60,8 +58,7 @@ Overlay::Overlay(const Overlay* overlay) : { } -void Overlay::init(QGLWidget* parent, QScriptEngine* scriptEngine) { - _parent = parent; +void Overlay::init(QScriptEngine* scriptEngine) { _scriptEngine = scriptEngine; } diff --git a/interface/src/ui/overlays/Overlay.h b/interface/src/ui/overlays/Overlay.h index 99ab588197..b921c2ddbb 100644 --- a/interface/src/ui/overlays/Overlay.h +++ b/interface/src/ui/overlays/Overlay.h @@ -38,7 +38,7 @@ public: Overlay(); Overlay(const Overlay* overlay); ~Overlay(); - void init(QGLWidget* parent, QScriptEngine* scriptEngine); + void init(QScriptEngine* scriptEngine); virtual void update(float deltatime) {} virtual void render(RenderArgs* args) = 0; @@ -85,7 +85,6 @@ public: protected: float updatePulse(); - QGLWidget* _parent; bool _isLoaded; float _alpha; float _glowLevel; diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 8ba7ddea00..c7b350f100 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -58,8 +58,7 @@ Overlays::~Overlays() { } -void Overlays::init(QGLWidget* parent) { - _parent = parent; +void Overlays::init() { _scriptEngine = new QScriptEngine(); } @@ -202,7 +201,7 @@ unsigned int Overlays::addOverlay(const QString& type, const QScriptValue& prope } unsigned int Overlays::addOverlay(Overlay* overlay) { - overlay->init(_parent, _scriptEngine); + overlay->init(_scriptEngine); QWriteLocker lock(&_lock); unsigned int thisID = _nextOverlayID; diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index 94ac6f98bb..42227d04f6 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -51,7 +51,7 @@ class Overlays : public QObject { public: Overlays(); ~Overlays(); - void init(QGLWidget* parent); + void init(); void update(float deltatime); void renderWorld(bool drawFront, RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE, RenderArgs::RenderSide renderSide = RenderArgs::MONO); @@ -95,7 +95,6 @@ private: QMap _overlaysWorld; QList _overlaysToDelete; unsigned int _nextOverlayID; - QGLWidget* _parent; QReadWriteLock _lock; QReadWriteLock _deleteLock; QScriptEngine* _scriptEngine; From 912b851eb72c0ee031de3c85c375feb84c8496a8 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 12:54:34 -0800 Subject: [PATCH 242/261] remove crufty references to QGLWidget --- interface/src/ui/overlays/Base3DOverlay.cpp | 1 - interface/src/ui/overlays/Circle3DOverlay.cpp | 1 - interface/src/ui/overlays/Cube3DOverlay.cpp | 2 -- interface/src/ui/overlays/Grid3DOverlay.h | 2 -- interface/src/ui/overlays/ImageOverlay.cpp | 1 - interface/src/ui/overlays/ImageOverlay.h | 1 - interface/src/ui/overlays/Overlay.cpp | 3 --- interface/src/ui/overlays/Overlay.h | 1 - interface/src/ui/overlays/Overlay2D.cpp | 3 --- interface/src/ui/overlays/Overlay2D.h | 1 - interface/src/ui/overlays/Planar3DOverlay.cpp | 1 - interface/src/ui/overlays/Planar3DOverlay.h | 1 - interface/src/ui/overlays/Rectangle3DOverlay.cpp | 2 -- interface/src/ui/overlays/Sphere3DOverlay.cpp | 2 -- interface/src/ui/overlays/TextOverlay.cpp | 2 -- interface/src/ui/overlays/TextOverlay.h | 4 ---- interface/src/ui/overlays/Volume3DOverlay.cpp | 1 - interface/src/ui/overlays/Volume3DOverlay.h | 1 - 18 files changed, 30 deletions(-) diff --git a/interface/src/ui/overlays/Base3DOverlay.cpp b/interface/src/ui/overlays/Base3DOverlay.cpp index 57c7aa791b..f0c49979c8 100644 --- a/interface/src/ui/overlays/Base3DOverlay.cpp +++ b/interface/src/ui/overlays/Base3DOverlay.cpp @@ -11,7 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include "Application.h" diff --git a/interface/src/ui/overlays/Circle3DOverlay.cpp b/interface/src/ui/overlays/Circle3DOverlay.cpp index e68f1bfb37..132f58b6f0 100644 --- a/interface/src/ui/overlays/Circle3DOverlay.cpp +++ b/interface/src/ui/overlays/Circle3DOverlay.cpp @@ -11,7 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include #include diff --git a/interface/src/ui/overlays/Cube3DOverlay.cpp b/interface/src/ui/overlays/Cube3DOverlay.cpp index 53d7d4e70b..a9bfbae8dd 100644 --- a/interface/src/ui/overlays/Cube3DOverlay.cpp +++ b/interface/src/ui/overlays/Cube3DOverlay.cpp @@ -11,8 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include - #include #include #include diff --git a/interface/src/ui/overlays/Grid3DOverlay.h b/interface/src/ui/overlays/Grid3DOverlay.h index d6c85a10ee..451ce0a498 100644 --- a/interface/src/ui/overlays/Grid3DOverlay.h +++ b/interface/src/ui/overlays/Grid3DOverlay.h @@ -17,8 +17,6 @@ #include -#include - #include #include diff --git a/interface/src/ui/overlays/ImageOverlay.cpp b/interface/src/ui/overlays/ImageOverlay.cpp index 3cc1b54b62..72e47b5e3d 100644 --- a/interface/src/ui/overlays/ImageOverlay.cpp +++ b/interface/src/ui/overlays/ImageOverlay.cpp @@ -11,7 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include diff --git a/interface/src/ui/overlays/ImageOverlay.h b/interface/src/ui/overlays/ImageOverlay.h index e167c4e755..31c6031102 100644 --- a/interface/src/ui/overlays/ImageOverlay.h +++ b/interface/src/ui/overlays/ImageOverlay.h @@ -14,7 +14,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include #include diff --git a/interface/src/ui/overlays/Overlay.cpp b/interface/src/ui/overlays/Overlay.cpp index b7700d8299..2cb8b3c91d 100644 --- a/interface/src/ui/overlays/Overlay.cpp +++ b/interface/src/ui/overlays/Overlay.cpp @@ -11,9 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include -#include -#include #include #include "Overlay.h" diff --git a/interface/src/ui/overlays/Overlay.h b/interface/src/ui/overlays/Overlay.h index b921c2ddbb..9077605fc4 100644 --- a/interface/src/ui/overlays/Overlay.h +++ b/interface/src/ui/overlays/Overlay.h @@ -14,7 +14,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include #include diff --git a/interface/src/ui/overlays/Overlay2D.cpp b/interface/src/ui/overlays/Overlay2D.cpp index df7df391eb..f60d44a472 100644 --- a/interface/src/ui/overlays/Overlay2D.cpp +++ b/interface/src/ui/overlays/Overlay2D.cpp @@ -11,9 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include -#include -#include #include #include "Overlay2D.h" diff --git a/interface/src/ui/overlays/Overlay2D.h b/interface/src/ui/overlays/Overlay2D.h index 7493add905..20641206c2 100644 --- a/interface/src/ui/overlays/Overlay2D.h +++ b/interface/src/ui/overlays/Overlay2D.h @@ -14,7 +14,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include #include diff --git a/interface/src/ui/overlays/Planar3DOverlay.cpp b/interface/src/ui/overlays/Planar3DOverlay.cpp index 925725d261..265cafa0ec 100644 --- a/interface/src/ui/overlays/Planar3DOverlay.cpp +++ b/interface/src/ui/overlays/Planar3DOverlay.cpp @@ -11,7 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include #include diff --git a/interface/src/ui/overlays/Planar3DOverlay.h b/interface/src/ui/overlays/Planar3DOverlay.h index 9355265f80..8a02b35bd2 100644 --- a/interface/src/ui/overlays/Planar3DOverlay.h +++ b/interface/src/ui/overlays/Planar3DOverlay.h @@ -16,7 +16,6 @@ #include -#include #include #include "Base3DOverlay.h" diff --git a/interface/src/ui/overlays/Rectangle3DOverlay.cpp b/interface/src/ui/overlays/Rectangle3DOverlay.cpp index 7a88b327d1..8662030e23 100644 --- a/interface/src/ui/overlays/Rectangle3DOverlay.cpp +++ b/interface/src/ui/overlays/Rectangle3DOverlay.cpp @@ -11,8 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include - #include #include #include diff --git a/interface/src/ui/overlays/Sphere3DOverlay.cpp b/interface/src/ui/overlays/Sphere3DOverlay.cpp index 11bd7b97e8..a0e8d06b41 100644 --- a/interface/src/ui/overlays/Sphere3DOverlay.cpp +++ b/interface/src/ui/overlays/Sphere3DOverlay.cpp @@ -11,8 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include - #include #include diff --git a/interface/src/ui/overlays/TextOverlay.cpp b/interface/src/ui/overlays/TextOverlay.cpp index f3b05b7300..85e5af708c 100644 --- a/interface/src/ui/overlays/TextOverlay.cpp +++ b/interface/src/ui/overlays/TextOverlay.cpp @@ -11,8 +11,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include - #include #include #include diff --git a/interface/src/ui/overlays/TextOverlay.h b/interface/src/ui/overlays/TextOverlay.h index 793d705d3c..6387b42bc3 100644 --- a/interface/src/ui/overlays/TextOverlay.h +++ b/interface/src/ui/overlays/TextOverlay.h @@ -14,13 +14,9 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include -#include -#include #include #include #include -#include #include diff --git a/interface/src/ui/overlays/Volume3DOverlay.cpp b/interface/src/ui/overlays/Volume3DOverlay.cpp index 40fea5c8c9..b0310f8155 100644 --- a/interface/src/ui/overlays/Volume3DOverlay.cpp +++ b/interface/src/ui/overlays/Volume3DOverlay.cpp @@ -14,7 +14,6 @@ // include this before QGLWidget, which includes an earlier version of OpenGL #include "InterfaceConfig.h" -#include #include #include #include diff --git a/interface/src/ui/overlays/Volume3DOverlay.h b/interface/src/ui/overlays/Volume3DOverlay.h index 7938641a8f..b7c59b2ace 100644 --- a/interface/src/ui/overlays/Volume3DOverlay.h +++ b/interface/src/ui/overlays/Volume3DOverlay.h @@ -16,7 +16,6 @@ #include -#include #include #include "Base3DOverlay.h" From a9fcde62653e6045d6460d8041c6782de1f686fc Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 13:07:52 -0800 Subject: [PATCH 243/261] fix two typos in BUILD guides --- BUILD.md | 2 +- BUILD_WIN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD.md b/BUILD.md index b8d7df0d0c..98b8cffab1 100644 --- a/BUILD.md +++ b/BUILD.md @@ -43,7 +43,7 @@ For example, a Qt5 5.3.2 installation to /usr/local/qt5 would require that QT_CM The path it needs to be set to will depend on where and how Qt5 was installed. e.g. export QT_CMAKE_PREFIX_PATH=/usr/local/qt/5.3.2/clang_64/lib/cmake/ - export QT_CMAKE_PREFIX_PATH=/usr/localCellar/qt5/5.3.2/lib/cmake + export QT_CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.3.2/lib/cmake export QT_CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake ####Generating build files diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 212dd31f98..28d26d9eb4 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -22,7 +22,7 @@ We expect nmake.exe to be located at the following path. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin -We exepect msbuild.exe to be located at the following path. +We expect msbuild.exe to be located at the following path. C:\Program Files (x86)\MSBUILD\12.0\Bin From 1c2606c6db2bd74e1a45b86c2c5e363d47b0b0a3 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 13:12:37 -0800 Subject: [PATCH 244/261] fail out if windeployqt is not found --- cmake/macros/CopyDllsBesideWindowsExecutable.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake index a97603a6ca..24996fde03 100644 --- a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -28,6 +28,10 @@ macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) ) find_program(WINDEPLOYQT_COMMAND windeployqt PATHS ${QT_DIR}/bin NO_DEFAULT_PATH) + + if (NOT WINDEPLOYQT_COMMAND) + message(FATAL_ERROR "Could not find windeployqt at ${QT_DIR}/bin. windeployqt is required.") + endif () # add a post-build command to call windeployqt to copy Qt plugins add_custom_command( From d24287f62762cb56e5d52986dc6e06f2c50743fa Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 13:48:28 -0800 Subject: [PATCH 245/261] look in Xcode application for 10.9 SDK --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7a64fef18..288d669077 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,11 +96,16 @@ if (APPLE) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) # find the 10.9 SDK path - execute_process(COMMAND xcodebuild -sdk -version OUTPUT_VARIABLE XCODE_SDK_VERSIONS) - string(REGEX MATCH \\/.+MacOSX10.9.sdk OSX_SDK_PATH ${XCODE_SDK_VERSIONS}) + find_path(_OSX_DESIRED_SDK_PATH NAME MacOSX10.9.sdk HINTS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ ${OSX_SDK_PATH}) + + if (NOT _OSX_DESIRED_SDK_PATH) + message(FATAL_ERROR "Could not find OS X 10.9 SDK. Please pass OSX_SDK_PATH to CMake to point us to your SDKs directory.") + else () + message(STATUS "Found OS X 10.9 SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX10.9.sdk") + endif () # set that as the SDK to use - set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH}) + set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX10.9.sdk) endif () # Find includes in corresponding build directories From 994c0386d307d5cc91196db61200e60b4d88b9e7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 13:50:59 -0800 Subject: [PATCH 246/261] cleanup command that looks for SDK --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 288d669077..b3fc5b2d2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,14 +89,19 @@ endif () # figure out where the qt dir is get_filename_component(QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../" ABSOLUTE) -set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) +set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) -if (APPLE) +if (APPLE) # set our OS X deployment target set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) # find the 10.9 SDK path - find_path(_OSX_DESIRED_SDK_PATH NAME MacOSX10.9.sdk HINTS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ ${OSX_SDK_PATH}) + find_path( + _OSX_DESIRED_SDK_PATH + NAME MacOSX10.9.sdk + HINTS ${OSX_SDK_PATH} + PATHS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ + ) if (NOT _OSX_DESIRED_SDK_PATH) message(FATAL_ERROR "Could not find OS X 10.9 SDK. Please pass OSX_SDK_PATH to CMake to point us to your SDKs directory.") From e0d31f6e617fa7dbe2c09f889eb461b2d4e34bc9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 13:52:14 -0800 Subject: [PATCH 247/261] remove extra added spaces --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3fc5b2d2a..8a9c77bc4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,9 +89,9 @@ endif () # figure out where the qt dir is get_filename_component(QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../" ABSOLUTE) -set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) +set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) -if (APPLE) +if (APPLE) # set our OS X deployment target set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) From a7a9ede744bc23e0215ac59cc6e98a27e2775d6e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 13:53:57 -0800 Subject: [PATCH 248/261] handle an SDK in Xcode beta --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a9c77bc4f..75282137dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ if (APPLE) NAME MacOSX10.9.sdk HINTS ${OSX_SDK_PATH} PATHS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ + /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ ) if (NOT _OSX_DESIRED_SDK_PATH) From 5eecb6a8377e1407c17f3e1355a0060249924903 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 14:44:10 -0800 Subject: [PATCH 249/261] correctly delete glbuffers --- libraries/gpu/src/gpu/Context.h | 3 ++- libraries/gpu/src/gpu/GLBackend.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/gpu/src/gpu/Context.h b/libraries/gpu/src/gpu/Context.h index b8cba3ded1..78e58bf721 100644 --- a/libraries/gpu/src/gpu/Context.h +++ b/libraries/gpu/src/gpu/Context.h @@ -11,6 +11,7 @@ #ifndef hifi_gpu_Context_h #define hifi_gpu_Context_h +#include #include #include "Resource.h" @@ -21,7 +22,7 @@ namespace gpu { class GPUObject { public: GPUObject() {} - ~GPUObject() {} + virtual ~GPUObject() {} }; class Batch; diff --git a/libraries/gpu/src/gpu/GLBackend.h b/libraries/gpu/src/gpu/GLBackend.h index e3450ae71a..49d4bd4c19 100644 --- a/libraries/gpu/src/gpu/GLBackend.h +++ b/libraries/gpu/src/gpu/GLBackend.h @@ -32,7 +32,7 @@ public: static void checkGLError(); - class GLBuffer { + class GLBuffer : public GPUObject { public: Stamp _stamp; GLuint _buffer; From af43ba34442afa7b844dc920210b3caab3a4eec5 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 15:21:24 -0800 Subject: [PATCH 250/261] used a registered quad for the audio box since its color constantly changes --- interface/src/audio/AudioToolBox.cpp | 6 +++++- interface/src/audio/AudioToolBox.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/interface/src/audio/AudioToolBox.cpp b/interface/src/audio/AudioToolBox.cpp index e12b7bcbb0..330e7bc194 100644 --- a/interface/src/audio/AudioToolBox.cpp +++ b/interface/src/audio/AudioToolBox.cpp @@ -106,8 +106,12 @@ void AudioToolBox::render(int x, int y, bool boxed) { glm::vec2 bottomRight(_iconBounds.right(), _iconBounds.bottom()); glm::vec2 texCoordTopLeft(1,1); glm::vec2 texCoordBottomRight(0,0); + + if (_boxQuadID == GeometryCache::UNKNOWN_ID) { + _boxQuadID = DependencyManager::get()->allocateID(); + } - DependencyManager::get()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor); + DependencyManager::get()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor, _boxQuadID); glDisable(GL_TEXTURE_2D); } \ No newline at end of file diff --git a/interface/src/audio/AudioToolBox.h b/interface/src/audio/AudioToolBox.h index 2c073c1825..526de89b9c 100644 --- a/interface/src/audio/AudioToolBox.h +++ b/interface/src/audio/AudioToolBox.h @@ -13,6 +13,7 @@ #define hifi_AudioToolBox_h #include +#include class AudioToolBox : public Dependency { SINGLETON_DEPENDENCY @@ -26,6 +27,7 @@ private: GLuint _micTextureId = 0; GLuint _muteTextureId = 0; GLuint _boxTextureId = 0; + int _boxQuadID = GeometryCache::UNKNOWN_ID; QRect _iconBounds; qint64 _iconPulseTimeReference = 0; }; From b03928cec7dae8208bb349d55b40a95f9c69e494 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 16:31:43 -0800 Subject: [PATCH 251/261] some cleanup --- interface/src/Application.cpp | 12 ------------ interface/src/GLCanvas.h | 5 ----- 2 files changed, 17 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 5c6b370cfb..0bdd8f8f53 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -215,7 +215,6 @@ bool setupEssentials(int& argc, char** argv) { DependencyManager::registerInheritance(); // Set dependencies - //auto glCanvasGlobal = DependencyManager::set(); auto addressManager = DependencyManager::set(); auto nodeList = DependencyManager::set(NodeType::Agent, listenPort); auto geometryCache = DependencyManager::set(); @@ -532,8 +531,6 @@ void Application::aboutToQuit() { } void Application::cleanupBeforeQuit() { - qDebug() << "Application::cleanupBeforeQuit() ------------ BEGIN --------------"; - _datagramProcessor.shutdown(); // tell the datagram processor we're shutting down, so it can short circuit _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts ScriptEngine::stopAllScripts(this); // stop all currently running global scripts @@ -577,12 +574,9 @@ void Application::cleanupBeforeQuit() { // destroy the AudioClient so it and its thread have a chance to go down safely DependencyManager::destroy(); - - qDebug() << "Application::cleanupBeforeQuit() ------------ END --------------"; } Application::~Application() { - qDebug() << "Application::~Application() ------------ BEGIN --------------"; EntityTree* tree = _entities.getTree(); tree->lockForWrite(); _entities.getTree()->setSimulation(NULL); @@ -601,19 +595,13 @@ Application::~Application() { ModelEntityItem::cleanupLoadedAnimations() ; - //DependencyManager::destroy(); - - qDebug() << "Application::~Application() ------------ BEGIN CACHE CLEANUP --------------"; DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); - qDebug() << "Application::~Application() ------------ END CACHE CLEANUP --------------"; qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages - - qDebug() << "Application::~Application() ------------ END --------------"; } void Application::initializeGL() { diff --git a/interface/src/GLCanvas.h b/interface/src/GLCanvas.h index 9e75d92b42..e2bbf3b841 100644 --- a/interface/src/GLCanvas.h +++ b/interface/src/GLCanvas.h @@ -16,17 +16,12 @@ #include #include -//#include - /// customized canvas that simply forwards requests/events to the singleton application class GLCanvas : public QGLWidget { Q_OBJECT public: GLCanvas(); - virtual ~GLCanvas() { - qDebug() << "Deleting GLCanvas"; - } bool isThrottleRendering() const; From 05d7d47045b8297057dbe1345dc35e029c74f4d8 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Feb 2015 16:32:48 -0800 Subject: [PATCH 252/261] some cleanup --- libraries/gpu/src/gpu/Context.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/gpu/src/gpu/Context.h b/libraries/gpu/src/gpu/Context.h index 78e58bf721..8140c91bf6 100644 --- a/libraries/gpu/src/gpu/Context.h +++ b/libraries/gpu/src/gpu/Context.h @@ -11,7 +11,6 @@ #ifndef hifi_gpu_Context_h #define hifi_gpu_Context_h -#include #include #include "Resource.h" From 434c0b569f51c10825acd0cbde7299803912a58e Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Thu, 26 Feb 2015 06:28:28 +0530 Subject: [PATCH 253/261] Make vhacd tool optional --- tools/CMakeLists.txt | 4 ++++ tools/vhacd/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 57fe18c53f..003920a442 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -3,4 +3,8 @@ add_subdirectory(bitstream2json) add_subdirectory(json2bitstream) add_subdirectory(mtc) add_subdirectory(scribe) + +find_package(VHACD) +if(VHACD_FOUND) add_subdirectory(vhacd) +endif() diff --git a/tools/vhacd/CMakeLists.txt b/tools/vhacd/CMakeLists.txt index 51e15c8239..db0cc13e67 100644 --- a/tools/vhacd/CMakeLists.txt +++ b/tools/vhacd/CMakeLists.txt @@ -2,7 +2,7 @@ set(TARGET_NAME vhacd) setup_hifi_project() link_hifi_libraries(shared model fbx gpu networking octree) -find_package(VHACD REQUIRED) +#find_package(VHACD REQUIRED) done in CMakeList.txt in parent directory target_include_directories(${TARGET_NAME} PUBLIC ${VHACD_INCLUDE_DIRS}) target_link_libraries(${TARGET_NAME} ${VHACD_LIBRARIES}) From f8627c823357590f904aa9911b6a16e30b7f6d23 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 25 Feb 2015 17:48:26 -0800 Subject: [PATCH 254/261] fix handling for vc12 externals --- cmake/macros/SetupExternalsBinaryDir.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/macros/SetupExternalsBinaryDir.cmake b/cmake/macros/SetupExternalsBinaryDir.cmake index c066363455..04bd00643c 100644 --- a/cmake/macros/SetupExternalsBinaryDir.cmake +++ b/cmake/macros/SetupExternalsBinaryDir.cmake @@ -14,10 +14,12 @@ macro(SETUP_EXTERNALS_BINARY_DIR) # get a short name for the generator to use in the path STRING(REGEX REPLACE " " "-" CMAKE_GENERATOR_FOLDER_NAME ${CMAKE_GENERATOR}) - if (CMAKE_GENERATOR_FOLDER_NAME STREQUAL "Unix-Makefiles") - set(CMAKE_GENERATOR_FOLDER_NAME "makefiles") - elseif (CMAKE_GENERATOR_FOLDER_NAME STREQUAL "Visual-Studio-12") - set(CMAKE_GENERATOR_FOLDER_NAME "vs12") + if (MSVC12) + set(CMAKE_GENERATOR_FOLDER_NAME "vc12") + else () + if (CMAKE_GENERATOR_FOLDER_NAME STREQUAL "Unix-Makefiles") + set(CMAKE_GENERATOR_FOLDER_NAME "makefiles") + endif () endif () set(EXTERNALS_BINARY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build-ext") From ce60bb40d73aa24e4e338ed42dbfe10c5422f739 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Thu, 26 Feb 2015 22:32:47 +0530 Subject: [PATCH 255/261] removed tags for *.md files --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index aee74ebddc..3b44b99e68 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,4 @@ libraries/audio-client/external/*/* gvr-interface/assets/oculussig* gvr-interface/libs/* -TAGS -*.md \ No newline at end of file +TAGS \ No newline at end of file From bdb79f261952f5c081c1b377ca8fe556bd098cef Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Thu, 26 Feb 2015 22:56:21 +0530 Subject: [PATCH 256/261] Resetting from master --- BUILD.md | 9 +-------- BUILD_WIN.md | 43 +++++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/BUILD.md b/BUILD.md index b94ab1ff50..82cbf6628c 100644 --- a/BUILD.md +++ b/BUILD.md @@ -2,20 +2,13 @@ * [cmake](http://www.cmake.org/cmake/resources/software.html) ~> 2.8.12.2 * [Qt](http://qt-project.org/downloads) ~> 5.3.2 +* [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. * [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 * [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 * [Gverb](https://github.com/highfidelity/gverb/archive/master.zip) (direct download to latest version) -* [VHACD](https://github.com/virneo/v-hacd)(clone this repository) - -#### CMake External Project Dependencies - -The following dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build` directory in each of the subfolders for each external project. These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. - -* [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 -* [gverb](https://github.com/highfidelity/gverb) ### OS Specific Build Guides * [BUILD_OSX.md](BUILD_OSX.md) - additional instructions for OS X. diff --git a/BUILD_WIN.md b/BUILD_WIN.md index f735936d0a..8022fae5b8 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -56,6 +56,9 @@ The recommended route for CMake to find the external dependencies is to place al -> bin -> include -> lib + -> glm + -> glm + -> glm.hpp -> openssl -> bin -> include @@ -67,9 +70,6 @@ The recommended route for CMake to find the external dependencies is to place al -> include -> lib -> test - -> vhacd - -> include - -> lib For many of the external libraries where precompiled binaries are readily available you should be able to simply copy the extracted folder that you get from the download links provided at the top of the guide. Otherwise you may need to build from source and install the built product to this directory. The `root_lib_dir` in the above example can be wherever you choose on your system - as long as the environment variable HIFI_LIB_DIR is set to it. From here on, whenever you see %HIFI_LIB_DIR% you should substitute the directory that you chose. @@ -117,21 +117,6 @@ Add to the PATH: `%HIFI_LIB_DIR%\zlib` Important! This should be added at the beginning of the path, not the end (your system likely has many copies of zlib1.dll, and you want High Fidelity to use the correct version). If High Fidelity picks up the wrong zlib1.dll then it might be unable to use it, and that would cause it to fail to start, showing only the cryptic error "The application was unable to start correctly: 0xc0000022". -###vhacd -Download it directly from https://github.com/virneo/v-hacd - -To build it run the following commands - 1. cd src\ - 2. mkdir build - 3. cd build - 4. cmake .. - -Build using visual studio 2013. Build ALL_BUILD and INSTALL targets both in Release and Debug. - -This will create an output folder with include and lib directory inside it. - -Either copy that folder to ENV %HIFI_LIB_DIR%/vhacd or create an environment variable VHACD_ROOT_DIR to this output directory. - ###freeglut Download the binary package: `freeglut-MSVC-2.8.1-1.mp.zip`. Extract to %HIFI_LIB_DIR%\freeglut. @@ -144,6 +129,26 @@ Download the binary package: `glew-1.10.0-win32.zip`. Extract to %HIFI_LIB_DIR%\ Add to the PATH: `%HIFI_LIB_DIR%\glew\bin\Release\Win32` +###GLM + +This package contains only headers, so there's nothing to add to the PATH. + +Be careful with glm. For the folder other libraries would normally call 'include', the folder containing the headers, glm opts to use 'glm'. You will have a glm folder nested inside the top-level glm folder. + +###Gverb + +1. Go to https://github.com/highfidelity/gverb + Or download the sources directly via this link: + https://github.com/highfidelity/gverb/archive/master.zip + +2. Extract the archive + +3. Place the directories “include” and “src” in interface/external/gverb + (Normally next to this readme) + +4. Clear your build directory, run cmake, build and you should be all set. + + ###Bullet Bullet 2.82 source can be [downloaded here](https://code.google.com/p/bullet/downloads/detail?name=bullet-2.82-r2704.zip). Bullet does not come with prebuilt libraries, you need to make those yourself. @@ -181,8 +186,6 @@ We recommend you install it to %HIFI_LIB_DIR%\soxr. This will help our FindSoxr Extract the soxr archive wherever you like. Then, inside the extracted folder, create a directory called `build`. From that build directory, the following commands will build and then install soxr to `%HIFI_LIB_DIR%`. -(Make sure to run the following inside Visual Studio) - ``` cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%HIFI_LIB_DIR%/soxr nmake From 36c3131524a2005cdc11e76ffaf8434751b8f4fd Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Fri, 27 Feb 2015 00:14:46 +0530 Subject: [PATCH 257/261] Rectifying bad merge in BUILD.md and BUILD_WIN.md --- BUILD.md | 37 ++++++--- BUILD_WIN.md | 153 +++++-------------------------------- tools/vhacd/CMakeLists.txt | 4 +- tools/vhacd/src/main.cpp | 5 +- 4 files changed, 50 insertions(+), 149 deletions(-) diff --git a/BUILD.md b/BUILD.md index 82cbf6628c..98b8cffab1 100644 --- a/BUILD.md +++ b/BUILD.md @@ -2,15 +2,31 @@ * [cmake](http://www.cmake.org/cmake/resources/software.html) ~> 2.8.12.2 * [Qt](http://qt-project.org/downloads) ~> 5.3.2 -* [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. -* [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 -* [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 -* [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 -* [Gverb](https://github.com/highfidelity/gverb/archive/master.zip) (direct download to latest version) -### OS Specific Build Guides +####CMake External Project Dependencies + +* [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 +* [Intel Threading Building Blocks](https://www.threadingbuildingblocks.org/) ~> 4.3 +* [glm](http://glm.g-truc.net/0.9.5/index.html) ~> 0.9.5.4 +* [gverb](https://github.com/highfidelity/gverb) +* [Soxr](http://sourceforge.net/projects/soxr/) ~> 0.1.1 + +The following external projects are optional dependencies. You can indicate to CMake that you would like to include them by passing -DGET_$NAME=1 when running a clean CMake build. For example, to get CMake to download and compile QXmpp you would pass -DGET_QXMPP=1. + +* [SDL2](https://www.libsdl.org/download-2.0.php) ~> 2.0.3 + * Enables game controller support in Interface +* [QXmpp](https://github.com/qxmpp-project/qxmpp) ~> 0.7.6 + * Enables text chat support in Interface + +The above dependencies will be downloaded, built, linked and included automatically by CMake where we require them. The CMakeLists files that handle grabbing each of the following external dependencies can be found in the [cmake/externals folder](cmake/externals). The resulting downloads, source files and binaries will be placed in the `build-ext` directory in each of the subfolders for each external project. + +These are not placed in your normal build tree when doing an out of source build so that they do not need to be re-downloaded and re-compiled every time the CMake build folder is cleared. Should you want to force a re-download and re-compile of a specific external, you can simply remove that directory from the appropriate subfolder in `build-ext`. Should you want to force a re-download and re-compile of all externals, just remove the `build-ext` folder. + +If you would like to use a specific install of a dependency instead of the version that would be grabbed as a CMake ExternalProject, you can pass -DGET_$NAME=0 (where $NAME is the name of the subfolder in [cmake/externals](cmake/externals)) when you run CMake to tell it not to get that dependency as an external project. + +###OS Specific Build Guides * [BUILD_OSX.md](BUILD_OSX.md) - additional instructions for OS X. * [BUILD_LINUX.md](BUILD_LINUX.md) - additional instructions for Linux. * [BUILD_WIN.md](BUILD_WIN.md) - additional instructions for Windows. @@ -45,6 +61,9 @@ For example, to pass the QT_CMAKE_PREFIX_PATH variable during build file generat cmake .. -DQT_CMAKE_PREFIX_PATH=/usr/local/qt/5.3.2/lib/cmake ####Finding Dependencies + +The following applies for dependencies we do not grab via CMake ExternalProject (OpenSSL is an example), or for dependencies you have opted not to grab as a CMake ExternalProject (via -DGET_$NAME=0). The list of dependencies we grab by default as external projects can be found in [the CMake External Project Dependencies section](#cmake-external-project-dependencies). + You can point our [Cmake find modules](cmake/modules/) to the correct version of dependencies by setting one of the three following variables to the location of the correct version of the dependency. In the examples below the variable $NAME would be replaced by the name of the dependency in uppercase, and $name would be replaced by the name of the dependency in lowercase (ex: OPENSSL_ROOT_DIR, openssl). @@ -55,12 +74,6 @@ In the examples below the variable $NAME would be replaced by the name of the de ###Optional Components -####QXmpp - -You can [find QXmpp here](https://github.com/qxmpp-project/qxmpp), 0.7.6 is the version you want. The inclusion of the QXmpp enables text chat in the Interface client. - -OS X users who tap our [homebrew formulas repository](https://github.com/highfidelity/homebrew-formulas) can install QXmpp via homebrew - `brew install highfidelity/formulas/qxmpp`. - ####Devices You can support external input/output devices such as Oculus Rift, Leap Motion, Faceshift, PrioVR, MIDI, Razr Hydra and more by adding each individual SDK in the visible building path. Refer to the readme file available in each device folder in [interface/external/](interface/external) for the detailed explanation of the requirements to use the device. diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 8022fae5b8..28d26d9eb4 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -1,12 +1,6 @@ Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only Windows specific instructions are found in this file. -###Windows Specific Dependencies -* [GLEW](http://glew.sourceforge.net/) ~> 1.10.0 -* [freeglut MSVC](http://www.transmissionzero.co.uk/software/freeglut-devel/) ~> 2.8.1 -* [zLib](http://www.zlib.net/) ~> 1.2.8 -* (remember that you need all other dependencies listed in [BUILD.md](BUILD.md)) - -####Visual Studio 2013 +###Visual Studio 2013 You can use the Community or Professional editions of Visual Studio 2013. @@ -16,10 +10,22 @@ Or you can start a regular command prompt and then run: "%VS120COMNTOOLS%\vsvars32.bat" -#####Windows SDK 8.1 +####Windows SDK 8.1 If using Visual Studio 2013 and building as a Visual Studio 2013 project you need the Windows 8 SDK which you should already have as part of installing Visual Studio 2013. You should be able to see it at `C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86`. +####nmake & msbuild + +Some of the external projects may require nmake and msbuild to compile and install. If they are not installed at the locations listed below, please ensure that both are in your PATH so CMake can find them when required. + +We expect nmake.exe to be located at the following path. + + C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin + +We expect msbuild.exe to be located at the following path. + + C:\Program Files (x86)\MSBUILD\12.0\Bin + ###Qt You can use the online installer or the offline installer. If you use the offline installer, be sure to select the "OpenGL" version. @@ -32,9 +38,8 @@ NOTE: Qt does not support 64-bit builds on Windows 7, so you must use the 32-bit * [Download the offline installer](http://download.qt-project.org/official_releases/qt/5.3/5.3.2/qt-opensource-windows-x86-msvc2013_opengl-5.3.2.exe) Once Qt is installed, you need to manually configure the following: -* Make sure the Qt runtime DLLs are loadable. You must do this before you attempt to build because some tools for the build depend on Qt. E.g., add to the PATH: `Qt\5.3.2\msvc2013_opengl\bin\`. -* Go to Control Panel > System > Advanced System Settings > Environment Variables > New ... -* Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.3.2\msvc2013_opengl` directory. +* Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.3.2\msvc2013_opengl\lib\cmake` directory. + * You can set an environment variable from Control Panel > System > Advanced System Settings > Environment Variables > New ###External Libraries @@ -42,40 +47,19 @@ As it stands, Hifi/Interface is a 32-bit application, so all libraries should al CMake will need to know where the headers and libraries for required external dependencies are. +We use CMake's `fixup_bundle` to find the DLLs all of our exectuable targets require, and then copy them beside the executable in a post-build step. If `fixup_bundle` is having problems finding a DLL, you can fix it manually on your end by adding the folder containing that DLL to your path. Let us know which DLL CMake had trouble finding, as it is possible a tweak to our CMake files is required. + The recommended route for CMake to find the external dependencies is to place all of the dependencies in one folder and set one ENV variable - HIFI_LIB_DIR. That ENV variable should point to a directory with the following structure: root_lib_dir - -> bullet - -> include - -> lib - -> freeglut - -> bin - -> include - -> lib - -> glew - -> bin - -> include - -> lib - -> glm - -> glm - -> glm.hpp -> openssl -> bin -> include -> lib - -> tbb - -> include - -> lib - -> zlib - -> include - -> lib - -> test For many of the external libraries where precompiled binaries are readily available you should be able to simply copy the extracted folder that you get from the download links provided at the top of the guide. Otherwise you may need to build from source and install the built product to this directory. The `root_lib_dir` in the above example can be wherever you choose on your system - as long as the environment variable HIFI_LIB_DIR is set to it. From here on, whenever you see %HIFI_LIB_DIR% you should substitute the directory that you chose. -As with the Qt libraries, you will need to make sure that directories containing DLL'S are in your path. Where possible, you can use static builds of the external dependencies to avoid this requirement. - -###OpenSSL +####OpenSSL Qt will use OpenSSL if it's available, but it doesn't install it, so you must install it separately. @@ -95,107 +79,10 @@ To prevent these problems, install OpenSSL yourself. Download the following bina Install OpenSSL into the Windows system directory, to make sure that Qt uses the version that you've just installed, and not some other version. -###Intel Threading Building Blocks (TBB) - -Download the zip from the [TBB website](https://www.threadingbuildingblocks.org/). - -We recommend you extract it to %HIFI_LIB_DIR%\tbb. This will help our FindTBB cmake module find what it needs. You can place it wherever you like on your machine if you specify TBB_ROOT_DIR as an environment variable or a variable passed when cmake is run. - -###Zlib - -Download the compiled DLL from the [zlib website](http://www.zlib.net/). Extract to %HIFI_LIB_DIR%\zlib. - -Add the following environment variables (remember to substitute your own directory for %HIFI_LIB_DIR%): - - ZLIB_LIBRARY=%HIFI_LIB_DIR%\zlib\lib\zdll.lib - ZLIB_INCLUDE_DIR=%HIFI_LIB_DIR%\zlib\include - -Add to the PATH: `%HIFI_LIB_DIR%\zlib` - -(The PATH environment variable is where Windows looks for its DLL's and executables. There's a great tool for editing these variables with ease, [Rapid Environment Editor](http://www.rapidee.com/en/download)) - -Important! This should be added at the beginning of the path, not the end (your -system likely has many copies of zlib1.dll, and you want High Fidelity to use the correct version). If High Fidelity picks up the wrong zlib1.dll then it might be unable to use it, and that would cause it to fail to start, showing only the cryptic error "The application was unable to start correctly: 0xc0000022". - -###freeglut - -Download the binary package: `freeglut-MSVC-2.8.1-1.mp.zip`. Extract to %HIFI_LIB_DIR%\freeglut. - -Add to the PATH: `%HIFI_LIB_DIR%\freeglut\bin` - -###GLEW - -Download the binary package: `glew-1.10.0-win32.zip`. Extract to %HIFI_LIB_DIR%\glew (you'll need to rename the default directory name). - -Add to the PATH: `%HIFI_LIB_DIR%\glew\bin\Release\Win32` - -###GLM - -This package contains only headers, so there's nothing to add to the PATH. - -Be careful with glm. For the folder other libraries would normally call 'include', the folder containing the headers, glm opts to use 'glm'. You will have a glm folder nested inside the top-level glm folder. - -###Gverb - -1. Go to https://github.com/highfidelity/gverb - Or download the sources directly via this link: - https://github.com/highfidelity/gverb/archive/master.zip - -2. Extract the archive - -3. Place the directories “include” and “src” in interface/external/gverb - (Normally next to this readme) - -4. Clear your build directory, run cmake, build and you should be all set. - - -###Bullet - -Bullet 2.82 source can be [downloaded here](https://code.google.com/p/bullet/downloads/detail?name=bullet-2.82-r2704.zip). Bullet does not come with prebuilt libraries, you need to make those yourself. - -* Download the zip file and extract into a temporary folder -* Create a directory named cmakebuild. Bullet comes with a build\ directory by default, however, that directory is intended for use with premake, and considering premake doesn't support VS2013, we prefer to run the cmake build on its own directory. -* Make the following modifications to Bullet's source: - 1. In file: Extras\HACD\hacdICHull.cpp --- in line: 17 --- insert: #include <algorithm> - 2. In file: src\MiniCL\cl_MiniCL_Defs.h --- comment lines 364 to 372 - 3. In file: CMakeLists.txt set to ON the option USE_MSVC_RUNTIME_LIBRARY_DLL in line 27 - -Then create the Visual Studio solution and build the libraries - run the following commands from a Visual Studio 2013 command prompt, from within the cmakebuild directory created before: - -```shell -cmake .. -G "Visual Studio 12" -msbuild BULLET_PHYSICS.sln /p:Configuration=Debug -``` - -This will create Debug libraries in cmakebuild\lib\Debug. You can replace Debug with Release in the msbuild command and that will generate Release libraries in cmakebuild\lib\Release. - -You now have Bullet libraries compiled, now you need to put them in the right place for hifi to find them: - -* Create a directory named bullet\ inside your %HIFI_LIB_DIR% -* Create two directores named lib\ and include\ inside bullet\ -* Copy all the contents inside src\ from the bullet unzip path into %HIFI_LIB_DIR%\bullet\include\ -* Copy all the contents inside cmakebuild\lib\ into %HIFI_LIB_DIR\bullet\lib - -_Note that the INSTALL target should handle the copying of files into an install directory automatically, however, without modifications to Cmake, the install target didn't work right for me, please update this instructions if you get that working right - Leo <leo@highfidelity.io>_ - -###Soxr - -Download the zip from the [soxr sourceforge page](http://sourceforge.net/projects/soxr/). - -We recommend you install it to %HIFI_LIB_DIR%\soxr. This will help our FindSoxr cmake module find what it needs. You can place it wherever you like on your machine if you specify SOXR_ROOT_DIR as an environment variable or a variable passed when cmake is run. - -Extract the soxr archive wherever you like. Then, inside the extracted folder, create a directory called `build`. From that build directory, the following commands will build and then install soxr to `%HIFI_LIB_DIR%`. - -``` -cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%HIFI_LIB_DIR%/soxr -nmake -nmake install -``` - ###Build High Fidelity using Visual Studio Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake. - cmake .. -DZLIB_LIBRARY=%ZLIB_LIBRARY% -DZLIB_INCLUDE_DIR=%ZLIB_INCLUDE_DIR% -G "Visual Studio 12" + cmake .. -G "Visual Studio 12" Open %HIFI_DIR%\build\hifi.sln and compile. diff --git a/tools/vhacd/CMakeLists.txt b/tools/vhacd/CMakeLists.txt index db0cc13e67..31a7f7c8e2 100644 --- a/tools/vhacd/CMakeLists.txt +++ b/tools/vhacd/CMakeLists.txt @@ -18,8 +18,6 @@ if(NOT WIN32) endif() endif() -add_dependency_external_project(glm) +add_dependency_external_projects(glm) find_package(GLM REQUIRED) target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS}) - -include_dependency_includes() diff --git a/tools/vhacd/src/main.cpp b/tools/vhacd/src/main.cpp index 31866a7cfc..3d7f2d7504 100644 --- a/tools/vhacd/src/main.cpp +++ b/tools/vhacd/src/main.cpp @@ -27,7 +27,10 @@ int main(int argc, char * argv[]){ vhacd::ComputeResults results; // results after computing vhacd VHACD::IVHACD::Parameters params; vhacd::ProgressCallback pCallBack; - + if (argc < 2){ + cout << "please provide a FBX file as argument\n "; + return 1; + } string filename(argv[1]); if (filename.empty()){ cout << "please provide a FBX file as argument\n "; From 95839dd64e9caec0138efb7f6a308b23bd0da0f3 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Fri, 27 Feb 2015 00:27:18 +0530 Subject: [PATCH 258/261] untabify the source files --- tools/vhacd/src/VHACDUtil.cpp | 155 ++++++++++++++++----------------- tools/vhacd/src/VHACDUtil.h | 47 +++++----- tools/vhacd/src/main.cpp | 157 +++++++++++++++++----------------- 3 files changed, 180 insertions(+), 179 deletions(-) diff --git a/tools/vhacd/src/VHACDUtil.cpp b/tools/vhacd/src/VHACDUtil.cpp index 95e78b212d..d4ab9d7c8a 100644 --- a/tools/vhacd/src/VHACDUtil.cpp +++ b/tools/vhacd/src/VHACDUtil.cpp @@ -16,104 +16,105 @@ //Read all the meshes from provided FBX file bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *results){ - // open the fbx file - QFile fbx(filename); - if (!fbx.open(QIODevice::ReadOnly)) { - return false; - } - std::cout << "Reading FBX.....\n"; + // open the fbx file + QFile fbx(filename); + if (!fbx.open(QIODevice::ReadOnly)) { + return false; + } + std::cout << "Reading FBX.....\n"; - QByteArray fbxContents = fbx.readAll(); - FBXGeometry geometry = readFBX(fbxContents, QVariantHash()); - //results->meshCount = geometry.meshes.count(); - - int count = 0; - foreach(FBXMesh mesh, geometry.meshes) { - //get vertices for each mesh - QVector vertices = mesh.vertices; + QByteArray fbxContents = fbx.readAll(); + FBXGeometry geometry = readFBX(fbxContents, QVariantHash()); + //results->meshCount = geometry.meshes.count(); + + int count = 0; + foreach(FBXMesh mesh, geometry.meshes) { + //get vertices for each mesh + QVector vertices = mesh.vertices; - //get the triangle indices for each mesh - QVector triangles; - foreach(FBXMeshPart part, mesh.parts) { - QVector indices = part.triangleIndices; - triangles += indices; - } + //get the triangle indices for each mesh + QVector triangles; + foreach(FBXMeshPart part, mesh.parts) { + QVector indices = part.triangleIndices; + triangles += indices; + } - //only read meshes with triangles - if (triangles.count() <= 0) - continue; - results->perMeshVertices.append(vertices); - results->perMeshTriangleIndices.append(triangles); - count++; - } + //only read meshes with triangles + if (triangles.count() <= 0) + continue; + results->perMeshVertices.append(vertices); + results->perMeshTriangleIndices.append(triangles); + count++; + } - results->meshCount = count; - return true; + results->meshCount = count; + return true; } bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const{ - VHACD::IVHACD * interfaceVHACD = VHACD::CreateVHACD(); - int meshCount = meshes->meshCount; - int count = 0; - std::cout << "Performing V-HACD computation on " << meshCount <<" meshes ..... " << std::endl; + VHACD::IVHACD * interfaceVHACD = VHACD::CreateVHACD(); + int meshCount = meshes->meshCount; + int count = 0; + std::cout << "Performing V-HACD computation on " << meshCount <<" meshes ..... " << std::endl; - for (int i = 0; i < meshCount; i++){ - - std::vector vertices = meshes->perMeshVertices.at(i).toStdVector(); - std::vector triangles = meshes->perMeshTriangleIndices.at(i).toStdVector(); - int nPoints = (unsigned int)vertices.size(); - int nTriangles = (unsigned int)triangles.size() / 3; - std::cout << "Mesh " << i + 1 << " : "; - // compute approximate convex decomposition - bool res = interfaceVHACD->Compute(&vertices[0].x, 3, nPoints, &triangles[0], 3, nTriangles, params); - if (!res){ - std::cout << "V-HACD computation failed for Mesh : " << i + 1 << std::endl; - continue; - } - count++; //For counting number of successfull computations + for (int i = 0; i < meshCount; i++){ + + std::vector vertices = meshes->perMeshVertices.at(i).toStdVector(); + std::vector triangles = meshes->perMeshTriangleIndices.at(i).toStdVector(); + int nPoints = (unsigned int)vertices.size(); + int nTriangles = (unsigned int)triangles.size() / 3; + std::cout << "Mesh " << i + 1 << " : "; + // compute approximate convex decomposition + bool res = interfaceVHACD->Compute(&vertices[0].x, 3, nPoints, &triangles[0], 3, nTriangles, params); + if (!res){ + std::cout << "V-HACD computation failed for Mesh : " << i + 1 << std::endl; + continue; + } + count++; //For counting number of successfull computations - //Number of hulls for the mesh - unsigned int nConvexHulls = interfaceVHACD->GetNConvexHulls(); - results->convexHullsCountList.append(nConvexHulls); + //Number of hulls for the mesh + unsigned int nConvexHulls = interfaceVHACD->GetNConvexHulls(); + results->convexHullsCountList.append(nConvexHulls); - //get all the convex hulls for this mesh - QVector convexHulls; - for (unsigned int j = 0; j < nConvexHulls; j++){ - VHACD::IVHACD::ConvexHull hull; - interfaceVHACD->GetConvexHull(j, hull); - convexHulls.append(hull); - } - results->convexHullList.append(convexHulls); - } //end of for loop + //get all the convex hulls for this mesh + QVector convexHulls; + for (unsigned int j = 0; j < nConvexHulls; j++){ + VHACD::IVHACD::ConvexHull hull; + interfaceVHACD->GetConvexHull(j, hull); + convexHulls.append(hull); + } + results->convexHullList.append(convexHulls); + } //end of for loop - results->meshCount = count; + results->meshCount = count; - //release memory - interfaceVHACD->Clean(); - interfaceVHACD->Release(); + //release memory + interfaceVHACD->Clean(); + interfaceVHACD->Release(); - if (count > 0) - return true; - else - return false; + if (count > 0) + return true; + else + return false; } vhacd::VHACDUtil:: ~VHACDUtil(){ - //nothing to be cleaned + //nothing to be cleaned } //ProgressClaback implementation -void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation){ - int progress = (int)(overallProgress + 0.5); +void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, + const char * const stage, const char * const operation){ + int progress = (int)(overallProgress + 0.5); - if (progress < 10) - std::cout << "\b\b"; - else - std::cout << "\b\b\b"; - std::cout << progress << "%"; + if (progress < 10) + std::cout << "\b\b"; + else + std::cout << "\b\b\b"; + std::cout << progress << "%"; - if (progress >= 100) - std::cout << std::endl; + if (progress >= 100) + std::cout << std::endl; } diff --git a/tools/vhacd/src/VHACDUtil.h b/tools/vhacd/src/VHACDUtil.h index 036d4ce526..b87ba07ff0 100644 --- a/tools/vhacd/src/VHACDUtil.h +++ b/tools/vhacd/src/VHACDUtil.h @@ -23,32 +23,33 @@ namespace vhacd{ - typedef struct{ - int meshCount; - QVector convexHullsCountList; - QVector> convexHullList; - }ComputeResults; + typedef struct{ + int meshCount; + QVector convexHullsCountList; + QVector> convexHullList; + }ComputeResults; - typedef struct{ - int meshCount; - QVector> perMeshVertices; - QVector> perMeshTriangleIndices; - }LoadFBXResults; + typedef struct{ + int meshCount; + QVector> perMeshVertices; + QVector> perMeshTriangleIndices; + }LoadFBXResults; - class VHACDUtil{ - public: - bool loadFBX(const QString filename, vhacd::LoadFBXResults *results); - bool computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const; - ~VHACDUtil(); - }; + class VHACDUtil{ + public: + bool loadFBX(const QString filename, vhacd::LoadFBXResults *results); + bool computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD::Parameters params, vhacd::ComputeResults *results)const; + ~VHACDUtil(); + }; - class ProgressCallback : public VHACD::IVHACD::IUserCallback{ - public: - ProgressCallback(void); - ~ProgressCallback(); + class ProgressCallback : public VHACD::IVHACD::IUserCallback{ + public: + ProgressCallback(void); + ~ProgressCallback(); - //Couldn't follow coding guideline here due to virtual function declared in IUserCallback - void Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation); - }; + //Couldn't follow coding guideline here due to virtual function declared in IUserCallback + void Update(const double overallProgress, const double stageProgress, const double operationProgress, + const char * const stage, const char * const operation); + }; } #endif //hifi_VHACDUtil_h \ No newline at end of file diff --git a/tools/vhacd/src/main.cpp b/tools/vhacd/src/main.cpp index 3d7f2d7504..e43f712fa0 100644 --- a/tools/vhacd/src/main.cpp +++ b/tools/vhacd/src/main.cpp @@ -20,93 +20,92 @@ using namespace std; using namespace VHACD; int main(int argc, char * argv[]){ - vector triangles; // array of indexes - vector points; // array of coordinates - vhacd::VHACDUtil vUtil; - vhacd::LoadFBXResults fbx; //mesh data from loaded fbx file - vhacd::ComputeResults results; // results after computing vhacd - VHACD::IVHACD::Parameters params; - vhacd::ProgressCallback pCallBack; - if (argc < 2){ - cout << "please provide a FBX file as argument\n "; - return 1; - } - string filename(argv[1]); - if (filename.empty()){ - cout << "please provide a FBX file as argument\n "; - return 1; - } + vector triangles; // array of indexes + vector points; // array of coordinates + vhacd::VHACDUtil vUtil; + vhacd::LoadFBXResults fbx; //mesh data from loaded fbx file + vhacd::ComputeResults results; // results after computing vhacd + VHACD::IVHACD::Parameters params; + vhacd::ProgressCallback pCallBack; + if (argc < 2){ + cout << "please provide a FBX file as argument\n "; + return 1; + } + string filename(argv[1]); + if (filename.empty()){ + cout << "please provide a FBX file as argument\n "; + return 1; + } - QString fname = QString::fromStdString(filename); + QString fname = QString::fromStdString(filename); - //set parameters for V-HACD - params.m_callback = &pCallBack; //progress callback - params.m_resolution = 50000; - params.m_depth = 10; - params.m_concavity = 0.003; - params.m_alpha = 0.05; // controls the bias toward clipping along symmetry planes - params.m_pca = 1; // enable/disable normalizing the mesh before applying the convex decomposition - params.m_mode = 1; // 0: voxel - based approximate convex decomposition, 1 : tetrahedron - based approximate convex decomposition - params.m_maxNumVerticesPerCH = 128; - params.m_minVolumePerCH = 0.0001; // controls the adaptive sampling of the generated convex - hulls + //set parameters for V-HACD + params.m_callback = &pCallBack; //progress callback + params.m_resolution = 50000; + params.m_depth = 10; + params.m_concavity = 0.003; + params.m_alpha = 0.05; // controls the bias toward clipping along symmetry planes + params.m_pca = 1; // enable/disable normalizing the mesh before applying the convex decomposition + params.m_mode = 1; // 0: voxel - based approximate convex decomposition, 1 : tetrahedron - based approximate convex decomposition + params.m_maxNumVerticesPerCH = 128; + params.m_minVolumePerCH = 0.0001; // controls the adaptive sampling of the generated convex - hulls - // load the mesh + // load the mesh - auto begin = std::chrono::high_resolution_clock::now(); - if (!vUtil.loadFBX(fname, &fbx)){ - cout << "Error in opening FBX file...."; - return 1; - } - auto end = std::chrono::high_resolution_clock::now(); - auto loadDuration = std::chrono::duration_cast(end - begin).count(); + auto begin = std::chrono::high_resolution_clock::now(); + if (!vUtil.loadFBX(fname, &fbx)){ + cout << "Error in opening FBX file...."; + return 1; + } + auto end = std::chrono::high_resolution_clock::now(); + auto loadDuration = std::chrono::duration_cast(end - begin).count(); - //perform vhacd computation - begin = std::chrono::high_resolution_clock::now(); - if (!vUtil.computeVHACD(&fbx, params, &results)){ - cout << "Compute Failed..."; - return 1; - } - end = std::chrono::high_resolution_clock::now(); - auto computeDuration = std::chrono::duration_cast(end - begin).count(); + //perform vhacd computation + begin = std::chrono::high_resolution_clock::now(); + if (!vUtil.computeVHACD(&fbx, params, &results)){ + cout << "Compute Failed..."; + return 1; + } + end = std::chrono::high_resolution_clock::now(); + auto computeDuration = std::chrono::duration_cast(end - begin).count(); - int totalVertices = 0; - for (int i = 0; i < fbx.meshCount; i++){ - totalVertices += fbx.perMeshVertices.at(i).count(); - } + int totalVertices = 0; + for (int i = 0; i < fbx.meshCount; i++){ + totalVertices += fbx.perMeshVertices.at(i).count(); + } - int totalTriangles = 0; - for (int i = 0; i < fbx.meshCount; i++){ - totalTriangles += fbx.perMeshTriangleIndices.at(i).count(); - } + int totalTriangles = 0; + for (int i = 0; i < fbx.meshCount; i++){ + totalTriangles += fbx.perMeshTriangleIndices.at(i).count(); + } - int totalHulls = 0; - QVector hullCounts = results.convexHullsCountList; - for (int i = 0; i < results.meshCount; i++){ - totalHulls += hullCounts.at(i); - } - cout << endl << "Summary of V-HACD Computation..................." << endl; - cout << "File Path : " << fname.toStdString() << endl; - cout << "Number Of Meshes : " << fbx.meshCount << endl; - cout << "Processed Meshes : " << results.meshCount << endl; - cout << "Total vertices : " << totalVertices << endl; - cout << "Total Triangles : " << totalTriangles << endl; - cout << "Total Convex Hulls : " << totalHulls << endl; - cout << "Total FBX load time: " << (double)loadDuration / 1000000000.00 << " seconds" << endl; - cout << "V-HACD Compute time: " << (double)computeDuration / 1000000000.00 << " seconds" << endl; - cout << endl << "Summary per convex hull ........................" << endl < chList = results.convexHullList.at(i); - cout << "\t" << "Number Of Hulls : " << chList.count() << endl; + int totalHulls = 0; + QVector hullCounts = results.convexHullsCountList; + for (int i = 0; i < results.meshCount; i++){ + totalHulls += hullCounts.at(i); + } + cout << endl << "Summary of V-HACD Computation..................." << endl; + cout << "File Path : " << fname.toStdString() << endl; + cout << "Number Of Meshes : " << fbx.meshCount << endl; + cout << "Processed Meshes : " << results.meshCount << endl; + cout << "Total vertices : " << totalVertices << endl; + cout << "Total Triangles : " << totalTriangles << endl; + cout << "Total Convex Hulls : " << totalHulls << endl; + cout << "Total FBX load time: " << (double)loadDuration / 1000000000.00 << " seconds" << endl; + cout << "V-HACD Compute time: " << (double)computeDuration / 1000000000.00 << " seconds" << endl; + cout << endl << "Summary per convex hull ........................" << endl < chList = results.convexHullList.at(i); + cout << "\t" << "Number Of Hulls : " << chList.count() << endl; - for (int j = 0; j < results.convexHullList.at(i).count(); j++){ + for (int j = 0; j < results.convexHullList.at(i).count(); j++){ + cout << "\tHUll : " << j + 1 << endl; + cout << "\t\tNumber Of Points : " << chList.at(j).m_nPoints << endl; + cout << "\t\tNumber Of Triangles : " << chList.at(j).m_nTriangles << endl; + } + } - cout << "\tHUll : " << j + 1 << endl; - cout << "\t\tNumber Of Points : " << chList.at(j).m_nPoints << endl; - cout << "\t\tNumber Of Triangles : " << chList.at(j).m_nTriangles << endl; - } - } - - getchar(); - return 0; + getchar(); + return 0; } \ No newline at end of file From 93106be46663ed09ec3f125adc9bc6f7533476d5 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Fri, 27 Feb 2015 00:58:55 +0530 Subject: [PATCH 259/261] VHACD dependency build instructions --- BUILD.md | 2 +- BUILD_WIN.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index 98b8cffab1..6968d9bde8 100644 --- a/BUILD.md +++ b/BUILD.md @@ -4,7 +4,7 @@ * [Qt](http://qt-project.org/downloads) ~> 5.3.2 * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. - +* [VHACD](https://github.com/virneo/v-hacd)(clone this repository)(Optional) ####CMake External Project Dependencies * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82 diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 28d26d9eb4..df50fd82c8 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -79,6 +79,21 @@ To prevent these problems, install OpenSSL yourself. Download the following bina Install OpenSSL into the Windows system directory, to make sure that Qt uses the version that you've just installed, and not some other version. +###vhacd +Download it directly from https://github.com/virneo/v-hacd + +To build it run the following commands + 1. cd src\ + 2. mkdir build + 3. cd build + 4. cmake .. + +Build using visual studio 2013. Build ALL_BUILD and INSTALL targets both in Release and Debug. + +This will create an output folder with include and lib directory inside it. + +Either copy the contents of output folder to ENV %HIFI_LIB_DIR%/vhacd or create an environment variable VHACD_ROOT_DIR to this output directory. + ###Build High Fidelity using Visual Studio Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake. From d4367924ad5b0646f3cf682e3b0dbf836f8cc995 Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Fri, 27 Feb 2015 00:59:59 +0530 Subject: [PATCH 260/261] Clean up coding standard violations --- tools/vhacd/src/VHACDUtil.cpp | 41 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/tools/vhacd/src/VHACDUtil.cpp b/tools/vhacd/src/VHACDUtil.cpp index d4ab9d7c8a..63b3bba459 100644 --- a/tools/vhacd/src/VHACDUtil.cpp +++ b/tools/vhacd/src/VHACDUtil.cpp @@ -26,25 +26,26 @@ bool vhacd::VHACDUtil::loadFBX(const QString filename, vhacd::LoadFBXResults *re QByteArray fbxContents = fbx.readAll(); FBXGeometry geometry = readFBX(fbxContents, QVariantHash()); //results->meshCount = geometry.meshes.count(); - + int count = 0; - foreach(FBXMesh mesh, geometry.meshes) { + foreach(FBXMesh mesh, geometry.meshes){ //get vertices for each mesh - QVector vertices = mesh.vertices; + QVector vertices = mesh.vertices; //get the triangle indices for each mesh QVector triangles; - foreach(FBXMeshPart part, mesh.parts) { + foreach(FBXMeshPart part, mesh.parts){ QVector indices = part.triangleIndices; triangles += indices; } //only read meshes with triangles - if (triangles.count() <= 0) - continue; + if (triangles.count() <= 0){ + continue; + } results->perMeshVertices.append(vertices); results->perMeshTriangleIndices.append(triangles); - count++; + count++; } results->meshCount = count; @@ -55,10 +56,10 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD VHACD::IVHACD * interfaceVHACD = VHACD::CreateVHACD(); int meshCount = meshes->meshCount; int count = 0; - std::cout << "Performing V-HACD computation on " << meshCount <<" meshes ..... " << std::endl; + std::cout << "Performing V-HACD computation on " << meshCount << " meshes ..... " << std::endl; for (int i = 0; i < meshCount; i++){ - + std::vector vertices = meshes->perMeshVertices.at(i).toStdVector(); std::vector triangles = meshes->perMeshTriangleIndices.at(i).toStdVector(); int nPoints = (unsigned int)vertices.size(); @@ -92,10 +93,13 @@ bool vhacd::VHACDUtil::computeVHACD(vhacd::LoadFBXResults *meshes, VHACD::IVHACD interfaceVHACD->Clean(); interfaceVHACD->Release(); - if (count > 0) + if (count > 0){ return true; - else + } + else{ return false; + } + } vhacd::VHACDUtil:: ~VHACDUtil(){ @@ -103,19 +107,22 @@ vhacd::VHACDUtil:: ~VHACDUtil(){ } //ProgressClaback implementation -void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, +void vhacd::ProgressCallback::Update(const double overallProgress, const double stageProgress, const double operationProgress, const char * const stage, const char * const operation){ int progress = (int)(overallProgress + 0.5); - if (progress < 10) + if (progress < 10){ std::cout << "\b\b"; - else + } + else{ std::cout << "\b\b\b"; + } + std::cout << progress << "%"; - if (progress >= 100) - std::cout << std::endl; - + if (progress >= 100){ + std::cout << std::endl; + } } vhacd::ProgressCallback::ProgressCallback(void){} From 695cfb3397485b028bfefac9b4311e3340f5e2ba Mon Sep 17 00:00:00 2001 From: Virendra Singh Date: Fri, 27 Feb 2015 01:04:23 +0530 Subject: [PATCH 261/261] VHACD dependency build instructions --- BUILD.md | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.md b/BUILD.md index 6968d9bde8..f2efe05289 100644 --- a/BUILD.md +++ b/BUILD.md @@ -5,6 +5,7 @@ * [OpenSSL](https://www.openssl.org/related/binaries.html) ~> 1.0.1g * IMPORTANT: OpenSSL 1.0.1g is critical to avoid a security vulnerability. * [VHACD](https://github.com/virneo/v-hacd)(clone this repository)(Optional) + ####CMake External Project Dependencies * [Bullet Physics Engine](https://code.google.com/p/bullet/downloads/list) ~> 2.82