Compare commits

..

1 commit

Author SHA1 Message Date
83ce0342f4
Update FUNDING.yml 2023-03-09 12:56:00 +01:00
1235 changed files with 51158 additions and 48444 deletions

View file

@ -1,6 +1,6 @@
# Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2020-2022 Vircadia contributors.
# Copyright 2021-2024 Overte e.V.
# Copyright 2021-2023 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
name: Linux Server CI Build
@ -12,10 +12,6 @@ on:
push:
branches:
- master
tags:
# Release tags. E.g. 2024.06.1
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- "[0-9][0-9][0-9][0-9].[0-9][0-9].**"
env:
BUILD_TYPE: Release
@ -23,8 +19,6 @@ env:
UPLOAD_BUCKET: overte-public
UPLOAD_REGION: fra1
UPLOAD_ENDPOINT: "https://fra1.digitaloceanspaces.com"
# Disable VCPKG caching to save time.
VCPKG_FEATURE_FLAGS: -binarycaching
jobs:
build:
@ -35,79 +29,59 @@ jobs:
matrix:
include:
- os: debian-11
image: docker.io/overte/overte-server-build:0.1.3-debian-11-amd64
image: docker.io/overte/overte-server-build:0.1.2-debian-11-amd64
arch: amd64
# https://github.com/testflows/TestFlows-GitHub-Hetzner-Runners/wiki/Meta-Labels
# self_hosted makes the Hetzner auto-scaler put up the job.
# type-cx52 is a Hetzner VPS server type. In this case cs52 is a server with 16-cores and 32GB of RAM.
# image-x86-app-docker-ce is a Hetzner image.
# https://github.com/testflows/TestFlows-GitHub-Hetzner-Runners/wiki/Specifying-The-Runner-Image
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
runner: ubuntu-latest
- os: debian-11
image: docker.io/overte/overte-server-build:0.1.3-debian-11-aarch64
image: docker.io/overte/overte-server-build:0.1.2-debian-11-aarch64
arch: aarch64
runner: [self_hosted, type-cax41, image-arm-app-docker-ce]
runner: linux_aarch64
- os: debian-12
image: docker.io/overte/overte-server-build:0.1.3-debian-12-amd64
- os: ubuntu-18.04
image: docker.io/overte/overte-server-build:0.1.1-ubuntu-18.04-amd64
arch: amd64
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
- os: debian-12
image: docker.io/overte/overte-server-build:0.1.3-debian-12-aarch64
arch: aarch64
runner: [self_hosted, type-cax41, image-arm-app-docker-ce]
runner: ubuntu-latest
- os: ubuntu-20.04
image: docker.io/overte/overte-server-build:0.1.3-ubuntu-20.04-amd64
image: docker.io/overte/overte-server-build:0.1.1-ubuntu-20.04-amd64
arch: amd64
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
runner: ubuntu-latest
- os: ubuntu-22.04
image: docker.io/overte/overte-server-build:0.1.3-ubuntu-22.04-amd64
image: docker.io/overte/overte-server-build:0.1.1-ubuntu-22.04-amd64
arch: amd64
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
runner: ubuntu-latest
- os: ubuntu-22.04
image: docker.io/overte/overte-server-build:0.1.3-ubuntu-22.04-aarch64
image: docker.io/overte/overte-server-build:0.1.1-ubuntu-22.04-aarch64
arch: aarch64
runner: [self_hosted, type-cax41, image-arm-app-docker-ce]
runner: linux_aarch64
- os: ubuntu-24.04
image: docker.io/overte/overte-server-build:0.1.3-ubuntu-24.04-amd64
- os: fedora-36
image: docker.io/overte/overte-server-build:0.1.2-fedora-36-amd64
arch: amd64
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
runner: ubuntu-latest
- os: ubuntu-24.04
image: docker.io/overte/overte-server-build:0.1.3-ubuntu-24.04-aarch64
- os: fedora-36
image: docker.io/overte/overte-server-build:0.1.2-fedora-36-aarch64
arch: aarch64
runner: [self_hosted, type-cax41, image-arm-app-docker-ce]
runner: linux_aarch64
- os: fedora-39
image: docker.io/overte/overte-server-build:0.1.4-fedora-39-amd64
- os: fedora-37
image: docker.io/overte/overte-server-build:0.1.2-fedora-37-amd64
arch: amd64
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
runner: ubuntu-latest
- os: fedora-39
image: docker.io/overte/overte-server-build:0.1.4-fedora-39-aarch64
- os: fedora-37
image: docker.io/overte/overte-server-build:0.1.2-fedora-37-aarch64
arch: aarch64
runner: [self_hosted, type-cax41, image-arm-app-docker-ce]
- os: fedora-40
image: docker.io/overte/overte-server-build:0.1.4-fedora-39-amd64
arch: amd64
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
- os: fedora-40
image: docker.io/overte/overte-server-build:0.1.4-fedora-39-aarch64
arch: aarch64
runner: [self_hosted, type-cax41, image-arm-app-docker-ce]
runner: linux_aarch64
- os: rockylinux-9
image: docker.io/overte/overte-server-build:0.1.3-rockylinux-9-amd64
image: docker.io/overte/overte-server-build:0.1.2-rockylinux-9-amd64
arch: amd64
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
runner: ubuntu-latest
fail-fast: false
@ -115,14 +89,6 @@ jobs:
container: ${{matrix.image}}
steps:
- name: Clear Working Directories
if: contains(matrix.runner, 'linux_aarch64') || contains(matrix.runner, 'linux_amd64')
shell: bash
run: |
rm -rf ./*
rm -rf ~/overte-files
rm -rf ~/.cache
- name: Configure Build Environment 1
shell: bash
run: |
@ -151,7 +117,7 @@ jobs:
fi
# Tagged builds. E.g. release or release candidate builds.
if [ "${{github.ref_type}}" == "tag" ]; then
if [ "${{github.event_name}}" != "pull_request" ]; then
echo "PRODUCTION_BUILD=true" >> $GITHUB_ENV
fi
@ -185,30 +151,16 @@ jobs:
echo "UPLOAD_PREFIX=build/overte/master" >> $GITHUB_ENV
echo "RELEASE_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
else # tagged
echo "DEBVERSION=${{ github.ref_name }}-$GIT_COMMIT_SHORT-${{ matrix.os }}" >> $GITHUB_ENV
echo "RPMVERSION=${{ github.ref_name }}.$GIT_COMMIT_SHORT" >> $GITHUB_ENV
echo "DEBVERSION=${{ github.run_number }}-${{ github.ref_name }}-$GIT_COMMIT_SHORT-${{ matrix.os }}" >> $GITHUB_ENV
echo "RPMVERSION=${${{ github.ref_name }}//-/.}.${{ github.run_number }}.$GIT_COMMIT_SHORT" >> $GITHUB_ENV
fi
if [ "${{ github.ref_type }}" == "tag" ]; then # tagged
echo "RELEASE_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV
if [[ "${{ github.ref_name }}" == *"rc"* ]]; then # release candidate
# The uploader already creates a subfolder for each RELEASE_NUMBER.
echo "UPLOAD_PREFIX=build/overte/release-candidate/" >> $GITHUB_ENV
if [[ "${{ github.ref_name }}" != "master" && "${{ github.ref_name }}" != "pull_request" ]]; then # tagged
echo "RELEASE_NUMBER=/${{ github.ref_name }}" >> $GITHUB_ENV
if [ "${{ github.ref_name }}" == *"rc"* ]; then # release candidate
echo "UPLOAD_PREFIX=build/overte/release-candidate" >> $GITHUB_ENV
else # release
echo "UPLOAD_PREFIX=build/overte/release/" >> $GITHUB_ENV
fi
fi
echo "BUILD_NUMBER=$GIT_COMMIT_SHORT" >> $GITHUB_ENV
if [ -z "$CMAKE_BACKTRACE_URL" ]; then
if [ "${{ github.ref_type }}" == "tag" ]; then
export CMAKE_BACKTRACE_URL="${{ secrets.SENTRY_MINIDUMP_ENDPOINT }}"
export CMAKE_BACKTRACE_TOKEN="${{ github.ref_name }}_${{ matrix.os }}_${{ github.sha }}"
else
# We're building a PR, default to the PR endpoint
export CMAKE_BACKTRACE_URL="https://o4504831972343808.ingest.sentry.io/api/4504832427950080/minidump/?sentry_key=f511de295975461b8f92a36f4a4a4f32"
export CMAKE_BACKTRACE_TOKEN="server_pr_${{ github.event.number }}_${{ github.sha }}"
echo "UPLOAD_PREFIX=build/overte/release" >> $GITHUB_ENV
fi
fi
@ -225,12 +177,10 @@ jobs:
else # RPM
if [ "${{ matrix.os }}" == "rockylinux-9" ]; then
echo "ARTIFACT_PATTERN=overte-server-$RPMVERSION-1.el9.$INSTALLER_EXT" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" == "fedora-38" ]; then
echo "ARTIFACT_PATTERN=overte-server-$RPMVERSION-1.fc38.$INSTALLER_EXT" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" == "fedora-39" ]; then
echo "ARTIFACT_PATTERN=overte-server-$RPMVERSION-1.fc39.$INSTALLER_EXT" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" == "fedora-40" ]; then
echo "ARTIFACT_PATTERN=overte-server-$RPMVERSION-1.fc40.$INSTALLER_EXT" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" == "fedora-36" ]; then
echo "ARTIFACT_PATTERN=overte-server-$RPMVERSION-1.fc36.$INSTALLER_EXT" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" == "fedora-37" ]; then
echo "ARTIFACT_PATTERN=overte-server-$RPMVERSION-1.fc37.$INSTALLER_EXT" >> $GITHUB_ENV
else
echo "Error! ARTIFACT_PATTERN not set!"
exit 1 # Fail
@ -238,7 +188,7 @@ jobs:
fi
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 1
@ -250,9 +200,7 @@ jobs:
- name: Configure CMake
working-directory: build
shell: bash
run: |
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release $CMAKE_EXTRA
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release $CMAKE_EXTRA
- name: Compress cmake logs
if: always()
@ -305,7 +253,8 @@ jobs:
df -h
- name: Upload artifact to GitHub
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_PATTERN }}
path: pkg-scripts/${{ env.ARTIFACT_PATTERN }}
@ -318,11 +267,3 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.s3_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.s3_secret_access_key }}
run: python3 $GITHUB_WORKSPACE/tools/ci-scripts/upload.py
- name: Clear Working Directories
if: contains(matrix.runner, 'linux_aarch64') || contains(matrix.runner, 'linux_amd64')
shell: bash
run: |
rm -rf ./*
rm -rf ~/overte-files
rm -rf ~/.cache

View file

@ -1,6 +1,6 @@
# Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2020-2022 Vircadia contributors
# Copyright 2021-2024 Overte e.V.
# Copyright 2021-2022 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
name: Master CI Build
@ -24,10 +24,6 @@ env:
UPLOAD_BUCKET: overte-public
UPLOAD_REGION: fra1
UPLOAD_ENDPOINT: "https://fra1.digitaloceanspaces.com"
CMAKE_BACKTRACE_URL: ${{ secrets.SENTRY_MINIDUMP_ENDPOINT }}
CMAKE_BACKTRACE_TOKEN: master_${{ github.event.number }}_${{ github.sha }}
# Disable VCPKG caching to save time.
VCPKG_FEATURE_FLAGS: -binarycaching
# OSX-specific variables
DEVELOPER_DIR: /Applications/Xcode_11.2.app/Contents/Developer
@ -45,11 +41,11 @@ jobs:
include:
- os: windows-2019
build_type: full
#- os: macOS-10.15
# build_type: full
#- os: ubuntu-20.04
# build_type: full
# apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion3 libpulse0 libsnappy1v5 libwebpdemux2 libwebpmux3 python3-github python3-distro
- os: macOS-10.15
build_type: full
- os: ubuntu-20.04
build_type: full
apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion3 libpulse0 libsnappy1v5 libwebpdemux2 libwebpmux3 python3-github python3-distro
fail-fast: false
runs-on: ${{matrix.os}}
steps:
@ -113,16 +109,12 @@ jobs:
echo "CLIENT_ONLY=TRUE" >> $GITHUB_ENV
echo "INSTALLER=Overte-Interface-master$BUILD_NUMBER-${{ steps.buildenv1.outputs.github_sha_short }}.$INSTALLER_EXT" >> $GITHUB_ENV
fi
- name: Clear Working Directories
if: contains(matrix.runner, 'linux_aarch64')
- name: Clear working directory
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
rm -rf ./*
rm -rf ~/overte-files
rm -rf ~/.cache
- uses: actions/checkout@v4
working-directory: ${{runner.workspace}}
run: rm -rf ./*
- uses: actions/checkout@v1
with:
submodules: false
fetch-depth: 1
@ -161,7 +153,7 @@ jobs:
- name: Override NSIS
shell: pwsh
if: startsWith(matrix.os, 'windows')
run: choco install nsis --allow-downgrade --version=3.06.1
run: choco install nsis --version=3.06.1
- name: Install Python modules
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
@ -281,11 +273,3 @@ jobs:
# with:
# name: symbols
# path: ${{runner.workspace}}/${{ steps.buildenv1.outputs.symbols_archive }}
- name: Clear Working Directories
if: contains(matrix.runner, 'linux_aarch64')
shell: bash
run: |
rm -rf ./*
rm -rf ~/overte-files
rm -rf ~/.cache

View file

@ -1,5 +1,5 @@
# Copyright 2022-2024 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Overte e.V.
# SPDX-License-Identifier: MIT
name: Master API-docs CI Build and Deploy
@ -10,11 +10,11 @@ on:
jobs:
build_site:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
name: Build and deploy API-docs
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: Install dependencies
working-directory: tools/jsdoc
@ -31,14 +31,13 @@ jobs:
jsdoc root.js -r api-mainpage.md -c config.json -d output
- name: Deploy API-docs
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
uses: SamKirkland/FTP-Deploy-Action@4.3.0
with:
server: www531.your-server.de
protocol: ftps
username: ${{ secrets.GHA_HETZNER_APIDOCS_FTP_USER }}
password: ${{ secrets.GHA_HETZNER_APIDOCS_FTP_PASS }}
server: ftp.tuxfamily.org
username: ${{ secrets.GHA_JSDOC_FTP_USER }}
password: ${{ secrets.GHA_JSDOC_FTP_PASS }}
local-dir: ./tools/jsdoc/output/
server-dir: /
server-dir: overte/apidocs.overte.org-web/htdocs/
exclude: |
**/staging/**
.htaccess

View file

@ -1,5 +1,5 @@
# Copyright 2022-2024 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022-2023 Overte e.V.
# SPDX-License-Identifier: MIT
name: Master Doxygen CI Build and Deploy
@ -14,7 +14,7 @@ jobs:
name: Build and deploy Doxygen documentation
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install dependencies
run: |
@ -29,14 +29,13 @@ jobs:
doxygen Doxyfile
- name: Deploy Doxygen
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
uses: SamKirkland/FTP-Deploy-Action@4.3.3
with:
server: www531.your-server.de
protocol: ftps
username: ${{ secrets.GHA_HETZNER_DOXYGEN_FTP_USER }}
password: ${{ secrets.GHA_HETZNER_DOXYGEN_FTP_PASS }}
server: ftp.tuxfamily.org
username: ${{ secrets.GHA_JSDOC_FTP_USER }}
password: ${{ secrets.GHA_JSDOC_FTP_PASS }}
local-dir: ./build/docs/html/
server-dir: /
server-dir: overte/doxygen.overte.org-web/htdocs/
exclude: |
**/staging/**
.htaccess

View file

@ -1,6 +1,6 @@
# Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2020-2022 Vircadia contributors.
# Copyright 2021-2024 Overte e.V.
# Copyright 2021-2022 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
name: Pull Request CI Build
@ -21,11 +21,8 @@ env:
RELEASE_NUMBER: ${{ github.event.number }}
VERSION_CODE: ${{ github.event.number }}
# Sentry Crash Reporting
# We can't use secrets or actions here, so the actual value has to be hardcoded.
CMAKE_BACKTRACE_URL: "https://o4504831972343808.ingest.sentry.io/api/4504832427950080/minidump/?sentry_key=f511de295975461b8f92a36f4a4a4f32"
CMAKE_BACKTRACE_URL:
CMAKE_BACKTRACE_TOKEN: PR_${{ github.event.number }}_${{ github.sha }}
# Disable VCPKG caching to save time.
VCPKG_FEATURE_FLAGS: -binarycaching
UPLOAD_BUCKET: overte-public
UPLOAD_REGION: fra1
@ -45,40 +42,27 @@ env:
jobs:
build_pr:
name: "${{matrix.os}}, ${{matrix.arch}}"
name: "${{matrix.os}}, ${{matrix.build_type}}"
strategy:
matrix:
include:
- os: Windows 2019
runner: windows-2019
arch: x86_64
- os: windows-2019
build_type: full
#- os: macOS-10.15
# build_type: full
- os: Ubuntu 20.04
# https://github.com/testflows/TestFlows-GitHub-Hetzner-Runners/wiki/Meta-Labels
# self_hosted makes the Hetzner auto-scaler put up the job.
# type-cx52 is a Hetzner VPS server type. In this case cs52 is a server with 16-cores and 32GB of RAM.
# image-x86-app-docker-ce is a Hetzner image.
# https://github.com/testflows/TestFlows-GitHub-Hetzner-Runners/wiki/Specifying-The-Runner-Image
runner: [self_hosted, type-cx52, image-x86-app-docker-ce]
arch: amd64
- os: macOS-10.15
build_type: full
apt-dependencies: pkg-config libxext-dev libdouble-conversion-dev libpcre2-16-0 libpulse0 libharfbuzz-dev libnss3 libnspr4 libxdamage1 libasound2 # add missing dependencies to docker image when convenient
image: docker.io/overte/overte-full-build:0.1.1-ubuntu-20.04-amd64
- os: ubuntu-20.04
build_type: full
apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion3 libpulse0 libsnappy1v5 libwebpdemux2 libwebpmux3 python3-distro
# Android builds are currently failing
#- os: ubuntu-18.04
# build_type: android
# apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion1 libpulse0 python3-github python3-distro
# Do not change the names of self-hosted runners without knowing what you are doing, as they correspond to labels that have to be set on the runner.
- os: Ubuntu 22.04
runner: [self_hosted, type-cax41, image-arm-app-docker-ce]
arch: aarch64
- os: self-hosted_debian-11_aarch64
build_type: full
image: docker.io/overte/overte-full-build:0.1.1-ubuntu-22.04-aarch64
apt-dependencies: qtbase5-dev qtbase5-private-dev qtwebengine5-dev qtwebengine5-dev-tools qtmultimedia5-dev libqt5opengl5-dev qtscript5-dev libqt5scripttools5 libqt5webchannel5-dev libqt5websockets5-dev qtxmlpatterns5-dev-tools qttools5-dev libqt5xmlpatterns5-dev libqt5svg5-dev qml-module-qtwebchannel build-essential cmake curl freeglut3-dev git libasound2 libasound2-dev libdouble-conversion-dev libdrm-dev libfontconfig1 libgl1-mesa-dev libglvnd-dev libharfbuzz-dev libjack-dev libjack0 libnspr4 libnss3 libpcre2-16-0 libpulse0 libsdl2-dev libssl-dev libudev-dev libxcb-xinerama0-dev libxcb-xinput0 libxcomposite1 libxcursor1 libxi-dev libxmu-dev libxrandr-dev libxslt1.1 libxtst6 make mesa-common-dev mesa-utils nodejs npm patchelf python2 python3 python3-distro xdg-user-dirs zlib1g-dev ninja-build zip python3-distro
fail-fast: false
runs-on: ${{matrix.runner}}
container: ${{matrix.image}}
runs-on: ${{matrix.os}}
steps:
- name: Configure Build Environment 1
shell: bash
@ -91,18 +75,19 @@ jobs:
echo "APP_TARGET_NAME=$APP_NAME" >> $GITHUB_ENV
# Linux build variables
if [[ "${{ matrix.os }}" = "Ubuntu"* ]]; then
if [[ "${{ matrix.os }}" = "ubuntu-"* || "${{ matrix.os }}" = *"debian"* ]]; then
echo "PYTHON_EXEC=python3" >> $GITHUB_ENV
echo "INSTALLER_EXT=*" >> $GITHUB_ENV
echo "CMAKE_BUILD_EXTRA=-- -j$(nproc)" >> $GITHUB_ENV
# Don't optimize builds to save build time.
echo "OVERTE_OPTIMIZE=false" >> $GITHUB_ENV
# Starting with Ubuntu 22.04 we can use system Qt
if [[ "${{ matrix.image }}" = *"ubuntu-22.04"* ]]; then
# Variables specific to our aarch64 runner
if [ "${{ matrix.os }}" = "self-hosted_debian-11_aarch64" ]; then
echo "OVERTE_USE_SYSTEM_QT=true" >> $GITHUB_ENV
echo "CI_WORKSPACE=${{runner.workspace}}" >> $GITHUB_ENV
fi
if [[ "${{ matrix.arch }}" = "aarch64" ]]; then
if [[ "${{ matrix.os }}" = *"aarch64" ]]; then
echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV
if [ "${{ matrix.build_type }}" = "full" ]; then
echo "CMAKE_EXTRA=-DOVERTE_CPU_ARCHITECTURE= -DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV
@ -112,7 +97,7 @@ jobs:
fi
if [[ "${{ matrix.arch }}" = "amd64" ]]; then
if [[ "${{ matrix.os }}" != *"aarch64" ]]; then
if [ "${{ matrix.build_type }}" = "full" ]; then
echo "CMAKE_EXTRA=-DOVERTE_CPU_ARCHITECTURE=-msse3 -DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV
else
@ -133,7 +118,7 @@ jobs:
echo "APP_TARGET_NAME=Overte" >> $GITHUB_ENV
fi
# Windows build variables
if [ "${{ matrix.os }}" = "Windows 2019" ]; then
if [ "${{ matrix.os }}" = "windows-2019" ]; then
echo "PYTHON_EXEC=python" >> $GITHUB_ENV
echo "INSTALLER_EXT=exe" >> $GITHUB_ENV
if [ "${{ matrix.build_type }}" = "full" ]; then
@ -164,24 +149,22 @@ jobs:
echo "INSTALLER=Overte-Interface-$RELEASE_NUMBER-${GIT_COMMIT_SHORT}.$INSTALLER_EXT" >> $GITHUB_ENV
fi
- name: Clear Working Directories
if: contains(matrix.runner, 'linux_aarch64') || contains(matrix.runner, 'linux_amd64')
- name: Clear Working Directory
if: startsWith(matrix.os, 'windows') || contains(matrix.os, 'self-hosted')
shell: bash
run: |
rm -rf ./*
rm -rf ~/overte-files
rm -rf ~/.cache
working-directory: ${{runner.workspace}}
run: rm -rf ./*
- uses: actions/checkout@v4
- uses: actions/checkout@v1
with:
submodules: false
fetch-depth: 1
- name: Install dependencies
shell: bash
if: startsWith(matrix.os, 'Ubuntu') || contains(matrix.os, 'Debian') || startsWith(matrix.os, 'macOS')
if: startsWith(matrix.os, 'ubuntu') || contains(matrix.os, 'debian') || startsWith(matrix.os, 'macOS')
run: |
if [[ "${{ matrix.os }}" =~ "Ubuntu" || "${{ matrix.os }}" =~ "Debian" ]]; then
if [[ "${{ matrix.os }}" =~ "ubuntu" || "${{ matrix.os }}" =~ "debian" ]]; then
echo "Updating apt repository index"
sudo apt update || exit 1
@ -204,7 +187,7 @@ jobs:
sudo cp -rp MacOSX10.12.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ || exit 0
echo " done"
fi
if [[ "${{ matrix.os }}" =~ "Debian 11" ]]; then
if [[ "${{ matrix.os }}" =~ "debian-11" ]]; then
echo "Installing CMake from Debian Backports"
echo deb http://deb.debian.org/debian bullseye-backports main > /etc/apt/sources.list.d/bullseye-backports.list
sudo apt update
@ -214,20 +197,20 @@ jobs:
- name: Override NSIS
shell: pwsh
if: startsWith(matrix.os, 'Windows')
run: choco install nsis --allow-downgrade --version=3.06.1
if: startsWith(matrix.os, 'windows')
run: choco install nsis --version=3.06.1
- name: Install Python modules
if: startsWith(matrix.os, 'Windows') || startsWith(matrix.os, 'macOS')
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
shell: bash
run: $PYTHON_EXEC -m pip install boto3 PyGithub
- name: Create Build Environment
shell: bash
run: cmake -E make_directory ./build
run: cmake -E make_directory "${{runner.workspace}}/build"
- name: Configure CMake
working-directory: build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release $CMAKE_EXTRA
@ -240,44 +223,48 @@ jobs:
else
TAR=tar
fi
find "$HOME/overte-files/vcpkg" -name '*log' -type f -print0 | $TAR --null --force-local -T - -c --xz -v -f "./cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz"
if [ ${{ env.CI_WORKSPACE }} ]; then
find "$CI_WORKSPACE/overte-files/vcpkg" -name '*log' -type f -print0 | $TAR --null --force-local -T - -c --xz -v -f "${{ runner.workspace }}/cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz"
else
find "$HOME/overte-files/vcpkg" -name '*log' -type f -print0 | $TAR --null --force-local -T - -c --xz -v -f "${{ runner.workspace }}/cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz"
fi
- name: Archive cmake logs
if: always()
uses: actions/upload-artifact@v3
with:
name: cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz
path: ./cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz
path: ${{ runner.workspace }}/cmake-logs-${{ matrix.os }}-${{ github.event.number }}.tar.xz
if-no-files-found: error
- name: Build Application
if: matrix.build_type == 'full' || matrix.build_type == 'client'
working-directory: build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target $APP_TARGET_NAME $CMAKE_BUILD_EXTRA
- name: Build Domain Server
if: matrix.build_type == 'full'
working-directory: build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target domain-server $CMAKE_BUILD_EXTRA
- name: Build Assignment Client
if: matrix.build_type == 'full'
working-directory: build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target assignment-client $CMAKE_BUILD_EXTRA
- name: Build Console
if: matrix.build_type == 'full' && matrix.arch != 'aarch64' || startsWith(matrix.os, 'windows')
working-directory: build
if: matrix.build_type == 'full' || startsWith(matrix.os, 'windows')
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . --config $BUILD_TYPE --target packaged-server-console $CMAKE_BUILD_EXTRA
run: cmake --build . --config $BUILD_TYPE --target packaged-server-console $CMAKE_BUILD_EXTRA
- name: Build Installer
if: matrix.build_type != 'android' && matrix.arch != 'aarch64'
working-directory: build
if: matrix.build_type != 'android'
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
echo "Retry code from https://unix.stackexchange.com/a/137639"
@ -328,30 +315,22 @@ jobs:
- name: Output system stats
if: ${{ always() }}
working-directory: build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
echo "Disk usage:"
df -h
- name: Output Installer Logs
if: failure() && startsWith(matrix.os, 'Windows')
if: failure() && startsWith(matrix.os, 'windows')
shell: bash
working-directory: build
working-directory: ${{runner.workspace}}/build
run: cat ./_CPack_Packages/win64/NSIS/NSISOutput.log
- name: Upload Artifact
if: startsWith(matrix.os, 'Windows') || startsWith(matrix.os, 'macOS')
uses: actions/upload-artifact@v4
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_PATTERN }}
path: ./build/${{ env.ARTIFACT_PATTERN }}
path: ${{ runner.workspace }}/build/${{ env.ARTIFACT_PATTERN }}
if-no-files-found: error
- name: Clear Working Directories
if: contains(matrix.runner, 'linux_aarch64') || contains(matrix.runner, 'linux_amd64')
shell: bash
run: |
rm -rf ./*
rm -rf ~/overte-files
rm -rf ~/.cache

View file

@ -1,213 +0,0 @@
# Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2020-2022 Vircadia contributors
# Copyright 2021-2024 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
name: Windows Release Build
on:
push:
tags:
# Release tags. E.g. 2024.06.1
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- "[0-9][0-9][0-9][0-9].[0-9][0-9].**"
env:
APP_NAME: interface
BUILD_TYPE: Release
CI_BUILD: Github
GIT_COMMIT: ${{ github.sha }}
PRODUCTION_BUILD: true
RELEASE_TYPE: PRODUCTION
RELEASE_NUMBER: ${{ github.ref_name }}
STABLE_BUILD: 1
UPLOAD_BUCKET: overte-public
UPLOAD_REGION: fra1
UPLOAD_ENDPOINT: "https://fra1.digitaloceanspaces.com"
CMAKE_BACKTRACE_URL: ${{ secrets.SENTRY_MINIDUMP_ENDPOINT }}
CMAKE_BACKTRACE_TOKEN: ${{ github.ref_name }}_Windows_${{ github.sha }}
# Disable VCPKG caching to save time.
VCPKG_FEATURE_FLAGS: -binarycaching
# WIN-specific variables
PreferredToolArchitecture: X64
jobs:
build:
strategy:
matrix:
include:
- os: windows-2019
build_type: full
fail-fast: false
runs-on: ${{matrix.os}}
steps:
- name: Configure build environment 1
shell: bash
id: buildenv1
run: |
echo "GIT_COMMIT_SHORT=`echo ${{ github.sha }} | cut -c1-7`" >> $GITHUB_ENV
if [[ "${{ github.ref_name }}" == *"rc"* ]]; then # release candidate
# The uploader already creates a subfolder for each RELEASE_NUMBER.
echo "UPLOAD_PREFIX=build/overte/release-candidate/" >> $GITHUB_ENV
else # release
echo "UPLOAD_PREFIX=build/overte/release/" >> $GITHUB_ENV
fi
echo ::set-output name=github_sha_short::`echo $GIT_COMMIT | cut -c1-7`
echo "JOB_NAME=${{matrix.os}}, ${{matrix.build_type}}" >> $GITHUB_ENV
echo "APP_TARGET_NAME=$APP_NAME" >> $GITHUB_ENV
echo "PYTHON_EXEC=python" >> $GITHUB_ENV
echo "ZIP_COMMAND=7z" >> $GITHUB_ENV
echo "ZIP_ARGS=a" >> $GITHUB_ENV
echo "INSTALLER_EXT=exe" >> $GITHUB_ENV
echo "CMAKE_EXTRA=-A x64" >> $GITHUB_ENV
echo "SYMBOL_REGEX=\(exe\|dll\|pdb\)" >> $GITHUB_ENV
echo "symbols_archive=$RELEASE_NUMBER-${{ github.sha }}-win-symbols.zip" >> $GITHUB_ENV
# echo "HF_PFX_PASSPHRASE=${{secrets.pfx_key}}" >> $GITHUB_ENV
# echo "HF_PFX_FILE=${{runner.workspace}}\build\codesign.pfx" >> $GITHUB_ENV
# Configuration is broken into two steps because you can't set an env var and also reference it in the same step
- name: Configure build environment 2
shell: bash
run: |
echo "BUILD_NUMBER=$GIT_COMMIT_SHORT" >> $GITHUB_ENV
echo "${{ steps.buildenv1.outputs.symbols_archive }}"
echo "ARTIFACT_PATTERN=Overte-$RELEASE_NUMBER.$INSTALLER_EXT" >> $GITHUB_ENV
echo "CLIENT_ONLY=FALSE" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 1
- name: Override NSIS
shell: pwsh
if: startsWith(matrix.os, 'windows')
run: choco install nsis --allow-downgrade --version=3.06.1
- name: Install Python modules
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
shell: bash
run: $PYTHON_EXEC -m pip install boto3 PyGithub
- name: Create build environment
shell: bash
run: cmake -E make_directory "${{runner.workspace}}/build"
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release -DCLIENT_ONLY:BOOLEAN=$CLIENT_ONLY -DBYPASS_SIGNING:BOOLEAN=TRUE $CMAKE_EXTRA
- name: Build application
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target $APP_TARGET_NAME $CMAKE_BUILD_EXTRA
- name: Build domain server
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target domain-server $CMAKE_BUILD_EXTRA
- name: Build assignment client
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target assignment-client $CMAKE_BUILD_EXTRA
- name: Build console
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target packaged-server-console $CMAKE_BUILD_EXTRA
- name: Build installer
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
echo "Retry code from https://unix.stackexchange.com/a/137639"
function fail {
echo $1 >&2
exit 1
}
function retry {
local n=1
local max=5
local delay=15
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
echo "Command failed. Attempt $n/$max:"
sleep $delay;
else
fail "The command has failed after $n attempts."
fi
}
done
}
retry cmake --build . --config $BUILD_TYPE --target package $CMAKE_BUILD_EXTRA
#- name: Sign installer (Windows)
# if: startsWith(matrix.os, 'windows')
# shell: powershell
# working-directory: C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64
# run: .\signtool.exe sign /fd sha256 /f ${{runner.workspace}}\build\codesign.pfx /p ${{secrets.pfx_key}} /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 ${{runner.workspace}}\build\${env:ARTIFACT_PATTERN}
- name: Output system stats
if: ${{ always() }}
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
echo "Disk usage:"
df -h
- name: Output installer logs
if: failure() && startsWith(matrix.os, 'windows')
shell: bash
working-directory: ${{runner.workspace}}/build
run: cat ./_CPack_Packages/win64/NSIS/NSISOutput.log
- name: Upload artifact to S3
shell: bash
working-directory: ${{runner.workspace}}/build
env:
AWS_ACCESS_KEY_ID: ${{ secrets.s3_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.s3_secret_access_key }}
run: $PYTHON_EXEC $GITHUB_WORKSPACE/tools/ci-scripts/upload.py
- name: Upload artifact to GitHub
uses: actions/upload-artifact@v4
with:
name: ${{ env.INSTALLER }}
path: ${{runner.workspace}}/build/${{ env.ARTIFACT_PATTERN }}
if-no-files-found: error
- name: Archive symbols
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
working-directory: ${{runner.workspace}}
shell: bash
run: |
SYMBOLS_TEMP="symbols-temp"
mkdir $SYMBOLS_TEMP
find "./build" -regex ".*\.$SYMBOL_REGEX" -exec cp -r {} $SYMBOLS_TEMP \;
cd $SYMBOLS_TEMP
$ZIP_COMMAND $ZIP_ARGS ../${{ steps.buildenv1.outputs.symbols_archive }} .
- name: Upload debug symbols to GitHub
uses: actions/upload-artifact@v4
with:
name: ${{ steps.buildenv1.outputs.symbols_archive }}
path: ./${{ steps.buildenv1.outputs.symbols_archive }}
if-no-files-found: error
- name: Clear Working Directories
if: contains(matrix.runner, 'linux_aarch64')
shell: bash
run: |
rm -rf ./*
rm -rf ~/overte-files
rm -rf ~/.cache

62
.gitignore vendored
View file

@ -1,7 +1,7 @@
# https://www.git-scm.com/docs/gitignore
#
# Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2022-2023 Overte e.V.
# Copyright 2022 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
VideoDecodeStats
@ -11,17 +11,13 @@ CMakeCache.txt
CMakeFiles/
CMakeScripts/
cmake_install.cmake
/build*/
cmake-build-minsizerelease-visual-studio/
cmake-build-release-visual-studio/
build*/
cmake-build-relwithdebinfo-visual-studio/
cmake-build-debug-visual-studio/
cmake-build-debug/
/release*/
/debug*/
/gprof*/
/valgrind*/
/ext/
release*/
debug*/
gprof*/
valgrind*/
ext/
Makefile
*.user
@ -29,14 +25,14 @@ Makefile
*.iml
*.class
local.properties
/android/gradle*
/android/.gradle
/android/**/src/main/jniLibs
/android/**/libs
/android/**/bin
/android/**/src/main/res/values/libs.xml
/android/**/src/main/assets
/android/**/gradle*
android/gradle*
android/.gradle
android/**/src/main/jniLibs
android/**/libs
android/**/bin
android/**/src/main/res/values/libs.xml
android/**/src/main/assets
android/**/gradle*
*.class
# Visual Studio
@ -50,8 +46,6 @@ local.properties
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# Workspace
*.code-workspace
# Xcode
*.xcodeproj
@ -72,23 +66,22 @@ profile
DerivedData
.idea/
# KDevelop
*~
*.kdev4
*.hmap
# ignore interface optional externals
/interface/external/*/*
interface/external/*/*
!interface/external/*/readme.txt
# Ignore interfaceCache for Linux users
/interface/interfaceCache/
interface/interfaceCache/
# ignore audio-client externals
/libraries/audio-client/external/*/*
libraries/audio-client/external/*/*
!libraries/audio-client/external/*/readme.txt
gvr-interface/assets/oculussig*
gvr-interface/libs/*
# ignore files for various dev environments
TAGS
*.sw[po]
@ -111,22 +104,21 @@ interface/compiledResources
*.rcc
# GPUCache
/interface/resources/GPUCache/*
interface/resources/GPUCache/*
# package lock file for JSDoc tool
/tools/jsdoc/package-lock.json
tools/jsdoc/package-lock.json
# Python compile artifacts
**/__pycache__
# ignore local unity project files for avatar exporter
/tools/unity-avatar-exporter
tools/unity-avatar-exporter
/server-console/package-lock.json
/vcpkg/
server-console/package-lock.json
vcpkg/
/tools/nitpick/compiledResources
/qt/
qt/
# Act local GitHub Actions
.secret

View file

@ -111,7 +111,10 @@ CMAKE_BACKTRACE_TOKEN
// The release version, e.g., 2021.3.2.
RELEASE_NUMBER
// The release name, e.g., Eos.
RELEASE_NAME
// The build commit, e.g., use a Git hash for the most recent commit in the branch - fd6973b.
BUILD_NUMBER
// The type of release.

View file

@ -8,8 +8,6 @@ SPDX-License-Identifier: Apache-2.0
# Build Android
*Last Updated on December 15, 2020*
> [!WARNING]
> Android building is currently broken, due to breaking changes in Qt and Gradle. Help with updating (or rewriting) the Gradle scripts would be great.
Please read the [general build guide](BUILD.md) for information on building other platforms. Only Android specific instructions are found in this file. **Note that these instructions apply to building for the Oculus Quest 1.**

View file

@ -51,10 +51,9 @@ Download and install the latest version of CMake 3.15.
Download the file named win64-x64 Installer from the [CMake Website](https://cmake.org/download/). You can access the installer on this [3.15 Version page](https://cmake.org/files/v3.15/). During installation, make sure to check "Add CMake to system PATH for all users" when prompted.
## Step 4. (Optional) Node.JS and NPM
## Step 4. Node.JS and NPM
Install version 10.15.0 LTS (or greater) of [Node.JS and NPM](<https://nodejs.org/en/download/>).
This is required to build the server-console, hifi-screenshare, jsdoc, and for javascript console autocompletion.
## Step 5. (Optional) Install Qt
@ -75,7 +74,7 @@ To create this variable:
* Set "Variable name" to `QT_CMAKE_PREFIX_PATH`
* Set "Variable value" to `%QT_INSTALL_DIR%\5.15.2\msvc2019_64\lib\cmake`, where `%QT_INSTALL_DIR%` is the directory you specified for Qt's installation. The default is `C:\Qt`.
## Step 6. (Optional) Create VCPKG environment variable
## Step 6. Create VCPKG environment variable
In the next step, you will use CMake to build Overte. By default, the CMake process builds dependency files in Windows' `%TEMP%` directory, which is periodically cleared by the operating system. To prevent you from having to re-build the dependencies in the event that Windows clears that directory, we recommend that you create a `HIFI_VCPKG_BASE` environment variable linked to a directory somewhere on your machine. That directory will contain all dependency files until you manually remove them.
To create this variable:
@ -96,24 +95,13 @@ To create this variable:
## Step 7. Running CMake to Generate Build Files
These instructions only apply to Visual Studio 2019.
Run Command Prompt from Start and run the following commands:
`cd "%OVERTE_DIR%"`
`mkdir build`
`cd build`
### Automatic
There is a batch file to automatically run the commands below for ease of use.
`winprepareVS19.bat`
### Manual
Run The Command Prompt from Start and run the following commands:
```Bash
cd "%OVERTE_DIR%"
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A x64
```
### Visual Studio 2019
Run `cmake .. -G "Visual Studio 16 2019" -A x64`.
Where `%OVERTE_DIR%` is the directory for the Overte repository.
@ -144,7 +132,7 @@ Note: You can also run Interface by launching it from command line or File Explo
For any problems after Step #7, first try this:
* Delete your locally cloned copy of the Overte repository
* Restart your computer
* Redownload the [repository](https://github.com/overte-org/overte)
* Redownload the [repository](https://github.com/overte.org/overte)
* Restart directions from Step #7
## CMake gives you the same error message repeatedly after the build fails

View file

@ -1,6 +1,6 @@
<!--
Copyright 2022-2023 Overte e.V.
SPDX-License-Identifier: Apache-2.0
Copyright 2022 Overte e.V.
SPDX-License-Identifier: MIT
-->
# Changelog
@ -12,79 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
This project does **not** adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
<!-- ## [Unreleased] 2023.07.22 -->
<!-- ## [2023.07.1] 2023.07.22 -->
<!--
### Misc
- Updated the Unity Avatar Exporter and added Linux support
- Added Linux support to the Unity Avatar Exporter
-->
### Fixes
- Fixed color conversion for glTF material colors (PR307)
- Fixed a possible crash in Mesh::map (PR392)
- Fixed multiple memory corruption issues that were causing frequent crashes (PR185)
Most notably this gets rid of a frequent Create App related crash.
- Hide private methods and QObject signals from script engine (PR444)
- Fixed a regression that broke resetting the settings (PR445)
- Fixed deadlock on start on Debian Testing (PR185)
- Fixed Windows 11 showing up as Windows 10 in logs (PR448)
- Fixed Metallic values on FBX models created by Blender 2.79 or earlier (PR463)
- Fixed laser pointers being rendered below overlays (PR490)
- Fixed angle text sometimes being occluded when using Create app (PR498)
- Hugely improved Create app performance in Domains with many entities (PR498)
- Fixed an issue that could cause laser pointers to rapidly flash (PR495)
- Fixed the connection failure dialog mentioning "Explore" instead of "Places" (PR515)
### Changes
- Replaced Vircadia Metaverse Server with a testing server as federation default (PR330)
- An empty audio device list now throws a warning instead of just a debug message (PR347)
- Increased the maximum log file size from 512 kiB to 10 MiB (PR342,PR513)
- Decreased the amount of retained log files from 100 to 20 (PR342)
- Pressing the Return key with the the address/search bar in the Places App selected now navigates you to that address (PR403)
- Replaced QT Script with V8 scripting engine (PR185,PR507,PR519)
This is a huge change under the hood, which ended up fixing a lot of issues.
Since the new scripting engine does not behave exactly the same as the old one,
some scripts might need fixing. The new scripting engine is especially picky when it comes to undefined behaviour.
Most notably "use strict" is actually strict now and won't allow you to use variables without defining them first.
- Silenced ForceHtmlAudioOutputDeviceUpdate log message (PR473)
- Improved crash reporting functionality (PR480,PR484,PR518)
Interface will ask if future crashes should be reported automatically when it detects that it crashed on last run.
It will also ask once in case of a non-stable build.
- Changed the VR overlay to only recenter when moving (PR478)
- Added a workaround that prevents most users from needing to press down on the thumbstick to move (PR481,PR512)
### Additions
- Added option to graphics menu for choosing which screen to use for full screen mode (PR302)
- file URLs can now be navigated to using the Places App (PR397)
- Added IME support in Desktop mode (PR431)
This allows typing in languages like Japanese or Chinese that make use of an IME.
- Added vertical Field Of View setting to graphics menu (PR465)
- Added crash reporting to the Domain server, Assignment client, and Oven (PR482)
### Removals
- Removed outdated Inventory and Marketplace options from Wearables UI (PR303)
- Removed outdated Beacon system (PR327)
- Removed long deprecated styles-uit and controls-uit QML modules (PR380)
- Removed outdated Marketplace and Wallet code (PR381,PR477,PR487)
### Build system
- Fixed error in configuration step on some rolling release Linux distributions (PR301)
- Removed executable permissions from files that shouldn't have them (PR349)
- Added QML import path (PR379)
- Fixed building on GCC 13 (PR385)
- Fixed a bunch of warnings on C++20 (PR385)
- Updated TBB dependency from version 2019_U8-1 to 2021.5.0 (PR412)
- Fixed NVTT compilation on Visual Studio 2022 (PR374)
- Disabled libOVR on MSVC 2022 (PR430)
- Added Qt 5.15.9 package for aarch64 Ubuntu 20.04 (PR409)
- Fixed build error on aarch64 (PR409)
- Replaced QT Script with V8/libnode (PR185,PR409,PR443)
- Updated Qt on Windows to 5.15.10 with KDE patches (PR448)
- Updated included OpenSSL to 3.0.5 (PR448)
<!-- ## [Unreleased] 2022.12.24 -->
## [2022.12.1] 2022.12.24
### Fixes
@ -101,7 +29,7 @@ This project does **not** adhere to [Semantic Versioning](https://semver.org/spe
### Changes
- Disable anti-aliasing by default (PR294)
- Made the deadlock watchdog less spammy (PR288)
- Domain Server Metadata exporter is now disabled by default (PR247)
- Domain Server Metadata exporter by default is now disabled by default (PR247)
This avoids port conflicts when running multiple Domain Servers on one machine.
- Improved the notification system (PR190,PR189)
Notifications can be closed by just clicking them now.
@ -109,6 +37,7 @@ This project does **not** adhere to [Semantic Versioning](https://semver.org/spe
VR notifications are now unlit and have been slightly moved.
The notification system is generally more stable.
### Additions
- Added partial Blender FBX metallic support (PR221)
- Added tooltips for PolyVox/Voxel properties to Create App (PR244)

View file

@ -1,6 +1,6 @@
# Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2019-2021 Vircadia contributors.
# Copyright 2020-2023 Overte e.V.
# Copyright 2020-2022 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
# If we're running under the gradle build, HIFI_ANDROID will be set here, but
@ -12,11 +12,6 @@ else()
cmake_minimum_required(VERSION 3.2)
endif()
# 3.14 is the minimum version that supports symlinks on Windows
cmake_minimum_required(VERSION 3.14)
# This should allow using long paths on Windows
SET(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
# Passing of variables to vcpkg
#
@ -135,14 +130,11 @@ if( NOT WIN32 )
MESSAGE(STATUS "OVERTE_CPU_ARCHITECTURE: ${OVERTE_CPU_ARCHITECTURE}")
endif()
# Function alignment is necessary for V8.
# SetAlignedPointerInInternalField requires at least 2 byte alignment and -falign-functions will set alignment
# to machine specific value which should be greater than 2.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OVERTE_OPTIMIZE_FLAGS} -falign-functions")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OVERTE_OPTIMIZE_FLAGS} -falign-functions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OVERTE_OPTIMIZE_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OVERTE_OPTIMIZE_FLAGS}")
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${OVERTE_OPTIMIZE_FLAGS} -falign-functions")
set(ENV{CFLAGS} "$ENV{CFLAGS} ${OVERTE_OPTIMIZE_FLAGS} -falign-functions")
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${OVERTE_OPTIMIZE_FLAGS}")
set(ENV{CFLAGS} "$ENV{CFLAGS} ${OVERTE_OPTIMIZE_FLAGS}")
message($ENV{CXXFLAGS})
endif()
@ -184,13 +176,8 @@ if(OVERTE_WARNINGS_WHITELIST)
endif()
if(OVERTE_WARNINGS_AS_ERRORS)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "" AND WIN32))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
set(CMAKE_CFLAGS "${CMAKE_CFLAGS} /WX")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_CFLAGS "${CMAKE_CFLAGS} -Werror")
endif()
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Werror")
set(ENV{CFLAGS} "$ENV{CXXFLAGS} -Werror")
endif()
@ -205,9 +192,13 @@ else()
set(VCPKG_BUILD_TYPE_PARAM --vcpkg-build-type ${VCPKG_BUILD_TYPE})
endif()
execute_process(
COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --release-type ${RELEASE_TYPE} --build-root ${CMAKE_BINARY_DIR} ${VCPKG_BUILD_TYPE_PARAM}
COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --vcpkg-skip-clean --release-type ${RELEASE_TYPE} --build-root ${CMAKE_BINARY_DIR} ${VCPKG_BUILD_TYPE_PARAM}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULTS_VARIABLE PREBUILD_RET
)
# squelch the Policy CMP0074 warning without requiring an update to cmake 3.12.
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
cmake_policy(SET CMP0074 NEW)
endif()
endif()
if (PREBUILD_RET GREATER 0)
@ -257,6 +248,9 @@ else()
endif()
set(SCREENSHARE 0)
if (WIN32)
set(SCREENSHARE 1)
endif()
if (APPLE AND NOT CLIENT_ONLY)
# Don't include Screenshare in OSX client-only builds.
set(SCREENSHARE 1)
@ -488,7 +482,6 @@ if (BUILD_CLIENT)
endif()
option(USE_SIXENSE "Build Interface with sixense library/plugin" OFF)
option(USE_NEURON "Build Interface with Neuron library/plugin" OFF)
endif()
if (BUILD_CLIENT OR BUILD_SERVER)
@ -519,6 +512,3 @@ if (BUILD_INSTALLER)
endif()
generate_installers()
endif()
# QML import paths for Qt Creator and KDevelop code completion
set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/interface/resources/qml;${CMAKE_SOURCE_DIR}/launchers/qt/resources/qml CACHE PATH "Extra QML import paths for KDevelop and Qt Creator")

View file

@ -106,7 +106,7 @@ For code signing to work, you will need to set the `HF_PFX_FILE` and `HF_PFX_PAS
1. Ensure you have all the prerequisites fulfilled from the [MacOS Build Guide](BUILD_OSX.md).
2. Perform a clean CMake in your build folder. e.g.
```bash
BUILD_GLOBAL_SERVICES=STABLE USE_STABLE_GLOBAL_SERVICES=1 RELEASE_BUILD=PRODUCTION BUILD_NUMBER="Insert Build Identifier here e.g. short hash of your last Git commit" STABLE_BUILD=1 PRODUCTION_BUILD=1 RELEASE_NUMBER="Insert Release Version Here e.g. 1.1.0" RELEASE_TYPE=PRODUCTION cmake -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" -DCLIENT_ONLY=1 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOSX_SDK=10.12 ..
BUILD_GLOBAL_SERVICES=STABLE USE_STABLE_GLOBAL_SERVICES=1 RELEASE_BUILD=PRODUCTION BUILD_NUMBER="Insert Build Identifier here e.g. short hash of your last Git commit" RELEASE_NAME="Insert Release Name Here" STABLE_BUILD=1 PRODUCTION_BUILD=1 RELEASE_NUMBER="Insert Release Version Here e.g. 1.1.0" RELEASE_TYPE=PRODUCTION cmake -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" -DCLIENT_ONLY=1 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOSX_SDK=10.12 ..
```
3. Pick a method to build and package your release.

View file

@ -1,6 +1,6 @@
Copyright (c) 2013-2019, High Fidelity, Inc.
Copyright (c) 2019-2021, Vircadia contributors.
Copyright (c) 2022-2023, Overte e.V.
Copyright (c) 2022, Overte e.V.
All rights reserved.
https://overte.org

View file

@ -33,7 +33,7 @@ Overte is a free and open source 3D social virtual worlds software.
* Full-body avatars
* FBX, glTF, and OBJ support
* JavaScript scripting engine
* 256km²/4096km³ world space in a server
* 16km³ world space in a server
* Fully self-hosted
* Apache 2.0
@ -78,9 +78,9 @@ Overte consists of many projects and codebases with its unifying structure's goa
- The Interface - You are here!
- The Server - You are also here!
- [The Directory Server (Codename Iamus)](https://github.com/overte-org/overte-metaverse/)
- [The Directory Server Dashboard (Codename Iamus)](https://github.com/overte-org/metaverse-dashboard/)
- [The Launcher (Codename Pantheon)](https://github.com/overte-org/pantheon-launcher/) - Currently Windows only.
- [The Directory Server (Codename Iamus)](https://github.com/overte/Iamus/)
- [The Directory Server Dashboard (Codename Iamus)](https://github.com/overte/project-iamus-dashboard/)
- [The Launcher (Codename Pantheon)](https://github.com/overte/pantheon-launcher/) - Currently Windows only.
#### Tools
- [Overte Builder for Linux](https://github.com/overte-org/overte-builder/)

View file

@ -1,3 +0,0 @@
# Security Policy
## Reporting a Vulnerability
To report a potential vulnerability, please direct message a board member on Matrix or Discord, or open a draft Security Advisory at https://github.com/overte-org/overte/security/advisories.

View file

@ -109,7 +109,7 @@ public class PermissionChecker extends Activity {
JSONObject obj = new JSONObject();
try {
obj.put("firstRun",false);
obj.put(SETTINGS_FULL_PRIVATE_GROUP_NAME + "/Avatar/fullAvatarURL", avatarPaths[which]);
obj.put("Avatar/fullAvatarURL", avatarPaths[which]);
File directory = new File(pathForJson);
if(!directory.exists()) directory.mkdirs();

View file

@ -1,10 +1,6 @@
# Copyright 2013-2019 High Fidelity, Inc.
# Copyright 2021-2022 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
set(TARGET_NAME assignment-client)
setup_hifi_project(Core Gui Network Quick WebSockets)
setup_hifi_project(Core Gui Network Script Quick WebSockets)
# Fix up the rpath so macdeployqt works
if (APPLE)
@ -23,9 +19,6 @@ link_hifi_libraries(
)
include_hifi_library_headers(procedural)
add_crashpad()
target_breakpad()
if (BUILD_TOOLS)
add_dependencies(${TARGET_NAME} oven)

View file

@ -4,11 +4,9 @@
//
// Created by Stephen Birarda on 7/1/13.
// Copyright 2013 High Fidelity, Inc.
// Copyright 2023 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// SPDX-License-Identifier: Apache-2.0
//
#include "Agent.h"
@ -29,7 +27,6 @@
#include <DebugDraw.h>
#include <EntityScriptingInterface.h>
#include <LocationScriptingInterface.h>
#include <AudioScriptingInterface.h>
#include <MessagesClient.h>
#include <NetworkAccessManager.h>
#include <NodeList.h>
@ -37,9 +34,7 @@
#include <ResourceCache.h>
#include <ResourceScriptingInterface.h>
#include <ScriptCache.h>
#include <ScriptEngine.h>
#include <ScriptEngines.h>
#include <ScriptManager.h>
#include <SoundCacheScriptingInterface.h>
#include <SoundCache.h>
#include <UserActivityLoggerScriptingInterface.h>
@ -61,7 +56,7 @@
#include "entities/AssignmentParentFinder.h"
#include "AssignmentDynamicFactory.h"
#include <recording/RecordingScriptingInterface.h>
#include "RecordingScriptingInterface.h"
#include "AbstractAudioInterface.h"
#include "AgentScriptingInterface.h"
@ -185,7 +180,7 @@ static const QString AGENT_LOGGING_NAME = "agent";
void Agent::run() {
// Create ScriptEngines on threaded-assignment thread then move to main thread.
DependencyManager::set<ScriptEngines>(ScriptManager::AGENT_SCRIPT)->moveToThread(qApp->thread());
DependencyManager::set<ScriptEngines>(ScriptEngine::AGENT_SCRIPT)->moveToThread(qApp->thread());
DependencyManager::set<ScriptCache>();
@ -377,7 +372,7 @@ void Agent::executeScript() {
// the following block is scoped so that any shared pointers we take here
// are cleared before we call setFinished at the end of the function
{
_scriptManager = scriptManagerFactory(ScriptManager::AGENT_SCRIPT, _scriptContents, _payload);
_scriptEngine = scriptEngineFactory(ScriptEngine::AGENT_SCRIPT, _scriptContents, _payload);
// setup an Avatar for the script to use
auto scriptedAvatar = DependencyManager::get<ScriptableAvatar>();
@ -391,11 +386,10 @@ void Agent::executeScript() {
scriptedAvatar->getHeadOrientation();
// give this AvatarData object to the script engine
auto scriptEngine = _scriptManager->engine();
scriptEngine->registerGlobalObject("Avatar", scriptedAvatar.data());
_scriptEngine->registerGlobalObject("Avatar", scriptedAvatar.data());
// give scripts access to the Users object
scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
_scriptEngine->registerGlobalObject("Users", DependencyManager::get<UsersScriptingInterface>().data());
auto player = DependencyManager::get<recording::Deck>();
connect(player.data(), &recording::Deck::playbackStateChanged, [&player, &scriptedAvatar] {
@ -499,26 +493,26 @@ void Agent::executeScript() {
});
auto avatarHashMap = DependencyManager::set<AvatarHashMap>();
scriptEngine->registerGlobalObject("AvatarList", avatarHashMap.data());
_scriptEngine->registerGlobalObject("AvatarList", avatarHashMap.data());
// register ourselves to the script engine
scriptEngine->registerGlobalObject("Agent", new AgentScriptingInterface(this));
_scriptEngine->registerGlobalObject("Agent", new AgentScriptingInterface(this));
scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data());
scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
_scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data());
_scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
ScriptValue webSocketServerConstructorValue = scriptEngine->newFunction(WebSocketServerClass::constructor);
scriptEngine->globalObject().setProperty("WebSocketServer", webSocketServerConstructorValue);
QScriptValue webSocketServerConstructorValue = _scriptEngine->newFunction(WebSocketServerClass::constructor);
_scriptEngine->globalObject().setProperty("WebSocketServer", webSocketServerConstructorValue);
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
scriptEngine->registerGlobalObject("EntityViewer", &_entityViewer);
_scriptEngine->registerGlobalObject("EntityViewer", &_entityViewer);
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
_scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
LocationScriptingInterface::locationSetter);
auto recordingInterface = DependencyManager::get<RecordingScriptingInterface>();
scriptEngine->registerGlobalObject("Recording", recordingInterface.data());
_scriptEngine->registerGlobalObject("Recording", recordingInterface.data());
entityScriptingInterface->init();
@ -528,8 +522,8 @@ void Agent::executeScript() {
DependencyManager::set<AssignmentParentFinder>(_entityViewer.getTree());
DependencyManager::get<ScriptEngines>()->runScriptInitializers(_scriptManager);
_scriptManager->run();
DependencyManager::get<ScriptEngines>()->runScriptInitializers(_scriptEngine);
_scriptEngine->run();
Frame::clearFrameHandler(AUDIO_FRAME_TYPE);
Frame::clearFrameHandler(AVATAR_FRAME_TYPE);
@ -608,7 +602,7 @@ void Agent::setIsAvatar(bool isAvatar) {
// start the timer
_avatarQueryTimer->start(AVATAR_VIEW_PACKET_SEND_INTERVAL_MSECS);
connect(_scriptManager.get(), &ScriptManager::update,
connect(_scriptEngine.data(), &ScriptEngine::update,
scriptableAvatar.data(), &ScriptableAvatar::update, Qt::QueuedConnection);
// tell the avatarAudioTimer to start ticking
@ -644,7 +638,7 @@ void Agent::setIsAvatar(bool isAvatar) {
nodeList->sendPacket(std::move(packet), *node);
});
disconnect(_scriptManager.get(), &ScriptManager::update,
disconnect(_scriptEngine.data(), &ScriptEngine::update,
scriptableAvatar.data(), &ScriptableAvatar::update);
QMetaObject::invokeMethod(&_avatarAudioTimer, "stop");
@ -881,7 +875,7 @@ void Agent::aboutToFinish() {
// drop our shared pointer to the script engine, then ask ScriptEngines to shutdown scripting
// this ensures that the ScriptEngine goes down before ScriptEngines
_scriptManager.reset();
_scriptEngine.clear();
{
DependencyManager::get<ScriptEngines>()->shutdownScripting();
@ -901,8 +895,8 @@ void Agent::aboutToFinish() {
}
void Agent::stop() {
if (_scriptManager) {
_scriptManager->stop();
if (_scriptEngine) {
_scriptEngine->stop();
} else {
setFinished(true);
}

View file

@ -4,11 +4,9 @@
//
// Created by Stephen Birarda on 7/1/13.
// Copyright 2013 High Fidelity, Inc.
// Copyright 2023 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// SPDX-License-Identifier: Apache-2.0
//
#ifndef hifi_Agent_h
@ -17,12 +15,12 @@
#include <memory>
#include <vector>
#include <QtScript/QScriptEngine>
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include <QtCore/QUrl>
#include <QtCore/QTimer>
#include <QUuid>
#include <QtCore/QSharedPointer>
#include <EntityEditPacketSender.h>
#include <EntityTree.h>
@ -31,17 +29,11 @@
#include <plugins/CodecPlugin.h>
#include <Sound.h>
#include "AudioGate.h"
#include "MixedAudioStream.h"
#include "entities/EntityTreeHeadlessViewer.h"
#include "avatars/ScriptableAvatar.h"
class ScriptEngine;
class ScriptManager;
using ScriptEnginePointer = std::shared_ptr<ScriptEngine>;
using ScriptManagerPointer = std::shared_ptr<ScriptManager>;
class Agent : public ThreadedAssignment {
Q_OBJECT
@ -98,7 +90,7 @@ private:
void encodeFrameOfZeros(QByteArray& encodedZeros);
void computeLoudness(const QByteArray* decodedBuffer, QSharedPointer<ScriptableAvatar>);
ScriptManagerPointer _scriptManager;
ScriptEnginePointer _scriptEngine;
EntityEditPacketSender _entityEditSender;
EntityTreeHeadlessViewer _entityViewer;

View file

@ -40,7 +40,7 @@
*/
class AgentScriptingInterface : public QObject {
Q_OBJECT
Q_PROPERTY(bool isAvatar READ getIsAvatar WRITE setIsAvatar)
Q_PROPERTY(bool isAvatar READ isAvatar WRITE setIsAvatar)
Q_PROPERTY(bool isPlayingAvatarSound READ isPlayingAvatarSound)
Q_PROPERTY(bool isListeningToAudioStream READ isListeningToAudioStream WRITE setIsListeningToAudioStream)
Q_PROPERTY(bool isNoiseGateEnabled READ isNoiseGateEnabled WRITE setIsNoiseGateEnabled)
@ -77,15 +77,15 @@ public slots:
/*@jsdoc
* Checks whether the script is emulating an avatar.
* @function Agent.getIsAvatar
* @function Agent.isAvatar
* @returns {boolean} <code>true</code> if the script is emulating an avatar, otherwise <code>false</code>.
* @example <caption>Check whether the agent is emulating an avatar.</caption>
* (function () {
* print("Agent is avatar: " + Agent.getIsAvatar());
* print("Agent is avatar: " + Agent.isAvatar());
* print("Agent is avatar: " + Agent.isAvatar); // Same result.
* }());
*/
bool getIsAvatar() const { return _agent->isAvatar(); }
bool isAvatar() const { return _agent->isAvatar(); }
/*@jsdoc
* Plays a sound from the position and with the orientation of the emulated avatar's head. No sound is played unless

View file

@ -45,7 +45,7 @@ const QString ASSIGNMENT_CLIENT_TARGET_NAME = "assignment-client";
const long long ASSIGNMENT_REQUEST_INTERVAL_MSECS = 1 * 1000;
AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool,
quint16 listenPort, QString assignmentServerHostname,
quint16 listenPort, QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort, quint16 assignmentMonitorPort,
bool disableDomainPortAutoDiscovery) :
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME)
@ -72,6 +72,13 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
// setup our _requestAssignment member variable from the passed arguments
_requestAssignment = Assignment(Assignment::RequestCommand, requestAssignmentType, assignmentPool);
// check for a wallet UUID on the command line or in the config
// this would represent where the user running AC wants funds sent to
if (!walletUUID.isNull()) {
qCDebug(assignment_client) << "The destination wallet UUID for credits is" << uuidStringWithoutCurlyBraces(walletUUID);
_requestAssignment.setWalletUUID(walletUUID);
}
// check for an overriden assignment server hostname
if (assignmentServerHostname != "") {
// change the hostname for our assignment server

View file

@ -27,7 +27,7 @@ class AssignmentClient : public QObject {
Q_OBJECT
public:
AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool,
quint16 listenPort, QString assignmentServerHostname,
quint16 listenPort, QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort, quint16 assignmentMonitorPort,
bool disableDomainPortAutoDiscovery);
~AssignmentClient();

View file

@ -24,8 +24,6 @@
#include <SharedUtil.h>
#include <ShutdownEventListener.h>
#include <shared/ScriptInitializerMixin.h>
#include <crash-handler/CrashHandler.h>
#include "Assignment.h"
#include "AssignmentClient.h"
@ -72,6 +70,10 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
"Minimum UDP listen port", "port");
parser.addOption(minChildListenPort);
const QCommandLineOption walletDestinationOption(ASSIGNMENT_WALLET_DESTINATION_ID_OPTION,
"set wallet destination", "wallet-uuid");
parser.addOption(walletDestinationOption);
const QCommandLineOption assignmentServerHostnameOption(CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION,
"set assignment-server hostname", "hostname");
parser.addOption(assignmentServerHostnameOption);
@ -108,9 +110,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
const QCommandLineOption logOption("logOptions", "Logging options, comma separated: color,nocolor,process_id,thread_id,milliseconds,keep_repeats,journald,nojournald", "options");
parser.addOption(logOption);
const QCommandLineOption forceCrashReportingOption("forceCrashReporting", "Force crash reporting to initialize.");
parser.addOption(forceCrashReportingOption);
if (!parser.parse(QCoreApplication::arguments())) {
std::cout << parser.errorText().toStdString() << std::endl; // Avoid Qt log spam
parser.showHelp();
@ -179,7 +178,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
disableDomainPortAutoDiscovery = true;
}
Assignment::Type requestAssignmentType = Assignment::AllTypes;
if (argumentVariantMap.contains(ASSIGNMENT_TYPE_OVERRIDE_OPTION)) {
requestAssignmentType = (Assignment::Type) argumentVariantMap.value(ASSIGNMENT_TYPE_OVERRIDE_OPTION).toInt();
@ -188,9 +186,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
requestAssignmentType = (Assignment::Type) parser.value(clientTypeOption).toInt();
}
auto &ch = CrashHandler::getInstance();
ch.setAnnotation("type", QString::number(requestAssignmentType));
QString assignmentPool;
// check for an assignment pool passed on the command line or in the config
if (argumentVariantMap.contains(ASSIGNMENT_POOL_OPTION)) {
@ -200,6 +195,14 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
assignmentPool = parser.value(poolOption);
}
QUuid walletUUID;
if (argumentVariantMap.contains(ASSIGNMENT_WALLET_DESTINATION_ID_OPTION)) {
walletUUID = argumentVariantMap.value(ASSIGNMENT_WALLET_DESTINATION_ID_OPTION).toString();
}
if (parser.isSet(walletDestinationOption)) {
walletUUID = parser.value(walletDestinationOption);
}
QString assignmentServerHostname;
if (argumentVariantMap.contains(CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION)) {
assignmentServerHostname = argumentVariantMap.value(CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION).toString();
@ -256,10 +259,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
}
}
if (parser.isSet(forceCrashReportingOption)) {
ch.setEnabled(true);
}
QThread::currentThread()->setObjectName("main thread");
LogHandler::getInstance().moveToThread(thread());
@ -271,14 +270,14 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
if (numForks || minForks || maxForks) {
AssignmentClientMonitor* monitor = new AssignmentClientMonitor(numForks, minForks, maxForks,
requestAssignmentType, assignmentPool, listenPort,
childMinListenPort, assignmentServerHostname,
childMinListenPort, walletUUID, assignmentServerHostname,
assignmentServerPort, httpStatusPort, logDirectory,
disableDomainPortAutoDiscovery);
monitor->setParent(this);
connect(this, &QCoreApplication::aboutToQuit, monitor, &AssignmentClientMonitor::aboutToQuit);
} else {
AssignmentClient* client = new AssignmentClient(requestAssignmentType, assignmentPool, listenPort,
assignmentServerHostname,
walletUUID, assignmentServerHostname,
assignmentServerPort, monitorPort,
disableDomainPortAutoDiscovery);
client->setParent(this);

View file

@ -19,6 +19,7 @@
const QString ASSIGNMENT_TYPE_OVERRIDE_OPTION = "t";
const QString ASSIGNMENT_POOL_OPTION = "pool";
const QString ASSIGNMENT_CLIENT_LISTEN_PORT_OPTION = "p";
const QString ASSIGNMENT_WALLET_DESTINATION_ID_OPTION = "wallet";
const QString CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION = "a";
const QString ASSIGNMENT_MONITOR_MIN_CHILDREN_LISTEN_PORT_OPTION = "min-listen-port";
const QString CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION = "server-port";

View file

@ -41,7 +41,7 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
const unsigned int minAssignmentClientForks,
const unsigned int maxAssignmentClientForks,
Assignment::Type requestAssignmentType, QString assignmentPool,
quint16 listenPort, quint16 childMinListenPort, QString assignmentServerHostname,
quint16 listenPort, quint16 childMinListenPort, QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort, quint16 httpStatusServerPort, QString logDirectory,
bool disableDomainPortAutoDiscovery) :
_httpManager(QHostAddress::LocalHost, httpStatusServerPort, "", this),
@ -50,6 +50,7 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
_maxAssignmentClientForks(maxAssignmentClientForks),
_requestAssignmentType(requestAssignmentType),
_assignmentPool(assignmentPool),
_walletUUID(walletUUID),
_assignmentServerHostname(assignmentServerHostname),
_assignmentServerPort(assignmentServerPort),
_childMinListenPort(childMinListenPort),
@ -184,6 +185,10 @@ void AssignmentClientMonitor::spawnChildClient() {
_childArguments.append("--" + ASSIGNMENT_POOL_OPTION);
_childArguments.append(_assignmentPool);
}
if (!_walletUUID.isNull()) {
_childArguments.append("--" + ASSIGNMENT_WALLET_DESTINATION_ID_OPTION);
_childArguments.append(_walletUUID.toString());
}
if (_assignmentServerHostname != "") {
_childArguments.append("--" + CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION);
_childArguments.append(_assignmentServerHostname);

View file

@ -39,7 +39,7 @@ class AssignmentClientMonitor : public QObject, public HTTPRequestHandler {
public:
AssignmentClientMonitor(const unsigned int numAssignmentClientForks, const unsigned int minAssignmentClientForks,
const unsigned int maxAssignmentClientForks, Assignment::Type requestAssignmentType,
QString assignmentPool, quint16 listenPort, quint16 childMinListenPort,
QString assignmentPool, quint16 listenPort, quint16 childMinListenPort, QUuid walletUUID,
QString assignmentServerHostname, quint16 assignmentServerPort, quint16 httpStatusServerPort,
QString logDirectory, bool disableDomainPortAutoDiscovery);
~AssignmentClientMonitor();
@ -72,6 +72,7 @@ private:
Assignment::Type _requestAssignmentType;
QString _assignmentPool;
QUuid _walletUUID;
QString _assignmentServerHostname;
quint16 _assignmentServerPort;

View file

@ -371,8 +371,6 @@ void AssetServer::completeSetup() {
auto& domainHandler = nodeList->getDomainHandler();
const QJsonObject& settingsObject = domainHandler.getSettingsObject();
commonParseSettingsObject(settingsObject);
static const QString ASSET_SERVER_SETTINGS_KEY = "asset_server";
if (!settingsObject.contains(ASSET_SERVER_SETTINGS_KEY)) {

View file

@ -38,7 +38,6 @@
#include "AudioMixerClientData.h"
#include "AvatarAudioStream.h"
#include "InjectedAudioStream.h"
#include "crash-handler/CrashHandler.h"
using namespace std;
@ -50,7 +49,6 @@ static const QString AUDIO_ENV_GROUP_KEY = "audio_env";
static const QString AUDIO_BUFFER_GROUP_KEY = "audio_buffer";
static const QString AUDIO_THREADING_GROUP_KEY = "audio_threading";
int AudioMixer::_numStaticJitterFrames{ DISABLE_STATIC_JITTER_FRAMES };
float AudioMixer::_noiseMutingThreshold{ DEFAULT_NOISE_MUTING_THRESHOLD };
float AudioMixer::_attenuationPerDoublingInDistance{ DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE };
@ -562,8 +560,6 @@ void AudioMixer::clearDomainSettings() {
void AudioMixer::parseSettingsObject(const QJsonObject& settingsObject) {
qCDebug(audio) << "AVX2 Support:" << (cpuSupportsAVX2() ? "enabled" : "disabled");
commonParseSettingsObject(settingsObject);
if (settingsObject.contains(AUDIO_THREADING_GROUP_KEY)) {
QJsonObject audioThreadingGroupObject = settingsObject[AUDIO_THREADING_GROUP_KEY].toObject();
const QString AUTO_THREADS = "auto_threads";

View file

@ -222,23 +222,13 @@ void AudioMixerClientData::parseInjectorGainSet(ReceivedMessage& message, const
qCDebug(audio) << "Setting MASTER injector gain for" << uuid << "to" << gain;
}
bool setGainInStreams(const QUuid &nodeID, float gain, std::vector<AudioMixerClientData::MixableStream> &streamVector) {
auto itActive = std::find_if(streamVector.cbegin(), streamVector.cend(),
[nodeID](const AudioMixerClientData::MixableStream& mixableStream){
void AudioMixerClientData::setGainForAvatar(QUuid nodeID, float gain) {
auto it = std::find_if(_streams.active.cbegin(), _streams.active.cend(), [nodeID](const MixableStream& mixableStream){
return mixableStream.nodeStreamID.nodeID == nodeID && mixableStream.nodeStreamID.streamID.isNull();
});
if (itActive != streamVector.cend()) {
itActive->hrtf->setGainAdjustment(gain);
return true;
} else {
return false;
}
}
void AudioMixerClientData::setGainForAvatar(QUuid nodeID, float gain) {
if (!setGainInStreams(nodeID, gain, _streams.active)) {
setGainInStreams(nodeID, gain, _streams.inactive);
if (it != _streams.active.cend()) {
it->hrtf->setGainAdjustment(gain);
}
}

View file

@ -94,6 +94,8 @@ AvatarMixer::AvatarMixer(ReceivedMessage& message) :
PacketReceiver::makeSourcedListenerReference<AvatarMixer>(this, &AvatarMixer::queueIncomingPacket));
packetReceiver.registerListenerForTypes({ PacketType::OctreeStats, PacketType::EntityData, PacketType::EntityErase },
PacketReceiver::makeSourcedListenerReference<AvatarMixer>(this, &AvatarMixer::handleOctreePacket));
packetReceiver.registerListener(PacketType::ChallengeOwnership,
PacketReceiver::makeSourcedListenerReference<AvatarMixer>(this, &AvatarMixer::queueIncomingPacket));
packetReceiver.registerListenerForTypes({
PacketType::ReplicatedAvatarIdentity,
@ -510,6 +512,8 @@ void AvatarMixer::handleAvatarKilled(SharedNodePointer avatarNode) {
} else {
_sessionDisplayNames.erase(displayNameIter);
}
nodeData->getAvatar().stopChallengeTimer();
}
std::unique_ptr<NLPacket> killPacket;
@ -988,8 +992,6 @@ void AvatarMixer::handlePacketVersionMismatch(PacketType type, const SockAddr& s
}
void AvatarMixer::parseDomainServerSettings(const QJsonObject& domainSettings) {
commonParseSettingsObject(domainSettings);
const QString AVATAR_MIXER_SETTINGS_KEY = "avatar_mixer";
QJsonObject avatarMixerGroupObject = domainSettings[AVATAR_MIXER_SETTINGS_KEY].toObject();

View file

@ -73,6 +73,9 @@ int AvatarMixerClientData::processPackets(const SlaveSharedData& slaveSharedData
case PacketType::BulkAvatarTraitsAck:
processBulkAvatarTraitsAckMessage(*packet);
break;
case PacketType::ChallengeOwnership:
_avatar->processChallengeResponse(*packet);
break;
default:
Q_UNREACHABLE();
}
@ -80,6 +83,10 @@ int AvatarMixerClientData::processPackets(const SlaveSharedData& slaveSharedData
}
assert(_packetQueue.empty());
if (_avatar) {
_avatar->processCertifyEvents();
}
return packetsProcessed;
}
@ -223,6 +230,8 @@ void AvatarMixerClientData::processSetTraitsMessage(ReceivedMessage& message,
if (traitType == AvatarTraits::SkeletonModelURL) {
// special handling for skeleton model URL, since we need to make sure it is in the whitelist
checkSkeletonURLAgainstWhitelist(slaveSharedData, sendingNode, packetTraitVersion);
// Deferred for UX work. With no PoP check, no need to get the .fst.
_avatar->fetchAvatarFST();
}
anyTraitsChanged = true;

View file

@ -0,0 +1,418 @@
//
// MixerAvatar.cpp
// assignment-client/src/avatars
//
// Created by Simon Walton April 2019
// Copyright 2019 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 "MixerAvatar.h"
#include <QRegularExpression>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include <QNetworkReply>
#include <QCryptographicHash>
#include <QApplication>
#include <ResourceManager.h>
#include <NetworkAccessManager.h>
#include <NetworkingConstants.h>
#include <MetaverseAPI.h>
#include <EntityItem.h>
#include <EntityItemProperties.h>
#include "ClientTraitsHandler.h"
#include "AvatarLogging.h"
MixerAvatar::MixerAvatar() {
static constexpr int CHALLENGE_TIMEOUT_MS = 10 * 1000; // 10 s
_challengeTimer.setSingleShot(true);
_challengeTimer.setInterval(CHALLENGE_TIMEOUT_MS);
_challengeTimer.callOnTimeout(this, &MixerAvatar::challengeTimeout);
// QTimer::start is a set of overloaded functions.
connect(this, &MixerAvatar::startChallengeTimer, &_challengeTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
}
const char* MixerAvatar::stateToName(VerifyState state) {
return QMetaEnum::fromType<VerifyState>().valueToKey(state);
}
void MixerAvatar::challengeTimeout() {
switch (_verifyState) {
case challengeClient:
_verifyState = staticValidation;
_pendingEvent = true;
if (++_numberChallenges < NUM_CHALLENGES_BEFORE_FAIL) {
qCDebug(avatars) << "Retrying (" << _numberChallenges << ") timed-out challenge for" << getDisplayName()
<< getSessionUUID();
} else {
_certifyFailed = true;
_needsIdentityUpdate = true;
qCWarning(avatars) << "ALERT: Dynamic verification TIMED-OUT for" << getDisplayName() << getSessionUUID();
}
break;
case verificationFailed:
qCDebug(avatars) << "Retrying failed challenge for" << getDisplayName() << getSessionUUID();
_verifyState = staticValidation;
_pendingEvent = true;
break;
default:
qCDebug(avatars) << "Ignoring timeout of avatar challenge";
break;
}
}
void MixerAvatar::fetchAvatarFST() {
if (_verifyState >= requestingFST && _verifyState <= challengeClient) {
qCDebug(avatars) << "WARNING: Avatar verification restarted; old state:" << stateToName(_verifyState);
}
_verifyState = nonCertified;
_pendingEvent = false;
QUrl avatarURL = _skeletonModelURL;
if (avatarURL.isEmpty() || avatarURL.isLocalFile() || avatarURL.scheme() == "qrc") {
// Not network FST.
return;
}
_certificateIdFromURL.clear();
_certificateIdFromFST.clear();
_marketplaceIdFromURL.clear();
_marketplaceIdFromFST.clear();
auto resourceManager = DependencyManager::get<ResourceManager>();
// Match UUID + (optionally) URL cert
static const QRegularExpression marketIdRegex{
"^https://.*?highfidelity\\.com/api/.*?/commerce/entity_edition/([-0-9a-z]{36})(.*?certificate_id=([\\w/+%]+)|.*).*$"
};
auto marketIdMatch = marketIdRegex.match(avatarURL.toDisplayString());
if (marketIdMatch.hasMatch()) {
QMutexLocker certifyLocker(&_avatarCertifyLock);
_marketplaceIdFromURL = marketIdMatch.captured(1);
if (marketIdMatch.lastCapturedIndex() == 3) {
_certificateIdFromURL = QUrl::fromPercentEncoding(marketIdMatch.captured(3).toUtf8());
}
}
ResourceRequest* fstRequest = resourceManager->createResourceRequest(this, avatarURL);
if (fstRequest) {
QMutexLocker certifyLocker(&_avatarCertifyLock);
_avatarRequest = fstRequest;
_verifyState = requestingFST;
connect(fstRequest, &ResourceRequest::finished, this, &MixerAvatar::fstRequestComplete);
fstRequest->send();
} else {
qCDebug(avatars) << "Couldn't create FST request for" << avatarURL << getSessionUUID();
_verifyState = error;
}
_needsIdentityUpdate = true;
}
void MixerAvatar::fstRequestComplete() {
ResourceRequest* fstRequest = static_cast<ResourceRequest*>(QObject::sender());
QMutexLocker certifyLocker(&_avatarCertifyLock);
if (_verifyState == requestingFST && fstRequest == _avatarRequest) {
auto result = fstRequest->getResult();
if (result != ResourceRequest::Success) {
_verifyState = error;
qCDebug(avatars) << "FST request for" << fstRequest->getUrl() << "(user " << getSessionUUID() << ") failed:" << result;
} else {
_avatarFSTContents = fstRequest->getData();
_verifyState = receivedFST;
_pendingEvent = true;
}
_avatarRequest = nullptr;
} else {
qCDebug(avatars) << "Incorrect or outdated FST request for" << getDisplayName();
}
fstRequest->deleteLater();
}
bool MixerAvatar::generateFSTHash() {
if (_avatarFSTContents.length() == 0) {
return false;
}
QByteArray hashJson = canonicalJson(_avatarFSTContents);
QCryptographicHash fstHash(QCryptographicHash::Sha256);
fstHash.addData(hashJson);
_certificateHash = fstHash.result();
return true;
}
bool MixerAvatar::validateFSTHash(const QString& publicKey) const {
// Guess we should refactor this stuff into a Authorization namespace ...
return EntityItemProperties::verifySignature(publicKey, _certificateHash,
QByteArray::fromBase64(_certificateIdFromFST.toUtf8()));
}
QByteArray MixerAvatar::canonicalJson(const QString fstFile) {
QStringList fstLines = fstFile.split("\n", Qt::SkipEmptyParts);
static const QString fstKeywordsReg {
"(marketplaceID|itemDescription|itemCategories|itemArtist|itemLicenseUrl|limitedRun|itemName|"
"filename|texdir|script|editionNumber|certificateID)"
};
QRegularExpression fstLineRegExp { QString("^\\s*") + fstKeywordsReg + "\\s*=\\s*(\\S.*)$" };
QStringListIterator fstLineIter(fstLines);
QJsonObject certifiedItems;
QStringList scripts;
while (fstLineIter.hasNext()) {
auto line = fstLineIter.next();
auto lineMatch = fstLineRegExp.match(line);
if (lineMatch.hasMatch()) {
QString key = lineMatch.captured(1);
if (key == "certificateID") {
_certificateIdFromFST = lineMatch.captured(2);
} else if (key == "itemDescription") {
// Item description can be multiline - intermediate lines end in <CR>
QString itemDesc = lineMatch.captured(2);
while (itemDesc.endsWith('\r') && fstLineIter.hasNext()) {
itemDesc += '\n' + fstLineIter.next();
}
certifiedItems[key] = QJsonValue(itemDesc);
} else if (key == "limitedRun" || key == "editionNumber") {
double value = lineMatch.captured(2).toDouble();
if (value != 0.0) {
certifiedItems[key] = QJsonValue(value);
}
} else if (key == "script") {
scripts.append(lineMatch.captured(2).trimmed());
} else {
certifiedItems[key] = QJsonValue(lineMatch.captured(2));
if (key == "marketplaceID") {
_marketplaceIdFromFST = lineMatch.captured(2);
}
}
}
}
if (!scripts.empty()) {
scripts.sort();
certifiedItems["script"] = QJsonArray::fromStringList(scripts);
}
QJsonDocument jsonDocCertifiedItems(certifiedItems);
//Example working form:
//return R"({"editionNumber":34,"filename":"http://mpassets.highfidelity.com/7f142fde-541a-4902-b33a-25fa89dfba21-v1/Bridger/Hifi_Toon_Male_3.fbx","itemArtist":"EgyMax",
//"itemCategories":"Avatars","itemDescription":"This is my first avatar. I hope you like it. More will come","itemName":"Bridger","limitedRun":-1,
//"marketplaceID":"7f142fde-541a-4902-b33a-25fa89dfba21","texdir":"http://mpassets.highfidelity.com/7f142fde-541a-4902-b33a-25fa89dfba21-v1/Bridger/textures"})";
return jsonDocCertifiedItems.toJson(QJsonDocument::Compact);
}
void MixerAvatar::ownerRequestComplete() {
QMutexLocker certifyLocker(&_avatarCertifyLock);
QNetworkReply* networkReply = static_cast<QNetworkReply*>(QObject::sender());
if (_verifyState != requestingOwner) {
qCDebug(avatars) << "WARNING: outdated avatar-owner information received in state" << stateToName(_verifyState);
} else if (networkReply->error() == QNetworkReply::NoError) {
_dynamicMarketResponse = networkReply->readAll();
_verifyState = ownerResponse;
_pendingEvent = true;
} else {
auto jsonData = QJsonDocument::fromJson(networkReply->readAll())["data"];
if (!jsonData.isUndefined() && !jsonData.toObject()["message"].isUndefined()) {
qCDebug(avatars) << "Owner lookup failed for" << getDisplayName() << "("
<< getSessionUUID() << ") :"
<< jsonData.toObject()["message"].toString();
_verifyState = error;
_pendingEvent = false;
}
}
networkReply->deleteLater();
}
void MixerAvatar::requestCurrentOwnership() {
// Get registered owner's public key from directory server.
static const QString POP_MARKETPLACE_API { "/api/v1/commerce/proof_of_purchase_status/transfer" };
auto& networkAccessManager = NetworkAccessManager::getInstance();
QNetworkRequest networkRequest;
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QUrl requestURL = MetaverseAPI::getCurrentMetaverseServerURL();
requestURL.setPath(POP_MARKETPLACE_API);
networkRequest.setUrl(requestURL);
QJsonObject request;
request["certificate_id"] = _certificateIdFromFST;
QNetworkReply* networkReply = networkAccessManager.put(networkRequest, QJsonDocument(request).toJson());
connect(networkReply, &QNetworkReply::finished, this, &MixerAvatar::ownerRequestComplete);
}
void MixerAvatar::processCertifyEvents() {
if (!_pendingEvent) {
return;
}
QMutexLocker certifyLocker(&_avatarCertifyLock);
switch (_verifyState) {
case receivedFST:
{
generateFSTHash();
_numberChallenges = 0;
if (_certificateIdFromFST.length() != 0) {
QString& marketplacePublicKey = EntityItem::_marketplacePublicKey;
bool staticVerification = validateFSTHash(marketplacePublicKey);
_verifyState = staticVerification ? staticValidation : verificationFailed;
if (_verifyState == staticValidation) {
requestCurrentOwnership();
_verifyState = requestingOwner;
} else {
_needsIdentityUpdate = true;
_pendingEvent = false;
qCDebug(avatars) << "Avatar" << getDisplayName() << "(" << getSessionUUID() << ") FAILED static certification";
}
} else { // FST doesn't have a certificate, so noncertified rather than failed:
_pendingEvent = false;
_certifyFailed = false;
_needsIdentityUpdate = true;
_verifyState = nonCertified;
qCDebug(avatars) << "Avatar " << getDisplayName() << "(" << getSessionUUID() << ") isn't certified";
}
break;
}
case staticValidation:
{
requestCurrentOwnership();
_verifyState = requestingOwner;
break;
}
case ownerResponse:
{
QJsonDocument responseJson = QJsonDocument::fromJson(_dynamicMarketResponse.toUtf8());
QString ownerPublicKey;
bool ownerValid = false;
_pendingEvent = false;
if (responseJson["status"].toString() == "success") {
QJsonValue jsonData = responseJson["data"];
if (jsonData.isObject()) {
auto ownerJson = jsonData["transfer_recipient_key"];
if (ownerJson.isString()) {
ownerPublicKey = ownerJson.toString();
}
auto transferStatusJson = jsonData["transfer_status"];
if (transferStatusJson.isArray() && transferStatusJson.toArray()[0].toString() == "confirmed") {
ownerValid = true;
}
}
if (ownerValid && !ownerPublicKey.isEmpty()) {
if (ownerPublicKey.startsWith("-----BEGIN ")){
_ownerPublicKey = ownerPublicKey;
} else {
_ownerPublicKey = "-----BEGIN PUBLIC KEY-----\n"
+ ownerPublicKey
+ "\n-----END PUBLIC KEY-----\n";
}
sendOwnerChallenge();
_verifyState = challengeClient;
} else {
_verifyState = error;
qCDebug(avatars) << "Get owner status - couldn't parse response for" << getSessionUUID()
<< ":" << _dynamicMarketResponse;
}
} else {
qCDebug(avatars) << "Get owner status failed for" << getDisplayName() << _marketplaceIdFromURL <<
"message:" << responseJson["message"].toString();
_verifyState = error;
}
break;
}
case requestingOwner:
{ // Qt networking done on this thread:
QCoreApplication::processEvents();
break;
}
default:
qCDebug(avatars) << "Unexpected verify state" << stateToName(_verifyState);
break;
} // close switch
}
void MixerAvatar::sendOwnerChallenge() {
auto nodeList = DependencyManager::get<NodeList>();
QByteArray avatarID = ("{" + _marketplaceIdFromFST + "}").toUtf8();
if (_challengeNonce.isEmpty()) {
_challengeNonce = QUuid::createUuid().toByteArray();
QCryptographicHash nonceHash(QCryptographicHash::Sha256);
nonceHash.addData(_challengeNonce);
_challengeNonceHash = nonceHash.result();
}
auto challengeOwnershipPacket = NLPacket::create(PacketType::ChallengeOwnership,
2 * sizeof(int) + _challengeNonce.length() + avatarID.length(), true);
challengeOwnershipPacket->writePrimitive(avatarID.length());
challengeOwnershipPacket->writePrimitive(_challengeNonce.length());
challengeOwnershipPacket->write(avatarID);
challengeOwnershipPacket->write(_challengeNonce);
nodeList->sendPacket(std::move(challengeOwnershipPacket), *(nodeList->nodeWithUUID(getSessionUUID())) );
QCryptographicHash nonceHash(QCryptographicHash::Sha256);
nonceHash.addData(_challengeNonce);
_challengeNonceHash = nonceHash.result();
_pendingEvent = false;
emit startChallengeTimer();
}
void MixerAvatar::processChallengeResponse(ReceivedMessage& response) {
QByteArray avatarID;
QMutexLocker certifyLocker(&_avatarCertifyLock);
stopChallengeTimer();
if (_verifyState == challengeClient) {
QByteArray responseData = response.readAll();
if (responseData.length() < 8) {
_verifyState = error;
qCWarning(avatars) << "ALERT: Avatar challenge response packet too small, length:" << responseData.length();
return;
}
int avatarIDLength;
int signedNonceLength;
{
QDataStream responseStream(responseData);
responseStream.setByteOrder(QDataStream::LittleEndian);
responseStream >> avatarIDLength >> signedNonceLength;
}
QByteArray avatarID(responseData.data() + 2 * sizeof(int), avatarIDLength);
QByteArray signedNonce(responseData.data() + 2 * sizeof(int) + avatarIDLength, signedNonceLength);
bool challengeResult = EntityItemProperties::verifySignature(_ownerPublicKey, _challengeNonceHash,
QByteArray::fromBase64(signedNonce));
_verifyState = challengeResult ? verificationSucceeded : verificationFailed;
_certifyFailed = !challengeResult;
_needsIdentityUpdate = true;
if (_certifyFailed) {
qCDebug(avatars) << "Dynamic verification FAILED for" << getDisplayName() << getSessionUUID();
emit startChallengeTimer();
} else {
qCDebug(avatars) << "Dynamic verification SUCCEEDED for" << getDisplayName() << getSessionUUID();
_challengeNonce.clear();
}
} else {
qCDebug(avatars) << "WARNING: Unexpected avatar challenge-response in state" << stateToName(_verifyState);
}
}
void MixerAvatar::stopChallengeTimer() {
if (QThread::currentThread() == thread()) {
_challengeTimer.stop();
} else {
QMetaObject::invokeMethod(&_challengeTimer, &QTimer::stop);
}
}

View file

@ -21,14 +21,28 @@ class ResourceRequest;
class MixerAvatar : public AvatarData {
Q_OBJECT
public:
inline MixerAvatar() {}
MixerAvatar();
bool getNeedsHeroCheck() const { return _needsHeroCheck; }
void setNeedsHeroCheck(bool needsHeroCheck = true) { _needsHeroCheck = needsHeroCheck; }
void fetchAvatarFST();
virtual bool isCertifyFailed() const override { return _certifyFailed; }
bool needsIdentityUpdate() const { return _needsIdentityUpdate; }
void setNeedsIdentityUpdate(bool value = true) { _needsIdentityUpdate = value; }
void processCertifyEvents();
void processChallengeResponse(ReceivedMessage& response);
void stopChallengeTimer();
// Avatar certification/verification:
enum VerifyState {
nonCertified, requestingFST, receivedFST, staticValidation, requestingOwner, ownerResponse,
challengeClient, verified, verificationFailed, verificationSucceeded, error
};
Q_ENUM(VerifyState)
bool isInScreenshareZone() const { return _inScreenshareZone; }
void setInScreenshareZone(bool value = true) { _inScreenshareZone = value; }
const QUuid& getScreenshareZone() const { return _screenshareZone; }
@ -36,9 +50,44 @@ public:
private:
bool _needsHeroCheck { false };
static const char* stateToName(VerifyState state);
VerifyState _verifyState { nonCertified };
std::atomic<bool> _pendingEvent { false };
QMutex _avatarCertifyLock;
ResourceRequest* _avatarRequest { nullptr };
QString _marketplaceIdFromURL;
QString _marketplaceIdFromFST;
QByteArray _avatarFSTContents;
QByteArray _certificateHash;
QString _certificateIdFromURL;
QString _certificateIdFromFST;
QString _dynamicMarketResponse;
QString _ownerPublicKey;
QByteArray _challengeNonce;
QByteArray _challengeNonceHash;
QTimer _challengeTimer;
static constexpr int NUM_CHALLENGES_BEFORE_FAIL = 1;
int _numberChallenges { 0 };
bool _certifyFailed { false };
bool _needsIdentityUpdate { false };
bool _inScreenshareZone { false };
QUuid _screenshareZone;
bool generateFSTHash();
bool validateFSTHash(const QString& publicKey) const;
QByteArray canonicalJson(const QString fstFile);
void requestCurrentOwnership();
void sendOwnerChallenge();
static const QString VERIFY_FAIL_MODEL;
private slots:
void fstRequestComplete();
void ownerRequestComplete();
void challengeTimeout();
signals:
void startChallengeTimer();
};
using MixerAvatarSharedPointer = std::shared_ptr<MixerAvatar>;

View file

@ -4,11 +4,9 @@
//
// Created by Clement on 7/22/14.
// Copyright 2014 High Fidelity, Inc.
// Copyright 2023 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// SPDX-License-Identifier: Apache-2.0
//
#include "ScriptableAvatar.h"
@ -19,23 +17,17 @@
#include <shared/QtHelpers.h>
#include <AnimUtil.h>
#include <AvatarHashMap.h>
#include <ClientTraitsHandler.h>
#include <GLMHelpers.h>
#include <ResourceRequestObserver.h>
#include <AvatarLogging.h>
#include <EntityItem.h>
#include <EntityItemProperties.h>
#include <NetworkAccessManager.h>
#include <NetworkingConstants.h>
ScriptableAvatar::ScriptableAvatar() {
_clientTraitsHandler.reset(new ClientTraitsHandler(this));
static std::once_flag once;
std::call_once(once, [] {
qRegisterMetaType<HFMModel::Pointer>("HFMModel::Pointer");
});
}
QByteArray ScriptableAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) {
@ -56,7 +48,6 @@ void ScriptableAvatar::startAnimation(const QString& url, float fps, float prior
_animation = DependencyManager::get<AnimationCache>()->getAnimation(url);
_animationDetails = AnimationDetails("", QUrl(url), fps, 0, loop, hold, false, firstFrame, lastFrame, true, firstFrame, false);
_maskedJoints = maskedJoints;
_isAnimationRigValid = false;
}
void ScriptableAvatar::stopAnimation() {
@ -94,12 +85,11 @@ QStringList ScriptableAvatar::getJointNames() const {
}
void ScriptableAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
_avatarAnimSkeleton.reset();
_geometryResource.reset();
_bind.reset();
_animSkeleton.reset();
AvatarData::setSkeletonModelURL(skeletonModelURL);
updateJointMappings();
_isRigValid = false;
}
int ScriptableAvatar::sendAvatarDataPacket(bool sendAll) {
@ -143,87 +133,65 @@ static AnimPose composeAnimPose(const HFMJoint& joint, const glm::quat rotation,
}
void ScriptableAvatar::update(float deltatime) {
if (!_geometryResource && !_skeletonModelFilenameURL.isEmpty()) { // AvatarData will parse the .fst, but not get the .fbx skeleton.
_geometryResource = DependencyManager::get<ModelCache>()->getGeometryResource(_skeletonModelFilenameURL);
}
// Run animation
Q_ASSERT(QThread::currentThread() == thread());
if (_animation && _animation->isLoaded()) {
Q_ASSERT(thread() == _animation->thread());
auto frames = _animation->getFramesReference();
if (frames.size() > 0 && _geometryResource && _geometryResource->isHFMModelLoaded()) {
if (!_isRigValid) {
_rig.reset(_geometryResource->getHFMModel());
_isRigValid = true;
if (_animation && _animation->isLoaded() && _animation->getFrames().size() > 0 && !_bind.isNull() && _bind->isLoaded()) {
if (!_animSkeleton) {
_animSkeleton = std::make_shared<AnimSkeleton>(_bind->getHFMModel());
}
float currentFrame = _animationDetails.currentFrame + deltatime * _animationDetails.fps;
if (_animationDetails.loop || currentFrame < _animationDetails.lastFrame) {
while (currentFrame >= _animationDetails.lastFrame) {
currentFrame -= (_animationDetails.lastFrame - _animationDetails.firstFrame);
}
if (!_isAnimationRigValid) {
_animationRig.reset(_animation->getHFMModel());
_isAnimationRigValid = true;
_animationDetails.currentFrame = currentFrame;
const QVector<HFMJoint>& modelJoints = _bind->getHFMModel().joints;
QStringList animationJointNames = _animation->getJointNames();
const int nJoints = modelJoints.size();
if (_jointData.size() != nJoints) {
_jointData.resize(nJoints);
}
if (!_avatarAnimSkeleton) {
_avatarAnimSkeleton = std::make_shared<AnimSkeleton>(_geometryResource->getHFMModel());
const int frameCount = _animation->getFrames().size();
const HFMAnimationFrame& floorFrame = _animation->getFrames().at((int)glm::floor(currentFrame) % frameCount);
const HFMAnimationFrame& ceilFrame = _animation->getFrames().at((int)glm::ceil(currentFrame) % frameCount);
const float frameFraction = glm::fract(currentFrame);
std::vector<AnimPose> poses = _animSkeleton->getRelativeDefaultPoses();
const float UNIT_SCALE = 0.01f;
for (int i = 0; i < animationJointNames.size(); i++) {
const QString& name = animationJointNames[i];
// As long as we need the model preRotations anyway, let's get the jointIndex from the bind skeleton rather than
// trusting the .fst (which is sometimes not updated to match changes to .fbx).
int mapping = _bind->getHFMModel().getJointIndex(name);
if (mapping != -1 && !_maskedJoints.contains(name)) {
AnimPose floorPose = composeAnimPose(modelJoints[mapping], floorFrame.rotations[i], floorFrame.translations[i] * UNIT_SCALE);
AnimPose ceilPose = composeAnimPose(modelJoints[mapping], ceilFrame.rotations[i], floorFrame.translations[i] * UNIT_SCALE);
blend(1, &floorPose, &ceilPose, frameFraction, &poses[mapping]);
}
}
float currentFrame = _animationDetails.currentFrame + deltatime * _animationDetails.fps;
if (_animationDetails.loop || currentFrame < _animationDetails.lastFrame) {
while (currentFrame >= _animationDetails.lastFrame) {
currentFrame -= (_animationDetails.lastFrame - _animationDetails.firstFrame);
std::vector<AnimPose> absPoses = poses;
_animSkeleton->convertRelativePosesToAbsolute(absPoses);
for (int i = 0; i < nJoints; i++) {
JointData& data = _jointData[i];
AnimPose& absPose = absPoses[i];
if (data.rotation != absPose.rot()) {
data.rotation = absPose.rot();
data.rotationIsDefaultPose = false;
}
_animationDetails.currentFrame = currentFrame;
const QVector<HFMJoint>& modelJoints = _geometryResource->getHFMModel().joints;
QStringList animationJointNames = _animation->getJointNames();
const int nJoints = modelJoints.size();
if (_jointData.size() != nJoints) {
_jointData.resize(nJoints);
AnimPose& relPose = poses[i];
if (data.translation != relPose.trans()) {
data.translation = relPose.trans();
data.translationIsDefaultPose = false;
}
const int frameCount = frames.size();
const HFMAnimationFrame& floorFrame = frames.at((int)glm::floor(currentFrame) % frameCount);
const HFMAnimationFrame& ceilFrame = frames.at((int)glm::ceil(currentFrame) % frameCount);
const float frameFraction = glm::fract(currentFrame);
std::vector<AnimPose> poses = _avatarAnimSkeleton->getRelativeDefaultPoses();
// TODO: this needs more testing, it's possible that we need not only scale but also rotation and translation
// According to tests with unmatching avatar and animation armatures, sometimes bones are not rotated correctly.
// Matching armatures already work very well now.
const float UNIT_SCALE = _animationRig.GetScaleFactorGeometryToUnscaledRig() / _rig.GetScaleFactorGeometryToUnscaledRig();
for (int i = 0; i < animationJointNames.size(); i++) {
const QString& name = animationJointNames[i];
// As long as we need the model preRotations anyway, let's get the jointIndex from the bind skeleton rather than
// trusting the .fst (which is sometimes not updated to match changes to .fbx).
int mapping = _geometryResource->getHFMModel().getJointIndex(name);
if (mapping != -1 && !_maskedJoints.contains(name)) {
AnimPose floorPose = composeAnimPose(modelJoints[mapping], floorFrame.rotations[i],
floorFrame.translations[i] * UNIT_SCALE);
AnimPose ceilPose = composeAnimPose(modelJoints[mapping], ceilFrame.rotations[i],
ceilFrame.translations[i] * UNIT_SCALE);
blend(1, &floorPose, &ceilPose, frameFraction, &poses[mapping]);
}
}
std::vector<AnimPose> absPoses = poses;
Q_ASSERT(_avatarAnimSkeleton != nullptr);
_avatarAnimSkeleton->convertRelativePosesToAbsolute(absPoses);
for (int i = 0; i < nJoints; i++) {
JointData& data = _jointData[i];
AnimPose& absPose = absPoses[i];
if (data.rotation != absPose.rot()) {
data.rotation = absPose.rot();
data.rotationIsDefaultPose = false;
}
AnimPose& relPose = poses[i];
if (data.translation != relPose.trans()) {
data.translation = relPose.trans();
data.translationIsDefaultPose = false;
}
}
} else {
_animation.clear();
}
} else {
_animation.clear();
}
}
@ -253,7 +221,7 @@ void ScriptableAvatar::updateJointMappings() {
// connects.
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
QNetworkRequest networkRequest = QNetworkRequest(_skeletonModelURL);
networkRequest.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, NetworkingConstants::OVERTE_USER_AGENT);
DependencyManager::get<ResourceRequestObserver>()->update(
_skeletonModelURL, -1, "AvatarData::updateJointMappings");
@ -273,7 +241,6 @@ void ScriptableAvatar::setJointMappingsFromNetworkReply() {
networkReply->deleteLater();
return;
}
// TODO: this works only with .fst files currently, not directly with FBX and GLB models
{
QWriteLocker writeLock(&_jointDataLock);
QByteArray line;
@ -282,7 +249,7 @@ void ScriptableAvatar::setJointMappingsFromNetworkReply() {
if (line.startsWith("filename")) {
int filenameIndex = line.indexOf('=') + 1;
if (filenameIndex > 0) {
_skeletonModelFilenameURL = _skeletonModelURL.resolved(QString(line.mid(filenameIndex).trimmed()));
_skeletonFBXURL = _skeletonModelURL.resolved(QString(line.mid(filenameIndex).trimmed()));
}
}
if (!line.startsWith("jointIndex")) {
@ -344,9 +311,7 @@ AvatarEntityMap ScriptableAvatar::getAvatarEntityDataInternal(bool allProperties
EntityItemProperties properties = entity->getProperties(desiredProperties);
QByteArray blob;
_helperScriptEngine.run( [&] {
EntityItemProperties::propertiesToBlob(*_helperScriptEngine.get(), sessionID, properties, blob, allProperties);
});
EntityItemProperties::propertiesToBlob(_scriptEngine, sessionID, properties, blob, allProperties);
data[id] = blob;
}
});
@ -370,12 +335,8 @@ void ScriptableAvatar::setAvatarEntityData(const AvatarEntityMap& avatarEntityDa
while (dataItr != avatarEntityData.end()) {
EntityItemProperties properties;
const QByteArray& blob = dataItr.value();
if (!blob.isNull()) {
_helperScriptEngine.run([&] {
if (EntityItemProperties::blobToProperties(*_helperScriptEngine.get(), blob, properties)) {
newProperties[dataItr.key()] = properties;
}
});
if (!blob.isNull() && EntityItemProperties::blobToProperties(_scriptEngine, blob, properties)) {
newProperties[dataItr.key()] = properties;
}
++dataItr;
}
@ -454,16 +415,9 @@ void ScriptableAvatar::updateAvatarEntity(const QUuid& entityID, const QByteArra
EntityItemPointer entity;
EntityItemProperties properties;
{
// TODO: checking how often this happens and what is the performance impact of having the script engine on separate thread
// If it's happening often, a method to move HelperScriptEngine into the current thread would be a good idea
bool result = _helperScriptEngine.runWithResult<bool> ( [&]() {
return EntityItemProperties::blobToProperties(*_helperScriptEngine.get(), entityData, properties);
});
if (!result) {
// entityData is corrupt
return;
}
if (!EntityItemProperties::blobToProperties(_scriptEngine, entityData, properties)) {
// entityData is corrupt
return;
}
std::map<QUuid, EntityItemPointer>::iterator itr = _entities.find(entityID);

View file

@ -4,11 +4,9 @@
//
// Created by Clement on 7/22/14.
// Copyright 2014 High Fidelity, Inc.
// Copyright 2023 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// SPDX-License-Identifier: Apache-2.0
//
#ifndef hifi_ScriptableAvatar_h
@ -19,9 +17,6 @@
#include <AvatarData.h>
#include <ScriptEngine.h>
#include <EntityItem.h>
#include "model-networking/ModelCache.h"
#include "Rig.h"
#include <HelperScriptEngine.h>
/*@jsdoc
* The <code>Avatar</code> API is used to manipulate scriptable avatars on the domain. This API is a subset of the
@ -220,16 +215,12 @@ private:
AnimationPointer _animation;
AnimationDetails _animationDetails;
QStringList _maskedJoints;
GeometryResource::Pointer _geometryResource;
Rig _rig;
bool _isRigValid{false};
Rig _animationRig;
bool _isAnimationRigValid{false};
std::shared_ptr<AnimSkeleton> _avatarAnimSkeleton;
AnimationPointer _bind; // a sleazy way to get the skeleton, given the various library/cmake dependencies
std::shared_ptr<AnimSkeleton> _animSkeleton;
QHash<QString, int> _fstJointIndices; ///< 1-based, since zero is returned for missing keys
QStringList _fstJointNames; ///< in order of depth-first traversal
QUrl _skeletonModelFilenameURL; // This contains URL from filename field in fst file
mutable HelperScriptEngine _helperScriptEngine;
QUrl _skeletonFBXURL;
mutable QScriptEngine _scriptEngine;
std::map<QUuid, EntityItemPointer> _entities;
/// Loads the joint indices, names from the FST file (if any)

View file

@ -15,6 +15,7 @@
#include <QTimer>
#include <QJsonArray>
#include <QJsonDocument>
#include <QRandomGenerator>
#include <EntityTree.h>
#include <ResourceCache.h>
@ -37,7 +38,8 @@ const char* LOCAL_MODELS_PERSIST_FILE = "resources/models.svo";
EntityServer::EntityServer(ReceivedMessage& message) :
OctreeServer(message),
_entitySimulation(nullptr)
_entitySimulation(nullptr),
_dynamicDomainVerificationTimer(this)
{
DependencyManager::set<ResourceManager>();
DependencyManager::set<ResourceCacheSharedItems>();
@ -54,8 +56,14 @@ EntityServer::EntityServer(ReceivedMessage& message) :
PacketType::EntityClone,
PacketType::EntityEdit,
PacketType::EntityErase,
PacketType::EntityPhysics },
PacketType::EntityPhysics,
PacketType::ChallengeOwnership,
PacketType::ChallengeOwnershipRequest,
PacketType::ChallengeOwnershipReply },
PacketReceiver::makeSourcedListenerReference<EntityServer>(this, &EntityServer::handleEntityPacket));
connect(&_dynamicDomainVerificationTimer, &QTimer::timeout, this, &EntityServer::startDynamicDomainVerification);
_dynamicDomainVerificationTimer.setSingleShot(true);
}
EntityServer::~EntityServer() {
@ -272,7 +280,7 @@ int EntityServer::sendSpecialPackets(const SharedNodePointer& node, OctreeQueryN
#ifdef EXTRA_ERASE_DEBUGGING
if (packetsSent > 0) {
qDebug() << "EntityServer::sendSpecialPackets() sent " << packetsSent << "special packets of "
qDebug() << "EntityServer::sendSpecialPackets() sent " << packetsSent << "special packets of "
<< totalBytes << " total bytes to node:" << node->getUUID();
}
#endif
@ -317,6 +325,18 @@ void EntityServer::readAdditionalConfiguration(const QJsonObject& settingsSectio
tree->setEntityMaxTmpLifetime(EntityTree::DEFAULT_MAX_TMP_ENTITY_LIFETIME);
}
int minTime;
if (readOptionInt("dynamicDomainVerificationTimeMin", settingsSectionObject, minTime)) {
_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = minTime * 1000;
}
int maxTime;
if (readOptionInt("dynamicDomainVerificationTimeMax", settingsSectionObject, maxTime)) {
_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = maxTime * 1000;
}
startDynamicDomainVerification();
tree->setWantEditLogging(wantEditLogging);
tree->setWantTerseEditLogging(wantTerseEditLogging);
@ -326,14 +346,14 @@ void EntityServer::readAdditionalConfiguration(const QJsonObject& settingsSectio
} else {
tree->setEntityScriptSourceWhitelist("");
}
auto entityEditFilters = DependencyManager::get<EntityEditFilters>();
QString filterURL;
if (readOptionString("entityEditFilter", settingsSectionObject, filterURL) && !filterURL.isEmpty()) {
// connect the filterAdded signal, and block edits until you hear back
connect(entityEditFilters.data(), &EntityEditFilters::filterAdded, this, &EntityServer::entityFilterAdded);
entityEditFilters->addFilter(EntityItemID(), filterURL);
}
}
@ -367,7 +387,7 @@ void EntityServer::nodeKilled(SharedNodePointer node) {
// FIXME - this stats tracking is somewhat temporary to debug the Whiteboard issues. It's not a bad
// set of stats to have, but we'd probably want a different data structure if we keep it very long.
// Since this version uses a single shared QMap for all senders, there could be some lock contention
// Since this version uses a single shared QMap for all senders, there could be some lock contention
// on this QWriteLocker
void EntityServer::trackSend(const QUuid& dataID, quint64 dataLastEdited, const QUuid& sessionID) {
QWriteLocker locker(&_viewerSendingStatsLock);
@ -443,5 +463,20 @@ QString EntityServer::serverSubclassStats() {
void EntityServer::domainSettingsRequestFailed() {
auto nodeList = DependencyManager::get<NodeList>();
qCDebug(entities) << "The EntityServer couldn't get the Domain Settings.";
qCDebug(entities) << "The EntityServer couldn't get the Domain Settings. Starting dynamic domain verification with default values...";
_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS;
_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS;
startDynamicDomainVerification();
}
void EntityServer::startDynamicDomainVerification() {
qCDebug(entities) << "Starting Dynamic Domain Verification...";
EntityTreePointer tree = std::static_pointer_cast<EntityTree>(_tree);
tree->startDynamicDomainVerificationOnServer((float) _MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS / MSECS_PER_SECOND);
int nextInterval = QRandomGenerator::global()->bounded(((_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS + 1) - _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS) + _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS);
qCDebug(entities) << "Restarting Dynamic Domain Verification timer for" << nextInterval / 1000 << "seconds";
_dynamicDomainVerificationTimer.start(nextInterval);
}

View file

@ -81,6 +81,13 @@ private:
QReadWriteLock _viewerSendingStatsLock;
QMap<QUuid, QMap<QUuid, ViewerSendingStats>> _viewerSendingStats;
static const int DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 45 * 60 * 1000; // 45m
static const int DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = 60 * 60 * 1000; // 1h
int _MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MINIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 45m
int _MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS = DEFAULT_MAXIMUM_DYNAMIC_DOMAIN_VERIFICATION_TIMER_MS; // 1h
QTimer _dynamicDomainVerificationTimer;
void startDynamicDomainVerification();
};
#endif // hifi_EntityServer_h

View file

@ -13,17 +13,12 @@
#include <SharedUtil.h>
#include "AssignmentClientApp.h"
#include <crash-handler/CrashHandler.h>
int main(int argc, char* argv[]) {
setupHifiApplication(BuildInfo::ASSIGNMENT_CLIENT_NAME);
AssignmentClientApp app(argc, argv);
auto &ch = CrashHandler::getInstance();
ch.startMonitor(&app);
int acReturn = app.exec();
qDebug() << "assignment-client process" << app.applicationPid() << "exiting with status code" << acReturn;

View file

@ -121,8 +121,6 @@ void MessagesMixer::domainSettingsRequestComplete() {
}
void MessagesMixer::parseDomainServerSettings(const QJsonObject& domainSettings) {
commonParseSettingsObject(domainSettings);
const QString MESSAGES_MIXER_SETTINGS_KEY = "messages_mixer";
QJsonObject messagesMixerGroupObject = domainSettings[MESSAGES_MIXER_SETTINGS_KEY].toObject();

View file

@ -93,7 +93,19 @@ void OctreeInboundPacketProcessor::processPacket(QSharedPointer<ReceivedMessage>
// Ask our tree subclass if it can handle the incoming packet...
PacketType packetType = message->getType();
if (_myServer->getOctree()->handlesEditPacketType(packetType)) {
if (packetType == PacketType::ChallengeOwnership) {
_myServer->getOctree()->withWriteLock([&] {
_myServer->getOctree()->processChallengeOwnershipPacket(*message, sendingNode);
});
} else if (packetType == PacketType::ChallengeOwnershipRequest) {
_myServer->getOctree()->withWriteLock([&] {
_myServer->getOctree()->processChallengeOwnershipRequestPacket(*message, sendingNode);
});
} else if (packetType == PacketType::ChallengeOwnershipReply) {
_myServer->getOctree()->withWriteLock([&] {
_myServer->getOctree()->processChallengeOwnershipReplyPacket(*message, sendingNode);
});
} else if (_myServer->getOctree()->handlesEditPacketType(packetType)) {
PerformanceWarning warn(debugProcessPacket, "processPacket KNOWN TYPE", debugProcessPacket);
_receivedPacketCount++;

View file

@ -1023,8 +1023,6 @@ void OctreeServer::readConfiguration() {
const QJsonObject& settingsObject = DependencyManager::get<NodeList>()->getDomainHandler().getSettingsObject();
commonParseSettingsObject(settingsObject);
QString settingsKey = getMyDomainSettingsKey();
QJsonObject settingsSectionObject = settingsObject[settingsKey].toObject();
_settings = settingsSectionObject; // keep this for later

View file

@ -4,11 +4,9 @@
//
// Created by Clément Brisset on 1/5/17.
// Copyright 2013 High Fidelity, Inc.
// Copyright 2023 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// SPDX-License-Identifier: Apache-2.0
//
#include "EntityScriptServer.h"
@ -16,9 +14,7 @@
#include <mutex>
#include <AudioConstants.h>
#include <AudioScriptingInterface.h>
#include <AudioInjectorManager.h>
#include <AvatarHashMap.h>
#include <ClientServerUtils.h>
#include <DebugDraw.h>
#include <EntityNodeData.h>
@ -44,8 +40,16 @@
using Mutex = std::mutex;
using Lock = std::lock_guard<Mutex>;
static std::mutex logBufferMutex;
static std::string logBuffer;
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
auto logMessage = LogHandler::getInstance().printMessage((LogMsgType) type, context, message);
if (!logMessage.isEmpty()) {
Lock lock(logBufferMutex);
logBuffer.append(logMessage.toStdString() + '\n');
}
}
int EntityScriptServer::_entitiesScriptEngineCount = 0;
@ -106,7 +110,7 @@ EntityScriptServer::~EntityScriptServer() {
static const QString ENTITY_SCRIPT_SERVER_LOGGING_NAME = "entity-script-server";
void EntityScriptServer::handleReloadEntityServerScriptPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
if (senderNode->getCanRez() || senderNode->getCanRezTmp()) {
if (senderNode->getCanRez() || senderNode->getCanRezTmp() || senderNode->getCanRezCertified() || senderNode->getCanRezTmpCertified()) {
auto entityID = QUuid::fromRfc4122(message->read(NUM_BYTES_RFC4122_UUID));
if (_entityViewer.getTree() && !_shuttingDown) {
@ -117,7 +121,7 @@ void EntityScriptServer::handleReloadEntityServerScriptPacket(QSharedPointer<Rec
}
void EntityScriptServer::handleEntityScriptGetStatusPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
if (senderNode->getCanRez() || senderNode->getCanRezTmp()) {
if (senderNode->getCanRez() || senderNode->getCanRezTmp() || senderNode->getCanRezCertified() || senderNode->getCanRezTmpCertified()) {
MessageID messageID;
message->readPrimitive(&messageID);
auto entityID = QUuid::fromRfc4122(message->read(NUM_BYTES_RFC4122_UUID));
@ -126,7 +130,7 @@ void EntityScriptServer::handleEntityScriptGetStatusPacket(QSharedPointer<Receiv
replyPacketList->writePrimitive(messageID);
EntityScriptDetails details;
if (_entitiesScriptManager->getEntityScriptDetails(entityID, details)) {
if (_entitiesScriptEngine->getEntityScriptDetails(entityID, details)) {
replyPacketList->writePrimitive(true);
replyPacketList->writePrimitive(details.status);
replyPacketList->writeString(details.errorInfo);
@ -141,14 +145,11 @@ void EntityScriptServer::handleEntityScriptGetStatusPacket(QSharedPointer<Receiv
void EntityScriptServer::handleSettings() {
auto nodeList = DependencyManager::get<NodeList>();
auto& domainHandler = nodeList->getDomainHandler();
const QJsonObject& settingsObject = domainHandler.getSettingsObject();
commonParseSettingsObject(settingsObject);
static const QString ENTITY_SCRIPT_SERVER_SETTINGS_KEY = "entity_script_server";
if (!settingsObject.contains(ENTITY_SCRIPT_SERVER_SETTINGS_KEY)) {
@ -174,7 +175,7 @@ void EntityScriptServer::handleSettings() {
}
void EntityScriptServer::updateEntityPPS() {
int numRunningScripts = _entitiesScriptManager->getNumRunningEntityScripts();
int numRunningScripts = _entitiesScriptEngine->getNumRunningEntityScripts();
int pps;
if (std::numeric_limits<int>::max() / _entityPPSPerScript < numRunningScripts) {
qWarning() << QString("Integer multiplication would overflow, clamping to maxint: %1 * %2").arg(numRunningScripts).arg(_entityPPSPerScript);
@ -188,7 +189,7 @@ void EntityScriptServer::updateEntityPPS() {
}
void EntityScriptServer::handleEntityServerScriptLogPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
bool canRezAny = senderNode->getCanRez() || senderNode->getCanRezTmp();
bool canRezAny = senderNode->getCanRez() || senderNode->getCanRezTmp() || senderNode->getCanRezCertified() || senderNode->getCanRezTmpCertified();
bool enable = false;
message->readPrimitive(&enable);
@ -209,10 +210,10 @@ void EntityScriptServer::handleEntityServerScriptLogPacket(QSharedPointer<Receiv
}
void EntityScriptServer::pushLogs() {
QJsonArray buffer;
std::string buffer;
{
Lock lock(_logBufferMutex);
std::swap(_logBuffer, buffer);
Lock lock(logBufferMutex);
std::swap(logBuffer, buffer);
}
if (buffer.empty()) {
@ -223,30 +224,19 @@ void EntityScriptServer::pushLogs() {
}
auto nodeList = DependencyManager::get<NodeList>();
QJsonDocument document;
document.setArray(buffer);
QString data(document.toJson());
std::string string = data.toStdString();
auto cstring = string.c_str();
for (auto uuid : _logListeners) {
auto node = nodeList->nodeWithUUID(uuid);
if (node && node->getActiveSocket()) {
auto packet = NLPacketList::create(PacketType::EntityServerScriptLog, QByteArray(), true, true);
packet->write(cstring, strlen(cstring));
packet->write(buffer.data(), buffer.size());
nodeList->sendPacketList(std::move(packet), *node);
}
}
}
void EntityScriptServer::addLogEntry(const QString& message, const QString& fileName, int lineNumber, const EntityItemID& entityID, ScriptMessage::Severity severity) {
ScriptMessage entry(message, fileName, lineNumber, entityID, ScriptMessage::ScriptType::TYPE_ENTITY_SCRIPT, severity);
Lock lock(_logBufferMutex);
_logBuffer.append(entry.toJson());
}
void EntityScriptServer::handleEntityScriptCallMethodPacket(QSharedPointer<ReceivedMessage> receivedMessage, SharedNodePointer senderNode) {
if (_entitiesScriptManager && _entityViewer.getTree() && !_shuttingDown) {
if (_entitiesScriptEngine && _entityViewer.getTree() && !_shuttingDown) {
auto entityID = QUuid::fromRfc4122(receivedMessage->read(NUM_BYTES_RFC4122_UUID));
auto method = receivedMessage->readString();
@ -260,13 +250,13 @@ void EntityScriptServer::handleEntityScriptCallMethodPacket(QSharedPointer<Recei
params << paramString;
}
_entitiesScriptManager->callEntityScriptMethod(entityID, method, params, senderNode->getUUID());
_entitiesScriptEngine->callEntityScriptMethod(entityID, method, params, senderNode->getUUID());
}
}
void EntityScriptServer::run() {
DependencyManager::set<ScriptEngines>(ScriptManager::ENTITY_SERVER_SCRIPT);
DependencyManager::set<ScriptEngines>(ScriptEngine::ENTITY_SERVER_SCRIPT);
DependencyManager::set<EntityScriptServerServices>();
DependencyManager::set<AvatarHashMap>();
@ -298,7 +288,7 @@ void EntityScriptServer::run() {
entityScriptingInterface->init();
_entityViewer.init();
// setup the JSON filter that asks for entities with a non-default serverScripts property
QJsonObject queryJSONParameters;
queryJSONParameters[EntityJSONQueryProperties::SERVER_SCRIPTS_PROPERTY] = EntityQueryFilterSymbol::NonDefault;
@ -309,7 +299,7 @@ void EntityScriptServer::run() {
queryFlags[EntityJSONQueryProperties::INCLUDE_DESCENDANTS_PROPERTY] = true;
queryJSONParameters[EntityJSONQueryProperties::FLAGS_PROPERTY] = queryFlags;
// setup the JSON parameters so that OctreeQuery does not use a frustum and uses our JSON filter
_entityViewer.getOctreeQuery().setJSONParameters(queryJSONParameters);
@ -386,7 +376,7 @@ void EntityScriptServer::nodeKilled(SharedNodePointer killedNode) {
if (!hasAnotherEntityServer) {
clear();
}
break;
}
case NodeType::Agent: {
@ -456,8 +446,7 @@ void EntityScriptServer::selectAudioFormat(const QString& selectedCodecName) {
void EntityScriptServer::resetEntitiesScriptEngine() {
auto engineName = QString("about:Entities %1").arg(++_entitiesScriptEngineCount);
auto newManager = scriptManagerFactory(ScriptManager::ENTITY_SERVER_SCRIPT, NO_SCRIPT, engineName);
auto newEngine = newManager->engine();
auto newEngine = scriptEngineFactory(ScriptEngine::ENTITY_SERVER_SCRIPT, NO_SCRIPT, engineName);
auto webSocketServerConstructorValue = newEngine->newFunction(WebSocketServerClass::constructor);
newEngine->globalObject().setProperty("WebSocketServer", webSocketServerConstructorValue);
@ -467,65 +456,42 @@ void EntityScriptServer::resetEntitiesScriptEngine() {
// connect this script engines printedMessage signal to the global ScriptEngines these various messages
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
connect(newManager.get(), &ScriptManager::printedMessage, scriptEngines, &ScriptEngines::onPrintedMessage);
connect(newManager.get(), &ScriptManager::errorMessage, scriptEngines, &ScriptEngines::onErrorMessage);
connect(newManager.get(), &ScriptManager::warningMessage, scriptEngines, &ScriptEngines::onWarningMessage);
connect(newManager.get(), &ScriptManager::infoMessage, scriptEngines, &ScriptEngines::onInfoMessage);
connect(newEngine.data(), &ScriptEngine::printedMessage, scriptEngines, &ScriptEngines::onPrintedMessage);
connect(newEngine.data(), &ScriptEngine::errorMessage, scriptEngines, &ScriptEngines::onErrorMessage);
connect(newEngine.data(), &ScriptEngine::warningMessage, scriptEngines, &ScriptEngines::onWarningMessage);
connect(newEngine.data(), &ScriptEngine::infoMessage, scriptEngines, &ScriptEngines::onInfoMessage);
// Make script engine messages available through ScriptDiscoveryService
connect(newManager.get(), &ScriptManager::infoEntityMessage, scriptEngines, &ScriptEngines::infoEntityMessage);
connect(newManager.get(), &ScriptManager::printedEntityMessage, scriptEngines, &ScriptEngines::printedEntityMessage);
connect(newManager.get(), &ScriptManager::errorEntityMessage, scriptEngines, &ScriptEngines::errorEntityMessage);
connect(newManager.get(), &ScriptManager::warningEntityMessage, scriptEngines, &ScriptEngines::warningEntityMessage);
connect(newManager.get(), &ScriptManager::infoEntityMessage,
[this](const QString& message, const QString& fileName, int lineNumber, const EntityItemID& entityID) {
addLogEntry(message, fileName, lineNumber, entityID, ScriptMessage::Severity::SEVERITY_INFO);
});
connect(newManager.get(), &ScriptManager::printedEntityMessage,
[this](const QString& message, const QString& fileName, int lineNumber, const EntityItemID& entityID) {
addLogEntry(message, fileName, lineNumber, entityID, ScriptMessage::Severity::SEVERITY_PRINT);
});
connect(newManager.get(), &ScriptManager::errorEntityMessage,
[this](const QString& message, const QString& fileName, int lineNumber, const EntityItemID& entityID) {
addLogEntry(message, fileName, lineNumber, entityID, ScriptMessage::Severity::SEVERITY_ERROR);
});
connect(newManager.get(), &ScriptManager::warningEntityMessage,
[this](const QString& message, const QString& fileName, int lineNumber, const EntityItemID& entityID) {
addLogEntry(message, fileName, lineNumber, entityID, ScriptMessage::Severity::SEVERITY_WARNING);
});
connect(newManager.get(), &ScriptManager::update, this, [this] {
connect(newEngine.data(), &ScriptEngine::update, this, [this] {
_entityViewer.queryOctree();
_entityViewer.getTree()->preUpdate();
_entityViewer.getTree()->update();
});
scriptEngines->runScriptInitializers(newManager);
newManager->runInThread();
std::shared_ptr<EntitiesScriptEngineProvider> newEngineSP = newManager;
scriptEngines->runScriptInitializers(newEngine);
newEngine->runInThread();
auto newEngineSP = qSharedPointerCast<EntitiesScriptEngineProvider>(newEngine);
// On the entity script server, these are the same
DependencyManager::get<EntityScriptingInterface>()->setPersistentEntitiesScriptEngine(newEngineSP);
DependencyManager::get<EntityScriptingInterface>()->setNonPersistentEntitiesScriptEngine(newEngineSP);
if (_entitiesScriptManager) {
disconnect(_entitiesScriptManager.get(), &ScriptManager::entityScriptDetailsUpdated,
if (_entitiesScriptEngine) {
disconnect(_entitiesScriptEngine.data(), &ScriptEngine::entityScriptDetailsUpdated,
this, &EntityScriptServer::updateEntityPPS);
}
_entitiesScriptManager.swap(newManager);
connect(_entitiesScriptManager.get(), &ScriptManager::entityScriptDetailsUpdated,
_entitiesScriptEngine.swap(newEngine);
connect(_entitiesScriptEngine.data(), &ScriptEngine::entityScriptDetailsUpdated,
this, &EntityScriptServer::updateEntityPPS);
}
void EntityScriptServer::clear() {
// unload and stop the engine
if (_entitiesScriptManager) {
if (_entitiesScriptEngine) {
// do this here (instead of in deleter) to avoid marshalling unload signals back to this thread
_entitiesScriptManager->unloadAllEntityScripts();
_entitiesScriptManager->stop();
_entitiesScriptManager->waitTillDoneRunning();
_entitiesScriptEngine->unloadAllEntityScripts();
_entitiesScriptEngine->stop();
_entitiesScriptEngine->waitTillDoneRunning();
}
_entityViewer.clear();
@ -537,8 +503,8 @@ void EntityScriptServer::clear() {
}
void EntityScriptServer::shutdownScriptEngine() {
if (_entitiesScriptManager) {
_entitiesScriptManager->disconnectNonEssentialSignals(); // disconnect all slots/signals from the script engine, except essential
if (_entitiesScriptEngine) {
_entitiesScriptEngine->disconnectNonEssentialSignals(); // disconnect all slots/signals from the script engine, except essential
}
_shuttingDown = true;
@ -547,7 +513,7 @@ void EntityScriptServer::shutdownScriptEngine() {
auto scriptEngines = DependencyManager::get<ScriptEngines>();
scriptEngines->shutdownScripting();
_entitiesScriptManager.reset();
_entitiesScriptEngine.clear();
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
// our entity tree is going to go away so tell that to the EntityScriptingInterface
@ -565,8 +531,8 @@ void EntityScriptServer::addingEntity(const EntityItemID& entityID) {
}
void EntityScriptServer::deletingEntity(const EntityItemID& entityID) {
if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptManager) {
_entitiesScriptManager->unloadEntityScript(entityID, true);
if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) {
_entitiesScriptEngine->unloadEntityScript(entityID, true);
}
}
@ -577,20 +543,20 @@ void EntityScriptServer::entityServerScriptChanging(const EntityItemID& entityID
}
void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, bool forceRedownload) {
if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptManager) {
if (_entityViewer.getTree() && !_shuttingDown && _entitiesScriptEngine) {
EntityItemPointer entity = _entityViewer.getTree()->findEntityByEntityItemID(entityID);
EntityScriptDetails details;
bool isRunning = _entitiesScriptManager->getEntityScriptDetails(entityID, details);
bool isRunning = _entitiesScriptEngine->getEntityScriptDetails(entityID, details);
if (entity && (forceRedownload || !isRunning || details.scriptText != entity->getServerScripts())) {
if (isRunning) {
_entitiesScriptManager->unloadEntityScript(entityID, true);
_entitiesScriptEngine->unloadEntityScript(entityID, true);
}
QString scriptUrl = entity->getServerScripts();
if (!scriptUrl.isEmpty()) {
scriptUrl = DependencyManager::get<ResourceManager>()->normalizeURL(scriptUrl);
_entitiesScriptManager->loadEntityScript(entityID, scriptUrl, forceRedownload);
_entitiesScriptEngine->loadEntityScript(entityID, scriptUrl, forceRedownload);
}
}
}
@ -607,13 +573,13 @@ void EntityScriptServer::sendStatsPacket() {
QJsonObject scriptEngineStats;
int numberRunningScripts = 0;
const auto scriptManager = _entitiesScriptManager;
if (scriptManager) {
numberRunningScripts = scriptManager->getNumRunningEntityScripts();
const auto scriptEngine = _entitiesScriptEngine;
if (scriptEngine) {
numberRunningScripts = scriptEngine->getNumRunningEntityScripts();
}
scriptEngineStats["number_running_scripts"] = numberRunningScripts;
statsObject["script_engine_stats"] = scriptEngineStats;
auto nodeList = DependencyManager::get<NodeList>();
QJsonObject nodesObject;

View file

@ -4,11 +4,9 @@
//
// Created by Clément Brisset on 1/5/17.
// Copyright 2013 High Fidelity, Inc.
// Copyright 2023 Overte e.V.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// SPDX-License-Identifier: Apache-2.0
//
#ifndef hifi_EntityScriptServer_h
@ -20,16 +18,12 @@
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include <QtCore/QUuid>
#include <QtCore/QSharedPointer>
#include <EntityEditPacketSender.h>
#include <plugins/CodecPlugin.h>
#include <ScriptEngine.h>
#include <SimpleEntitySimulation.h>
#include <ThreadedAssignment.h>
#include <ScriptManager.h>
#include <ScriptMessage.h>
#include <QJsonArray>
#include "../entities/EntityTreeHeadlessViewer.h"
class EntityScriptServer : public ThreadedAssignment {
@ -57,32 +51,10 @@ private slots:
void handleSettings();
void updateEntityPPS();
/**
* @brief Handles log subscribe/unsubscribe requests
*
* Clients can subscribe to logs by sending a script log packet. Entity Script Server keeps list of subscribers
* and sends them logs in JSON format.
*/
void handleEntityServerScriptLogPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
/**
* @brief Transmit logs
*
* This is called periodically through a timer to transmit logs from scripts.
*/
void pushLogs();
/**
* @brief Adds log entry to the transmit buffer
*
* This is connected to entity script log events in the script manager and adds script log message to the buffer
* containing messages that will be sent to subscribed clients.
*/
void addLogEntry(const QString& message, const QString& fileName, int lineNumber, const EntityItemID& entityID, ScriptMessage::Severity severity);
void handleEntityScriptCallMethodPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
@ -104,14 +76,11 @@ private:
bool _shuttingDown { false };
static int _entitiesScriptEngineCount;
ScriptManagerPointer _entitiesScriptManager;
ScriptEnginePointer _entitiesScriptEngine;
SimpleEntitySimulationPointer _entitySimulation;
EntityEditPacketSender _entityEditSender;
EntityTreeHeadlessViewer _entityViewer;
QJsonArray _logBuffer;
std::mutex _logBufferMutex;
int _maxEntityPPS { DEFAULT_MAX_ENTITY_PPS };
int _entityPPSPerScript { DEFAULT_ENTITY_PPS_PER_SCRIPT };

View file

@ -6,6 +6,10 @@ if (NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
message( FATAL_ERROR "Only 64 bit builds supported." )
endif()
if (USE_CCACHE OR "$ENV{USE_CCACHE}")
configure_ccache()
endif()
if (WIN32)
add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)

View file

@ -15,22 +15,14 @@ string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
if (WIN32)
# Note the -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
# It's important that we pass our build type down to other builds we make, especially on Windows.
# On Windows, debug libraries get a 'd' suffix, eg, LibOVRd.lib. This means that a mismatch of build
# types means we'll generate a LibOVRd.lib and the rest of the system will look for LibOVR.lib, or
# viceversa.
ExternalProject_Add(
${EXTERNAL_NAME}
URL "${EXTERNAL_BUILD_ASSETS}/dependencies/ovr_sdk_win_1.35.0.zip"
URL_MD5 1e3e8b2101387af07ff9c841d0ea285e
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/LibOVRCMakeLists.txt" <SOURCE_DIR>/CMakeLists.txt
LOG_DOWNLOAD 1
DOWNLOAD_EXTRACT_TIMESTAMP 1
BUILD_BYPRODUCTS
"project/Lib/LibOVR.lib"
"project/Lib/LibOVRd.lib"
)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)

View file

@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.2)
project(LibOVR)
message(STATUS "Building LibOVR for ${CMAKE_BUILD_TYPE} configuration")
include_directories(LibOVR/Include LibOVR/Src)
file(GLOB HEADER_FILES LibOVR/Include/*.h)
file(GLOB EXTRA_HEADER_FILES LibOVR/Include/Extras/*.h)

View file

@ -16,8 +16,6 @@ if (WIN32)
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
DOWNLOAD_EXTRACT_TIMESTAMP 1
BUILD_BYPRODUCTS
"project/src/LibOVRPlatform/Windows/LibOVRPlatform64_1.lib"
)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)

View file

@ -13,13 +13,6 @@ if (WIN32)
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
DOWNLOAD_EXTRACT_TIMESTAMP 1
BUILD_BYPRODUCTS
"project/src/crashpad/out/Release_x64/lib_MD/crashpad_client.lib"
"project/src/crashpad/out/Release_x64/lib_MD/crashpad_util.lib"
"project/src/crashpad/out/Release_x64/lib_MD/base.lib"
"project/src/crashpad/out/Debug_x64/lib_MD/crashpad_client.lib"
"project/src/crashpad/out/Debug_x64/lib_MD/crashpad_util.lib"
"project/src/crashpad/out/Debug_x64/lib_MD/base.lib"
)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)

View file

@ -4,82 +4,18 @@ set(EXTERNAL_NAME steamworks)
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
set(STEAMWORKS_URL "${EXTERNAL_BUILD_ASSETS}/dependencies/steamworks_sdk_158a.zip")
set(STEAMWORKS_URL_SHA512 "fe906a7510a2125ab1441ad349e8bc31fafc9ab8130ec3843287e615a850305a8ed303e8d9e5bae4fee06024987834fb9f64c6c10d3da3784267a4906e59c831")
set(STEAMWORKS_URL "${EXTERNAL_BUILD_ASSETS}/dependencies/steamworks_sdk_137.zip")
set(STEAMWORKS_URL_MD5 "95ba9d0e3ddc04f8a8be17d2da806cbb")
# Ninja needs to know all the files that result from this upfront, so we need to tell it what files this is going
# to generate with BUILD_BYPRODUCTS. We need to include all the files that are going to be referenced from elsewhere
# in the build.
#
# This should include both libraries and headers, since from the point of view of the build, those are the outputs
# of the project, even though we're not actually building anything here, and just unzipping an existing binary.
#
# I believe this list can't be obtained automatically from the compressed file, and needs to be generated by hand.
# Steam SDK .zip has a sdk/ subdirectory, but for ExternalProject, this gets turned into project/src/steamworks.
# So inside the SDK, sdk/redistributable_bin/steam_api.dll becomes project/src/steamworks/redistributable_bin/steam_api.dll
# This can be seen under $BUILD_DIR/ext.
ExternalProject_Add(
${EXTERNAL_NAME}
URL ${STEAMWORKS_URL}
URL_HASH SHA512=${STEAMWORKS_URL_SHA512}
URL_MD5 ${STEAMWORKS_URL_MD5}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
DOWNLOAD_EXTRACT_TIMESTAMP 1
BUILD_BYPRODUCTS
"project/src/steamworks/redistributable_bin/win64/steam_api64.lib"
"project/src/steamworks/redistributable_bin/win64/steam_api64.dll"
"project/src/steamworks/redistributable_bin/osx/steam_api.dylib"
"project/src/steamworks/redistributable_bin/linux64/libsteam_api.so"
"project/src/steamworks/redistributable_bin/linux32/libsteam_api.so"
"project/src/steamworks/redistributable_bin/steam_api.lib"
"project/src/steamworks/redistributable_bin/steam_api.dll"
"project/src/steamworks/public/steam/isteamapplist.h"
"project/src/steamworks/public/steam/isteamapps.h"
"project/src/steamworks/public/steam/isteamappticket.h"
"project/src/steamworks/public/steam/isteamclient.h"
"project/src/steamworks/public/steam/isteamcontroller.h"
"project/src/steamworks/public/steam/isteamdualsense.h"
"project/src/steamworks/public/steam/isteamfriends.h"
"project/src/steamworks/public/steam/isteamgamecoordinator.h"
"project/src/steamworks/public/steam/isteamgameserver.h"
"project/src/steamworks/public/steam/isteamgameserverstats.h"
"project/src/steamworks/public/steam/isteamhtmlsurface.h"
"project/src/steamworks/public/steam/isteamhttp.h"
"project/src/steamworks/public/steam/isteaminput.h"
"project/src/steamworks/public/steam/isteaminventory.h"
"project/src/steamworks/public/steam/isteammatchmaking.h"
"project/src/steamworks/public/steam/isteammusic.h"
"project/src/steamworks/public/steam/isteammusicremote.h"
"project/src/steamworks/public/steam/isteamnetworking.h"
"project/src/steamworks/public/steam/isteamnetworkingmessages.h"
"project/src/steamworks/public/steam/isteamnetworkingsockets.h"
"project/src/steamworks/public/steam/isteamnetworkingutils.h"
"project/src/steamworks/public/steam/isteamparentalsettings.h"
"project/src/steamworks/public/steam/isteamps3overlayrenderer.h"
"project/src/steamworks/public/steam/isteamremoteplay.h"
"project/src/steamworks/public/steam/isteamremotestorage.h"
"project/src/steamworks/public/steam/isteamscreenshots.h"
"project/src/steamworks/public/steam/isteamugc.h"
"project/src/steamworks/public/steam/isteamuser.h"
"project/src/steamworks/public/steam/isteamuserstats.h"
"project/src/steamworks/public/steam/isteamutils.h"
"project/src/steamworks/public/steam/isteamvideo.h"
"project/src/steamworks/public/steam/matchmakingtypes.h"
"project/src/steamworks/public/steam/steam_api_common.h"
"project/src/steamworks/public/steam/steam_api_flat.h"
"project/src/steamworks/public/steam/steam_api.h"
"project/src/steamworks/public/steam/steam_api_internal.h"
"project/src/steamworks/public/steam/steamclientpublic.h"
"project/src/steamworks/public/steam/steamencryptedappticket.h"
"project/src/steamworks/public/steam/steam_gameserver.h"
"project/src/steamworks/public/steam/steamhttpenums.h"
"project/src/steamworks/public/steam/steamnetworkingfakeip.h"
"project/src/steamworks/public/steam/steamnetworkingtypes.h"
"project/src/steamworks/public/steam/steamps3params.h"
"project/src/steamworks/public/steam/steamtypes.h"
"project/src/steamworks/public/steam/steamuniverse.h"
)
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")

View file

@ -27,11 +27,6 @@ macro(add_crashpad)
set(CMAKE_BACKTRACE_TOKEN $ENV{CMAKE_BACKTRACE_TOKEN})
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
message(STATUS "Checking crashpad config - Linux aarch64 is not supported by crashpad, disabled.")
set(USE_CRASHPAD FALSE)
endif()
if (USE_CRASHPAD)
message(STATUS "Checking crashpad config - enabled.")
get_property(CRASHPAD_CHECKED GLOBAL PROPERTY CHECKED_FOR_CRASHPAD_ONCE)

0
cmake/macros/AutoScribeShader.cmake Normal file → Executable file
View file

View file

@ -0,0 +1,45 @@
#
# ConfigureCCache.cmake
# cmake/macros
#
# Created by Clement Brisset on 10/10/18.
# Copyright 2018 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(configure_ccache)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
message(STATUS "Configuring ccache")
# Set up wrapper scripts
set(C_LAUNCHER "${CCACHE_PROGRAM}")
set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
set(LAUNCH_C_IN "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/launch-c.in")
set(LAUNCH_CXX_IN "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/launch-cxx.in")
set(LAUNCH_C "${CMAKE_BINARY_DIR}/CMakeFiles/launch-c")
set(LAUNCH_CXX "${CMAKE_BINARY_DIR}/CMakeFiles/launch-cxx")
configure_file(${LAUNCH_C_IN} ${LAUNCH_C})
configure_file(${LAUNCH_CXX_IN} ${LAUNCH_CXX})
execute_process(COMMAND chmod a+rx ${LAUNCH_C} ${LAUNCH_CXX})
if(CMAKE_GENERATOR STREQUAL "Xcode")
# Set Xcode project attributes to route compilation and linking
# through our scripts
set(CMAKE_XCODE_ATTRIBUTE_CC ${LAUNCH_C})
set(CMAKE_XCODE_ATTRIBUTE_CXX ${LAUNCH_CXX})
set(CMAKE_XCODE_ATTRIBUTE_LD ${LAUNCH_C})
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS ${LAUNCH_CXX})
else()
# Support Unix Makefiles and Ninja
set(CMAKE_C_COMPILER_LAUNCHER ${LAUNCH_C})
set(CMAKE_CXX_COMPILER_LAUNCHER ${LAUNCH_CXX})
endif()
else()
message(WARNING "Could not find ccache")
endif()
endmacro()

View file

@ -20,13 +20,13 @@ macro(manually_install_openssl_for_qt)
find_package(OpenSSL REQUIRED)
install(
FILES "${VCPKG_INSTALL_ROOT}/bin/libcrypto-3-x64.dll"
FILES "${VCPKG_INSTALL_ROOT}/bin/libcrypto-1_1-x64.dll"
DESTINATION ${TARGET_INSTALL_DIR}
COMPONENT ${TARGET_INSTALL_COMPONENT}
)
install(
FILES "${VCPKG_INSTALL_ROOT}/bin/libssl-3-x64.dll"
FILES "${VCPKG_INSTALL_ROOT}/bin/libssl-1_1-x64.dll"
DESTINATION ${TARGET_INSTALL_DIR}
COMPONENT ${TARGET_INSTALL_COMPONENT}
)

View file

@ -2,11 +2,9 @@
# MemoryDebugger.cmake
#
# Copyright 2015 High Fidelity, Inc.
# Copyright 2023 Overte e.V.
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
# SPDX-License-Identifier: Apache-2.0
#
macro(SETUP_MEMORY_DEBUGGER)
@ -15,25 +13,10 @@ if ("$ENV{OVERTE_MEMORY_DEBUGGING}")
message(FATAL_ERROR "Thread debugging and memory debugging can't be enabled at the same time." )
endif()
if (OVERTE_OPTIMIZE)
message(WARNING "You should consider building without optimization by passing -DOVERTE_OPTIMIZE=false to CMake")
endif()
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
message(WARNING "You should consider building with debugging enabled by passing -DCMAKE_BUILD_TYPE=Debug to CMake. Current type is ${CMAKE_BUILD_TYPE}")
endif()
SET( OVERTE_MEMORY_DEBUGGING true )
SET ( DISABLE_WEBRTC true )
endif ()
if ( OVERTE_MEMORY_DEBUGGING)
# WebRTC doesn't work with memory debugging enabled, it fails to link:
# /usr/bin/ld: ../../libraries/networking/libnetworking.so: undefined reference to `typeinfo for rtc::Thread'
# /usr/bin/ld: ../../libraries/networking/libnetworking.so: undefined reference to `typeinfo for webrtc::SessionDescriptionInterface'
# /usr/bin/ld: ../../libraries/networking/libnetworking.so: undefined reference to `typeinfo for webrtc::IceCandidateInterface'
add_compile_definitions(DISABLE_WEBRTC)
if (OVERTE_MEMORY_DEBUGGING)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address -fsanitize-recover=address")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address -fsanitize-recover=address")

View file

@ -23,6 +23,7 @@ macro(SET_PACKAGING_PARAMETERS)
set_from_env(RELEASE_TYPE RELEASE_TYPE "DEV")
set_from_env(RELEASE_NUMBER RELEASE_NUMBER "")
set_from_env(RELEASE_NAME RELEASE_NAME "")
set_from_env(STABLE_BUILD STABLE_BUILD 0)
set_from_env(PRELOADED_STARTUP_LOCATION PRELOADED_STARTUP_LOCATION "")

View file

@ -1,6 +0,0 @@
macro(TARGET_DISCORD_RPC)
find_library(DISCORD_RPC_LIBRARY_RELEASE discord-rpc PATHS ${VCPKG_INSTALL_ROOT}/lib)
find_library(DISCORD_RPC_LIBRARY_DEBUG discord-rpc PATHS ${VCPKG_INSTALL_ROOT}/debug/lib)
select_library_configurations(DISCORD_RPC)
target_link_libraries(${TARGET_NAME} ${DISCORD_RPC_LIBRARY})
endmacro()

0
cmake/macros/TargetDraco.cmake Normal file → Executable file
View file

View file

@ -14,38 +14,36 @@ macro(TARGET_OPENEXR)
TMP
REGEX "#define OPENEXR_VERSION_STRING.*$")
string(REGEX MATCHALL "[0-9.]+" OPENEXR_VERSION ${TMP})
file(STRINGS
${openexr_config_file}
TMP
REGEX "#define OPENEXR_VERSION_MAJOR.*$")
string(REGEX MATCHALL "[0-9]" OPENEXR_MAJOR_VERSION ${TMP})
file(STRINGS
${openexr_config_file}
TMP
REGEX "#define OPENEXR_VERSION_MINOR.*$")
string(REGEX MATCHALL "[0-9]" OPENEXR_MINOR_VERSION ${TMP})
else()
message(WARNING "Failed to find ${openexr_config_file}")
endif()
set(OPENEXR_LIBRARY_RELEASE "")
set(OPENEXR_LIBRARY_DEBUG "")
foreach(OPENEXR_LIB
OpenEXRCore
OpenEXR
OpenEXRUtil
IlmImf
IlmImfUtil
Half
Iex
IlmThread
IexMath
Imath
)
IlmThread)
# OpenEXR libraries may be suffixed with the version number, so we search
# using both versioned and unversioned names.
find_library(OPENEXR_${OPENEXR_LIB}_LIBRARY_RELEASE
NAMES
${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}
${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}_s
${OPENEXR_LIB}_s
PATHS ${VCPKG_INSTALL_ROOT}/lib NO_DEFAULT_PATH
@ -54,15 +52,13 @@ macro(TARGET_OPENEXR)
if(OPENEXR_${OPENEXR_LIB}_LIBRARY_RELEASE)
list(APPEND OPENEXR_LIBRARY_RELEASE ${OPENEXR_${OPENEXR_LIB}_LIBRARY_RELEASE})
else()
message(WARNING "Failed to find ${OPENEXR_LIB} (release); ${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}")
endif()
# OpenEXR libraries may be suffixed with the version number, so we search
# using both versioned and unversioned names.
find_library(OPENEXR_${OPENEXR_LIB}_LIBRARY_DEBUG
NAMES
${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}_d
${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}_s_d
${OPENEXR_LIB}_s_d
PATHS ${VCPKG_INSTALL_ROOT}/debug/lib NO_DEFAULT_PATH
@ -71,19 +67,10 @@ macro(TARGET_OPENEXR)
if(OPENEXR_${OPENEXR_LIB}_LIBRARY_DEBUG)
list(APPEND OPENEXR_LIBRARY_DEBUG ${OPENEXR_${OPENEXR_LIB}_LIBRARY_DEBUG})
else()
message(WARNING "Failed to find ${OPENEXR_LIB} (debug); ${OPENEXR_LIB}-${OPENEXR_MAJOR_VERSION}_${OPENEXR_MINOR_VERSION}_d")
endif()
endforeach(OPENEXR_LIB)
select_library_configurations(OPENEXR)
target_link_libraries(${TARGET_NAME} ${OPENEXR_LIBRARY})
target_include_directories(${TARGET_NAME} PUBLIC "${VCPKG_INSTALL_ROOT}/include/Imath")
# This prevents:
# LNK2001 unresolved external symbol imath_half_to_float_table
#
# Apparently something changed in newer versions.
target_compile_definitions(${TARGET_NAME} PUBLIC IMATH_HALF_NO_LOOKUP_TABLE)
endif()
endmacro()

View file

@ -1,15 +0,0 @@
#
# Copyright 2022-2023 Overte e.V.
# Created by dr Karol Suprynowicz on 2022/09/03
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
# SPDX-License-Identifier: Apache-2.0
#
macro(TARGET_V8)
find_package(V8 REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${V8_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${V8_LIBRARIES})
endmacro()

View file

@ -1,481 +0,0 @@
#
# CMake Find V8 Google JavaScript Engine by Parra Studios
# CMake script to find V8 JavaScript Engine.
#
# Copyright (C) 2016 - 2022 Vicente Eduardo Ferrer Garcia <vic798@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Modified by dr Karol Suprynowicz on 2022/09/03
# Copyright 2022-2023 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
# Find V8 library and include paths
#
# V8_FOUND - True if V8 was found
# V8_INCLUDE_DIR - V8 headers path
# V8_LIBRARIES - List of V8 libraries
# V8_VERSION - V8 version
# V8_VERSION_MAJOR - V8 major version
# V8_VERSION_MINOR - V8 minor version
# V8_VERSION_PATCH - V8 patch version
# V8_VERSION_TWEAK - V8 patch version
# V8_VERSION_HEX - V8 version in hexadecimal format
# V8_EXECUTABLE - V8 shell
# Prevent vervosity if already included
if(V8_INCLUDE_DIR)
set(V8_FIND_QUIETLY TRUE)
endif()
# Debug flag
set(_V8_CMAKE_DEBUG TRUE)
# Include package manager
include(FindPackageHandleStandardArgs)
# V8 search paths
set(V8_PATHS
${VCPKG_INSTALL_ROOT}
${V8_HOME}
${V8_ROOT}
$ENV{ProgramFiles}/v8
$ENV{SystemDrive}/v8
$ENV{V8_HOME}
$ENV{EXTERNLIBS}/v8
${V8_DIR}
$ENV{V8_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
/usr/freeware
)
# V8 platform dependant paths
if(NOT UNIX)
set(V8_PATHS_DEBUG
${V8_DIR}/build/Debug
)
set(V8_PATHS_RELEASE
${V8_DIR}/build/Release
)
else()
set(V8_PATHS_DEBUG
${V8_DIR}/out/ia32.debug
${V8_DIR}/out/x64.debug
${V8_DIR}/out/native
)
set(V8_PATHS_RELEASE
${V8_DIR}/out/ia32.release
${V8_DIR}/out/x64.release
${V8_DIR}/out/native
)
endif()
# V8 library paths
#set(V8_LIBRARY_PATH_SUFFIXES lib lib64 lib/x86_64-linux-gnu lib.target)
# Find include path
if(MSVC OR CMAKE_BUILD_TYPE EQUAL "Debug")
set(V8_HEADERS v8.h v8-debug.h v8-profiler.h v8stdint.h)
else()
set(V8_HEADERS v8.h v8stdint.h)
endif()
find_path(V8_INCLUDE_DIR ${V8_HEADERS}
PATHS ${V8_PATHS}
PATH_SUFFIXES include include/node
DOC "Google V8 JavaScript Engine Headers"
)
MESSAGE("V8 include dir: ${V8_INCLUDE_DIR}")
# Define library names
set(V8_NAMES_DEBUG libnode.so.108 libnode libnode.so libnode.lib v8D v8_baseD v8_base.ia32D v8_base.x64D libv8_baseD v8_baseD.lib v8_libbaseD v8_libbase.ia32D v8_libbase.x64D libv8_libbaseD v8_libbaseD.lib)
set(V8_NAMES_RELEASE libnode.so.108 libnode libnode.so libnode.lib v8 v8_base v8_base.ia32 v8_base.x64 libv8_base v8_base.lib v8_libbase v8_libbase.ia32 v8_libbase.x64 libv8_libbase v8_libbase.lib)
set(V8_PLATFORM_NAMES_DEBUG libnode.so.108 v8_libplatform.lib libnode libnode.so libnode.lib v8_libplatformD v8_libplatformD.a v8_libplatformD.lib)
set(V8_PLATFORM_NAMES_RELEASE libnode.so.108 v8_libplatform.lib libnode libnode.so libnode.lib v8_libplatform v8_libplatform.a)
set(V8_SAMPLER_NAMES_DEBUG libnode.so.108 libnode libnode.so libnode.lib v8_libsamplerD v8_libsamplerD.a v8_libsamplerD.lib)
set(V8_SAMPLER_NAMES_RELEASE libnode.so.108 libnode libnode.so libnode.lib v8_libsampler v8_libsampler.a v8_libsampler.lib)
set(V8_SNAPSHOT_NAMES_DEBUG libnode.so.108 libnode libnode.so libnode.lib v8_snapshotD libv8_snapshotD v8_snapshotD.lib)
set(V8_SNAPSHOT_NAMES_RELEASE libnode.so.108 libnode libnode.so libnode.lib v8_snapshot libv8_snapshot v8_snapshot.lib)
set(V8_ICU_NAMES_DEBUG libnode.so.108 libnode libnode.so libnode.lib icudataD icudataD.a icudataD.lib)
set(V8_ICU_NAMES_RELEASE libnode.so.108 libnode libnode.so libnode.lib icudata icudata.a icudata.lib)
set(V8_ICUUC_NAMES_DEBUG libnode.so.108 libnode libnode.so libnode.lib icuucD libicuucD)
set(V8_ICUUC_NAMES_RELEASE libnode.so.108 libnode libnode.so libnode.lib icuuc libicuuc)
set(V8_ICUI18N_NAMES_DEBUG libnode.so.108 libnode libnode.so libnode.lib icui18nD libicui18nD)
set(V8_ICUI18N_NAMES_RELEASE libnode.so.108 libnode libnode.so libnode.lib icui18n libicui18n)
# Find V8 base library debug
find_library(V8_LIBRARY_DEBUG
NAMES ${V8_NAMES_DEBUG}
PATHS ${V8_PATHS} ${V8_PATHS_DEBUG}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library (Debug)"
)
MESSAGE("V8_LIBRARY_DEBUG: ${V8_LIBRARY_DEBUG}")
# Find V8 base library release
find_library(V8_LIBRARY_RELEASE
NAMES ${V8_NAMES_RELEASE}
PATHS ${V8_PATHS} ${V8_PATHS_RELEASE}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library (Release)"
)
MESSAGE("V8_LIBRARY_RELEASE: ${V8_LIBRARY_RELEASE}")
# Find V8 platform library debug
find_library(V8_PLATFORM_LIBRARY_DEBUG
NAMES ${V8_PLATFORM_NAMES_DEBUG}
PATHS ${V8_PATHS} ${V8_PATHS_DEBUG}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library Platform (Debug)"
)
MESSAGE("V8_PLATFORM_LIBRARY_DEBUG: ${V8_PLATFORM_LIBRARY_DEBUG}")
# Find V8 platform library release
find_library(V8_PLATFORM_LIBRARY_RELEASE
NAMES ${V8_PLATFORM_NAMES_RELEASE}
PATHS ${V8_PATHS} ${V8_PATHS_RELEASE}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library Platform (Release)"
)
MESSAGE("V8_PLATFORM_LIBRARY_RELEASE: ${V8_PLATFORM_LIBRARY_RELEASE}")
# Find V8 platform library debug
find_library(V8_SAMPLER_LIBRARY_DEBUG
NAMES ${V8_SAMPLER_NAMES_DEBUG}
PATHS ${V8_PATHS} ${V8_PATHS_DEBUG}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library Sampler (Debug)"
)
MESSAGE("V8_SAMPLER_LIBRARY_DEBUG: ${V8_SAMPLER_LIBRARY_DEBUG}")
# Find V8 platform library release
find_library(V8_SAMPLER_LIBRARY_RELEASE
NAMES ${V8_SAMPLER_NAMES_RELEASE}
PATHS ${V8_PATHS} ${V8_PATHS_RELEASE}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library Sampler (Release)"
)
MESSAGE("V8_SAMPLER_LIBRARY_RELEASE: ${V8_SAMPLER_LIBRARY_RELEASE}")
# Find V8 snapshot library debug
find_library(V8_SNAPSHOT_LIBRARY_DEBUG
NAMES ${V8_SNAPSHOT_NAMES_DEBUG}
PATHS ${V8_PATHS} ${V8_PATHS_DEBUG}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library Snapshot (Debug)"
)
MESSAGE("V8_SNAPSHOT_LIBRARY_DEBUG: ${V8_SNAPSHOT_LIBRARY_DEBUG}")
# Find V8 snapshot library release
find_library(V8_SNAPSHOT_LIBRARY_RELEASE
NAMES ${V8_SNAPSHOT_NAMES_RELEASE}
PATHS ${V8_PATHS} ${V8_PATHS_RELEASE}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library Snapshot (Release)"
)
MESSAGE("V8_SNAPSHOT_LIBRARY_RELEASE: ${V8_SNAPSHOT_LIBRARY_RELEASE}")
# Find V8 icu library debug
find_library(V8_ICU_LIBRARY_DEBUG
NAMES ${V8_ICU_NAMES_DEBUG}
PATHS ${V8_PATHS} ${V8_PATHS_DEBUG}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library ICU (Debug)"
)
MESSAGE("V8_ICU_LIBRARY_DEBUG: ${V8_ICU_LIBRARY_DEBUG}")
# Find V8 icu library release
find_library(V8_ICU_LIBRARY_RELEASE
NAMES ${V8_ICU_NAMES_RELEASE}
PATHS ${V8_PATHS} ${V8_PATHS_RELEASE}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library ICU (Release)"
)
MESSAGE("V8_ICU_LIBRARY_RELEASE: ${V8_ICU_LIBRARY_RELEASE}")
# Find V8 icuuc library debug
find_library(V8_ICUUC_LIBRARY_DEBUG
NAMES ${V8_ICUUC_NAMES_DEBUG}
PATHS ${V8_PATHS} ${V8_PATHS_DEBUG}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library ICUUC (Debug)"
)
MESSAGE("V8_ICUUC_LIBRARY_DEBUG: ${V8_ICUUC_LIBRARY_DEBUG}")
# Find V8 icuuc library release
find_library(V8_ICUUC_LIBRARY_RELEASE
NAMES ${V8_ICUUC_NAMES_RELEASE}
PATHS ${V8_PATHS} ${V8_PATHS_RELEASE}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library ICUUC (Release)"
)
MESSAGE("V8_ICUUC_LIBRARY_RELEASE: ${V8_ICUUC_LIBRARY_RELEASE}")
# Find V8 icui18n library debug
find_library(V8_ICUI18N_LIBRARY_DEBUG
NAMES ${V8_ICUI18N_NAMES_DEBUG}
PATHS ${V8_PATHS} ${V8_PATHS_DEBUG}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library ICUI18N (Debug)"
)
MESSAGE("V8_ICUI18N_LIBRARY_DEBUG: ${V8_ICUI18N_LIBRARY_DEBUG}")
# Find V8 icui18n library release
find_library(V8_ICUI18N_LIBRARY_RELEASE
NAMES ${V8_ICUI18N_NAMES_RELEASE}
PATHS ${V8_PATHS} ${V8_PATHS_RELEASE}
PATH_SUFFIXES ${V8_LIBRARY_PATH_SUFFIXES}
DOC "Google V8 JavaScript Engine Library ICUI18N (Release)"
)
MESSAGE("V8_ICUI18N_LIBRARY_RELEASE: ${V8_ICUI18N_LIBRARY_RELEASE}")
# Base build with snapshot
MESSAGE("1")
if(MSVC)
if(V8_LIBRARY_DEBUG AND V8_LIBRARY_RELEASE AND V8_SNAPSHOT_LIBRARY_DEBUG AND V8_SNAPSHOT_LIBRARY_RELEASE)
set(V8_LIBRARY
${V8_LIBRARY_DEBUG} ${V8_PLATFORM_LIBRARY_DEBUG} ${V8_SNAPSHOT_LIBRARY_DEBUG} # ${V8_ICU_LIBRARY_DEBUG}
${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE} ${V8_SNAPSHOT_LIBRARY_RELEASE} # ${V8_ICU_LIBRARY_RELEASE}
)
set(V8_LIBRARIES
optimized ${V8_LIBRARY_RELEASE} debug ${V8_LIBRARY_DEBUG}
optimized ${V8_PLATFORM_LIBRARY_RELEASE} debug ${V8_PLATFORM_LIBRARY_DEBUG}
# optimized ${V8_ICU_LIBRARY_RELEASE} debug ${V8_ICU_LIBRARY_DEBUG}
optimized ${V8_SNAPSHOT_LIBRARY_RELEASE} debug ${V8_SNAPSHOT_LIBRARY_DEBUG}
optimized Winmm.lib debug Winmm.lib
)
endif()
else()
MESSAGE("2")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE("3")
if(V8_LIBRARY_DEBUG AND V8_PLATFORM_LIBRARY_DEBUG AND V8_SAMPLER_LIBRARY_DEBUG)
set(V8_LIBRARY ${V8_LIBRARY_DEBUG} ${V8_PLATFORM_LIBRARY_DEBUG} ${V8_SAMPLER_LIBRARY_DEBUG}) # ${V8_ICU_LIBRARY_DEBUG})
elseif(V8_LIBRARY_DEBUG AND V8_PLATFORM_LIBRARY_DEBUG)
MESSAGE("4")
set(V8_LIBRARY ${V8_LIBRARY_DEBUG} ${V8_PLATFORM_LIBRARY_DEBUG}) # ${V8_SAMPLER_LIBRARY_DEBUG}) # ${V8_ICU_LIBRARY_DEBUG})
else()
if(V8_LIBRARY_RELEASE AND V8_PLATFORM_LIBRARY_RELEASE AND V8_SAMPLER_LIBRARY_RELEASE)
set(V8_LIBRARY ${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE} ${V8_SAMPLER_LIBRARY_RELEASE}) # ${V8_ICU_LIBRARY_DEBUG})
elseif(V8_LIBRARY_RELEASE AND V8_PLATFORM_LIBRARY_RELEASE)
set(V8_LIBRARY ${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE}) # ${V8_SAMPLER_LIBRARY_RELEASE}) # ${V8_ICU_LIBRARY_DEBUG})
endif()
endif()
else()
if(V8_LIBRARY_RELEASE AND V8_PLATFORM_LIBRARY_RELEASE AND V8_SAMPLER_LIBRARY_RELEASE)
set(V8_LIBRARY ${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE} ${V8_SAMPLER_LIBRARY_RELEASE}) # ${V8_ICU_LIBRARY_RELEASE})
elseif(V8_LIBRARY_RELEASE AND V8_PLATFORM_LIBRARY_RELEASE )
set(V8_LIBRARY ${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE} ) # ${V8_SAMPLER_LIBRARY_RELEASE} ${V8_ICU_LIBRARY_RELEASE})
endif()
endif()
set(V8_LIBRARIES ${V8_LIBRARY})
endif()
# Set version libraries
set(V8_LIBRARIES_DEPENDS)
if (V8_LIBRARY_DEBUG)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_LIBRARY_DEBUG}.${V8_FIND_VERSION}
)
endif()
if (V8_LIBRARY_RELEASE)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_LIBRARY_RELEASE}.${V8_FIND_VERSION}
)
endif()
if(V8_ICU_LIBRARY_DEBUG)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_ICU_LIBRARY_DEBUG}.${ICU_FIND_VERSION}
)
endif()
if(V8_ICU_LIBRARY_RELEASE)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_ICU_LIBRARY_RELEASE}.${ICU_FIND_VERSION}
)
endif()
if(V8_ICUUC_LIBRARY_DEBUG)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_ICUUC_LIBRARY_DEBUG}.${ICU_FIND_VERSION}
)
endif()
if(V8_ICUUC_LIBRARY_RELEASE)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_ICUUC_LIBRARY_RELEASE}.${ICU_FIND_VERSION}
)
endif()
if(V8_ICUI18N_LIBRARY_DEBUG)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_ICUI18N_LIBRARY_DEBUG}.${ICU_FIND_VERSION}
)
endif()
if(V8_ICUI18N_LIBRARY_RELEASE)
set(V8_LIBRARIES_DEPENDS
${V8_LIBRARIES_DEPENDS}
${V8_ICUI18N_LIBRARY_RELEASE}.${ICU_FIND_VERSION}
)
endif()
MESSAGE("V8_LIBRARY: ${V8_LIBRARY}")
find_package_handle_standard_args(V8 DEFAULT_MSG V8_LIBRARY V8_INCLUDE_DIR)
# Base build
if(NOT V8_FOUND)
if(MSVC)
if(V8_LIBRARY_DEBUG AND V8_LIBRARY_RELEASE)
set(V8_LIBRARY
${V8_LIBRARY_DEBUG} ${V8_LIBRARY_RELEASE}
${V8_PLATFORM_LIBRARY_DEBUG} ${V8_PLATFORM_LIBRARY_RELEASE}
# ${V8_ICU_LIBRARY_DEBUG} ${V8_ICU_LIBRARY_RELEASE}
)
set(V8_LIBRARIES
optimized ${V8_LIBRARY_RELEASE} debug ${V8_LIBRARY_DEBUG}
optimized ${V8_PLATFORM_LIBRARY_RELEASE} debug ${V8_PLATFORM_LIBRARY_DEBUG}
# optimized ${V8_ICU_LIBRARY_RELEASE} debug ${V8_ICU_LIBRARY_DEBUG}
optimized Winmm.lib debug Winmm.lib
)
endif()
else()
if(CMAKE_BUILD_TYPE EQUAL "Debug")
if(V8_LIBRARY_DEBUG)
set(V8_LIBRARY ${V8_LIBRARY_DEBUG} ${V8_PLATFORM_LIBRARY_DEBUG}) # ${V8_ICU_LIBRARY_DEBUG})
endif()
else()
if(V8_LIBRARY_RELEASE)
set(V8_LIBRARY ${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE}) # ${V8_ICU_LIBRARY_RELEASE})
endif()
endif()
set(V8_LIBRARIES ${V8_LIBRARY})
endif()
find_package_handle_standard_args(V8 DEFAULT_MSG V8_LIBRARY V8_INCLUDE_DIR)
endif()
# Minimal build
if(NOT V8_FOUND)
if(MSVC)
if(V8_LIBRARY_RELEASE)
set(V8_LIBRARY ${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE}) # ${V8_ICU_LIBRARY_RELEASE})
set(V8_LIBRARIES
optimized ${V8_LIBRARY_RELEASE} debug ${V8_LIBRARY_RELEASE}
optimized ${V8_PLATFORM_LIBRARY_RELEASE} debug ${V8_PLATFORM_LIBRARY_RELEASE}
# optimized ${V8_ICU_LIBRARY_RELEASE} debug ${V8_ICU_LIBRARY_RELEASE}
optimized Winmm.lib debug Winmm.lib
)
endif()
else()
if(V8_LIBRARY_RELEASE)
set(V8_LIBRARY ${V8_LIBRARY_RELEASE} ${V8_PLATFORM_LIBRARY_RELEASE}) # ${V8_ICU_LIBRARY_RELEASE})
endif()
set(V8_LIBRARIES ${V8_LIBRARY})
endif()
find_package_handle_standard_args(V8 DEFAULT_MSG V8_LIBRARY V8_INCLUDE_DIR)
endif()
# Detect V8 version
if(V8_FOUND AND V8_INCLUDE_DIR)
file(READ ${V8_INCLUDE_DIR}/v8-version.h V8_VERSION_FILE)
string(REGEX MATCH "#define V8_MAJOR_VERSION ([0-9]+)" V8_VERSION_MAJOR_DEF ${V8_VERSION_FILE})
string(REGEX MATCH "([0-9]+)$" V8_VERSION_MAJOR ${V8_VERSION_MAJOR_DEF})
string(REGEX MATCH "#define V8_MINOR_VERSION ([0-9]+)" V8_VERSION_MINOR_DEF ${V8_VERSION_FILE})
string(REGEX MATCH "([0-9]+)$" V8_VERSION_MINOR ${V8_VERSION_MINOR_DEF})
string(REGEX MATCH "#define V8_BUILD_NUMBER ([0-9]+)" V8_VERSION_PATCH_DEF ${V8_VERSION_FILE})
string(REGEX MATCH "([0-9]+)$" V8_VERSION_PATCH ${V8_VERSION_PATCH_DEF})
string(REGEX MATCH "#define V8_PATCH_LEVEL ([0-9]+)" V8_VERSION_TWEAK_DEF ${V8_VERSION_FILE})
string(REGEX MATCH "([0-9]+)$" V8_VERSION_TWEAK ${V8_VERSION_TWEAK_DEF})
set(V8_VERSION "${V8_VERSION_MAJOR}.${V8_VERSION_MINOR}.${V8_VERSION_PATCH}.${V8_VERSION_TWEAK}")
set(V8_VERSION_HEX 0x0${V8_VERSION_MAJOR}${V8_VERSION_MINOR}${V8_VERSION_PATCH}${V8_VERSION_TWEAK})
string(LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_LENGTH)
while(V8_VERSION_HEX_LENGTH LESS 8)
set(V8_VERSION_HEX "${V8_VERSION_HEX}0")
string(LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_LENGTH)
endwhile()
endif()
# Detect V8 shell
set(V8_EXECUTABLE_NAMES d8)
find_program(V8_EXECUTABLE
NAMES ${V8_EXECUTABLE_NAMES}
)
mark_as_advanced(V8_LIBRARY V8_INCLUDE_DIR)
if(V8_FOUND)
set(V8_INCLUDE_DIRS ${V8_INCLUDE_DIR})
endif()
if(_V8_CMAKE_DEBUG)
message(STATUS "V8_INCLUDE_DIR: ${V8_INCLUDE_DIR}")
message(STATUS "V8_LIBRARIES: ${V8_LIBRARIES}")
message(STATUS "V8_LIBRARIES_DEPENDS: ${V8_LIBRARIES_DEPENDS}")
message(STATUS "V8_VERSION: ${V8_VERSION}")
message(STATUS "V8_VERSION_HEX: ${V8_VERSION_HEX}")
message(STATUS "V8_EXECUTABLE: ${V8_EXECUTABLE}")
endif()

View file

@ -1,38 +0,0 @@
diff --git a/artery-font/serialization.hpp b/artery-font/serialization.hpp
index 69263a8..6075eda 100644
--- a/artery-font/serialization.hpp
+++ b/artery-font/serialization.hpp
@@ -109,15 +109,16 @@ template <ReadFunction READ, typename REAL, template <typename> class LIST, clas
bool decode(ArteryFont<REAL, LIST, BYTE_ARRAY, STRING> &font, void *userData) {
uint32 totalLength = 0;
uint32 prevLength = 0;
- uint32 checksum = crc32Init();
+ //uint32 checksum = crc32Init();
byte dump[4];
#define ARTERY_FONT_DECODE_READ(target, len) { \
if (READ((target), (len), userData) != int(len)) \
return false; \
totalLength += (len); \
- for (int _i = 0; _i < int(len); ++_i) \
- checksum = crc32Update(checksum, reinterpret_cast<const byte *>(target)[_i]); \
}
+ // for (int _i = 0; _i < int(len); ++_i) \
+ // checksum = crc32update(checksum, reinterpret_cast<const byte *>(target)[_i]); \
+ //}
#define ARTERY_FONT_DECODE_REALIGN() { \
if (totalLength&0x03u) { \
uint32 len = 0x04u-(totalLength&0x03u); \
@@ -228,10 +229,10 @@ bool decode(ArteryFont<REAL, LIST, BYTE_ARRAY, STRING> &font, void *userData) {
ARTERY_FONT_DECODE_READ(&footer, sizeof(footer)-sizeof(footer.checksum));
if (footer.magicNo != ARTERY_FONT_FOOTER_MAGIC_NO)
return false;
- uint32 finalChecksum = checksum;
+ //uint32 finalChecksum = checksum;
ARTERY_FONT_DECODE_READ(&footer.checksum, sizeof(footer.checksum));
- if (footer.checksum != finalChecksum)
- return false;
+ //if (footer.checksum != finalChecksum)
+ // return false;
if (totalLength != footer.totalLength)
return false;
}

View file

@ -1,15 +0,0 @@
# header-only library
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Chlumsky/artery-font-format
REF 34134bde3cea35a93c2ae5703fa8d3d463793400
SHA512 6b2fc0de9ca7b367c9b98f829ce6cee858f1252b12a49b6f1e89a5a2fdb109e20ef812f0b30495195ca0b177adae32d5e238fdc305724857ced098be2d29a6af
HEAD_REF master
PATCHES "disable-checksum.patch"
)
file(COPY "${SOURCE_PATH}/artery-font" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
# Handle copyright
configure_file("${SOURCE_PATH}/LICENSE.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)

View file

@ -1,7 +0,0 @@
{
"name": "artery-font-format",
"version": "1.0.1",
"description": "Header-only C++ library that facilitates encoding and decoding of the Artery Atlas Font format",
"homepage": "https://github.com/Chlumsky/artery-font-format",
"license": "MIT"
}

View file

@ -1,15 +0,0 @@
# header-only library
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO jkuhlmann/cgltf
REF de399881c65c438a635627c749440eeea7e05599
SHA512 753923116b92642848ff2bda70695ddd0e7be6db43ed3cfc37aff4cba90a29a92e3dbda139a5f2c80cad1d2cdaf81e1383e4ea7a12195f61fe8cfeb105e53ea2
HEAD_REF master
)
file(COPY "${SOURCE_PATH}/cgltf.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
file(COPY "${SOURCE_PATH}/cgltf_write.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
# Handle copyright
configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)

View file

@ -1,7 +0,0 @@
{
"name": "cgltf",
"version": "1.13",
"description": "Single-file glTF 2.0 loader and writer written in C99",
"homepage": "https://github.com/jkuhlmann/cgltf",
"license": "MIT"
}

View file

@ -1,21 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5dad9e9..961f02d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ file(GLOB_RECURSE ALL_SOURCE_FILES
src/*.cpp src/*.h src/*.c
)
+if(0)
# Set CLANG_FORMAT_SUFFIX if you are using custom clang-format, e.g. clang-format-5.0
find_program(CLANG_FORMAT_CMD clang-format${CLANG_FORMAT_SUFFIX})
@@ -43,7 +44,7 @@ if (NOT RAPIDJSONTEST)
)
file(REMOVE ${RJ_TAR_FILE})
endif(NOT RAPIDJSONTEST)
-
+endif()
find_file(RAPIDJSON NAMES rapidjson rapidjson-1.1.0 PATHS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty CMAKE_FIND_ROOT_PATH_BOTH)
add_library(rapidjson STATIC IMPORTED ${RAPIDJSON})

View file

@ -1,33 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO discordapp/discord-rpc
REF v3.4.0
SHA512 ca981b833aff5f21fd629a704deadd8e3fb5423d959ddb75e381313f6462d984c567671b10c8f031905c08d85792ddbe2dddc402ba2613c42de9e80fc68d0d51
HEAD_REF master
PATCHES disable-downloading.patch
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT)
file(REMOVE_RECURSE "${SOURCE_PATH}/thirdparty")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DUSE_STATIC_CRT=${STATIC_CRT}
-DBUILD_EXAMPLES=OFF
-DRAPIDJSONTEST=TRUE
"-DRAPIDJSON=${CURRENT_INSTALLED_DIR}"
)
if(EXISTS ${SOURCE_PATH}/thirdparty)
message(FATAL_ERROR "The source directory should not be modified during the build.")
endif()
vcpkg_cmake_install()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
# Copy copright information
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/discord-rpc" RENAME "copyright")
vcpkg_copy_pdbs()

View file

@ -1,18 +0,0 @@
{
"name": "discord-rpc",
"version": "3.4.0",
"port-version": 3,
"description": "Rich Presence allows you to leverage the totally overhauled \"Now Playing\" section in a Discord user's profile to help people play your game together.",
"homepage": "https://github.com/discordapp/discord-rpc",
"dependencies": [
"rapidjson",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View file

@ -1,4 +1,4 @@
Source: draco
Version: 1.3.5-fixed
Version: 1.3.3
Description: A library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.
Build-Depends:

View file

@ -1,4 +1,4 @@
Source: hifi-client-deps
Version: 0.1
Description: Collected dependencies for High Fidelity applications
Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator, discord-rpc (!android)
Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator

View file

@ -1,8 +1,4 @@
# Copyright 2018-2019 High Fidelity, Inc.
# Copyright 2020 Vircadia contributors
# Copyright 2021-2023 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
Source: hifi-deps
Version: 0.1.5-github-actions
Description: Collected dependencies for High Fidelity applications
Build-Depends: artery-font-format, bullet3, cgltf, draco, etc2comp, glad, glm, node, nvtt, openexr (!android), openssl (windows), opus, polyvox, tbb (!android), vhacd, webrtc (!android|!(linux&arm)), zlib
Build-Depends: bullet3, draco, etc2comp, glad, glm, nvtt, openexr (!android), openssl (windows), opus, polyvox, tbb (!android), vhacd, webrtc (!android|!(linux&arm)), zlib

View file

@ -1,25 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO AcademySoftwareFoundation/Imath
REF v3.1.9
SHA512 ad96b2ac306fc13c01e8ea3256f885499c3f545be327feaba0f5e093b70b544bcca6f8b353fa7e35107aae515c19caced44331a95d0414f367ead4691ec73564
HEAD_REF master
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DIMATH_INSTALL_SYM_LINK=OFF
-DBUILD_TESTING=OFF
-DIMATH_INSTALL_PKG_CONFIG=ON
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Imath)
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View file

@ -1,18 +0,0 @@
{
"name": "imath",
"version": "3.1.9",
"port-version": 1,
"description": "Imath is a C++ and Python library of 2D and 3D vector, matrix, and math operations for computer graphics.",
"homepage": "https://github.com/AcademySoftwareFoundation/Imath",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View file

@ -1,6 +0,0 @@
# Copyright 2023 Overte e.V.
# SPDX-License-Identifier: MIT
Source: node
Version: 18.14.2-1
Homepage: https://nodejs.org/
Description: Node.js JavaScript runtime.

View file

@ -1,107 +0,0 @@
# Copyright 2023-2024 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
set(NODE_VERSION 18.14.2)
set(MASTER_COPY_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
file(READ "${VCPKG_ROOT_DIR}/_env/EXTERNAL_BUILD_ASSETS.txt" EXTERNAL_BUILD_ASSETS)
if (ANDROID)
# TODO
elseif (WIN32)
vcpkg_download_distfile(
NODE_SOURCE_ARCHIVE
URLS "${EXTERNAL_BUILD_ASSETS}/dependencies/node/node-install-18.15.1-win-x64-release.tar.xz"
SHA512 892608a43ae32b0a82a0e3c7994934d0ce85639ea372c8e7feb7de44220211fa91878bd0744e1488054777807dd5b0c0677b59b44ab5e9fd35ecf222b38d8046
FILENAME node-install-18.15.1-win-x64-release.tar.xz
)
elseif (APPLE)
# TODO
vcpkg_download_distfile(
NODE_SOURCE_ARCHIVE
URLS "${EXTERNAL_BUILD_ASSETS}/dependencies/node/node-install-18.14.2-macOSXSDK10.14-macos-amd64-release.tar.xz"
SHA512 TODO
FILENAME node-install-18.14.2-macOSXSDK10.14-macos-amd64-release.tar.xz
)
else ()
# else Linux desktop
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nodejs/node
REF v18.20.2
SHA512 10d3637c26274677d137f76bbb648d0e7851c994634a16c89858c3a13094a0692ea2cb9a787c6463c3001abd71dab0d83123127bc305171d097c48d21d691678
HEAD_REF v18.20.2
)
# node cannot configure out of source, which VCPKG expects. So we copy the source to the configure directory.
file(COPY ${SOURCE_PATH}/ DESTINATION "${CURRENT_BUILDTREES_DIR}")
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
# --gdb fails on aarch64
vcpkg_execute_build_process(
COMMAND ./configure --shared --v8-enable-object-print --shared-openssl --prefix=${CURRENT_BUILDTREES_DIR}/node-install/
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "configure-node"
)
else () # amd64
vcpkg_execute_build_process(
COMMAND ./configure --gdb --shared --v8-enable-object-print --shared-openssl --prefix=${CURRENT_BUILDTREES_DIR}/node-install/
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "configure-node"
)
endif ()
if(VCPKG_MAX_CONCURRENCY GREATER 0)
vcpkg_execute_build_process(
COMMAND make -j${VCPKG_MAX_CONCURRENCY}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "make-node"
)
vcpkg_execute_build_process(
COMMAND make -j${VCPKG_MAX_CONCURRENCY} install
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "install-node"
)
elseif (VCPKG_CONCURRENCY GREATER 0)
vcpkg_execute_build_process(
COMMAND make -j${VCPKG_CONCURRENCY}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "make-node"
)
vcpkg_execute_build_process(
COMMAND make -j${VCPKG_CONCURRENCY} install
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "install-node"
)
else ()
vcpkg_execute_build_process(
COMMAND make -j$(nproc)
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "make-node"
)
vcpkg_execute_build_process(
COMMAND make -j$(nproc) install
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME "install-node"
)
endif ()
set(NODE_INSTALL_PATH ${CURRENT_BUILDTREES_DIR})
endif ()
if (NODE_INSTALL_PATH)
else()
vcpkg_extract_source_archive(MASTER_COPY_SOURCE_PATH ARCHIVE ${NODE_SOURCE_ARCHIVE} NO_REMOVE_ONE_LEVEL)
set(NODE_INSTALL_PATH ${MASTER_COPY_SOURCE_PATH})
endif()
# move WIN dll to /bin and WIN .lib to /lib
if (WIN32)
file(COPY ${NODE_INSTALL_PATH}/node-install/include DESTINATION ${CURRENT_PACKAGES_DIR})
file(COPY ${NODE_INSTALL_PATH}/node-install/libnode.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${NODE_INSTALL_PATH}/node-install/v8_libplatform.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(COPY ${NODE_INSTALL_PATH}/node-install/libnode.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
else ()
file(COPY ${NODE_INSTALL_PATH}/node-install/include DESTINATION ${CURRENT_PACKAGES_DIR})
file(COPY ${NODE_INSTALL_PATH}/node-install/lib DESTINATION ${CURRENT_PACKAGES_DIR})
file(COPY ${NODE_INSTALL_PATH}/node-install/share DESTINATION ${CURRENT_PACKAGES_DIR})
file(COPY ${NODE_INSTALL_PATH}/node-install/bin DESTINATION ${CURRENT_PACKAGES_DIR})
endif ()

View file

@ -1,3 +1,3 @@
Source: nvtt
Version: 2.1.4
Version: 2.1.3
Description: Texture processing tools with support for Direct3D 10 and 11 formats.

View file

@ -9,8 +9,8 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO JulianGro/nvidia-texture-tools
REF 2a56c2321e5923b00c59a19f1b1528a72b2e0f6e
SHA512 b41cc44dfe0c389b184271ad8d385dcb96c78591e9017bdb6a2325b1cbc3100bb23294e9478d12dbd8490ca44dac6363810a87650a2cdc63445dad339658cbd2
REF 4c022091ad5dae8964052cadcc506c10e6956442
SHA512 dcae327f40e25408fdca73f01bc0555f38b0e9d6bf19adc87532e03365e3b4f6f12a6bcdd7dd27c7af3a5579b9ddd086a5f9c7ee7abd0d0f55c707db8666a780
HEAD_REF master
)

View file

@ -0,0 +1,4 @@
Source: openexr
Version: 2.3.0-2
Description: OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications
Build-Depends: zlib

View file

@ -0,0 +1,87 @@
include(FindPackageHandleStandardArgs)
find_path(OpenEXR_INCLUDE_DIRS OpenEXR/OpenEXRConfig.h)
find_path(OPENEXR_INCLUDE_PATHS NAMES ImfRgbaFile.h PATH_SUFFIXES OpenEXR)
file(STRINGS "${OpenEXR_INCLUDE_DIRS}/OpenEXR/OpenEXRConfig.h" OPENEXR_CONFIG_H)
string(REGEX REPLACE "^.*define OPENEXR_VERSION_MAJOR ([0-9]+).*$" "\\1" OpenEXR_VERSION_MAJOR "${OPENEXR_CONFIG_H}")
string(REGEX REPLACE "^.*define OPENEXR_VERSION_MINOR ([0-9]+).*$" "\\1" OpenEXR_VERSION_MINOR "${OPENEXR_CONFIG_H}")
set(OpenEXR_LIB_SUFFIX "${OpenEXR_VERSION_MAJOR}_${OpenEXR_VERSION_MINOR}")
include(SelectLibraryConfigurations)
if(NOT OpenEXR_BASE_LIBRARY)
find_library(OpenEXR_BASE_LIBRARY_RELEASE NAMES IlmImf-${OpenEXR_LIB_SUFFIX})
find_library(OpenEXR_BASE_LIBRARY_DEBUG NAMES IlmImf-${OpenEXR_LIB_SUFFIX}_d)
select_library_configurations(OpenEXR_BASE)
endif()
if(NOT OpenEXR_UTIL_LIBRARY)
find_library(OpenEXR_UTIL_LIBRARY_RELEASE NAMES IlmImfUtil-${OpenEXR_LIB_SUFFIX})
find_library(OpenEXR_UTIL_LIBRARY_DEBUG NAMES IlmImfUtil-${OpenEXR_LIB_SUFFIX}_d)
select_library_configurations(OpenEXR_UTIL)
endif()
if(NOT OpenEXR_HALF_LIBRARY)
find_library(OpenEXR_HALF_LIBRARY_RELEASE NAMES Half-${OpenEXR_LIB_SUFFIX})
find_library(OpenEXR_HALF_LIBRARY_DEBUG NAMES Half-${OpenEXR_LIB_SUFFIX}_d)
select_library_configurations(OpenEXR_HALF)
endif()
if(NOT OpenEXR_IEX_LIBRARY)
find_library(OpenEXR_IEX_LIBRARY_RELEASE NAMES Iex-${OpenEXR_LIB_SUFFIX})
find_library(OpenEXR_IEX_LIBRARY_DEBUG NAMES Iex-${OpenEXR_LIB_SUFFIX}_d)
select_library_configurations(OpenEXR_IEX)
endif()
if(NOT OpenEXR_MATH_LIBRARY)
find_library(OpenEXR_MATH_LIBRARY_RELEASE NAMES Imath-${OpenEXR_LIB_SUFFIX})
find_library(OpenEXR_MATH_LIBRARY_DEBUG NAMES Imath-${OpenEXR_LIB_SUFFIX}_d)
select_library_configurations(OpenEXR_MATH)
endif()
if(NOT OpenEXR_THREAD_LIBRARY)
find_library(OpenEXR_THREAD_LIBRARY_RELEASE NAMES IlmThread-${OpenEXR_LIB_SUFFIX})
find_library(OpenEXR_THREAD_LIBRARY_DEBUG NAMES IlmThread-${OpenEXR_LIB_SUFFIX}_d)
select_library_configurations(OpenEXR_THREAD)
endif()
if(NOT OpenEXR_IEXMATH_LIBRARY)
find_library(OpenEXR_IEXMATH_LIBRARY_RELEASE NAMES IexMath-${OpenEXR_LIB_SUFFIX})
find_library(OpenEXR_IEXMATH_LIBRARY_DEBUG NAMES IexMath-${OpenEXR_LIB_SUFFIX}d)
select_library_configurations(OpenEXR_IEXMATH)
endif()
set(OPENEXR_HALF_LIBRARY "${OpenEXR_HALF_LIBRARY}")
set(OPENEXR_IEX_LIBRARY "${OpenEXR_IEX_LIBRARY}")
set(OPENEXR_IMATH_LIBRARY "${OpenEXR_MATH_LIBRARY}")
set(OPENEXR_ILMIMF_LIBRARY "${OpenEXR_BASE_LIBRARY}")
set(OPENEXR_ILMIMFUTIL_LIBRARY "${OpenEXR_UTIL_LIBRARY}")
set(OPENEXR_ILMTHREAD_LIBRARY "${OpenEXR_THREAD_LIBRARY}")
set(OpenEXR_LIBRARY "${OpenEXR_BASE_LIBRARY}")
set(OpenEXR_LIBRARIES
${OpenEXR_LIBRARY}
${OpenEXR_MATH_LIBRARY}
${OpenEXR_IEXMATH_LIBRARY}
${OpenEXR_UTIL_LIBRARY}
${OpenEXR_HALF_LIBRARY}
${OpenEXR_IEX_LIBRARY}
${OpenEXR_THREAD_LIBRARY}
)
set(OPENEXR_LIBRARIES
${OPENEXR_HALF_LIBRARY}
${OPENEXR_IEX_LIBRARY}
${OPENEXR_IMATH_LIBRARY}
${OPENEXR_ILMIMF_LIBRARY}
${OPENEXR_ILMTHREAD_LIBRARY}
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR REQUIRED_VARS OpenEXR_LIBRARIES OpenEXR_INCLUDE_DIRS)
if(OpenEXR_FOUND)
set(OPENEXR_FOUND 1)
endif()

View file

@ -1,13 +0,0 @@
diff --git a/src/lib/OpenEXRCore/internal_dwa_simd.h b/src/lib/OpenEXRCore/internal_dwa_simd.h
index 7b53501ac..ca69c9848 100644
--- a/src/lib/OpenEXRCore/internal_dwa_simd.h
+++ b/src/lib/OpenEXRCore/internal_dwa_simd.h
@@ -18,7 +18,7 @@
// aligned. Unaligned pointers may risk seg-faulting.
//
-#if defined __SSE2__ || (_MSC_VER >= 1300 && !_M_CEE_PURE)
+#if defined __SSE2__ || (_MSC_VER >= 1300 && (_M_IX86 || _M_X64) && !_M_CEE_PURE)
# define IMF_HAVE_SSE2 1
# include <emmintrin.h>
# include <mmintrin.h>

View file

@ -0,0 +1,19 @@
diff --git a/OpenEXR/IlmImf/CMakeLists.txt b/OpenEXR/IlmImf/CMakeLists.txt
index e1a8740..d31cf68 100644
--- a/OpenEXR/IlmImf/CMakeLists.txt
+++ b/OpenEXR/IlmImf/CMakeLists.txt
@@ -2,14 +2,6 @@
SET(CMAKE_INCLUDE_CURRENT_DIR 1)
-IF (WIN32)
- SET(RUNTIME_DIR ${OPENEXR_PACKAGE_PREFIX}/bin)
- SET(WORKING_DIR ${RUNTIME_DIR})
-ELSE ()
- SET(RUNTIME_DIR ${OPENEXR_PACKAGE_PREFIX}/lib)
- SET(WORKING_DIR .)
-ENDIF ()
-
SET(BUILD_B44EXPLOGTABLE OFF)
IF (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/b44ExpLogTable.h")
SET(BUILD_B44EXPLOGTABLE ON)

View file

@ -1,46 +1,71 @@
set(OPENEXR_VERSION 2.3.0)
set(OPENEXR_HASH 268ae64b40d21d662f405fba97c307dad1456b7d996a447aadafd41b640ca736d4851d9544b4741a94e7b7c335fe6e9d3b16180e710671abfc0c8b2740b147b2)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO AcademySoftwareFoundation/openexr
REF "v${VERSION}"
SHA512 ec60e79341695452e05f50bbcc0d55e0ce00fbb64cdec01a83911189c8643eb28a8046b14ee4230e5f438f018f2f1d0714f691983474d7979befd199f3f34758
HEAD_REF master
PATCHES
fix-arm64-windows-build.patch # https://github.com/AcademySoftwareFoundation/openexr/pull/1447
OUT_SOURCE_PATH SOURCE_PATH
REPO openexr/openexr
REF v${OPENEXR_VERSION}
SHA512 ${OPENEXR_HASH}
HEAD_REF master
PATCHES "fix_install_ilmimf.patch"
)
vcpkg_check_features(OUT_FEATURE_OPTIONS OPTIONS
FEATURES
tools OPENEXR_BUILD_TOOLS
tools OPENEXR_INSTALL_TOOLS
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${OPTIONS}
-DBUILD_TESTING=OFF
-DOPENEXR_INSTALL_EXAMPLES=OFF
-DBUILD_DOCS=OFF
OPTIONS_DEBUG
-DOPENEXR_BUILD_TOOLS=OFF
-DOPENEXR_INSTALL_TOOLS=OFF
)
vcpkg_cmake_install()
set(OPENEXR_STATIC ON)
set(OPENEXR_SHARED OFF)
vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DOPENEXR_BUILD_PYTHON_LIBS=OFF
-DOPENEXR_BUILD_VIEWERS=OFF
-DOPENEXR_RUN_FUZZ_TESTS=OFF
-DOPENEXR_BUILD_SHARED=${OPENEXR_SHARED}
-DOPENEXR_BUILD_STATIC=${OPENEXR_STATIC}
OPTIONS_DEBUG
-DILMBASE_PACKAGE_PREFIX=${CURRENT_INSTALLED_DIR}/debug
OPTIONS_RELEASE
-DILMBASE_PACKAGE_PREFIX=${CURRENT_INSTALLED_DIR})
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# NOTE: Only use ".exe" extension on Windows executables.
# Is there a cleaner way to do this?
if(WIN32)
set(EXECUTABLE_SUFFIX ".exe")
else()
set(EXECUTABLE_SUFFIX "")
endif()
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/exrenvmap${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/exrheader${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/exrmakepreview${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/exrmaketiled${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/exrmultipart${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/exrmultiview${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/exrstdattr${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/exrenvmap${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/exrheader${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/exrmakepreview${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/exrmaketiled${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/exrmultipart${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/exrmultiview${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/exrstdattr${EXECUTABLE_SUFFIX})
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/OpenEXR)
vcpkg_fixup_pkgconfig()
if(OPENEXR_INSTALL_TOOLS)
vcpkg_copy_tools(
TOOL_NAMES exrenvmap exrheader exrinfo exrmakepreview exrmaketiled exrmultipart exrmultiview exrstdattr exr2aces
AUTO_CLEAN
)
if (OPENEXR_STATIC)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(OPENEXR_PORT_DIR "openexr")
else()
set(OPENEXR_PORT_DIR "OpenEXR")
endif()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${OPENEXR_PORT_DIR})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${OPENEXR_PORT_DIR}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${OPENEXR_PORT_DIR}/copyright)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindOpenEXR.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${OPENEXR_PORT_DIR})

View file

@ -1,4 +0,0 @@
openexr provides CMake targets:
find_package(OpenEXR CONFIG REQUIRED)
target_link_libraries(main PRIVATE OpenEXR::OpenEXR)

View file

@ -1,25 +0,0 @@
{
"name": "openexr",
"version": "3.1.8",
"description": "OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications",
"homepage": "https://www.openexr.com/",
"license": "BSD-3-Clause",
"supports": "!uwp",
"dependencies": [
"imath",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
],
"features": {
"tools": {
"description": "Build tools"
}
}
}

View file

@ -0,0 +1,157 @@
cmake_minimum_required(VERSION 3.9)
project(openssl C)
if(NOT SOURCE_PATH)
message(FATAL_ERROR "Requires SOURCE_PATH")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(PLATFORM android)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
set(PLATFORM linux-generic64)
else()
set(PLATFORM linux-generic32)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(PLATFORM darwin64-x86_64-cc)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(PLATFORM BSD-generic64)
else()
message(FATAL_ERROR "Unknown platform")
endif()
get_filename_component(COMPILER_ROOT "${CMAKE_C_COMPILER}" DIRECTORY)
message("CMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
message("COMPILER_ROOT=${COMPILER_ROOT}")
message("CMAKE_SYSROOT=${CMAKE_SYSROOT}")
message("CMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}")
message("CMAKE_C_FLAGS=${CMAKE_C_FLAGS}")
message("CMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}")
message("CMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}")
message("CMAKE_INCLUDE_SYSTEM_FLAG_C=${CMAKE_INCLUDE_SYSTEM_FLAG_C}")
set(CFLAGS "${CMAKE_C_FLAGS}")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CFLAGS "-Wno-error=unused-command-line-argument ${CMAKE_C_FLAGS}")
endif()
if(CMAKE_C_COMPILER_TARGET)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_TARGET}${CMAKE_C_COMPILER_TARGET}")
endif()
if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}")
endif()
if(CMAKE_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}")
elseif(CMAKE_OSX_SYSROOT AND CMAKE_C_COMPILE_OPTIONS_SYSROOT)
set(CFLAGS "${CFLAGS} ${CMAKE_C_COMPILE_OPTIONS_SYSROOT}${CMAKE_OSX_SYSROOT}")
endif()
string(REGEX REPLACE "^ " "" CFLAGS "${CFLAGS}")
if(CMAKE_HOST_WIN32)
file(TO_NATIVE_PATH ENV_PATH "${COMPILER_ROOT};$ENV{PATH}")
else()
file(TO_NATIVE_PATH ENV_PATH "${COMPILER_ROOT}:$ENV{PATH}")
endif()
set(ENV{ANDROID_DEV} "${CMAKE_SYSROOT}/usr")
set(ENV{CC} "${CMAKE_C_COMPILER}")
message("ENV{ANDROID_DEV}=$ENV{ANDROID_DEV}")
get_filename_component(SOURCE_PATH_NAME "${SOURCE_PATH}" NAME)
set(BUILDDIR "${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_PATH_NAME}")
if(NOT EXISTS "${BUILDDIR}")
file(COPY ${SOURCE_PATH} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
get_filename_component(MSYS_BIN_DIR "${MAKE}" DIRECTORY)
file(READ "${BUILDDIR}/Configure" _contents)
string(REPLACE "-mandroid" "" _contents "${_contents}")
file(WRITE "${BUILDDIR}/Configure" "${_contents}")
if(BUILD_SHARED_LIBS)
set(SHARED shared)
file(STRINGS "${BUILDDIR}/crypto/opensslv.h" SHLIB_VERSION
REGEX "^#[\t ]*define[\t ]+SHLIB_VERSION_NUMBER[\t ]+\".*\".*")
string(REGEX REPLACE "^.*SHLIB_VERSION_NUMBER[\t ]+\"([^\"]*)\".*$" "\\1"
SHLIB_VERSION "${SHLIB_VERSION}")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(LIB_EXT dylib)
set(LIB_EXTS ${SHLIB_VERSION}.${LIB_EXT})
else()
set(LIB_EXT so)
set(LIB_EXTS ${LIB_EXT}.${SHLIB_VERSION})
endif()
list(APPEND LIB_EXTS ${LIB_EXT})
else()
set(SHARED no-shared)
set(LIB_EXTS a)
endif()
foreach(lib ssl crypto)
foreach(ext ${LIB_EXTS})
list(APPEND INSTALL_LIBS "${BUILDDIR}/lib${lib}.${ext}")
endforeach()
endforeach()
if(CMAKE_HOST_WIN32)
set(ENV_COMMAND set)
set(PATH_VAR ";%PATH%")
else()
set(ENV_COMMAND export)
set(PATH_VAR ":$ENV{PATH}")
endif()
add_custom_command(
OUTPUT "${BUILDDIR}/Makefile"
COMMAND ${ENV_COMMAND} CC=${CMAKE_C_COMPILER}
COMMAND ${ENV_COMMAND} AR=${CMAKE_AR}
COMMAND ${ENV_COMMAND} LD=${CMAKE_LINKER}
COMMAND ${ENV_COMMAND} RANLIB=${CMAKE_RANLIB}
COMMAND ${ENV_COMMAND} MAKE=${MAKE}
COMMAND ${ENV_COMMAND} MAKEDEPPROG=${CMAKE_C_COMPILER}
COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}"
COMMAND "${PERL}" Configure
${SHARED}
enable-static-engine
no-ssl2
no-krb5
no-idea
no-bf
no-cast
no-seed
no-md2
${PLATFORM}
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--openssldir=/etc/ssl"
${CFLAGS}
COMMAND "${CMAKE_COMMAND}" "-DDIR=${BUILDDIR}" -P "${CMAKE_CURRENT_LIST_DIR}/remove-deps.cmake"
VERBATIM
WORKING_DIRECTORY "${BUILDDIR}"
)
add_custom_target(depend
COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}"
COMMAND "${MAKE}" links # depend MAKEDEPPROG=${CMAKE_C_COMPILER}
VERBATIM
WORKING_DIRECTORY "${BUILDDIR}"
DEPENDS "${BUILDDIR}/Makefile"
)
add_custom_target(build_libs ALL
COMMAND ${ENV_COMMAND} "PATH=${MSYS_BIN_DIR}${PATH_VAR}"
COMMAND "${CMAKE_COMMAND}" -E touch "${BUILDDIR}/krb5.h"
COMMAND "${MAKE}" build_libs
VERBATIM
WORKING_DIRECTORY "${BUILDDIR}"
DEPENDS depend
BYPRODUCTS ${INSTALL_LIBS}
)
install(
FILES ${INSTALL_LIBS}
DESTINATION lib
)

View file

@ -0,0 +1,3 @@
Source: openssl-unix
Version: 1.0.2s-1
Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.

View file

@ -0,0 +1,13 @@
diff --git a/Configure b/Configure
index c98107a..77ad9d3 100644
--- a/Configure
+++ b/Configure
@@ -972,7 +972,7 @@ PROCESS_ARGS:
}
elsif (/^--with-zlib-include=(.*)$/)
{
- $withargs{"zlib-include"}="-I$1";
+ $withargs{"zlib-include"}="-I\"$1\"";
}
elsif (/^--with-fipsdir=(.*)$/)
{

View file

@ -0,0 +1,25 @@
diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl
index dba96cb..5722f6e 100644
--- a/util/pl/VC-32.pl
+++ b/util/pl/VC-32.pl
@@ -154,9 +154,17 @@ else
$cflags=$opt_cflags.$base_cflags;
}
-# generate symbols.pdb unconditionally
-$app_cflag.=" /Zi /Fd\$(TMP_D)/app";
-$lib_cflag.=" /Zi /Fd\$(TMP_D)/lib";
+# generate symbols.pdb when building dlls and embed symbols when building static libs
+if ($shlib)
+ {
+ $app_cflag.=" /Zi /Fd\$(TMP_D)/app.pdb";
+ $lib_cflag.=" /Zi /Fd\$(TMP_D)/lib.pdb";
+ }
+else
+ {
+ $app_cflag.=" /Z7";
+ $lib_cflag.=" /Z7";
+ }
$lflags.=" /debug";
$obj='.obj';

View file

@ -0,0 +1,23 @@
diff --git a/crypto/cversion.c b/crypto/cversion.c
index bfff699..17b7912 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -56,6 +56,9 @@
* [including the GNU Public Licence.]
*/
+#define STRINGIFY2(x) #x
+#define STRINGIFY(x) STRINGIFY2(x)
+
#include "cryptlib.h"
#ifndef NO_WINDOWS_BRAINDEATH
@@ -79,7 +82,7 @@ const char *SSLeay_version(int t)
}
if (t == SSLEAY_CFLAGS) {
#ifdef CFLAGS
- return (CFLAGS);
+ return STRINGIFY(CFLAGS);
#else
return ("compiler: information not available");
#endif

View file

@ -0,0 +1,73 @@
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME)
message(FATAL_ERROR "This port is only for openssl on Unix-like systems")
endif()
if(EXISTS "${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h")
message(WARNING "Can't build openssl if libressl is installed. Please remove libressl, and try install openssl again if you need it. Build will continue but there might be problems since libressl is only a subset of openssl")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
return()
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
vcpkg_find_acquire_program(PERL)
set(OPENSSL_VERSION 1.0.2s)
vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE
URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" "https://www.openssl.org/source/old/1.0.2/openssl-${OPENSSL_VERSION}.tar.gz"
FILENAME "openssl-${OPENSSL_VERSION}.tar.gz"
SHA512 9f745452c4f777df694158e95003cde78a2cf8199bc481a563ec36644664c3c1415a774779b9791dd18f2aeb57fa1721cb52b3db12d025955e970071d5b66d2a
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH MASTER_COPY_SOURCE_PATH
ARCHIVE ${OPENSSL_SOURCE_ARCHIVE}
REF ${OPENSSL_VERSION}
PATCHES
ConfigureIncludeQuotesFix.patch
STRINGIFYPatch.patch
EmbedSymbolsInStaticLibsZ7.patch
)
if(CMAKE_HOST_WIN32)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make)
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
set(MAKE ${MSYS_ROOT}/usr/bin/make.exe)
else()
find_program(MAKE make)
if(NOT MAKE)
message(FATAL_ERROR "Could not find make. Please install it through your package manager.")
endif()
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}
PREFER_NINJA
OPTIONS
-DSOURCE_PATH=${MASTER_COPY_SOURCE_PATH}
-DPERL=${PERL}
-DMAKE=${MAKE}
OPTIONS_RELEASE
-DINSTALL_HEADERS=ON
)
vcpkg_install_cmake()
file(GLOB HEADERS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/include/openssl/*.h)
set(RESOLVED_HEADERS)
foreach(HEADER ${HEADERS})
get_filename_component(X "${HEADER}" REALPATH)
list(APPEND RESOLVED_HEADERS "${X}")
endforeach()
file(INSTALL ${RESOLVED_HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include/openssl)
file(INSTALL ${MASTER_COPY_SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl-unix RENAME copyright)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl)
endif()
vcpkg_test_cmake(PACKAGE_NAME OpenSSL MODULE)

View file

@ -0,0 +1,4 @@
The package openssl is compatible with built-in CMake targets:
find_package(OpenSSL REQUIRED)
target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)

View file

@ -0,0 +1,10 @@
_find_package(${ARGS})
if(OPENSSL_FOUND)
find_library(OPENSSL_DL_LIBRARY NAMES dl)
if(OPENSSL_DL_LIBRARY)
list(APPEND OPENSSL_LIBRARIES "dl")
if(TARGET OpenSSL::Crypto)
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dl")
endif()
endif()
endif()

View file

@ -0,0 +1,3 @@
Source: openssl-windows
Version: 1.1.1h
Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.

View file

@ -0,0 +1,142 @@
if(VCPKG_CMAKE_SYSTEM_NAME)
message(FATAL_ERROR "This port is only for building openssl on Windows Desktop")
endif()
set(OPENSSL_VERSION 1.1.1h)
set(MASTER_COPY_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-${OPENSSL_VERSION})
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}")
vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE
URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" "https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz"
FILENAME "openssl-${OPENSSL_VERSION}.tar.gz"
SHA512 da50fd99325841ed7a4367d9251c771ce505a443a73b327d8a46b2c6a7d2ea99e43551a164efc86f8743b22c2bdb0020bf24a9cbd445e9d68868b2dc1d34033a
)
vcpkg_extract_source_archive(${OPENSSL_SOURCE_ARCHIVE})
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
set(ENV{PATH} "${NASM_EXE_PATH};$ENV{PATH}")
vcpkg_find_acquire_program(JOM)
set(CONFIGURE_COMMAND ${PERL} Configure
enable-static-engine
enable-capieng
no-ssl2
-utf-8
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(OPENSSL_ARCH VC-WIN32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(OPENSSL_ARCH VC-WIN64A)
else()
message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Configure ${TARGET_TRIPLET}-rel")
file(COPY ${MASTER_COPY_SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/openssl-${OPENSSL_VERSION})
set(OPENSSLDIR_RELEASE ${CURRENT_PACKAGES_DIR})
vcpkg_execute_required_process(
COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} "--prefix=${OPENSSLDIR_RELEASE}" "--openssldir=${OPENSSLDIR_RELEASE}" -FS
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-rel
)
message(STATUS "Configure ${TARGET_TRIPLET}-rel done")
message(STATUS "Build ${TARGET_TRIPLET}-rel")
# Openssl's buildsystem has a race condition which will cause JOM to fail at some point.
# This is ok; we just do as much work as we can in parallel first, then follow up with a single-threaded build.
make_directory(${SOURCE_PATH_RELEASE}/inc32/openssl)
execute_process(
COMMAND ${JOM} -k -j $ENV{NUMBER_OF_PROCESSORS}
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-0-out.log
ERROR_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-0-err.log
)
vcpkg_execute_required_process(
COMMAND nmake install
WORKING_DIRECTORY ${SOURCE_PATH_RELEASE}
LOGNAME build-${TARGET_TRIPLET}-rel-1
)
message(STATUS "Build ${TARGET_TRIPLET}-rel done")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Configure ${TARGET_TRIPLET}-dbg")
file(COPY ${MASTER_COPY_SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/openssl-${OPENSSL_VERSION})
set(OPENSSLDIR_DEBUG ${CURRENT_PACKAGES_DIR}/debug)
vcpkg_execute_required_process(
COMMAND ${CONFIGURE_COMMAND} ${OPENSSL_ARCH} --debug "--prefix=${OPENSSLDIR_DEBUG}" "--openssldir=${OPENSSLDIR_DEBUG}" -FS
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}-dbg
)
message(STATUS "Configure ${TARGET_TRIPLET}-dbg done")
message(STATUS "Build ${TARGET_TRIPLET}-dbg")
make_directory(${SOURCE_PATH_DEBUG}/inc32/openssl)
execute_process(
COMMAND ${JOM} -k -j $ENV{NUMBER_OF_PROCESSORS}
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-dbg-0-out.log
ERROR_FILE ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-dbg-0-err.log
)
vcpkg_execute_required_process(
COMMAND nmake install
WORKING_DIRECTORY ${SOURCE_PATH_DEBUG}
LOGNAME build-${TARGET_TRIPLET}-dbg-1
)
message(STATUS "Build ${TARGET_TRIPLET}-dbg done")
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/certs)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/engines-1_1)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/private)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/certs)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/engines-1_1)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/private)
file(REMOVE
${CURRENT_PACKAGES_DIR}/openssl.cnf
${CURRENT_PACKAGES_DIR}/openssl.cnf.dist
${CURRENT_PACKAGES_DIR}/ct_log_list.cnf
${CURRENT_PACKAGES_DIR}/ct_log_list.cnf.dist
${CURRENT_PACKAGES_DIR}/debug/openssl.cnf
${CURRENT_PACKAGES_DIR}/debug/openssl.cnf.dist
${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf
${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf.dist
${CURRENT_PACKAGES_DIR}/debug/bin/openssl.exe
)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/openssl/)
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/openssl.exe ${CURRENT_PACKAGES_DIR}/tools/openssl/openssl.exe)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/openssl)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
# They should be empty, only the exes deleted above were in these directories
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/)
endif()
vcpkg_copy_pdbs()
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${MASTER_COPY_SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_test_cmake(PACKAGE_NAME OpenSSL MODULE)

View file

@ -0,0 +1,4 @@
The package openssl is compatible with built-in CMake targets:
find_package(OpenSSL REQUIRED)
target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)

View file

@ -0,0 +1,4 @@
Source: openssl
Version: 0
Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
Build-Depends: openssl-windows (windows), openssl-android (android), openssl-unix (!android&!windows)

View file

@ -1,32 +0,0 @@
function(install_pc_file name pc_data)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${name}.pc" @ONLY)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${name}.pc" @ONLY)
endif()
endfunction()
install_pc_file(openssl [[
Name: OpenSSL
Description: Secure Sockets Layer and cryptography libraries and tools
Requires: libssl libcrypto
]])
install_pc_file(libssl [[
Name: OpenSSL-libssl
Description: Secure Sockets Layer and cryptography libraries
Libs: -L"${libdir}" -llibssl
Requires: libcrypto
Cflags: -I"${includedir}"
]])
install_pc_file(libcrypto [[
Name: OpenSSL-libcrypto
Description: OpenSSL cryptography library
Libs: -L"${libdir}" -llibcrypto
Libs.private: -lcrypt32 -lws2_32
Cflags: -I"${includedir}"
]])
vcpkg_fixup_pkgconfig()

View file

@ -1,6 +0,0 @@
prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Version: @OPENSSL_VERSION@
@pc_data@

Some files were not shown because too many files have changed in this diff Show more