mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 00:07:24 +00:00
Merge branch 'devel' into devel-PFasano99
# Conflicts: # .github/workflows/CreateRelease.yml # .github/workflows/Linux.yml # .github/workflows/MacOS.yml # scripts/Linux/0_setup_env.sh
This commit is contained in:
commit
9413358b97
83
.github/workflows/BuildMeshLab.yml
vendored
Normal file
83
.github/workflows/BuildMeshLab.yml
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
name: BuildMeshLab
|
||||
|
||||
on:
|
||||
[push, pull_request]
|
||||
|
||||
env:
|
||||
QT_VERSION: 5.15.2
|
||||
MAC_CERT: ${{secrets.MACOS_CERT_ID}}
|
||||
WIN_CERT: ${{secrets.WIN_CERTIFICATE}}
|
||||
|
||||
jobs:
|
||||
meshlab_build:
|
||||
name: Build MeshLab
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ['ubuntu-18.04', 'macos-latest', 'windows-latest']
|
||||
precision: [single_precision, double_precision]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Setup MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Set CodeSign Certificate macOS
|
||||
if: runner.os == 'macOS' && env.MAC_CERT != null
|
||||
uses: apple-actions/import-codesign-certs@v1
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
|
||||
p12-password: ${{ secrets.MACOS_CERTIFICATE_PSSW }}
|
||||
- name: Set CodeSign Certificate Windows
|
||||
if: runner.os == 'Windows' && env.WIN_CERT != null
|
||||
run: |
|
||||
New-Item -ItemType directory -Path certificate
|
||||
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_CERTIFICATE }}'
|
||||
certutil -decode certificate\certificate.txt certificate\certificate.pfx
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
cache: true
|
||||
version: ${{ env.QT_VERSION }}
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/0_setup_env.sh --dont_install_qt --dont_install_cgal_and_boost --dont_install_embree
|
||||
- name: Setup env variables
|
||||
id: envs
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{matrix.precision}}" == "double_precision" ]; then
|
||||
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "artifact_suffix=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Cache external libraries sources
|
||||
id: cache-ext-libs
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: src/external/downloads/*
|
||||
key: ${{ runner.os }}-external-libraries
|
||||
- name: Ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }}
|
||||
- name: Configure and Build
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --nightly --ccache --use_brew_llvm
|
||||
- name: Deploy
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/2_deploy.sh --cert_pssw='${{ secrets.WIN_CERTIFICATE_PSSW }}' --cert_id=${{ secrets.MACOS_CERT_ID }}
|
||||
- name: Upload MeshLab Portable
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: MeshLab_${{ runner.os }}_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/
|
||||
- name: Upload MeshLab Packages
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: MeshLab_${{ runner.os }}_packages${{steps.envs.outputs.artifact_suffix}}
|
||||
path: packages/MeshLab*
|
||||
239
.github/workflows/CreateRelease.yml
vendored
239
.github/workflows/CreateRelease.yml
vendored
@ -28,209 +28,104 @@ jobs:
|
||||
with:
|
||||
commit_message: Set MeshLab version to ${{ github.event.inputs.version }}
|
||||
|
||||
linux_build:
|
||||
meshlab_build:
|
||||
needs: [update_ml_version]
|
||||
name: Build MeshLab (Linux)
|
||||
runs-on: ubuntu-18.04 #in order to deploy, need to use oldest supported version
|
||||
name: Build MeshLab
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: ['ubuntu-18.04', 'macos-latest', 'windows-latest']
|
||||
precision: [single_precision, double_precision]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: main
|
||||
submodules: recursive
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
cache: true
|
||||
version: ${{ env.QT_VERSION }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/0_setup_env_ubuntu.sh --dont_install_qt --dont_install_cgal_and_boost
|
||||
#needed by qt 5.15 on linux
|
||||
sudo apt-get install libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-render-util0-dev libxcb-xinerama0-dev
|
||||
- name: Setup env variables
|
||||
id: envs
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{matrix.precision}}" == "double_precision" ]; then
|
||||
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "artifact_suffix=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Configure and Build
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }}
|
||||
- name: Deploy and AppImage
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/2_deploy_and_appimage.sh
|
||||
- name: Upload Meshlab Portable
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/
|
||||
- name: Upload Meshlab AppImage
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_appimage${{steps.envs.outputs.artifact_suffix}}
|
||||
path: MeshLab*-linux.AppImage
|
||||
|
||||
macos_build:
|
||||
needs: [update_ml_version]
|
||||
name: Build MeshLab (MacOS)
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
precision: [single_precision, double_precision]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: main
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install libomp cgal xerces-c embree
|
||||
npm install -g appdmg
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
cache: true
|
||||
version: ${{ env.QT_VERSION }}
|
||||
- name: Setup env variables
|
||||
id: envs
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{matrix.precision}}" == "double_precision" ]; then
|
||||
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "artifact_suffix=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Configure and Build
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }}
|
||||
- name: Deploy
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/2_deploy.sh
|
||||
- name: Import Cert and Key
|
||||
- name: Setup MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Set CodeSign Certificate macOS
|
||||
if: runner.os == 'macOS'
|
||||
uses: apple-actions/import-codesign-certs@v1
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
|
||||
p12-password: ${{ secrets.MACOS_CERTIFICATE_PSSW }}
|
||||
- name: Sign
|
||||
- name: Set CodeSign Certificate Windows
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
codesign --options "runtime" --timestamp --force --deep --sign ${{ secrets.MACOS_CERT_ID }} install/meshlab.app
|
||||
- name: Notarize
|
||||
uses: devbotsxyz/xcode-notarize@v1
|
||||
with:
|
||||
product-path: "install/meshlab.app"
|
||||
appstore-connect-username: ${{ secrets.MACOS_NOTARIZATION_USER }}
|
||||
appstore-connect-password: ${{ secrets.MACOS_NOTARIZATION_PSSW }}
|
||||
- name: "Staple Release"
|
||||
uses: devbotsxyz/xcode-staple@v1
|
||||
with:
|
||||
product-path: "install/meshlab.app"
|
||||
- name: Create MeshLab DMG
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/3_dmg.sh
|
||||
- name: Upload MeshLab Portable
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/MeshLab*.app
|
||||
- name: Upload DMG
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_dmg${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/MeshLab*-macos.dmg
|
||||
|
||||
windows_build:
|
||||
needs: [update_ml_version]
|
||||
name: Build MeshLab (Windows)
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
precision: [single_precision, double_precision]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: main
|
||||
submodules: recursive
|
||||
- name: Setup MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
New-Item -ItemType directory -Path certificate
|
||||
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_CERTIFICATE }}'
|
||||
certutil -decode certificate\certificate.txt certificate\certificate.pfx
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
cache: true
|
||||
version: ${{ env.QT_VERSION }}
|
||||
- name: Setup env variables
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/0_setup_env.sh --dont_install_qt --dont_install_cgal_and_boost
|
||||
- name: Setup env variables
|
||||
id: envs
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{matrix.precision}}" == "double_precision" ]; then
|
||||
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "artifact_suffix=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
echo "VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC" >> $GITHUB_ENV
|
||||
- name: Set Certificate
|
||||
run: |
|
||||
New-Item -ItemType directory -Path certificate
|
||||
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_CERTIFICATE }}'
|
||||
certutil -decode certificate\certificate.txt certificate\certificate.pfx
|
||||
- name: Cache external libraries sources
|
||||
id: cache-ext-libs
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: src/external/downloads/*
|
||||
key: ${{ runner.os }}-external-libraries
|
||||
- name: Ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }}
|
||||
- name: Configure and Build
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }}
|
||||
- name: Sign Portable content
|
||||
run: |
|
||||
.\scripts\Windows\internal\sign_dlls.ps1 -pssw '${{ secrets.WIN_CERTIFICATE_PSSW }}' -path 'install\'
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --ccache
|
||||
- name: Deploy
|
||||
shell: C:\shells\msys2bash.cmd {0}
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/2_deploy.sh -qt=${{ env.Qt5_DIR }}
|
||||
- name: NSIS script
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/internal/nsis_script.sh
|
||||
- name: Create Installer
|
||||
uses: joncloud/makensis-action@v3.7
|
||||
with:
|
||||
script-file: "install/meshlab_final.nsi"
|
||||
- name: Move Installer
|
||||
bash scripts/${{ runner.os }}/2_deploy.sh --cert_pssw='${{ secrets.WIN_CERTIFICATE_PSSW }}' --cert_id=${{ secrets.MACOS_CERT_ID }}
|
||||
- name: Get AppBundle Name
|
||||
if: runner.os == 'macOS'
|
||||
id: abn
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir installer
|
||||
mv install/MeshLab*-windows.exe installer
|
||||
rm install/meshlab_final.nsi
|
||||
rm install/ExecWaitJob.nsh
|
||||
rm install/FileAssociation.nsh
|
||||
- name: Sign Installer
|
||||
run: |
|
||||
.\scripts\Windows\internal\sign_dlls.ps1 -pssw '${{ secrets.WIN_CERTIFICATE_PSSW }}' -path 'installer\'
|
||||
- name: Uploading MeshLab Portable
|
||||
cd install
|
||||
NAME=$(ls -d MeshLab*)
|
||||
echo "app_bundle_name=$NAME" >> $GITHUB_OUTPUT
|
||||
- name: Notarize macOS
|
||||
if: runner.os == 'macOS'
|
||||
uses: devbotsxyz/xcode-notarize@v1
|
||||
with:
|
||||
product-path: "install/${{steps.abn.outputs.app_bundle_name}}"
|
||||
appstore-connect-username: ${{ secrets.MACOS_NOTARIZATION_USER }}
|
||||
appstore-connect-password: ${{ secrets.MACOS_NOTARIZATION_PSSW }}
|
||||
- name: Staple Release macOS
|
||||
if: runner.os == 'macOS'
|
||||
uses: devbotsxyz/xcode-staple@v1
|
||||
with:
|
||||
product-path: "install/${{steps.abn.outputs.app_bundle_name}}"
|
||||
- name: Upload MeshLab Portable
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install
|
||||
- name: Upload Meshlab Installer
|
||||
name: MeshLab_${{ runner.os }}_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/
|
||||
- name: Upload MeshLab Packages
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_installer${{steps.envs.outputs.artifact_suffix}}
|
||||
path: installer/MeshLab*-windows.exe
|
||||
name: MeshLab_${{ runner.os }}_packages${{steps.envs.outputs.artifact_suffix}}
|
||||
path: packages/MeshLab*
|
||||
|
||||
#after building MeshLab for the three platforms, we create a release in github
|
||||
create_release:
|
||||
name: Create Release
|
||||
needs: [linux_build, macos_build, windows_build]
|
||||
needs: [meshlab_build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@ -238,22 +133,22 @@ jobs:
|
||||
- name: Download Linux ZIP
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_portable
|
||||
name: MeshLab_Linux_portable
|
||||
path: meshlab_linux_portable
|
||||
- name: Download Linux ZIP-d
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_portable_double
|
||||
name: MeshLab_Linux_portable_double
|
||||
path: meshlab_linux_portable_double
|
||||
- name: Download Linux AppImage
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_appimage
|
||||
name: MeshLab_Linux_packages
|
||||
path: meshlab_linux_appimage
|
||||
- name: Download Linux AppImage-d
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_appimage_double
|
||||
name: MeshLab_Linux_packages_double
|
||||
path: meshlab_linux_appimage_double
|
||||
- name: Change Permissions
|
||||
run: |
|
||||
@ -288,22 +183,22 @@ jobs:
|
||||
- name: Download MacOS DMG
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_dmg
|
||||
name: MeshLab_macOS_packages
|
||||
path: meshlab_macos_dmg
|
||||
- name: Download MacOS DMG-d
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_dmg_double
|
||||
name: MeshLab_macOS_packages_double
|
||||
path: meshlab_macos_dmg_double
|
||||
- name: Download MacOS Portable
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_portable
|
||||
name: MeshLab_macOS_portable
|
||||
path: meshlab_macos_portable
|
||||
- name: Download MacOS Portable-d
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_portable_double
|
||||
name: MeshLab_macOS_portable_double
|
||||
path: meshlab_macos_portable_double
|
||||
- name: Change Permissions
|
||||
run: |
|
||||
@ -321,22 +216,22 @@ jobs:
|
||||
- name: Download Windows ZIP
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_portable
|
||||
name: MeshLab_Windows_portable
|
||||
path: meshlab_windows_portable
|
||||
- name: Download Windows ZIP-d
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_portable_double
|
||||
name: MeshLab_Windows_portable_double
|
||||
path: meshlab_windows_portable_double
|
||||
- name: Download Windows Installer
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_installer
|
||||
name: MeshLab_Windows_packages
|
||||
path: meshlab_windows_installer
|
||||
- name: Download Windows Installer-d
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_installer_double
|
||||
name: MeshLab_Windows_packages_double
|
||||
path: meshlab_windows_installer_double
|
||||
- name: Create MeshLab Portable Windows Archive
|
||||
run: |
|
||||
|
||||
82
.github/workflows/Linux.yml
vendored
82
.github/workflows/Linux.yml
vendored
@ -1,82 +0,0 @@
|
||||
name: Linux
|
||||
|
||||
on:
|
||||
[push, pull_request]
|
||||
|
||||
env:
|
||||
QT_VERSION: 5.15.2
|
||||
|
||||
jobs:
|
||||
linux_build:
|
||||
name: Build MeshLab (Linux)
|
||||
runs-on: ubuntu-18.04 #in order to deploy, need to use oldest supported version
|
||||
strategy:
|
||||
matrix:
|
||||
precision: [single_precision, double_precision]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
cache: true
|
||||
version: ${{ env.QT_VERSION }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/0_setup_env_ubuntu.sh --dont_install_qt --dont_install_cgal_and_boost --dont_install_embree
|
||||
#needed by qt 5.15 on linux
|
||||
sudo apt-get install libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-render-util0-dev libxcb-xinerama0-dev
|
||||
- name: Setup env variables
|
||||
id: envs
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{matrix.precision}}" == "double_precision" ]; then
|
||||
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "artifact_suffix=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Cache external libraries sources
|
||||
id: cache-ext-libs
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: src/external/downloads/*
|
||||
key: ${{ runner.os }}-external-libraries
|
||||
- name: Ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }}
|
||||
- name: Configure and Build
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --nightly --ccache
|
||||
- name: Deploy and AppImage
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/2_deploy_and_appimage.sh
|
||||
#todo: try deb when ubuntu16.04 won't be required anymore by linuxdeployqt...
|
||||
#- name: Build deb package
|
||||
# uses: jiro4989/build-deb-action@v2
|
||||
# with:
|
||||
# package: MeshLab
|
||||
# package_root: install
|
||||
# maintainer: cnr-isti-vclab
|
||||
# version: ${{steps.envs.outputs.version}} # refs/tags/v*.*.*
|
||||
# arch: 'amd64'
|
||||
# desc: 'MeshLab ${{steps.envs.outputs.version}} deb package.'
|
||||
- name: Upload MeshLab Portable
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/
|
||||
- name: Upload MeshLab AppImage
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_linux_appimage${{steps.envs.outputs.artifact_suffix}}
|
||||
path: MeshLab*-linux.AppImage
|
||||
#- name: Upload MeshLab deb
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: meshlab_linux_deb${{steps.envs.outputs.artifact_suffix}}
|
||||
# path: MeshLab_${{steps.envs.outputs.version}}_amd64.deb
|
||||
70
.github/workflows/MacOS.yml
vendored
70
.github/workflows/MacOS.yml
vendored
@ -1,70 +0,0 @@
|
||||
name: MacOS
|
||||
|
||||
on:
|
||||
[push, pull_request]
|
||||
|
||||
env:
|
||||
QT_VERSION: 5.15.2
|
||||
|
||||
jobs:
|
||||
macos_build:
|
||||
name: Build MeshLab (MacOS)
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
precision: [single_precision, double_precision]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install llvm libomp cgal xerces-c tbb embree
|
||||
npm install -g appdmg
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
cache: true
|
||||
version: ${{ env.QT_VERSION }}
|
||||
- name: Setup env variables
|
||||
id: envs
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{matrix.precision}}" == "double_precision" ]; then
|
||||
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "artifact_suffix=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Cache external libraries sources
|
||||
id: cache-ext-libs
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: src/external/downloads/*
|
||||
key: ${{ runner.os }}-external-libraries
|
||||
- name: Ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }}
|
||||
- name: Configure and Build
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --nightly --use_brew_llvm --ccache
|
||||
- name: Deploy
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/2_deploy.sh
|
||||
- name: Create DMG
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/3_dmg.sh
|
||||
- name: Upload MeshLab Portable
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/MeshLab*.app
|
||||
- name: Upload DMG
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_macos_dmg${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install/MeshLab*.dmg
|
||||
86
.github/workflows/Windows.yml
vendored
86
.github/workflows/Windows.yml
vendored
@ -1,86 +0,0 @@
|
||||
name: Windows
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
QT_VERSION: 5.15.2
|
||||
|
||||
jobs:
|
||||
windows_build:
|
||||
name: Build MeshLab (Windows)
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
precision: [single_precision, double_precision]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Setup MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
cache: true
|
||||
version: ${{ env.QT_VERSION }}
|
||||
- name: Setup env variables
|
||||
shell: bash
|
||||
id: envs
|
||||
run: |
|
||||
if [ "${{matrix.precision}}" == "double_precision" ]; then
|
||||
echo "artifact_suffix=_double" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "artifact_suffix=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
echo "VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC" >> $GITHUB_ENV
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
choco install ccache
|
||||
choco install ninja
|
||||
choco install wget
|
||||
- name: Cache external libraries sources
|
||||
id: cache-ext-libs
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: src/external/downloads/*
|
||||
key: ${{ runner.os }}-external-libraries
|
||||
- name: Ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }}
|
||||
- name: Configure and Build
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --nightly --ccache
|
||||
- name: Deploy
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/2_deploy.sh
|
||||
- name: NSIS script
|
||||
shell: bash
|
||||
run: |
|
||||
bash scripts/${{ runner.os }}/internal/nsis_script.sh
|
||||
- name: Create Installer
|
||||
uses: joncloud/makensis-action@v3.7
|
||||
with:
|
||||
script-file: "install/meshlab_final.nsi"
|
||||
- name: Move Installer
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir installer
|
||||
mv install/MeshLab*-windows.exe installer/
|
||||
rm install/meshlab_final.nsi
|
||||
rm install/ExecWaitJob.nsh
|
||||
rm install/FileAssociation.nsh
|
||||
- name: Uploading MeshLab Portable
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_portable${{steps.envs.outputs.artifact_suffix}}
|
||||
path: install
|
||||
- name: Upload Meshlab Installer
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meshlab_windows_installer${{steps.envs.outputs.artifact_suffix}}
|
||||
path: installer/MeshLab*-windows.exe
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@ -23,6 +23,11 @@ build/*
|
||||
install/*
|
||||
|
||||
# external libraries automatically downloaded by cmake
|
||||
src/external/easyexif*/test-images/*
|
||||
src/external/glew*/auto/*
|
||||
src/external/glew*/build/*
|
||||
src/external/glew*/config/*
|
||||
src/external/glew*/doc/*
|
||||
src/external/downloads/*
|
||||
src/external/tmp.zip
|
||||
|
||||
|
||||
19
CMakeLists.txt
Normal file
19
CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright 2019, 2020, Collabora, Ltd.
|
||||
# Copyright 2019, 2021, Visual Computing Lab, ISTI - Italian National Research Council
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
project(MeshLab)
|
||||
|
||||
### Build options
|
||||
option(MESHLAB_BUILD_MINI "Build only common and meshlab - other plugin targets must be set manually" OFF)
|
||||
option(MESHLAB_BUILD_STRICT "Strictly enforce resolution of all symbols" ON)
|
||||
option(MESHLAB_BUILD_WITH_DOUBLE_SCALAR "Use double type instead of float type for scalars" OFF)
|
||||
option(MESHLAB_ENABLE_DEBUG_LOG_FILE "If enabled, all the logs of MeshLab will be also saved into a log file" OFF)
|
||||
|
||||
option(MESHLAB_BUILD_ONLY_LIBRARIES "Build only meshlab-common and plugins, excluding executables" OFF)
|
||||
option(MESHLAB_USE_DEFAULT_BUILD_AND_INSTALL_DIRS "If set to OFF, it expects that you set manually the binary and install directories" ON)
|
||||
|
||||
option(MESHLAB_IS_NIGHTLY_VERSION "Nightly version of meshlab will be used instead of ML_VERSION" OFF)
|
||||
|
||||
add_subdirectory(src)
|
||||
20
README.md
20
README.md
@ -1,9 +1,7 @@
|
||||
#  MeshLab
|
||||
|
||||
|
||||

|
||||

|
||||

|
||||
[](https://github.com/cnr-isti-vclab/meshlab/actions/workflows/BuildMeshLab.yml)
|
||||
|
||||
[](https://doi.org/10.5281/zenodo.5114037)
|
||||
|
||||
@ -18,19 +16,19 @@ MeshLab is available for Windows, macOS, and Linux.
|
||||
# Releases
|
||||
|
||||
You can find the last MeshLab release in the [Releases Tab](https://github.com/cnr-isti-vclab/meshlab/releases) for your favourite platform.
|
||||
You can also test a built version of MeshLab generated by the last commit pushed in this repository, by downloading the artifacts of the last [Github Actions](https://github.com/cnr-isti-vclab/meshlab/actions) workflow.
|
||||
You can also test the last nightly version of MeshLab, by downloading the artifacts of the last [Github Actions](https://github.com/cnr-isti-vclab/meshlab/actions) workflow. You can find a guide on how to download it [here](https://github.com/cnr-isti-vclab/meshlab/wiki/How-to-install-the-last-nightly-version).
|
||||
|
||||
# Build instructions
|
||||
|
||||
We provide a set of scripts that build and deploy MeshLab automatically. All the scripts can be found in the [scripts](https://github.com/cnr-isti-vclab/meshlab/tree/master/scripts) folder.
|
||||
For specific build instructions see the [src](https://github.com/cnr-isti-vclab/meshlab/blob/master/src/README.md) folder.
|
||||
We provide a set of scripts that build and deploy MeshLab automatically. All the scripts can be found in the [scripts](https://github.com/cnr-isti-vclab/meshlab/tree/main/scripts) folder.
|
||||
For specific build instructions see the [src](https://github.com/cnr-isti-vclab/meshlab/blob/main/src/README.md) folder.
|
||||
|
||||
# Branches
|
||||
# Branches and Pull Requests
|
||||
|
||||
On this repository, we keep two relevant branches:
|
||||
|
||||
- `main`: we keep here the **last release version of MeshLab**, with just bugfixes. In case of bugs caught after a release, this branch is used to publish "post-releases".
|
||||
- `devel`: we add here new features and functionalities of the software that are going to appear in the next release of MeshLab. Bugfixes pushed in `main` are automatically merged on the `devel` branch.
|
||||
- `main`: we keep here the **last release version of MeshLab**, with just bugfixes, optimizations and changes that do not affect the last released MeshLab binary. In case of bugs caught after a release, this branch is used to publish "post-releases".
|
||||
- `devel`: we add here new features and functionalities of the software that are going to appear in the next release of MeshLab. Bugfixes pushed in `main` are automatically merged into the `devel` branch.
|
||||
|
||||
Before committing a new change, or sending a pull request, please choose the branch that better suits for your change.
|
||||
If it is just a bugfix, or an edit that does not modify the software (e.g. documentation typos, changes to the deploy system, ...), use the `main` branch.
|
||||
@ -40,11 +38,11 @@ If it is a new feature that will change the behaviour or the usage of the softwa
|
||||
|
||||
The MeshLab repository is organized as follows:
|
||||
|
||||
* `distrib`: this folder contains a set of prebuilt libraries and shaders that will be used by MeshLab once it is compiled. For more details, check the readme [here](https://github.com/cnr-isti-vclab/meshlab/tree/master/distrib/README.md);
|
||||
* `docs`: doxygen scripts for generating MeshLab documentation. For more details, check the readme [here](https://github.com/cnr-isti-vclab/meshlab/tree/master/docs);
|
||||
* `sample` and `textures`: a set of files (meshes, images) used for tests;
|
||||
* `resources`: contains a set of files used by the software and by the deploy system to produce the final MeshLab binary;
|
||||
* `scripts`: in this folder there is a set of platform-dependent scripts to build and deploy MeshLab. For more details, check the readme [here](https://github.com/cnr-isti-vclab/meshlab/tree/master/scripts/README.md);
|
||||
* `src`: this folder contains all the source code of MeshLab, its plugins and the external libraries that it requires. For more details, check the readme [here](https://github.com/cnr-isti-vclab/meshlab/blob/master/src/README.md);
|
||||
* `src`: this folder contains all the source code of MeshLab and its plugins. For more details, check the readme [here](https://github.com/cnr-isti-vclab/meshlab/blob/master/src/README.md);
|
||||
* `unsupported`: this folder contains a set of old and unsupported MeshLab plugins that are no longer included and built under MeshLab.
|
||||
|
||||
# License
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
# distrib folder
|
||||
# MeshLab resources
|
||||
|
||||
The distrib folder contains a set of pre-built libraries and shaders that MeshLab needs to properly run, plus some other txt files and icons.
|
||||
The `resources` folder contains a set of files, binaries and shaders that MeshLab needs to be correctly built, deployed and packaged.
|
||||
|
||||
Examples of contained files:
|
||||
- icons;
|
||||
- deployment software binaries;
|
||||
- configuration files for packaging;
|
||||
- shaders;
|
||||
- license, privacy and readme files that are bundled in the final MeshLab packages.
|
||||
19
sample/TextureSingle.ply
Normal file
19
sample/TextureSingle.ply
Normal file
@ -0,0 +1,19 @@
|
||||
ply
|
||||
format ascii 1.0
|
||||
comment VCGLIB generated
|
||||
comment TextureFile TextureDouble_A.png
|
||||
element vertex 4
|
||||
property float x
|
||||
property float y
|
||||
property float z
|
||||
element face 2
|
||||
property list uchar int vertex_indices
|
||||
property list uchar float texcoord
|
||||
property int texnumber
|
||||
end_header
|
||||
0 0 0
|
||||
1 0 0
|
||||
1 1 0
|
||||
0 1 0
|
||||
3 0 1 2 6 0 0 2 0 2 2 0
|
||||
3 0 2 3 6 0 0 2 2 0 2 0
|
||||
@ -34,16 +34,18 @@ sudo apt-get update
|
||||
echo "=== installing mesa packages..."
|
||||
sudo apt-get install -y mesa-common-dev libglu1-mesa-dev
|
||||
|
||||
echo "=== installing cmake, patchelf, gmp, mpfr and xcerces-c..."
|
||||
sudo apt-get install -y cmake ninja-build patchelf libgmp-dev libmpfr-dev libxerces-c-dev libtbb-dev
|
||||
|
||||
if [ "$DONT_INSTALL_QT" = false ] ; then
|
||||
echo "=== installing qt packages..."
|
||||
sudo apt-get install -y qt5-default qttools5-dev-tools qtdeclarative5-dev
|
||||
else
|
||||
echo "=== jumping installation of qt packages..."
|
||||
# libraries that qt requires in any case
|
||||
sudo apt-get install -y libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-render-util0-dev libxcb-xinerama0-dev
|
||||
fi
|
||||
|
||||
echo "=== installing cmake, patchelf, gmp, mpfr, tbb, glfw3 and xcerces-c..."
|
||||
sudo apt-get install -y cmake patchelf libgmp-dev libmpfr-dev libtbb-dev libglfw3-dev libxerces-c-dev
|
||||
|
||||
# possibility to use always system libraries starting from ubuntu 20.04, since cgal is header only
|
||||
if [ "$DONT_INSTALL_CGAL_BOOST" = false ] ; then
|
||||
echo "=== installing cgal and boost..."
|
||||
@ -1,22 +1,10 @@
|
||||
#!/bin/bash
|
||||
# this is a script shell for compiling meshlab in a Linux environment.
|
||||
# Requires a Qt environment which is set-up properly, and an accessible
|
||||
# cmake binary.
|
||||
#
|
||||
# Without given arguments, MeshLab will be built in the meshlab/build
|
||||
# directory, and installed in $BUILD_PATH/../install.
|
||||
#
|
||||
# You can give as argument the BUILD_PATH and the INSTALL_PATH in the
|
||||
# following way:
|
||||
# bash 1_build.sh --build_path=/path/to/build --install_path=/path/to/install
|
||||
# -b and -i arguments are also supported.
|
||||
|
||||
#default paths wrt the script folder
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../../src
|
||||
BUILD_PATH=$SOURCE_PATH/../build
|
||||
INSTALL_PATH=$SOURCE_PATH/../install/usr/
|
||||
CORES="-j4"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../..
|
||||
BUILD_PATH=$SOURCE_PATH/build
|
||||
INSTALL_PATH=$SOURCE_PATH/install/usr/
|
||||
DOUBLE_PRECISION_OPTION=""
|
||||
NIGHTLY_OPTION=""
|
||||
QT_DIR=""
|
||||
@ -34,12 +22,8 @@ case $i in
|
||||
INSTALL_PATH="${i#*=}"/usr/
|
||||
shift # past argument=value
|
||||
;;
|
||||
-j*)
|
||||
CORES=$i
|
||||
shift # past argument=value
|
||||
;;
|
||||
-d|--double_precision)
|
||||
DOUBLE_PRECISION_OPTION="-DBUILD_WITH_DOUBLE_SCALAR=ON"
|
||||
DOUBLE_PRECISION_OPTION="-DMESHLAB_BUILD_WITH_DOUBLE_SCALAR=ON"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-n|--nightly)
|
||||
@ -75,11 +59,13 @@ fi
|
||||
BUILD_PATH=$(realpath $BUILD_PATH)
|
||||
INSTALL_PATH=$(realpath $INSTALL_PATH)
|
||||
|
||||
cd $BUILD_PATH
|
||||
if [ ! -z "$QT_DIR" ]
|
||||
then
|
||||
export Qt5_DIR=$QT_DIR
|
||||
fi
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $CCACHE $DOUBLE_PRECISION_OPTION $NIGHTLY_OPTION $SOURCE_PATH
|
||||
make $CORES
|
||||
make install
|
||||
|
||||
cd $BUILD_PATH
|
||||
export NINJA_STATUS="[%p (%f/%t) ] "
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $CCACHE $DOUBLE_PRECISION_OPTION $NIGHTLY_OPTION $SOURCE_PATH
|
||||
ninja
|
||||
ninja install
|
||||
|
||||
44
scripts/Linux/2_deploy.sh
Normal file
44
scripts/Linux/2_deploy.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
QT_DIR_OPTION=""
|
||||
PACKAGES_PATH=$SCRIPTS_PATH/../../packages
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR_OPTION=-qt=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
bash $SCRIPTS_PATH/internal/2a_make_bundle.sh -i=$INSTALL_PATH
|
||||
|
||||
echo "======= Bundle created ======="
|
||||
|
||||
bash $SCRIPTS_PATH/internal/2b_deb.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH
|
||||
|
||||
echo "======= Deb Created ======="
|
||||
|
||||
bash $SCRIPTS_PATH/internal/2c_portable.sh -i=$INSTALL_PATH $QT_DIR_OPTION
|
||||
|
||||
echo "======= Portable Version Created ======="
|
||||
|
||||
bash $SCRIPTS_PATH/internal/2d_appimage.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH
|
||||
|
||||
echo "======= AppImage Created ======="
|
||||
@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This is a script shell for deploying a meshlab-portable folder and create an AppImage.
|
||||
# Requires a properly built MeshLab (see 1_build.sh).
|
||||
#
|
||||
# Without given arguments, the folder that will be deployed is meshlab/install, which
|
||||
# should be the path where MeshLab has been installed (default output of 1_build.sh).
|
||||
# The AppImage will be placed in the directory where the script is run.
|
||||
#
|
||||
# You can give as argument the path where you installed MeshLab.
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
QT_DIR=""
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
bash $SCRIPTS_PATH/internal/make_bundle.sh -i=$INSTALL_PATH
|
||||
|
||||
if [ ! -z "$QT_DIR" ]
|
||||
then
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QT_DIR/lib
|
||||
export QMAKE=$QT_DIR/bin/qmake
|
||||
fi
|
||||
|
||||
chmod +x $INSTALL_PATH/usr/bin/meshlab
|
||||
|
||||
for plugin in $INSTALL_PATH/usr/lib/meshlab/plugins/*.so
|
||||
do
|
||||
patchelf --set-rpath '$ORIGIN/../../:$ORIGIN' $plugin
|
||||
done
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTALL_PATH/usr/lib
|
||||
$RESOURCES_PATH/linux/linuxdeploy --appdir=$INSTALL_PATH \
|
||||
--plugin qt --output appimage
|
||||
|
||||
#get version
|
||||
IFS=' ' #space delimiter
|
||||
STR_VERSION=$($INSTALL_PATH/AppRun --version)
|
||||
read -a strarr <<< "$STR_VERSION"
|
||||
ML_VERSION=${strarr[1]} #get the meshlab version from the string
|
||||
|
||||
mv MeshLab-*.AppImage MeshLab$ML_VERSION-linux.AppImage
|
||||
|
||||
#at this point, distrib folder contains all the files necessary to execute meshlab
|
||||
echo "$INSTALL_PATH is now a self contained meshlab application"
|
||||
@ -5,67 +5,36 @@ This folder contains a series of scripts to build and deploy MeshLab under a Lin
|
||||
## Note about Qt
|
||||
|
||||
Old versions of Ubuntu (< than 22.04) are shipped with old versions of Qt, but MeshLab requires Qt 5.15.
|
||||
Therefore, you must install manually Qt separatelly in your system. You can then given the path of the Qt installation
|
||||
directory to the various scripts.
|
||||
You can check an example of this scenario in the examples section.
|
||||
Therefore, you must install manually Qt separatelly in your system. You can then give the path of the Qt installation
|
||||
directory to the various scripts, or you can add Qt to your `LD_LIBRARY_PATH`.
|
||||
|
||||
## Scripts
|
||||
The `0_setup_env.sh` script won't install qt from apt if you pass the argument `dont_install_qt`.
|
||||
|
||||
* `0_setup_env_ubuntu.sh`: this script installs all the required dependencies that are necessary to build MeshLab in an Ubuntu distro (tested in 18.04, 20.04 and 22.04). If you never installed Qt and other libraries, you should run it before any other script;
|
||||
Arguments accepted by this script are the following:
|
||||
* `--dont_install_qt`: does not install qt libraries. You should use this option if you are running a version of ubuntu older than 22.04, and install then manually Qt.
|
||||
* `--dowload_cgal_and_boost_src`: downloads sources of cgal and boost libraries instead of using the system packages. It may be useful if you are running a version of ubuntu older than 20.04 (before this version, CGAL was not header only).
|
||||
|
||||
* `1_build.sh`: this script builds MeshLab in a Linux environment:
|
||||
* it requires a properly set Qt environment (see `0_setup_env_ubuntu.sh`);
|
||||
* takes as arguments:
|
||||
* the build directory (default: `src/build`): `--build_path=path/to/build`
|
||||
* the install directory (default: `src/install`): `--install_path=path/to/install`
|
||||
* the number of cores used to build MeshLab (default: `-j4`)`
|
||||
* the possibility to build MeshLab with double precision scalar: `--double_precision`
|
||||
* optionally, the path of the custom Qt directory: `--qt_dir=path/to/qt`
|
||||
* `2_deploy_and_appimage.sh`: this script makes the given path a portable version of MeshLab and creates also an [AppImage](https://appimage.org/) of it. Takes as arguments:
|
||||
* the path where the output install path of the `1_build.sh` script is placed (default: `src/install`): `--install_path=path/to/install`
|
||||
* optionally, the directory of the custom Qt directory: `--qt_dir=path/to/qt`
|
||||
* `make_it.sh`: this script builds, deploys and generates an [AppImage](https://appimage.org/) that can be run in a Linux Environment without dependencies. Arguments are the same of the `1_build.sh` script.
|
||||
## Dependencies
|
||||
|
||||
## Examples
|
||||
Dependencies are automatically installed by the `0_setup_env.sh` script, which uses [`apt-get`](https://linux.die.net/man/8/apt-get) as package manager.
|
||||
Be sure to have `apt-get` installed before running this script.
|
||||
|
||||
Building MeshLab on a clean Linux environment (build placed in `meshlab/src/build`):
|
||||
Libraries installed by the `0_setup_env.sh` are the following:
|
||||
- Required by MeshLab:
|
||||
- `mesa-common-dev`
|
||||
- `libglu1-mesa-dev`
|
||||
- `cmake`
|
||||
- `ninja-build`
|
||||
- `patchelf` (for deploy stage)
|
||||
- Required by Qt5:
|
||||
- `libxcb-icccm4-dev`
|
||||
- `libxcb-image0-dev`
|
||||
- `libxcb-keysyms1-dev`
|
||||
- `libxcb-render-util0-dev`
|
||||
- `libxcb-xinerama0-dev`
|
||||
- Optional:
|
||||
- `libgmp-dev` and `libmpfr-dev` (required by cgal)
|
||||
- `libxerces-c-dev` (required by libe57)
|
||||
- `libcgal-dev` and `libboost-all-dev` (required by several MeshLab plugins)
|
||||
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/Linux/0_setup_env_ubuntu.sh
|
||||
bash meshlab/scripts/Linux/1_build.sh
|
||||
The script won't install `cgal` and `boost` (and then they will be downloaded by `cmake` during configuration) if you pass the argument `--dont_install_cgal_and_boost`.
|
||||
|
||||
Building and generating AppImage MeshLab on an old Ubuntu version with Qt installed in the path `/opt/Qt`:
|
||||
## Note about deployment and AppImage packaging on Linux
|
||||
|
||||
* build directory: `meshlab/src/build`
|
||||
* AppDir/portable version: `meshlab/src/install`
|
||||
* AppImage path: `./`
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/Linux/0_setup_env_ubuntu.sh --dont_install_qt
|
||||
bash meshlab/scripts/Linux/1_build.sh --qt_dir=/opt/Qt/5.15.2/gcc_64
|
||||
bash meshlab/scripts/Linux/2_deploy_and_appimage.sh --qt_dir=/opt/Qt/5.15.2/gcc_64
|
||||
```
|
||||
|
||||
Or, alternatively:
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/Linux/0_setup_env_ubuntu.sh --dont_install_qt
|
||||
bash meshlab/scripts/Linux/make_it.sh --qt_dir=/opt/Qt/5.15.2/gcc_64
|
||||
```
|
||||
|
||||
Building and generating AppImage on a clean Linux environment, using 16 cores and custom directories:
|
||||
|
||||
* build directory: `./meshlab-build`
|
||||
* AppDir/portable version: `./meshlab-install`
|
||||
* AppImage path: `./`
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/Linux/0_setup_env_ubuntu.sh
|
||||
bash meshlab/scripts/Linux/make_it.sh --build_path="./meshlab-build" --install_path="./meshlab-install" -j16
|
||||
```
|
||||
To deploy MeshLab and make it portable, we use the tool [linuxdeploy](https://github.com/linuxdeploy/linuxdeploy). The authors of this tool suggest to use the last still-supported LTS version of Linux when deploying and generating an AppImage, in order to provide wide support of the application.
|
||||
@ -1,11 +1,4 @@
|
||||
#!/bin/bash
|
||||
# this is a script shell for setting up the application bundle for linux
|
||||
# Requires a properly built meshlab.
|
||||
#
|
||||
# Without given arguments, the application boundle will be placed in the meshlab/install
|
||||
# directory.
|
||||
#
|
||||
# You can give as argument the path were meshlab has been installed.
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/../
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
@ -26,8 +19,6 @@ case $i in
|
||||
esac
|
||||
done
|
||||
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTALL_PATH
|
||||
|
||||
#check if we have an exec in distrib
|
||||
if ! [ -f $INSTALL_PATH/usr/bin/meshlab ]
|
||||
then
|
||||
@ -70,6 +61,10 @@ cp $RESOURCES_PATH/LICENSE.txt $INSTALL_PATH/usr/share/doc/meshlab/
|
||||
cp $RESOURCES_PATH/privacy.txt $INSTALL_PATH/usr/share/doc/meshlab/
|
||||
cp $RESOURCES_PATH/readme.txt $INSTALL_PATH/usr/share/doc/meshlab/
|
||||
|
||||
for filename in $INSTALL_PATH/usr/lib/meshlab/plugins/*.so; do
|
||||
patchelf --set-rpath '$ORIGIN/../' $filename
|
||||
for plugin in $INSTALL_PATH/usr/lib/meshlab/plugins/*.so
|
||||
do
|
||||
# allow plugins to find linked libraries in usr/lib, usr/lib/meshlab and usr/lib/meshlab/plugins
|
||||
patchelf --set-rpath '$ORIGIN/../../:$ORIGIN/../:$ORIGIN' $plugin
|
||||
done
|
||||
|
||||
chmod +x $INSTALL_PATH/usr/bin/meshlab
|
||||
26
scripts/Linux/internal/2b_deb.sh
Normal file
26
scripts/Linux/internal/2b_deb.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
PACKAGES_PATH=$SCRIPTS_PATH/../../packages
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
mkdir $PACKAGES_PATH
|
||||
42
scripts/Linux/internal/2c_portable.sh
Normal file
42
scripts/Linux/internal/2c_portable.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
QT_DIR=""
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -z "$QT_DIR" ]
|
||||
then
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QT_DIR/lib
|
||||
export QMAKE=$QT_DIR/bin/qmake
|
||||
fi
|
||||
|
||||
$RESOURCES_PATH/linux/linuxdeploy --appdir=$INSTALL_PATH \
|
||||
--plugin qt
|
||||
|
||||
# after deploy, all required libraries are placed into usr/lib, therefore we can remove the ones in
|
||||
# usr/lib/meshlab (except for the ones that are loaded at runtime)
|
||||
shopt -s extglob
|
||||
cd $INSTALL_PATH/usr/lib/meshlab
|
||||
rm -v !("libIFXCore.so"|"libIFXExporting.so"|"libIFXScheduling.so")
|
||||
|
||||
#at this point, distrib folder contains all the files necessary to execute meshlab
|
||||
echo "$INSTALL_PATH is now a self contained meshlab application"
|
||||
36
scripts/Linux/internal/2d_appimage.sh
Normal file
36
scripts/Linux/internal/2d_appimage.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
PACKAGES_PATH=$SCRIPTS_PATH/../../packages
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
$RESOURCES_PATH/linux/linuxdeploy --appdir=$INSTALL_PATH \
|
||||
--output appimage
|
||||
|
||||
#get version
|
||||
IFS=' ' #space delimiter
|
||||
STR_VERSION=$($INSTALL_PATH/AppRun --version)
|
||||
read -a strarr <<< "$STR_VERSION"
|
||||
ML_VERSION=${strarr[1]} #get the meshlab version from the string
|
||||
|
||||
mkdir $PACKAGES_PATH
|
||||
mv MeshLab-*.AppImage $PACKAGES_PATH/MeshLab$ML_VERSION-linux.AppImage
|
||||
@ -1,28 +1,15 @@
|
||||
#!/bin/bash
|
||||
# This is a script shell for compiling and deploying MeshLab in a Linux environment.
|
||||
#
|
||||
# Requires a Qt environment which is set-up properly, and an accessible
|
||||
# cmake binary.
|
||||
#
|
||||
# Without given arguments, MeshLab will be built in the meshlab/build,
|
||||
# the folder meshlab/install will be a portable version of MeshLab and
|
||||
# the AppImage will be placed in meshlab/src.
|
||||
#
|
||||
# You can give as argument the build path, the install path (that will contain
|
||||
# the portable version of MeshLab), and the number of cores to use to build MeshLab
|
||||
# (default: 4).
|
||||
# The AppImage will be placed in the directory where the script is run.
|
||||
#
|
||||
# Example of call:
|
||||
# bash make_it.sh --build_path=path/to/build --install_path=path/to/install -j8
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../../src
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../..
|
||||
BUILD_PATH=$SOURCE_PATH/../build
|
||||
INSTALL_PATH=$SOURCE_PATH/../install
|
||||
CORES="-j4"
|
||||
PACKAGE_PATH=$SOURCE_PATH/../packages
|
||||
|
||||
DOUBLE_PRECISION_OPTION=""
|
||||
NIGHTLY_OPTION=""
|
||||
QT_DIR_OPTION=""
|
||||
CCACHE_OPTION=""
|
||||
|
||||
#check parameters
|
||||
for i in "$@"
|
||||
@ -36,23 +23,31 @@ case $i in
|
||||
INSTALL_PATH="${i#*=}"/usr/
|
||||
shift # past argument=value
|
||||
;;
|
||||
-j*)
|
||||
CORES=$i
|
||||
-p=*|--package_path=*)
|
||||
PACKAGE_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
--double_precision)
|
||||
DOUBLE_PRECISION_OPTION="--double_precision"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-n|--nightly)
|
||||
NIGHTLY_OPTION="--nightly"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR_OPTION=-qt=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
--ccache)
|
||||
CCACHE_OPTION="--ccache"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
bash $SCRIPTS_PATH/1_build.sh -b=$BUILD_PATH -i=$INSTALL_PATH $QT_DIR_OPTION $DOUBLE_PRECISION_OPTION $CORES
|
||||
bash $SCRIPTS_PATH/2_deploy_and_appimage.sh -i=$INSTALL_PATH $QT_DIR_OPTION
|
||||
bash $SCRIPTS_PATH/1_build.sh -b=$BUILD_PATH -i=$INSTALL_PATH $NIGHTLY_OPTION $DOUBLE_PRECISION_OPTION $QT_DIR_OPTION $CCACHE_OPTION
|
||||
bash $SCRIPTS_PATH/2_deploy.sh -i=$INSTALL_PATH -p=$PACKAGE_PATH $QT_DIR_OPTION
|
||||
|
||||
@ -1,16 +1,140 @@
|
||||
#scripts folder
|
||||
# MeshLab scripts
|
||||
|
||||
This folder contains a series of platform-dependent scripts to build and deploy MeshLab.
|
||||
This folder contains a series of platform-dependent bash scripts to build and deploy MeshLab.
|
||||
|
||||
Every platform folder contains:
|
||||
|
||||
* `1_build.sh`: a script that builds MeshLab. Requires a Qt environment properly set, with `cmake` accessible. Takes as inputh the build directory (default: `src/build`), the install directory (default: `src/install`) and the number of cores used to build MeshLab (default: `-j4`). Example of call: `bash 1_build.sh --build_path=path/to/build --install_path=path/to/install -j8`
|
||||
* `2_deploy.sh`: a script that deploys MeshLab, making sure that the folder will be a self-contained MeshLab, without Qt library dependencies. Requires a properly built MeshLab in the directory passed as an argument (default: `src/install`). Example of call: `bash 2_deploy.sh --install_path=path/to/deploy`
|
||||
* `3_$installer$.sh`: a script that computes a platform-dependent self-contained package/installer of MeshLab. Requires a properly deployed MeshLab in the directory passed as an argument (default: `src/install`). The result will be saved in the parent directory of the given argument.
|
||||
* `make_it.sh`: a script that computes all the three previous scripts: starting from the source code, it will produce a self-contained package/installer of MeshLab (arguments are the same of `1_build.sh`). Example of call: `bash makeit.sh --build_path=path/to/build --install_path=path/to/install -j8`
|
||||
* `0_setup_env.sh`: a script that installs automatically the required dependencies;
|
||||
* `1_build.sh`: a script that builds MeshLab;
|
||||
* `2_deploy.sh`: a script that deploys MeshLab;
|
||||
* `3_pack.sh`: a script that computes a platform-dependent self-contained package/installer of MeshLab;
|
||||
* `make_it.sh`: a script that computes all the three previous scripts;
|
||||
|
||||
Note for Windows: scripts are written in bash, therefore they should be run in a linux subsystem environment.
|
||||
|
||||
See in each platform subfolder for details and other platform-dependent requirements:
|
||||
- [Linux](https://github.com/cnr-isti-vclab/meshlab/tree/master/scripts/Linux)
|
||||
- [MaxOS](https://github.com/cnr-isti-vclab/meshlab/tree/master/scripts/macOS)
|
||||
- [Windows](https://github.com/cnr-isti-vclab/meshlab/tree/master/scripts/Windows)
|
||||
- [Linux](https://github.com/cnr-isti-vclab/meshlab/tree/main/scripts/Linux)
|
||||
- [MaxOS](https://github.com/cnr-isti-vclab/meshlab/tree/main/scripts/macOS)
|
||||
- [Windows](https://github.com/cnr-isti-vclab/meshlab/tree/main/scripts/Windows)
|
||||
|
||||
## `0_setup_env.sh`
|
||||
|
||||
This script installs automatically the required dependencies of MeshLab. Common dependencies are Qt and `cmake`.
|
||||
|
||||
The script uses a system package manager to install dependencies, which is:
|
||||
- [`apt-get`](https://linux.die.net/man/8/apt-get) on Linux;
|
||||
- [`brew`](https://brew.sh/) on macOS;
|
||||
- [`choco`](https://community.chocolatey.org/) on Windows.
|
||||
|
||||
Please be sure to have these package managers before running this script.
|
||||
|
||||
It takes as input the `--dont_install_qt` option, that allows the user to choose whether to install or not qt using the system package manager. It could be useful if Qt is installed using other sources. For example, in our GitHub actions workflows we use a specific action step to install Qt, in order to choose a specific version.
|
||||
|
||||
Please see the readme inside the desired platform folder for system dependent additional arguments and further details.
|
||||
|
||||
## `1_build.sh`
|
||||
|
||||
This script builds MeshLab. It assumes that the script `0_setup_env.sh` has been already executed and all the dependencies are correctly installed and accessible by the script.
|
||||
|
||||
It takes the following input arguments:
|
||||
- `--build_path`: the directory where will be placed the build files;
|
||||
- default: `[meshlab_repo]/build`
|
||||
- example: `--build_path=path/to/build`
|
||||
- `--install_path`: the directory where final MeshLab binaries, libraries and files will be placed;
|
||||
- default: `[meshlab_repo]/install`
|
||||
- example: `--install_path=path/to/install`
|
||||
- `--double_precision`: if present, this argument will tell to build MeshLab with double floating point precision;
|
||||
- `--nighly`: if present, this argument will tell to build MeshLab with a nightly version;
|
||||
- `--qt_dir`: the directory where to find Qt, useful when Qt is not in the `PATH`;
|
||||
- example: `--qt_dir=path/to/qt`
|
||||
- `--ccache`: if present, this argument will tell to use the `ccache` tool to speed up build time (useful for CI builds, be sure to have `ccache` installed).
|
||||
|
||||
Example of call:
|
||||
```
|
||||
bash 1_build.sh --build_path=path/to/build --install_path=path/to/install --double_precision
|
||||
```
|
||||
|
||||
## `2_deploy.sh`
|
||||
|
||||
This script deploys MeshLab, making sure that the folder will be a self-contained MeshLab, without Qt or any other system libraries dependencies. It assumes that the scripts `0_setup_env.sh` and `1_build.sh` have been already executed and there is a directory where all the final MeshLab files are placed.
|
||||
|
||||
It takes the following input arguments:
|
||||
- `--install_path`: the directory where final MeshLab binaries, libraries and files are placed; this will be the path where MeshLab will be deployed. It should be the same argument given to the `1_build.sh` script;
|
||||
- default: `[meshlab_repo]/install`
|
||||
- example: `--install_path=path/to/install`
|
||||
- `--qt_dir`: the directory where to find Qt, useful when Qt is not in the `PATH`; it should be the same argument given to the `1_build.sh` script;
|
||||
- example: `--qt_dir=path/to/qt`
|
||||
|
||||
Example of call:
|
||||
```
|
||||
bash 2_deploy.sh --install_path=path/to/install
|
||||
```
|
||||
|
||||
## `3_pack.sh`
|
||||
|
||||
This script generates a platform-dependent self-contained package/installer of MeshLab. It assumes that the scripts `0_setup_env.sh`, `1_build.sh` and `2_deploy.sh` have been already executed, and there is a directory where MeshLab has been deployed.
|
||||
|
||||
It takes the following input arguments:
|
||||
- `--install_path`: the directory containing MeshLab deployed; it should be the same argument given to the `2_deploy.sh` script;
|
||||
- default: `[meshlab_repo]/install`
|
||||
- example: `--install_path=path/to/install`
|
||||
- `--packages_path`: the directory where the output package(s) will be placed;
|
||||
- default: `[meshlab_repo]/packages`
|
||||
- example: `--packages_path=path/to/packages`
|
||||
|
||||
Example of call:
|
||||
```
|
||||
bash 3_pack.sh --install_path=path/to/install --package_path=path/to/packages
|
||||
```
|
||||
|
||||
## `make_it.sh`
|
||||
|
||||
This script computes all the three previous scripts: starting from the source code, it will produce a self-contained package/installer of MeshLab. Input arguments are a union of all the arguments of the previous scripts.
|
||||
|
||||
# Examples
|
||||
|
||||
The following examples can be run on Linux, macOS and Windows (using linux subsystem).
|
||||
|
||||
### Building MeshLab on a clean environment
|
||||
|
||||
The build directory will be placed in `meshlab/build`:
|
||||
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/[platform]/0_setup_env.sh
|
||||
bash meshlab/scripts/[platform]/1_build.sh
|
||||
|
||||
### Building, deploying and packaging MeshLab using a custom Qt installation
|
||||
|
||||
For example, let assume that Qt 5.15.2 is installed in the path `/opt/Qt`. We assume also that the compiler/architecture used by Qt is `gcc_64` (you can check yours in the directory `path/to/Qt/5.15.2/`).
|
||||
|
||||
* build directory: `meshlab/build`
|
||||
* AppDir/portable version: `meshlab/install`
|
||||
* package (installer, dmg, AppImage) path: `meshlab/packages`
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/[platform]/0_setup_env.sh --dont_install_qt
|
||||
bash meshlab/scripts/[platform]/1_build.sh --qt_dir=/opt/Qt/5.15.2/gcc_64
|
||||
bash meshlab/scripts/[platform]/2_deploy.sh --qt_dir=/opt/Qt/5.15.2/gcc_64
|
||||
bash meshlab/scripts/[plarform]/3_pack.sh
|
||||
```
|
||||
|
||||
Or, alternatively:
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/[platform]/0_setup_env.sh --dont_install_qt
|
||||
bash meshlab/scripts/[platform]/make_it.sh --qt_dir=/opt/Qt/5.15.2/gcc_64
|
||||
```
|
||||
|
||||
### Building, deploying and packaging MeshLab using custom directories
|
||||
|
||||
* build directory: `/my/meshlab/build`
|
||||
* AppDir/portable version: `/my/meshlab/install`
|
||||
* AppImage path: `/my/meshlab/packages`
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
bash meshlab/scripts/[platform]/0_setup_env.sh
|
||||
bash meshlab/scripts/[platform]/make_it.sh --build_path="/my/meshlab/build" --install_path="/my/meshlab/install" --package_path="/my/meshlab/packages"
|
||||
```
|
||||
|
||||
33
scripts/Windows/0_setup_env.sh
Normal file
33
scripts/Windows/0_setup_env.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# this is a script shell sets up a Windows environment where
|
||||
# MeshLab can be compiled, deployed and packaged.
|
||||
#
|
||||
# Run this script if you never installed any of the MeshLab dependencies.
|
||||
#
|
||||
# Requires: choco
|
||||
|
||||
DONT_INSTALL_QT=false
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
--dont_install_qt)
|
||||
DONT_INSTALL_QT=true
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
choco install cmake ninja ccache wget nsis
|
||||
|
||||
if [ "$DONT_INSTALL_QT" = false ] ; then
|
||||
echo "=== installing qt packages..."
|
||||
|
||||
choco install qt5-default
|
||||
else
|
||||
echo "=== jumping installation of qt packages..."
|
||||
fi
|
||||
@ -1,21 +1,10 @@
|
||||
#!/bin/bash
|
||||
# this is a script shell for compiling meshlab in a windows environment.
|
||||
# Requires a VS >= 2017 and Qt environments which are set-up properly,
|
||||
# and an accessible cmake binary.
|
||||
#
|
||||
# Without given arguments, MeshLab will be built in the meshlab/build
|
||||
# directory, and installed in meshlab/install.
|
||||
#
|
||||
# You can give as argument the BUILD_PATH and the INSTALL_PATH in the
|
||||
# following way:
|
||||
# bash 1_build.sh --build_path=/path/to/build --install_path=/path/to/install
|
||||
# -b and -i arguments are also supported.
|
||||
|
||||
#default paths wrt the script folder
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../../src
|
||||
BUILD_PATH=$SOURCE_PATH/../build
|
||||
INSTALL_PATH=$SOURCE_PATH/../install
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../..
|
||||
BUILD_PATH=$SOURCE_PATH/build
|
||||
INSTALL_PATH=$SOURCE_PATH/install
|
||||
DOUBLE_PRECISION_OPTION=""
|
||||
NIGHTLY_OPTION=""
|
||||
QT_DIR=""
|
||||
@ -34,7 +23,7 @@ case $i in
|
||||
shift # past argument=value
|
||||
;;
|
||||
-d|--double_precision)
|
||||
DOUBLE_PRECISION_OPTION="-DBUILD_WITH_DOUBLE_SCALAR=ON"
|
||||
DOUBLE_PRECISION_OPTION="-DMESHLAB_BUILD_WITH_DOUBLE_SCALAR=ON"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-n|--nightly)
|
||||
@ -70,12 +59,13 @@ fi
|
||||
BUILD_PATH=$(realpath $BUILD_PATH)
|
||||
INSTALL_PATH=$(realpath $INSTALL_PATH)
|
||||
|
||||
cd $BUILD_PATH
|
||||
if [ ! -z "$QT_DIR" ]
|
||||
then
|
||||
export Qt5_DIR=$QT_DIR
|
||||
fi
|
||||
|
||||
cd $BUILD_PATH
|
||||
export NINJA_STATUS="[%p (%f/%t) ] "
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $CCACHE $DOUBLE_PRECISION_OPTION $NIGHTLY_OPTION $SOURCE_PATH
|
||||
ninja
|
||||
ninja install
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
#!/bin/bash
|
||||
# This is a script shell for deploying a meshlab-portable folder.
|
||||
# Requires a properly built meshlab (see 1_build.sh).
|
||||
#
|
||||
# Without given arguments, the folder that will be deployed is meshlab/install.
|
||||
#
|
||||
# You can give as argument the path where meshlab is installed.
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
QT_DIR=""
|
||||
QT_DIR_OPTION=""
|
||||
PACKAGES_PATH=$SCRIPTS_PATH/../../packages
|
||||
SIGN=false
|
||||
CERT_FILE_OPTION=""
|
||||
CERT_PSSW=""
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
@ -20,7 +18,22 @@ case $i in
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR=${i#*=}/bin/
|
||||
QT_DIR_OPTION=qt="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-cf=*|--cert_file=*)
|
||||
CERT_FILE_OPTION=cf="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-cp=*|--cert_pssw=*)
|
||||
if [ -z "${i#*=}" ]; then
|
||||
SIGN=true
|
||||
CERT_PSSW="${i#*=}"
|
||||
fi
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
@ -29,17 +42,22 @@ case $i in
|
||||
esac
|
||||
done
|
||||
|
||||
${QT_DIR}windeployqt $INSTALL_PATH/meshlab.exe
|
||||
bash $SCRIPTS_PATH/internal/2a_portable.sh -i=$INSTALL_PATH $QT_DIR_OPTION
|
||||
|
||||
${QT_DIR}windeployqt $INSTALL_PATH/plugins/filter_sketchfab.dll --libdir $INSTALL_PATH/
|
||||
echo "======= Portable Version Created ======="
|
||||
|
||||
mv $INSTALL_PATH/lib/meshlab/IFX* $INSTALL_PATH
|
||||
cp $INSTALL_PATH/IFXCoreStatic.lib $INSTALL_PATH/lib/meshlab/
|
||||
cp $RESOURCES_PATH/LICENSE.txt $INSTALL_PATH/
|
||||
cp $RESOURCES_PATH/privacy.txt $INSTALL_PATH/
|
||||
if [ "$SIGN" = true ] ; then
|
||||
bash $SCRIPTS_PATH/internal/2b_sign_dlls.sh -i=$INSTALL_PATH $CERT_FILE_OPTION -cp=$CERT_PSSW
|
||||
|
||||
if [ ! -f $INSTALL_PATH/vc_redist.x64.exe ]
|
||||
then
|
||||
echo "Downloading vc_redist because it was missing..."
|
||||
wget https://aka.ms/vs/17/release/vc_redist.x64.exe --output-document=$INSTALL_PATH/vc_redist.x64.exe
|
||||
echo "======= Portable Version Signed ======="
|
||||
fi
|
||||
|
||||
bash $SCRIPTS_PATH/internal/2c_installer.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH
|
||||
|
||||
echo "======= Installer Created ======="
|
||||
|
||||
if [ "$SIGN" = true ] ; then
|
||||
bash $SCRIPTS_PATH/internal/2b_sign_dlls.sh -i=$PACKAGES_PATH $CERT_FILE_OPTION -cp=$CERT_PSSW
|
||||
|
||||
echo "======= Installer Signed ======="
|
||||
fi
|
||||
@ -1,37 +0,0 @@
|
||||
# This is a powershell script for computing an installer for MeshLab.
|
||||
# Requires:
|
||||
# - a properly deployed meshlab (see 1_deploy.sh);
|
||||
# - the env variable PATH containing the NSIS folder (makensis.exe must be directly accessible)
|
||||
#
|
||||
# Without given arguments, the folder that will be deployed is meshlab/install.
|
||||
#
|
||||
# You can give as argument the INSTALL_PATH.
|
||||
#
|
||||
# After running this script, the installer can be found inside the install folder.
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
sh $SCRIPTS_PATH/internal/nsis_script.sh -i=$INSTALL_PATH
|
||||
|
||||
makensis.exe $INSTALL_PATH/meshlab_final.nsi
|
||||
|
||||
rm $INSTALL_PATH/meshlab_final.nsi
|
||||
rm $INSTALL_PATH/ExecWaitJob.nsh
|
||||
rm $INSTALL_PATH/FileAssociation.nsh
|
||||
@ -1,28 +1,29 @@
|
||||
# Windows Scripts
|
||||
|
||||
This folder contains a series of scripts to build and deploy MeshLab under a Windows environment.
|
||||
**Note**: scripts are written in bash, therefore they should be run in a linux subsystem environment.
|
||||
|
||||
* `1_build.sh`: this script builds MeshLab in a Windows environment:
|
||||
* it requires a properly set Visual Studio (>=2015) and MSVC compiler;
|
||||
* it requires a properly set Qt environment;
|
||||
* `cmake` in the PATH env variable;
|
||||
* takes as arguments:
|
||||
* the build directory (default: `src/build`): `--build_path=path/to/build`
|
||||
* the install directory (default: `src/install`): `--install_path=path/to/install`
|
||||
* the number of cores used to build MeshLab (default: `-j4`)`
|
||||
* the possibility to build MeshLab with double precision scalar: `--double_precision`
|
||||
* `2_deploy.sh`: this script makes the given path a portable version of MeshLab. Takes as arguments:
|
||||
* the path where the output install path of the `1_build.sh` script is placed (default: `src/install`): `--install_path=path/to/install`
|
||||
* `3_installer.sh`: this script computes, starting from the portable folder of MeshLab, an NSIS installer. Takes as arguments:
|
||||
* the path where the output install path of the `2_deploy.sh` script is placed (default: `src/install`): `--install_path=path/to/install`
|
||||
* if MeshLab has been built with double precision scalar, add: `--double_precision`
|
||||
* it requires `makensis.exe` in the PATH env variable.
|
||||
## Note about the compiler
|
||||
|
||||
On Windows, we use MSVC compiler to build MeshLab. Before trying to build MeshLab, you should download and install VisualStudio with the C++ developer package, which contains the MSVC compiler.
|
||||
|
||||
## Examples
|
||||
Other compilers are not tested.
|
||||
|
||||
Building MeshLab on Windows, having VisualStudio, MSVC and Qt installed, cmake in the PATH (build placed in `meshlab/src/build`):
|
||||
## Note about Qt
|
||||
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
sh meshlab/scripts/Windows/1_build.sh
|
||||
MeshLab requires Qt 5.15. You can both install Qt5 using `choco` or manually in your system.
|
||||
If you install Qt manually. you can then give the path of the Qt installation directory to the various scripts, or you can add Qt to your `PATH`.
|
||||
|
||||
The `0_setup_env.sh` script won't install qt from `choco` if you pass the argument `dont_install_qt`.
|
||||
|
||||
## Dependencies
|
||||
|
||||
Dependencies are automatically installed by the `0_setup_env.sh` script, which uses [`choco`](https://community.chocolatey.org/) as package manager.
|
||||
Be sure to have `choco` installed before running this script.
|
||||
|
||||
Libraries installed by the `0_setup_env.sh` are the following:
|
||||
- Required by MeshLab:
|
||||
- `wget` (required by these scripts)
|
||||
- `ccache` (required by github actions)
|
||||
- `cmake`
|
||||
- `ninja`
|
||||
- `nsis` (for package stage)
|
||||
45
scripts/Windows/internal/2a_portable.sh
Normal file
45
scripts/Windows/internal/2a_portable.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
QT_DIR=""
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR=${i#*=}/bin/
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
${QT_DIR}windeployqt $INSTALL_PATH/meshlab.exe
|
||||
|
||||
${QT_DIR}windeployqt $INSTALL_PATH/plugins/filter_sketchfab.dll --libdir $INSTALL_PATH/
|
||||
|
||||
mv $INSTALL_PATH/lib/meshlab/IFX* $INSTALL_PATH
|
||||
cp $INSTALL_PATH/IFXCoreStatic.lib $INSTALL_PATH/lib/meshlab/
|
||||
cp $RESOURCES_PATH/LICENSE.txt $INSTALL_PATH/
|
||||
cp $RESOURCES_PATH/privacy.txt $INSTALL_PATH/
|
||||
|
||||
# remove all .lib files
|
||||
for file in $(find $INSTALL_PATH -name '*.lib');
|
||||
do
|
||||
rm $file
|
||||
done
|
||||
|
||||
if [ ! -f $INSTALL_PATH/vc_redist.x64.exe ]
|
||||
then
|
||||
echo "Downloading vc_redist because it was missing..."
|
||||
wget https://aka.ms/vs/17/release/vc_redist.x64.exe --output-document=$INSTALL_PATH/vc_redist.x64.exe
|
||||
fi
|
||||
42
scripts/Windows/internal/2b_sign_dlls.sh
Normal file
42
scripts/Windows/internal/2b_sign_dlls.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
CERT_FILE=$SCRIPTS_PATH/../../certificate/certificate.pfx
|
||||
CERT_PSSW=""
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-cf=*|--cert_file=*)
|
||||
CERT_FILE="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-cp=*|--cert_pssw=*)
|
||||
CERT_PSSW=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd $INSTALL_PATH
|
||||
|
||||
|
||||
CERT_REL=$(realpath --relative-to=$INSTALL_PATH $CERT_FILE) # get relative path of the cert file
|
||||
CERT_WIN=$(echo "$CERT_REL" | sed 's/^\///' | sed 's/\//\\/g') # get windows relative path (with backslashes) of the cert
|
||||
|
||||
# will sign all dll and exe files inside INSTALL_PATH, recursively
|
||||
for file in $(find $INSTALL_PATH -name '*.dll' -or -name '*.exe');
|
||||
do
|
||||
FILE_REL=$(realpath --relative-to=$INSTALL_PATH $file) # relative path
|
||||
FILE_WIN=$(echo "$FILE_REL" | sed 's/^\///' | sed 's/\//\\/g') # win relative path
|
||||
signtool.exe sign //fd SHA256 //f $CERT_WIN //p $CERT_PSSW //t http://timestamp.comodoca.com/authenticode $FILE_WIN
|
||||
done
|
||||
@ -1,20 +1,11 @@
|
||||
# This is a powershell script for computing the meshlab_final.nsi script.
|
||||
# Requires:
|
||||
# - a properly deployed meshlab (see windows_deploy.ps1);
|
||||
#
|
||||
# Without given arguments, the folder that will be deployed is meshlab/distrib.
|
||||
#
|
||||
# You can give as argument the DISTRIB_PATH.
|
||||
#
|
||||
# After running this script, a meshlab_final.script can be found in the resources folder.
|
||||
# This script is ready to be run by makensis.exe
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../../src
|
||||
INSTALL_PATH=$SOURCE_PATH/../install
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
PACKAGES_PATH=$SCRIPTS_PATH/../../packages
|
||||
|
||||
#check parameters
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
@ -22,12 +13,18 @@ case $i in
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Make nsis script
|
||||
|
||||
#get version
|
||||
IFS=' ' #space delimiter
|
||||
STR_VERSION=$($INSTALL_PATH/meshlab.exe --version)
|
||||
@ -40,3 +37,14 @@ sed -i "s%DISTRIB_PATH%.%g" $RESOURCES_PATH/windows/meshlab_final.nsi
|
||||
mv $RESOURCES_PATH/windows/meshlab_final.nsi $INSTALL_PATH/
|
||||
cp $RESOURCES_PATH/windows/ExecWaitJob.nsh $INSTALL_PATH/
|
||||
cp $RESOURCES_PATH/windows/FileAssociation.nsh $INSTALL_PATH/
|
||||
|
||||
# Make Installer
|
||||
|
||||
makensis.exe $INSTALL_PATH/meshlab_final.nsi
|
||||
|
||||
rm $INSTALL_PATH/meshlab_final.nsi
|
||||
rm $INSTALL_PATH/ExecWaitJob.nsh
|
||||
rm $INSTALL_PATH/FileAssociation.nsh
|
||||
|
||||
mkdir $PACKAGES_PATH
|
||||
mv $INSTALL_PATH/MeshLab*-windows.exe $PACKAGES_PATH
|
||||
@ -1,12 +0,0 @@
|
||||
param($pssw, $path, $cert_path="")
|
||||
|
||||
if ([string]::IsNullOrEmpty($cert_path)) {
|
||||
$cert_path = Join-Path $PSScriptRoot ..\..\..\certificate\certificate.pfx
|
||||
}
|
||||
|
||||
$files = Get-ChildItem $path -include ('*.exe', '*.dll') -Recurse
|
||||
|
||||
for ($i=0; $i -lt $files.Count; $i++) {
|
||||
$file = $files[$i].FullName
|
||||
signtool.exe sign /fd SHA256 /f $cert_path /p $pssw /t http://timestamp.comodoca.com/authenticode $file
|
||||
}
|
||||
@ -16,11 +16,15 @@
|
||||
# bash make_it.sh --build_path=path/to/build --install_path=path/to/install -j8
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../../src
|
||||
BUILD_PATH=$SOURCE_PATH/../build
|
||||
INSTALL_PATH=$SOURCE_PATH/../install
|
||||
CORES="-j4"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../..
|
||||
BUILD_PATH=$SOURCE_PATH/build
|
||||
INSTALL_PATH=$SOURCE_PATH/install
|
||||
PACKAGES_PATH=$SOURCE_PATH/packages
|
||||
|
||||
DOUBLE_PRECISION_OPTION=""
|
||||
NIGHTLY_OPTION=""
|
||||
QT_DIR_OPTION=""
|
||||
CCACHE_OPTION=""
|
||||
|
||||
#check parameters
|
||||
for i in "$@"
|
||||
@ -34,20 +38,32 @@ case $i in
|
||||
INSTALL_PATH="${i#*=}"/usr/
|
||||
shift # past argument=value
|
||||
;;
|
||||
-j*)
|
||||
CORES=$i
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
--double_precision)
|
||||
DOUBLE_PRECISION_OPTION="--double_precision"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-n|--nightly)
|
||||
NIGHTLY_OPTION="--nightly"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR_OPTION=-qt=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
--ccache)
|
||||
CCACHE_OPTION="--ccache"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
sh $SCRIPTS_PATH/1_build.sh -b=$BUILD_PATH -i=$INSTALL_PATH $DOUBLE_PRECISION_OPTION $CORES
|
||||
sh $SCRIPTS_PATH/2_deploy.sh -i=$INSTALL_PATH
|
||||
sh $SCRIPTS_PATH/3_installer.sh -i=$INSTALL_PATH $DOUBLE_PRECISION_OPTION
|
||||
bash $SCRIPTS_PATH/1_build.sh -b=$BUILD_PATH -i=$INSTALL_PATH $NIGHTLY_OPTION $DOUBLE_PRECISION_OPTION $QT_DIR_OPTION $CCACHE_OPTION
|
||||
bash $SCRIPTS_PATH/2_deploy.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH $QT_DIR_OPTION
|
||||
|
||||
|
||||
@ -6,11 +6,35 @@
|
||||
#
|
||||
# Requires: homebrew
|
||||
|
||||
brew install libomp qt cgal xerces-c
|
||||
DONT_INSTALL_QT=false
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
--dont_install_qt)
|
||||
DONT_INSTALL_QT=true
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
brew install coreutils node cmake ninja llvm libomp cgal xerces-c tbb embree
|
||||
npm install -g appdmg
|
||||
|
||||
echo "export QTDIR=/usr/local/opt/qt" >> ~/.bash_profile
|
||||
echo "export PATH=$QTDIR/bin:$PATH" >> ~/.bash_profile
|
||||
echo "export LD_LIBRARY_PATH=/usr/local/opt/qt/lib:$LD_LIBRARY_PATH" >> ~/.bash_profile
|
||||
echo "export PKG_CONFIG_PATH=/usr/local/opt/qt/lib:$PKG_CONFIG_PATH" >> ~/.bash_profile
|
||||
. ~/.bash_profile
|
||||
if [ "$DONT_INSTALL_QT" = false ] ; then
|
||||
echo "=== installing qt packages..."
|
||||
|
||||
brew install qt
|
||||
|
||||
echo "export QTDIR=/usr/local/opt/qt" >> ~/.bash_profile
|
||||
echo "export PATH=$QTDIR/bin:$PATH" >> ~/.bash_profile
|
||||
echo "export LD_LIBRARY_PATH=/usr/local/opt/qt/lib:$LD_LIBRARY_PATH" >> ~/.bash_profile
|
||||
echo "export PKG_CONFIG_PATH=/usr/local/opt/qt/lib:$PKG_CONFIG_PATH" >> ~/.bash_profile
|
||||
. ~/.bash_profile
|
||||
else
|
||||
echo "=== jumping installation of qt packages..."
|
||||
fi
|
||||
|
||||
@ -1,23 +1,10 @@
|
||||
#!/bin/bash
|
||||
# this is a script shell for compiling meshlab in a MacOS environment.
|
||||
# Requires a Qt environment which is set-up properly, and an accessible
|
||||
# cmake binary.
|
||||
#
|
||||
# Without given arguments, MeshLab will be built in the meshlab/build
|
||||
# directory, and installed in meshlab/install.
|
||||
#
|
||||
# You can give as argument the BUILD_PATH and the INSTALL_PATH in the
|
||||
# following way:
|
||||
# bash 1_build.sh --build_path=/path/to/build --install_path=/path/to/install
|
||||
# -b and -i arguments are also supported.
|
||||
|
||||
#default paths wrt the script folder
|
||||
SCRIPTS_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../../src
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
BUILD_PATH=$SOURCE_PATH/../build
|
||||
INSTALL_PATH=$SOURCE_PATH/../install
|
||||
CORES="-j4"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../..
|
||||
BUILD_PATH=$SOURCE_PATH/build
|
||||
INSTALL_PATH=$SOURCE_PATH/install
|
||||
DOUBLE_PRECISION_OPTION=""
|
||||
NIGHTLY_OPTION=""
|
||||
USE_BREW_LLVM=false
|
||||
@ -36,12 +23,8 @@ case $i in
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-j*)
|
||||
CORES=$i
|
||||
shift # past argument=value
|
||||
;;
|
||||
-d|--double_precision)
|
||||
DOUBLE_PRECISION_OPTION="-DBUILD_WITH_DOUBLE_SCALAR=ON"
|
||||
DOUBLE_PRECISION_OPTION="-DMESHLAB_BUILD_WITH_DOUBLE_SCALAR=ON"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-n|--nightly)
|
||||
@ -78,6 +61,11 @@ then
|
||||
mkdir -p $INSTALL_PATH
|
||||
fi
|
||||
|
||||
if [ ! -z "$QT_DIR" ]
|
||||
then
|
||||
export Qt5_DIR=$QT_DIR
|
||||
fi
|
||||
|
||||
if [ "$USE_BREW_LLVM" = true ] ; then
|
||||
export PATH="$(brew --prefix llvm)/bin:$PATH";
|
||||
export CC=/usr/local/opt/llvm/bin/clang
|
||||
@ -88,7 +76,11 @@ if [ "$USE_BREW_LLVM" = true ] ; then
|
||||
export LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib"
|
||||
fi
|
||||
|
||||
BUILD_PATH=$(realpath $BUILD_PATH)
|
||||
INSTALL_PATH=$(realpath $INSTALL_PATH)
|
||||
|
||||
cd $BUILD_PATH
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $CCACHE $DOUBLE_PRECISION_OPTION $NIGHTLY_OPTION $SOURCE_PATH
|
||||
make $CORES
|
||||
make install
|
||||
export NINJA_STATUS="[%p (%f/%t) ] "
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $CCACHE $DOUBLE_PRECISION_OPTION $NIGHTLY_OPTION $SOURCE_PATH
|
||||
ninja
|
||||
ninja install
|
||||
|
||||
@ -1,20 +1,12 @@
|
||||
#!/bin/bash
|
||||
# this is a script shell for deploying a meshlab-portable app.
|
||||
# Requires a properly built meshlab.
|
||||
#
|
||||
# Without given arguments, the folder that will be deployed is meshlab/install.
|
||||
#
|
||||
# You can give as argument the INSTALL_PATH in the following way:
|
||||
# bash 2_deploy.sh --install_path=/path/to/install
|
||||
# -i argument is also supported.
|
||||
#
|
||||
# After running this script, $INSTALL_PATH/meshlab.app will be a portable meshlab application.
|
||||
|
||||
SCRIPTS_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"
|
||||
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
QT_DIR=""
|
||||
APPNAME="meshlab.app"
|
||||
QT_DIR_OPTION=""
|
||||
PACKAGES_PATH=$SCRIPTS_PATH/../../packages
|
||||
SIGN=false
|
||||
CERT_ID=""
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
@ -25,7 +17,18 @@ case $i in
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR=${i#*=}/bin/
|
||||
QT_DIR_OPTION=-qt=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-ci=*|--cert_id=*)
|
||||
if [ -z "${i#*=}" ]; then
|
||||
SIGN=true
|
||||
CERT_ID="${i#*=}"
|
||||
fi
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
@ -34,12 +37,16 @@ case $i in
|
||||
esac
|
||||
done
|
||||
|
||||
ARGUMENTS=""
|
||||
bash $SCRIPTS_PATH/internal/2a_appbundle.sh -i=$INSTALL_PATH $QT_DIR_OPTION
|
||||
|
||||
for plugin in $INSTALL_PATH/$APPNAME/Contents/PlugIns/*.so
|
||||
do
|
||||
ARGUMENTS="${ARGUMENTS} -executable=${plugin}"
|
||||
done
|
||||
echo "======= AppBundle Created ======="
|
||||
|
||||
${QT_DIR}macdeployqt $INSTALL_PATH/$APPNAME \
|
||||
$ARGUMENTS
|
||||
if [ "$SIGN" = true ] ; then
|
||||
bash $SCRIPTS_PATH/internal/2b_sign_appbundle.sh -i=$INSTALL_PATH -ci=$CERT_ID
|
||||
|
||||
echo "======= AppBundle Signed ======="
|
||||
fi
|
||||
|
||||
bash $SCRIPTS_PATH/internal/2c_dmg.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH
|
||||
|
||||
echo "======= DMG Created ======="
|
||||
@ -1,37 +1,27 @@
|
||||
# MacOS Scripts
|
||||
|
||||
This folder contains a series of scripts to build and deploy MeshLab under a MacOS environment.
|
||||
This folder contains a series of scripts to build and deploy MeshLab under a MacOS x86_64 environment.
|
||||
|
||||
* `0_setup_env.sh`: this script installs all the required dependencies that are necessary to build MeshLab and to create its DMG in a MacOS machine (tested in 10.15 Catalina). It requires [homebrew](https://brew.sh/) installed;
|
||||
* `1_build.sh`: this script builds MeshLab in a MacOS environment:
|
||||
* it requires a properly set Qt environment (see `0_setup_env.sh`);
|
||||
* takes as arguments:
|
||||
* the build directory (default: `src/build`): `--build_path=path/to/build`
|
||||
* the install directory (default: `src/install`): `--install_path=path/to/install`
|
||||
* the number of cores used to build MeshLab (default: `-j4`)`
|
||||
* the possibility to build MeshLab with double precision scalar: `--double_precision`
|
||||
* `2_deploy.sh`: this script makes portable a `meshlab.app` appdir. Takes as arguments:
|
||||
* the path where the output install path of the `1_build.sh` script is placed (default: `src/install`): `--install_path=path/to/install`
|
||||
* `3_dmg.sh`: this script generates a [DMG](https://en.wikipedia.org/wiki/Apple_Disk_Image) that can be used to install MeshLab. Takes as arguments:
|
||||
* the path where the install path of the `2_deploy.sh` script is placed (default: `src/install`): `--install_path=path/to/install`
|
||||
* if MeshLab has been built with double precision scalar, add: `--double_precision`
|
||||
* `make_it.sh`: this script builds, deploys and generates a [DMG](https://en.wikipedia.org/wiki/Apple_Disk_Image) that can be used to install MeshLab. Arguments are the same of the `1_build.sh` script.
|
||||
Arm (Apple M1) is still not supported. It will be supported soon.
|
||||
## Note about Qt
|
||||
|
||||
## Examples
|
||||
MeshLab requires Qt 5.15. You can both install Qt5 using `brew` or manually in your system.
|
||||
If you install Qt manually. you can then give the path of the Qt installation directory to the various scripts, or you can add Qt to your `LD_LIBRARY_PATH`.
|
||||
|
||||
Building MeshLab on a clean MacOS environment (build placed in `meshlab/src/build`):
|
||||
The `0_setup_env.sh` script won't install qt from `brew` if you pass the argument `dont_install_qt`.
|
||||
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
sh meshlab/scripts/macOS/0_setup_env.sh
|
||||
sh meshlab/scripts/macOS/1_build.sh
|
||||
## Dependencies
|
||||
|
||||
Building and generating a DMG on a clean MacOS environment:
|
||||
* build directory: `./meshlab-build`
|
||||
* install directory: `./meshlab-install`
|
||||
* DMG path: `./`
|
||||
Dependencies are automatically installed by the `0_setup_env.sh` script, which uses [`brew`](https://brew.sh/) as package manager.
|
||||
Be sure to have `brew` installed before running this script.
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
sh meshlab/scripts/macOS/0_setup_env.sh
|
||||
sh meshlab/scripts/macOS/make_it.sh --build_path="./meshlab-build" --install_path="./meshlab-install"
|
||||
```
|
||||
Libraries installed by the `0_setup_env.sh` are the following:
|
||||
- Required by MeshLab:
|
||||
- `coreutils` (required by these scripts)
|
||||
- `cmake`
|
||||
- `ninja`
|
||||
- `libomp`
|
||||
- `node` (for package stage, to download appdmg)
|
||||
- Optional:
|
||||
- `xerces-c` (required by libe57)
|
||||
- `cgal` (required by several MeshLab plugins)
|
||||
39
scripts/macOS/internal/2a_appbundle.sh
Normal file
39
scripts/macOS/internal/2a_appbundle.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
QT_DIR=""
|
||||
APPNAME="meshlab.app"
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR=${i#*=}/bin/
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
ARGUMENTS=""
|
||||
|
||||
for plugin in $INSTALL_PATH/$APPNAME/Contents/PlugIns/*.so
|
||||
do
|
||||
ARGUMENTS="${ARGUMENTS} -executable=${plugin}"
|
||||
done
|
||||
|
||||
${QT_DIR}macdeployqt $INSTALL_PATH/$APPNAME \
|
||||
$ARGUMENTS
|
||||
|
||||
# remove everything from install path, except the appbundle
|
||||
cd $INSTALL_PATH
|
||||
ls | grep -xv "${APPNAME}" | xargs rm
|
||||
26
scripts/macOS/internal/2b_sign_appbundle.sh
Normal file
26
scripts/macOS/internal/2b_sign_appbundle.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
CERT_ID=""
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-i=*|--install_path=*)
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-ci=*|--cert_id=*)
|
||||
CERT_ID="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
codesign --options "runtime" --timestamp --force --deep --sign $CERT_ID $INSTALL_PATH/meshlab.app
|
||||
24
scripts/macOS/3_dmg.sh → scripts/macOS/internal/2c_dmg.sh
Executable file → Normal file
24
scripts/macOS/3_dmg.sh → scripts/macOS/internal/2c_dmg.sh
Executable file → Normal file
@ -1,17 +1,9 @@
|
||||
#!/bin/bash
|
||||
# this is a script shell for setting up the application DMG for MacOS.
|
||||
# Requires a properly built and deployed meshlab (requires to run the
|
||||
# 2_deploy.sh script first).
|
||||
#
|
||||
# Without given arguments, meshlab.app will be looked for in meshlab/install
|
||||
# folder. MeshLab DMG will be placed in the same directory of meshlab.app.
|
||||
#
|
||||
# You can give as argument the INSTALL_PATH containing meshlab.app, with -i or
|
||||
# --install_path option.
|
||||
|
||||
SCRIPTS_PATH=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..
|
||||
RESOURCES_PATH=$SCRIPTS_PATH/../../resources
|
||||
INSTALL_PATH=$SCRIPTS_PATH/../../install
|
||||
PACKAGES_PATH=$SCRIPTS_PATH/../../packages
|
||||
|
||||
#checking for parameters
|
||||
for i in "$@"
|
||||
@ -21,6 +13,10 @@ case $i in
|
||||
INSTALL_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
@ -49,10 +45,8 @@ rm -f $INSTALL_PATH/*.dmg
|
||||
|
||||
mv $INSTALL_PATH/meshlab.app $INSTALL_PATH/MeshLab$ML_VERSION.app
|
||||
|
||||
echo "Running appdmg"
|
||||
appdmg $RESOURCES_PATH/macos/meshlab_dmg_final.json $INSTALL_PATH/MeshLab$ML_VERSION-macos.dmg
|
||||
mkdir $PACKAGES_PATH
|
||||
|
||||
rm $RESOURCES_PATH/macos/meshlab_dmg_final.json
|
||||
appdmg $RESOURCES_PATH/macos/meshlab_dmg_final.json $PACKAGES_PATH/MeshLab$ML_VERSION-macos.dmg
|
||||
|
||||
#at this point, distrib folder contains a DMG MeshLab file
|
||||
echo "$INSTALL_PATH folder now contains a DMG file"
|
||||
rm $RESOURCES_PATH/macos/meshlab_dmg_final.json
|
||||
@ -1,27 +1,15 @@
|
||||
#!/bin/bash
|
||||
# This is a script shell for compiling and deploying MeshLab in a MacOS environment.
|
||||
#
|
||||
# Requires a Qt environment which is set-up properly, and an accessible
|
||||
# cmake binary.
|
||||
#
|
||||
# Without given arguments, MeshLab will be built in the meshlab/build,
|
||||
# the folder meshlab/install will contain meshlab.app and
|
||||
# the DMG will be placed in the meshlab directory.
|
||||
#
|
||||
# You can give as argument the build path, the install path (that will contain
|
||||
# the portable version of MeshLab), and the number of cores to use to build MeshLab
|
||||
# (default: 4).
|
||||
# The DMG will be placed in the parent directory of the install path.
|
||||
#
|
||||
# Example of call:
|
||||
# bash make_it.sh --build_path=path/to/build --install_path=path/to/install -j8
|
||||
|
||||
SCRIPTS_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../../src
|
||||
BUILD_PATH=$SOURCE_PATH/../build
|
||||
INSTALL_PATH=$SOURCE_PATH/../install
|
||||
CORES="-j4"
|
||||
SOURCE_PATH=$SCRIPTS_PATH/../..
|
||||
BUILD_PATH=$SOURCE_PATH/build
|
||||
INSTALL_PATH=$SOURCE_PATH/install
|
||||
PACKAGES_PATH=$SOURCE_PATH/packages
|
||||
|
||||
DOUBLE_PRECISION_OPTION=""
|
||||
NIGHTLY_OPTION=""
|
||||
QT_DIR_OPTION=""
|
||||
CCACHE_OPTION=""
|
||||
|
||||
#check parameters
|
||||
for i in "$@"
|
||||
@ -35,20 +23,32 @@ case $i in
|
||||
INSTALL_PATH="${i#*=}"/usr/
|
||||
shift # past argument=value
|
||||
;;
|
||||
-j*)
|
||||
CORES=$i
|
||||
-p=*|--packages_path=*)
|
||||
PACKAGES_PATH="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
--double_precision)
|
||||
DOUBLE_PRECISION_OPTION="--double_precision"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-n|--nightly)
|
||||
NIGHTLY_OPTION="--nightly"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-qt=*|--qt_dir=*)
|
||||
QT_DIR_OPTION=-qt=${i#*=}
|
||||
shift # past argument=value
|
||||
;;
|
||||
--ccache)
|
||||
CCACHE_OPTION="--ccache"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
sh $SCRIPTS_PATH/1_build.sh -b=$BUILD_PATH -i=$INSTALL_PATH $DOUBLE_PRECISION_OPTION $CORES
|
||||
sh $SCRIPTS_PATH/2_deploy.sh -i=$INSTALL_PATH
|
||||
sh $SCRIPTS_PATH/3_dmg.sh -i=$INSTALL_PATH $DOUBLE_PRECISION_OPTION
|
||||
bash $SCRIPTS_PATH/1_build.sh -b=$BUILD_PATH -i=$INSTALL_PATH $NIGHTLY_OPTION $DOUBLE_PRECISION_OPTION $QT_DIR_OPTION $CCACHE_OPTION
|
||||
bash $SCRIPTS_PATH/2_deploy.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH $QT_DIR_OPTION
|
||||
|
||||
|
||||
@ -2,20 +2,6 @@
|
||||
# Copyright 2019, 2021, Visual Computing Lab, ISTI - Italian National Research Council
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(MeshLab)
|
||||
|
||||
### Build options
|
||||
option(BUILD_MESHLAB_MINI "Build only common and meshlab - other plugin targets must be set manually" OFF)
|
||||
option(BUILD_STRICT "Strictly enforce resolution of all symbols" ON)
|
||||
option(BUILD_WITH_DOUBLE_SCALAR "Use double type instead of float type for scalars" OFF)
|
||||
option(ENABLE_MESHLAB_DEBUG_LOG_FILE "If enabled, all the logs of MeshLab will be also saved into a log file" OFF)
|
||||
|
||||
option(BUILD_ONLY_MESHLAB_LIBRARIES "Build only meshlab-common and plugins" OFF)
|
||||
option(USE_DEFAULT_BUILD_AND_INSTALL_DIRS "If set to OFF, it expects that you set manually the binary and install directories" ON)
|
||||
|
||||
option(MESHLAB_IS_NIGHTLY_VERSION "Nightly version of meshlab will be used instead of ML_VERSION" OFF)
|
||||
|
||||
### Dependencies
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/meshlab_global_settings.cmake" NO_POLICY_SCOPE)
|
||||
@ -41,7 +27,7 @@ find_package(Eigen3)
|
||||
set(MESHLAB_RESOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../resources)
|
||||
|
||||
### Build directories
|
||||
if (USE_DEFAULT_BUILD_AND_INSTALL_DIRS) # otherwise, we assume that all these dirs are defined in parent dir
|
||||
if (MESHLAB_USE_DEFAULT_BUILD_AND_INSTALL_DIRS) # otherwise, we assume that all these dirs are defined in parent dir
|
||||
set(MESHLAB_BUILD_DISTRIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/distrib)
|
||||
set(MESHLAB_LIB_OUTPUT_DIR ${MESHLAB_BUILD_DISTRIB_DIR})
|
||||
set(MESHLAB_PLUGIN_OUTPUT_DIR ${MESHLAB_BUILD_DISTRIB_DIR}/plugins)
|
||||
@ -57,8 +43,8 @@ if (USE_DEFAULT_BUILD_AND_INSTALL_DIRS) # otherwise, we assume that all these di
|
||||
include(GNUInstallDirs)
|
||||
if(INSTALL_TO_UNIX_LAYOUT)
|
||||
set(MESHLAB_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
|
||||
set(MESHLAB_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(MESHLAB_PLUGIN_INSTALL_DIR ${MESHLAB_LIB_INSTALL_DIR}/meshlab/plugins)
|
||||
set(MESHLAB_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/meshlab)
|
||||
set(MESHLAB_PLUGIN_INSTALL_DIR ${MESHLAB_LIB_INSTALL_DIR}/plugins)
|
||||
set(MESHLAB_SHADER_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/meshlab/shaders)
|
||||
elseif(APPLE)
|
||||
set(MESHLAB_BIN_INSTALL_DIR .)
|
||||
@ -74,7 +60,7 @@ if (USE_DEFAULT_BUILD_AND_INSTALL_DIRS) # otherwise, we assume that all these di
|
||||
|
||||
### Install Settings
|
||||
if (NOT APPLE)
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN/../${MESHLAB_LIB_INSTALL_DIR};$ORIGIN/../${CMAKE_INSTALL_LIBDIR})
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN/../lib/meshlab)
|
||||
else()
|
||||
SET(CMAKE_INSTALL_RPATH @executable_path/../Frameworks)
|
||||
endif()
|
||||
@ -120,7 +106,7 @@ add_subdirectory(${EXTERNAL_DIR})
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(common_gui)
|
||||
|
||||
if (NOT BUILD_ONLY_MESHLAB_LIBRARIES)
|
||||
if (NOT MESHLAB_BUILD_ONLY_LIBRARIES)
|
||||
add_subdirectory(meshlab)
|
||||
if(WIN32 AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/use_cpu_opengl")
|
||||
add_subdirectory(use_cpu_opengl)
|
||||
@ -235,7 +221,7 @@ endforeach()
|
||||
# This variable keeps track of the output filenames that need to be copied at build time
|
||||
set(COPIED_FILES)
|
||||
|
||||
if (NOT BUILD_ONLY_MESHLAB_LIBRARIES)
|
||||
if (NOT MESHLAB_BUILD_ONLY_LIBRARIES)
|
||||
# shaders
|
||||
set(SHADER_BASE_DIR "${MESHLAB_RESOURCES_DIR}/shaders")
|
||||
file(
|
||||
|
||||
@ -5,42 +5,52 @@ In the `src` directory there are several folders containing all the source code
|
||||
The source code of MeshLab is structured in the following directories:
|
||||
|
||||
* cmake: it contains a series of cmake scripts used to find external libraries;
|
||||
* [external](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/external): it contains a series of external libraries needed by several plugins. Some of these libraries are compiled before the compilation of meshlab, if a corresponding system library is not found and then linked; other are header-only libraries that are just included;
|
||||
* [external](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/external): it contains a series of cmake configuration files that will download external libraries needed by MeshLab and several plugins;
|
||||
* [common](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/common): a series of utility classes and functions used by MeshLab and its plugins;
|
||||
* [meshlab](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/meshlab): GUI and core of MeshLab;
|
||||
* [meshlabplugins](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/meshlabplugins): all the plugins that can be added to MeshLab;
|
||||
* [use_cpu_opengl](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/use_cpu_opengl): a tool compiled only under windows that allows to use non-GPU accelerated OpenGL calls;
|
||||
* [use_cpu_opengl](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/use_cpu_opengl): a tool compiled only under windows that allows to use non-GPU accelerated OpenGL functions;
|
||||
* [vcglib](https://github.com/cnr-isti-vclab/meshlab/tree/master/src/vcglib): submodule containing the vcglib.
|
||||
|
||||
## Build MeshLab
|
||||
|
||||
MeshLab builds with the three major compilers: `gcc`, `clang`, and `msvc`. It requires [Qt](https://www.qt.io/) 5.15.
|
||||
MeshLab builds with the three major compilers: `gcc`, `clang`, and `msvc`. It requires [Qt](https://www.qt.io/) 5.15, cmake and optionally ninja (required on windows). Only 64 bit is supported.
|
||||
|
||||
After setting up the Qt environment:
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/cnr-isti-vclab/meshlab
|
||||
mkdir meshlab/src/build
|
||||
cd meshlab/src/build
|
||||
mkdir meshlab/build
|
||||
cd meshlab/build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
You can also use [QtCreator](https://www.qt.io/product) to build meshlab:
|
||||
or, using ninja (supported also on Windows):
|
||||
|
||||
```
|
||||
cmake -GNinja ..
|
||||
ninja
|
||||
```
|
||||
|
||||
You can also use [QtCreator](https://www.qt.io/product) to build MeshLab:
|
||||
|
||||
1. Install QtCreator and Qt 5.15;
|
||||
2. Open `CMakeLists.txt` inside `src`;
|
||||
3. Select your favourite shadow build directory;
|
||||
4. Build meshlab.
|
||||
2. Open `CMakeLists.txt`;
|
||||
4. Configure and build MeshLab.
|
||||
|
||||
### External libraries
|
||||
|
||||
External libraries required by plugins, if not found, are automatically downloaded by `cmake` during the configuration, and placed into `src/external/downloads`.
|
||||
|
||||
### Platform specific notes
|
||||
On __osx__ some plugins exploit openmp parallelism (screened poisson, isoparametrization) so you need a compiler supporting it and the clang provided by xcode does not support openmp. You can install all the required libraries by running the following command in a terminal:
|
||||
|
||||
```
|
||||
brew install llvm libomp
|
||||
brew install libomp
|
||||
```
|
||||
|
||||
On __Windows__, we suggest to build meshlab using QtCreator. Before trying to build, you should:
|
||||
On __Windows__, we suggest to build MeshLab using QtCreator. Before trying to build, you should:
|
||||
|
||||
* install VisualStudio >= 2017 with the C++ development package;
|
||||
* install Qt 5.15 and QtCreator.
|
||||
|
||||
@ -38,7 +38,7 @@ if(APPLE)
|
||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||
endif()
|
||||
|
||||
if(BUILD_STRICT AND NOT MSVC AND NOT APPLE)
|
||||
if(MESHLAB_BUILD_STRICT AND NOT MSVC AND NOT APPLE)
|
||||
# Make sure that our shared libraries were appropriately linked
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#function used to add plugins
|
||||
function(add_meshlab_plugin target_name)
|
||||
set(EXCLUDE_ALL_ARG "")
|
||||
if (BUILD_MESHLAB_MINI)
|
||||
if (MESHLAB_BUILD_MINI)
|
||||
set(EXCLUDE_ALL_ARG "EXCLUDE_FROM_ALL")
|
||||
endif()
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_DOUBLE_SCALAR)
|
||||
if (MESHLAB_BUILD_WITH_DOUBLE_SCALAR)
|
||||
set(MESHLAB_VERSION "${MESHLAB_VERSION}d")
|
||||
endif()
|
||||
|
||||
@ -32,7 +32,7 @@ else()
|
||||
message(STATUS "MeshLab version: ${MESHLAB_VERSION}")
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_DOUBLE_SCALAR)
|
||||
if (MESHLAB_BUILD_WITH_DOUBLE_SCALAR)
|
||||
message(STATUS "Building with double precision")
|
||||
set(MESHLAB_SCALAR "double")
|
||||
else()
|
||||
@ -227,11 +227,11 @@ if (WIN32)
|
||||
PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${MESHLAB_LIB_OUTPUT_DIR})
|
||||
endif()
|
||||
|
||||
if(ENABLE_MESHLAB_DEBUG_LOG_FILE)
|
||||
if(MESHLAB_ENABLE_DEBUG_LOG_FILE)
|
||||
target_compile_definitions(meshlab-common PUBLIC MESHLAB_LOG_FILE_ENABLED)
|
||||
endif()
|
||||
|
||||
set_target_properties(meshlab-common PROPERTIES
|
||||
INSTALL_RPATH "${MESHLAB_LIB_INSTALL_DIR}:${INSTALL_RPATH}")
|
||||
INSTALL_RPATH "$ORIGIN")
|
||||
|
||||
install(TARGETS meshlab-common DESTINATION ${MESHLAB_LIB_INSTALL_DIR})
|
||||
|
||||
@ -79,4 +79,7 @@ set_property(TARGET meshlab-common-gui
|
||||
set_target_properties(meshlab-common-gui PROPERTIES
|
||||
INSTALL_RPATH "${MESHLAB_LIB_INSTALL_DIR}:${INSTALL_RPATH}")
|
||||
|
||||
set_target_properties(meshlab-common-gui PROPERTIES
|
||||
INSTALL_RPATH "$ORIGIN")
|
||||
|
||||
install(TARGETS meshlab-common-gui DESTINATION ${MESHLAB_LIB_INSTALL_DIR})
|
||||
|
||||
13
src/external/CMakeLists.txt
vendored
13
src/external/CMakeLists.txt
vendored
@ -3,20 +3,21 @@
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
option(
|
||||
ALLOW_OPTIONAL_EXTERNAL_MESHLAB_LIBRARIES
|
||||
MESHLAB_ALLOW_OPTIONAL_EXTERNAL_LIBRARIES
|
||||
"Allow to use/build optional external libraries"
|
||||
ON)
|
||||
|
||||
option(
|
||||
BUILD_BUNDLED_SOURCES_WITHOUT_WARNINGS
|
||||
"Should warnings be disabled on bundled source code?"
|
||||
MESHLAB_BUILD_EXTERNAL_SOURCES_WITHOUT_WARNINGS
|
||||
"Should warnings be disabled on external libraries code?"
|
||||
ON)
|
||||
|
||||
set(MESHLAB_EXTERNAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/downloads")
|
||||
set(MESHLAB_EXTERNAL_DOWNLOAD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/downloads")
|
||||
set(MESHLAB_EXTERNAL_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(MESHLAB_EXTERNAL_DOWNLOAD_DIR "${MESHLAB_EXTERNAL_DIR}/downloads")
|
||||
|
||||
add_library(external-disable-warnings INTERFACE)
|
||||
if(BUILD_BUNDLED_SOURCES_WITHOUT_WARNINGS)
|
||||
if(MESHLAB_BUILD_EXTERNAL_SOURCES_WITHOUT_WARNINGS)
|
||||
if(MSVC)
|
||||
# TODO
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
@ -35,7 +36,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/easyexif.cmake)
|
||||
|
||||
## OPTIONAL EXTERNAL LIBS ##
|
||||
|
||||
if ((NOT BUILD_MESHLAB_MINI) AND ALLOW_OPTIONAL_EXTERNAL_MESHLAB_LIBRARIES)
|
||||
if ((NOT MESHLAB_BUILD_MINI) AND MESHLAB_ALLOW_OPTIONAL_EXTERNAL_LIBRARIES)
|
||||
|
||||
message(STATUS "Searching for optional components")
|
||||
|
||||
|
||||
18
src/external/README.md
vendored
18
src/external/README.md
vendored
@ -1,14 +1,26 @@
|
||||
# External libraries for MeshLab
|
||||
|
||||
Notes about external libraries:
|
||||
This folder contains a set of `cmake` configuration files to download and build external libraries required by MeshLab and its plugins.
|
||||
|
||||
Most of the times, `cmake` will first try to find the external libraries installed in the system, and only if they are not found, it will download them.
|
||||
|
||||
## Required libraries
|
||||
|
||||
The libraries that are required to build MeshLab are:
|
||||
|
||||
- Eigen
|
||||
- GLEW
|
||||
- easyexif
|
||||
|
||||
Without these two libraries (or their relative system provided libraries), MeshLab cannot be compiled.
|
||||
Since these libraries are required, they are bundled into the `external` directory (with the exception of eigen, which is bundled in the VCGLib subrepo).
|
||||
Without these two libraries (or their relative system provided libraries), MeshLab cannot be built.
|
||||
|
||||
All the other libraries are optional, and they will be downloaded automatically by cmake during configuration in the `external/downloads`.
|
||||
|
||||
## Optional libraries
|
||||
|
||||
Boost and CGAL directories contain only a portion of the libraries, that is the code necessary to build the `mesh_booleans` plugin.
|
||||
All the other libraries are optional. Cmake adopts the following strategy:
|
||||
|
||||
- Try to find the library in the system (if a package of the library exists). If it is found, nothing else need to be done;
|
||||
- If the library is not found, try to download the source code of the library and place it into the `downloads` folder. If the download succeeds, the library is built along with MeshLab;
|
||||
- If the download does not succeed, all the plugins that require that library are ignored and won't be built.
|
||||
|
||||
29
src/external/easyexif-1.0/.gitignore
vendored
Normal file
29
src/external/easyexif-1.0/.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
demo
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
10
src/external/easyexif-1.0/CONTRIBUTORS
vendored
Normal file
10
src/external/easyexif-1.0/CONTRIBUTORS
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
The following people have contributed patches or issues to EasyEXIF:
|
||||
|
||||
Seth Fowler
|
||||
Val Malykh
|
||||
Carlos Apablaza Brito
|
||||
Simon Fuhrmann
|
||||
Toshiaki Ohkuma
|
||||
pet.b.hunt
|
||||
Jason Moey
|
||||
Tomas Volf
|
||||
24
src/external/easyexif-1.0/LICENSE
vendored
Normal file
24
src/external/easyexif-1.0/LICENSE
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
Copyright (c) 2010-2015 Mayank Lahiri
|
||||
mlahiri@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
-- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
-- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
75
src/external/easyexif-1.0/README.md
vendored
Normal file
75
src/external/easyexif-1.0/README.md
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
easyexif
|
||||
========
|
||||
|
||||
A tiny ISO-compliant C++ EXIF parsing library.
|
||||
|
||||
EasyEXIF is a tiny, lightweight C++ library that parses basic information out of EXIF files. It uses only the std::string library and is otherwise pure C++. You pass it the the binary contents of an entire JPEG file, and it parses out a few of the most important EXIF fields for you.
|
||||
|
||||
Why use this library? __Include one .h file, compile one .cc file, and that's it.__
|
||||
|
||||
Sometimes you just need to quickly extract basic information from a JPEG file's EXIF headers: the time the image was taken (not the file timestamp, the camera's internal time), the F-stop or exposure time, GPS information embedded in the EXIF file, what the camera make and model was, etc. Unfortunately, all the EXIF libraries out there are not very lightweight or easy to integrate into larger programs. EasyEXIF aims to solve that problem, and is released under a very liberal BSD License for use practically anywhere.
|
||||
|
||||
### Features:
|
||||
|
||||
1. Supports common Exif fields including GPS, ISO speed, etc.
|
||||
2. Extensively documented in the source.
|
||||
3. Valgrind tested for memory leaks.
|
||||
4. Handles corrupt JPEGs.
|
||||
5. Compiles without complaints using `-Wall -Wextra -Werror -pedantic -ansi` on gcc v4.8.2
|
||||
6. No uses of new/malloc.
|
||||
|
||||
### License
|
||||
|
||||
BSD.
|
||||
|
||||
### Contributions
|
||||
|
||||
Reasonable pull requests are gladly accepted.
|
||||
|
||||
The following people have committed patches to EasyExif.
|
||||
|
||||
* Tomas Volf
|
||||
* Seth Fowler
|
||||
* Val Malykh
|
||||
* Carlos Apablaza Brito
|
||||
* Simon Fuhrmann
|
||||
* Toshiaki Ohkuma
|
||||
* pet.b.hunt
|
||||
* Jason Moey
|
||||
|
||||
|
||||
### Example:
|
||||
|
||||
|
||||
```C++
|
||||
#include "exif.h"
|
||||
|
||||
EXIFInfo result;
|
||||
result.parseFrom(JPEGFileBuffer, BufferSize);
|
||||
|
||||
printf("Camera make : %s\n", result.Make.c_str());
|
||||
printf("Camera model : %s\n", result.Model.c_str());
|
||||
printf("Software : %s\n", result.Software.c_str());
|
||||
printf("Bits per sample : %d\n", result.BitsPerSample);
|
||||
printf("Image width : %d\n", result.ImageWidth);
|
||||
printf("Image height : %d\n", result.ImageHeight);
|
||||
printf("Image description : %s\n", result.ImageDescription.c_str());
|
||||
printf("Image orientation : %d\n", result.Orientation);
|
||||
printf("Image copyright : %s\n", result.Copyright.c_str());
|
||||
printf("Image date/time : %s\n", result.DateTime.c_str());
|
||||
printf("Original date/time: %s\n", result.DateTimeOriginal.c_str());
|
||||
printf("Digitize date/time: %s\n", result.DateTimeDigitized.c_str());
|
||||
printf("Subsecond time : %s\n", result.SubSecTimeOriginal.c_str());
|
||||
printf("Exposure time : 1/%d s\n", (unsigned) (1.0/result.ExposureTime));
|
||||
printf("F-stop : f/%.1f\n", result.FNumber);
|
||||
printf("ISO speed : %d\n", result.ISOSpeedRatings);
|
||||
printf("Subject distance : %f m\n", result.SubjectDistance);
|
||||
printf("Exposure bias : %f EV\n", result.ExposureBiasValue);
|
||||
printf("Flash used? : %d\n", result.Flash);
|
||||
printf("Metering mode : %d\n", result.MeteringMode);
|
||||
printf("Lens focal length : %f mm\n", result.FocalLength);
|
||||
printf("35mm focal length : %u mm\n", result.FocalLengthIn35mm);
|
||||
printf("GPS Latitude : %f deg\n", result.GeoLocation.Latitude);
|
||||
printf("GPS Longitude : %f deg\n", result.GeoLocation.Longitude);
|
||||
printf("GPS Altitude : %f m\n", result.GeoLocation.Altitude);
|
||||
```
|
||||
82
src/external/easyexif-1.0/demo.cpp
vendored
Normal file
82
src/external/easyexif-1.0/demo.cpp
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
#include <stdio.h>
|
||||
#include "exif.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
printf("Usage: demo <JPEG file>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Read the JPEG file into a buffer
|
||||
FILE *fp = fopen(argv[1], "rb");
|
||||
if (!fp) {
|
||||
printf("Can't open file.\n");
|
||||
return -1;
|
||||
}
|
||||
fseek(fp, 0, SEEK_END);
|
||||
unsigned long fsize = ftell(fp);
|
||||
rewind(fp);
|
||||
unsigned char *buf = new unsigned char[fsize];
|
||||
if (fread(buf, 1, fsize, fp) != fsize) {
|
||||
printf("Can't read file.\n");
|
||||
delete[] buf;
|
||||
return -2;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
// Parse EXIF
|
||||
easyexif::EXIFInfo result;
|
||||
int code = result.parseFrom(buf, fsize);
|
||||
delete[] buf;
|
||||
if (code) {
|
||||
printf("Error parsing EXIF: code %d\n", code);
|
||||
return -3;
|
||||
}
|
||||
|
||||
// Dump EXIF information
|
||||
printf("Camera make : %s\n", result.Make.c_str());
|
||||
printf("Camera model : %s\n", result.Model.c_str());
|
||||
printf("Software : %s\n", result.Software.c_str());
|
||||
printf("Bits per sample : %d\n", result.BitsPerSample);
|
||||
printf("Image width : %d\n", result.ImageWidth);
|
||||
printf("Image height : %d\n", result.ImageHeight);
|
||||
printf("Image description : %s\n", result.ImageDescription.c_str());
|
||||
printf("Image orientation : %d\n", result.Orientation);
|
||||
printf("Image copyright : %s\n", result.Copyright.c_str());
|
||||
printf("Image date/time : %s\n", result.DateTime.c_str());
|
||||
printf("Original date/time : %s\n", result.DateTimeOriginal.c_str());
|
||||
printf("Digitize date/time : %s\n", result.DateTimeDigitized.c_str());
|
||||
printf("Subsecond time : %s\n", result.SubSecTimeOriginal.c_str());
|
||||
printf("Exposure time : 1/%d s\n",
|
||||
(unsigned)(1.0 / result.ExposureTime));
|
||||
printf("F-stop : f/%.1f\n", result.FNumber);
|
||||
printf("ISO speed : %d\n", result.ISOSpeedRatings);
|
||||
printf("Subject distance : %f m\n", result.SubjectDistance);
|
||||
printf("Exposure bias : %f EV\n", result.ExposureBiasValue);
|
||||
printf("Flash used? : %d\n", result.Flash);
|
||||
printf("Metering mode : %d\n", result.MeteringMode);
|
||||
printf("Lens focal length : %f mm\n", result.FocalLength);
|
||||
printf("35mm focal length : %u mm\n", result.FocalLengthIn35mm);
|
||||
printf("GPS Latitude : %f deg (%f deg, %f min, %f sec %c)\n",
|
||||
result.GeoLocation.Latitude, result.GeoLocation.LatComponents.degrees,
|
||||
result.GeoLocation.LatComponents.minutes,
|
||||
result.GeoLocation.LatComponents.seconds,
|
||||
result.GeoLocation.LatComponents.direction);
|
||||
printf("GPS Longitude : %f deg (%f deg, %f min, %f sec %c)\n",
|
||||
result.GeoLocation.Longitude, result.GeoLocation.LonComponents.degrees,
|
||||
result.GeoLocation.LonComponents.minutes,
|
||||
result.GeoLocation.LonComponents.seconds,
|
||||
result.GeoLocation.LonComponents.direction);
|
||||
printf("GPS Altitude : %f m\n", result.GeoLocation.Altitude);
|
||||
printf("GPS Precision (DOP) : %f\n", result.GeoLocation.DOP);
|
||||
printf("Lens min focal length: %f mm\n", result.LensInfo.FocalLengthMin);
|
||||
printf("Lens max focal length: %f mm\n", result.LensInfo.FocalLengthMax);
|
||||
printf("Lens f-stop min : f/%.1f\n", result.LensInfo.FStopMin);
|
||||
printf("Lens f-stop max : f/%.1f\n", result.LensInfo.FStopMax);
|
||||
printf("Lens make : %s\n", result.LensInfo.Make.c_str());
|
||||
printf("Lens model : %s\n", result.LensInfo.Model.c_str());
|
||||
printf("Focal plane XRes : %f\n", result.LensInfo.FocalPlaneXResolution);
|
||||
printf("Focal plane YRes : %f\n", result.LensInfo.FocalPlaneYResolution);
|
||||
|
||||
return 0;
|
||||
}
|
||||
892
src/external/easyexif-1.0/exif.cpp
vendored
Normal file
892
src/external/easyexif-1.0/exif.cpp
vendored
Normal file
@ -0,0 +1,892 @@
|
||||
/**************************************************************************
|
||||
exif.cpp -- A simple ISO C++ library to parse basic EXIF
|
||||
information from a JPEG file.
|
||||
|
||||
Copyright (c) 2010-2015 Mayank Lahiri
|
||||
mlahiri@gmail.com
|
||||
All rights reserved (BSD License).
|
||||
|
||||
See exif.h for version history.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
-- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
-- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "exif.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace {
|
||||
|
||||
struct Rational {
|
||||
uint32_t numerator, denominator;
|
||||
operator double() const {
|
||||
if (denominator < 1e-20) {
|
||||
return 0;
|
||||
}
|
||||
return static_cast<double>(numerator) / static_cast<double>(denominator);
|
||||
}
|
||||
};
|
||||
|
||||
// IF Entry
|
||||
class IFEntry {
|
||||
public:
|
||||
using byte_vector = std::vector<uint8_t>;
|
||||
using ascii_vector = std::string;
|
||||
using short_vector = std::vector<uint16_t>;
|
||||
using long_vector = std::vector<uint32_t>;
|
||||
using rational_vector = std::vector<Rational>;
|
||||
|
||||
IFEntry()
|
||||
: tag_(0xFF), format_(0xFF), data_(0), length_(0), val_byte_(nullptr) {}
|
||||
IFEntry(const IFEntry &) = delete;
|
||||
IFEntry &operator=(const IFEntry &) = delete;
|
||||
IFEntry(IFEntry &&other)
|
||||
: tag_(other.tag_),
|
||||
format_(other.format_),
|
||||
data_(other.data_),
|
||||
length_(other.length_),
|
||||
val_byte_(other.val_byte_) {
|
||||
other.tag_ = 0xFF;
|
||||
other.format_ = 0xFF;
|
||||
other.data_ = 0;
|
||||
other.length_ = 0;
|
||||
other.val_byte_ = nullptr;
|
||||
}
|
||||
~IFEntry() { delete_union(); }
|
||||
unsigned short tag() const { return tag_; }
|
||||
void tag(unsigned short tag) { tag_ = tag; }
|
||||
unsigned short format() const { return format_; }
|
||||
bool format(unsigned short format) {
|
||||
switch (format) {
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
case 0x04:
|
||||
case 0x05:
|
||||
case 0x07:
|
||||
case 0x09:
|
||||
case 0x0a:
|
||||
case 0xff:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
delete_union();
|
||||
format_ = format;
|
||||
new_union();
|
||||
return true;
|
||||
}
|
||||
unsigned data() const { return data_; }
|
||||
void data(unsigned data) { data_ = data; }
|
||||
unsigned length() const { return length_; }
|
||||
void length(unsigned length) { length_ = length; }
|
||||
|
||||
// functions to access the data
|
||||
//
|
||||
// !! it's CALLER responsibility to check that format !!
|
||||
// !! is correct before accessing it's field !!
|
||||
//
|
||||
// - getters are use here to allow future addition
|
||||
// of checks if format is correct
|
||||
byte_vector &val_byte() { return *val_byte_; }
|
||||
ascii_vector &val_string() { return *val_string_; }
|
||||
short_vector &val_short() { return *val_short_; }
|
||||
long_vector &val_long() { return *val_long_; }
|
||||
rational_vector &val_rational() { return *val_rational_; }
|
||||
|
||||
private:
|
||||
// Raw fields
|
||||
unsigned short tag_;
|
||||
unsigned short format_;
|
||||
unsigned data_;
|
||||
unsigned length_;
|
||||
|
||||
// Parsed fields
|
||||
union {
|
||||
byte_vector *val_byte_;
|
||||
ascii_vector *val_string_;
|
||||
short_vector *val_short_;
|
||||
long_vector *val_long_;
|
||||
rational_vector *val_rational_;
|
||||
};
|
||||
|
||||
void delete_union() {
|
||||
switch (format_) {
|
||||
case 0x1:
|
||||
delete val_byte_;
|
||||
val_byte_ = nullptr;
|
||||
break;
|
||||
case 0x2:
|
||||
delete val_string_;
|
||||
val_string_ = nullptr;
|
||||
break;
|
||||
case 0x3:
|
||||
delete val_short_;
|
||||
val_short_ = nullptr;
|
||||
break;
|
||||
case 0x4:
|
||||
delete val_long_;
|
||||
val_long_ = nullptr;
|
||||
break;
|
||||
case 0x5:
|
||||
delete val_rational_;
|
||||
val_rational_ = nullptr;
|
||||
break;
|
||||
case 0xff:
|
||||
break;
|
||||
default:
|
||||
// should not get here
|
||||
// should I throw an exception or ...?
|
||||
break;
|
||||
}
|
||||
}
|
||||
void new_union() {
|
||||
switch (format_) {
|
||||
case 0x1:
|
||||
val_byte_ = new byte_vector();
|
||||
break;
|
||||
case 0x2:
|
||||
val_string_ = new ascii_vector();
|
||||
break;
|
||||
case 0x3:
|
||||
val_short_ = new short_vector();
|
||||
break;
|
||||
case 0x4:
|
||||
val_long_ = new long_vector();
|
||||
break;
|
||||
case 0x5:
|
||||
val_rational_ = new rational_vector();
|
||||
break;
|
||||
case 0xff:
|
||||
break;
|
||||
default:
|
||||
// should not get here
|
||||
// should I throw an exception or ...?
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Helper functions
|
||||
template <typename T, bool alignIntel>
|
||||
T parse(const unsigned char *buf);
|
||||
|
||||
template <>
|
||||
uint8_t parse<uint8_t, false>(const unsigned char *buf) {
|
||||
return *buf;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint8_t parse<uint8_t, true>(const unsigned char *buf) {
|
||||
return *buf;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint16_t parse<uint16_t, false>(const unsigned char *buf) {
|
||||
return (static_cast<uint16_t>(buf[0]) << 8) | buf[1];
|
||||
}
|
||||
|
||||
template <>
|
||||
uint16_t parse<uint16_t, true>(const unsigned char *buf) {
|
||||
return (static_cast<uint16_t>(buf[1]) << 8) | buf[0];
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t parse<uint32_t, false>(const unsigned char *buf) {
|
||||
return (static_cast<uint32_t>(buf[0]) << 24) |
|
||||
(static_cast<uint32_t>(buf[1]) << 16) |
|
||||
(static_cast<uint32_t>(buf[2]) << 8) | buf[3];
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t parse<uint32_t, true>(const unsigned char *buf) {
|
||||
return (static_cast<uint32_t>(buf[3]) << 24) |
|
||||
(static_cast<uint32_t>(buf[2]) << 16) |
|
||||
(static_cast<uint32_t>(buf[1]) << 8) | buf[0];
|
||||
}
|
||||
|
||||
template <>
|
||||
Rational parse<Rational, true>(const unsigned char *buf) {
|
||||
Rational r;
|
||||
r.numerator = parse<uint32_t, true>(buf);
|
||||
r.denominator = parse<uint32_t, true>(buf + 4);
|
||||
return r;
|
||||
}
|
||||
|
||||
template <>
|
||||
Rational parse<Rational, false>(const unsigned char *buf) {
|
||||
Rational r;
|
||||
r.numerator = parse<uint32_t, false>(buf);
|
||||
r.denominator = parse<uint32_t, false>(buf + 4);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to read entry.length() values for this entry.
|
||||
*
|
||||
* Returns:
|
||||
* true - entry.length() values were read
|
||||
* false - something went wrong, vec's content was not touched
|
||||
*/
|
||||
template <typename T, bool alignIntel, typename C>
|
||||
bool extract_values(C &container, const unsigned char *buf, const unsigned base,
|
||||
const unsigned len, const IFEntry &entry) {
|
||||
const unsigned char *data;
|
||||
uint32_t reversed_data;
|
||||
// if data fits into 4 bytes, they are stored directly in
|
||||
// the data field in IFEntry
|
||||
if (sizeof(T) * entry.length() <= 4) {
|
||||
if (alignIntel) {
|
||||
reversed_data = entry.data();
|
||||
} else {
|
||||
reversed_data = entry.data();
|
||||
// this reversing works, but is ugly
|
||||
unsigned char *data = reinterpret_cast<unsigned char *>(&reversed_data);
|
||||
unsigned char tmp;
|
||||
tmp = data[0];
|
||||
data[0] = data[3];
|
||||
data[3] = tmp;
|
||||
tmp = data[1];
|
||||
data[1] = data[2];
|
||||
data[2] = tmp;
|
||||
}
|
||||
data = reinterpret_cast<const unsigned char *>(&(reversed_data));
|
||||
} else {
|
||||
data = buf + base + entry.data();
|
||||
if (data + sizeof(T) * entry.length() > buf + len) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
container.resize(entry.length());
|
||||
for (size_t i = 0; i < entry.length(); ++i) {
|
||||
container[i] = parse<T, alignIntel>(data + sizeof(T) * i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <bool alignIntel>
|
||||
void parseIFEntryHeader(const unsigned char *buf, unsigned short &tag,
|
||||
unsigned short &format, unsigned &length,
|
||||
unsigned &data) {
|
||||
// Each directory entry is composed of:
|
||||
// 2 bytes: tag number (data field)
|
||||
// 2 bytes: data format
|
||||
// 4 bytes: number of components
|
||||
// 4 bytes: data value or offset to data value
|
||||
tag = parse<uint16_t, alignIntel>(buf);
|
||||
format = parse<uint16_t, alignIntel>(buf + 2);
|
||||
length = parse<uint32_t, alignIntel>(buf + 4);
|
||||
data = parse<uint32_t, alignIntel>(buf + 8);
|
||||
}
|
||||
|
||||
template <bool alignIntel>
|
||||
void parseIFEntryHeader(const unsigned char *buf, IFEntry &result) {
|
||||
unsigned short tag;
|
||||
unsigned short format;
|
||||
unsigned length;
|
||||
unsigned data;
|
||||
|
||||
parseIFEntryHeader<alignIntel>(buf, tag, format, length, data);
|
||||
|
||||
result.tag(tag);
|
||||
result.format(format);
|
||||
result.length(length);
|
||||
result.data(data);
|
||||
}
|
||||
|
||||
template <bool alignIntel>
|
||||
IFEntry parseIFEntry_temp(const unsigned char *buf, const unsigned offs,
|
||||
const unsigned base, const unsigned len) {
|
||||
IFEntry result;
|
||||
|
||||
// check if there even is enough data for IFEntry in the buffer
|
||||
if (buf + offs + 12 > buf + len) {
|
||||
result.tag(0xFF);
|
||||
return result;
|
||||
}
|
||||
|
||||
parseIFEntryHeader<alignIntel>(buf + offs, result);
|
||||
|
||||
// Parse value in specified format
|
||||
switch (result.format()) {
|
||||
case 1:
|
||||
if (!extract_values<uint8_t, alignIntel>(result.val_byte(), buf, base,
|
||||
len, result)) {
|
||||
result.tag(0xFF);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// string is basically sequence of uint8_t (well, according to EXIF even
|
||||
// uint7_t, but
|
||||
// we don't have that), so just read it as bytes
|
||||
if (!extract_values<uint8_t, alignIntel>(result.val_string(), buf, base,
|
||||
len, result)) {
|
||||
result.tag(0xFF);
|
||||
}
|
||||
// and cut zero byte at the end, since we don't want that in the
|
||||
// std::string
|
||||
if (result.val_string()[result.val_string().length() - 1] == '\0') {
|
||||
result.val_string().resize(result.val_string().length() - 1);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!extract_values<uint16_t, alignIntel>(result.val_short(), buf, base,
|
||||
len, result)) {
|
||||
result.tag(0xFF);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (!extract_values<uint32_t, alignIntel>(result.val_long(), buf, base,
|
||||
len, result)) {
|
||||
result.tag(0xFF);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (!extract_values<Rational, alignIntel>(result.val_rational(), buf,
|
||||
base, len, result)) {
|
||||
result.tag(0xFF);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 9:
|
||||
case 10:
|
||||
break;
|
||||
default:
|
||||
result.tag(0xFF);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// helper functions for convinience
|
||||
template <typename T>
|
||||
T parse_value(const unsigned char *buf, bool alignIntel) {
|
||||
if (alignIntel) {
|
||||
return parse<T, true>(buf);
|
||||
} else {
|
||||
return parse<T, false>(buf);
|
||||
}
|
||||
}
|
||||
|
||||
void parseIFEntryHeader(const unsigned char *buf, bool alignIntel,
|
||||
unsigned short &tag, unsigned short &format,
|
||||
unsigned &length, unsigned &data) {
|
||||
if (alignIntel) {
|
||||
parseIFEntryHeader<true>(buf, tag, format, length, data);
|
||||
} else {
|
||||
parseIFEntryHeader<false>(buf, tag, format, length, data);
|
||||
}
|
||||
}
|
||||
|
||||
IFEntry parseIFEntry(const unsigned char *buf, const unsigned offs,
|
||||
const bool alignIntel, const unsigned base,
|
||||
const unsigned len) {
|
||||
if (alignIntel) {
|
||||
return std::move(parseIFEntry_temp<true>(buf, offs, base, len));
|
||||
} else {
|
||||
return std::move(parseIFEntry_temp<false>(buf, offs, base, len));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Locates the EXIF segment and parses it using parseFromEXIFSegment
|
||||
//
|
||||
int easyexif::EXIFInfo::parseFrom(const unsigned char *buf, unsigned len) {
|
||||
// Sanity check: all JPEG files start with 0xFFD8.
|
||||
if (!buf || len < 4) return PARSE_EXIF_ERROR_NO_JPEG;
|
||||
if (buf[0] != 0xFF || buf[1] != 0xD8) return PARSE_EXIF_ERROR_NO_JPEG;
|
||||
|
||||
// Sanity check: some cameras pad the JPEG image with null bytes at the end.
|
||||
// Normally, we should able to find the JPEG end marker 0xFFD9 at the end
|
||||
// of the image, but not always. As long as there are null/0xFF bytes at the
|
||||
// end of the image buffer, keep decrementing len until an 0xFFD9 is found,
|
||||
// or some other bytes are. If the first non-zero/0xFF bytes from the end are
|
||||
// not 0xFFD9, then we can be reasonably sure that the buffer is not a JPEG.
|
||||
while (len > 2) {
|
||||
if (buf[len - 1] == 0 || buf[len - 1] == 0xFF) {
|
||||
len--;
|
||||
} else {
|
||||
if (buf[len - 1] != 0xD9 || buf[len - 2] != 0xFF) {
|
||||
return PARSE_EXIF_ERROR_NO_JPEG;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
clear();
|
||||
|
||||
// Scan for EXIF header (bytes 0xFF 0xE1) and do a sanity check by
|
||||
// looking for bytes "Exif\0\0". The marker length data is in Motorola
|
||||
// byte order, which results in the 'false' parameter to parse16().
|
||||
// The marker has to contain at least the TIFF header, otherwise the
|
||||
// EXIF data is corrupt. So the minimum length specified here has to be:
|
||||
// 2 bytes: section size
|
||||
// 6 bytes: "Exif\0\0" string
|
||||
// 2 bytes: TIFF header (either "II" or "MM" string)
|
||||
// 2 bytes: TIFF magic (short 0x2a00 in Motorola byte order)
|
||||
// 4 bytes: Offset to first IFD
|
||||
// =========
|
||||
// 16 bytes
|
||||
unsigned offs = 0; // current offset into buffer
|
||||
for (offs = 0; offs < len - 1; offs++)
|
||||
if (buf[offs] == 0xFF && buf[offs + 1] == 0xE1) break;
|
||||
if (offs + 4 > len) return PARSE_EXIF_ERROR_NO_EXIF;
|
||||
offs += 2;
|
||||
unsigned short section_length = parse_value<uint16_t>(buf + offs, false);
|
||||
if (offs + section_length > len || section_length < 16)
|
||||
return PARSE_EXIF_ERROR_CORRUPT;
|
||||
offs += 2;
|
||||
|
||||
return parseFromEXIFSegment(buf + offs, len - offs);
|
||||
}
|
||||
|
||||
int easyexif::EXIFInfo::parseFrom(const string &data) {
|
||||
return parseFrom((const unsigned char *)data.data(), data.length());
|
||||
}
|
||||
|
||||
//
|
||||
// Main parsing function for an EXIF segment.
|
||||
//
|
||||
// PARAM: 'buf' start of the EXIF TIFF, which must be the bytes "Exif\0\0".
|
||||
// PARAM: 'len' length of buffer
|
||||
//
|
||||
int easyexif::EXIFInfo::parseFromEXIFSegment(const unsigned char *buf,
|
||||
unsigned len) {
|
||||
bool alignIntel = true; // byte alignment (defined in EXIF header)
|
||||
unsigned offs = 0; // current offset into buffer
|
||||
if (!buf || len < 6) return PARSE_EXIF_ERROR_NO_EXIF;
|
||||
|
||||
if (!std::equal(buf, buf + 6, "Exif\0\0")) return PARSE_EXIF_ERROR_NO_EXIF;
|
||||
offs += 6;
|
||||
|
||||
// Now parsing the TIFF header. The first two bytes are either "II" or
|
||||
// "MM" for Intel or Motorola byte alignment. Sanity check by parsing
|
||||
// the unsigned short that follows, making sure it equals 0x2a. The
|
||||
// last 4 bytes are an offset into the first IFD, which are added to
|
||||
// the global offset counter. For this block, we expect the following
|
||||
// minimum size:
|
||||
// 2 bytes: 'II' or 'MM'
|
||||
// 2 bytes: 0x002a
|
||||
// 4 bytes: offset to first IDF
|
||||
// -----------------------------
|
||||
// 8 bytes
|
||||
if (offs + 8 > len) return PARSE_EXIF_ERROR_CORRUPT;
|
||||
unsigned tiff_header_start = offs;
|
||||
if (buf[offs] == 'I' && buf[offs + 1] == 'I')
|
||||
alignIntel = true;
|
||||
else {
|
||||
if (buf[offs] == 'M' && buf[offs + 1] == 'M')
|
||||
alignIntel = false;
|
||||
else
|
||||
return PARSE_EXIF_ERROR_UNKNOWN_BYTEALIGN;
|
||||
}
|
||||
this->ByteAlign = alignIntel;
|
||||
offs += 2;
|
||||
if (0x2a != parse_value<uint16_t>(buf + offs, alignIntel))
|
||||
return PARSE_EXIF_ERROR_CORRUPT;
|
||||
offs += 2;
|
||||
unsigned first_ifd_offset = parse_value<uint32_t>(buf + offs, alignIntel);
|
||||
offs += first_ifd_offset - 4;
|
||||
if (offs >= len) return PARSE_EXIF_ERROR_CORRUPT;
|
||||
|
||||
// Now parsing the first Image File Directory (IFD0, for the main image).
|
||||
// An IFD consists of a variable number of 12-byte directory entries. The
|
||||
// first two bytes of the IFD section contain the number of directory
|
||||
// entries in the section. The last 4 bytes of the IFD contain an offset
|
||||
// to the next IFD, which means this IFD must contain exactly 6 + 12 * num
|
||||
// bytes of data.
|
||||
if (offs + 2 > len) return PARSE_EXIF_ERROR_CORRUPT;
|
||||
int num_entries = parse_value<uint16_t>(buf + offs, alignIntel);
|
||||
if (offs + 6 + 12 * num_entries > len) return PARSE_EXIF_ERROR_CORRUPT;
|
||||
offs += 2;
|
||||
unsigned exif_sub_ifd_offset = len;
|
||||
unsigned gps_sub_ifd_offset = len;
|
||||
while (--num_entries >= 0) {
|
||||
IFEntry result =
|
||||
parseIFEntry(buf, offs, alignIntel, tiff_header_start, len);
|
||||
offs += 12;
|
||||
switch (result.tag()) {
|
||||
case 0x102:
|
||||
// Bits per sample
|
||||
if (result.format() == 3)
|
||||
this->BitsPerSample = result.val_short().front();
|
||||
break;
|
||||
|
||||
case 0x10E:
|
||||
// Image description
|
||||
if (result.format() == 2) this->ImageDescription = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x10F:
|
||||
// Digicam make
|
||||
if (result.format() == 2) this->Make = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x110:
|
||||
// Digicam model
|
||||
if (result.format() == 2) this->Model = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x112:
|
||||
// Orientation of image
|
||||
if (result.format() == 3)
|
||||
this->Orientation = result.val_short().front();
|
||||
break;
|
||||
|
||||
case 0x131:
|
||||
// Software used for image
|
||||
if (result.format() == 2) this->Software = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x132:
|
||||
// EXIF/TIFF date/time of image modification
|
||||
if (result.format() == 2) this->DateTime = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x8298:
|
||||
// Copyright information
|
||||
if (result.format() == 2) this->Copyright = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x8825:
|
||||
// GPS IFS offset
|
||||
gps_sub_ifd_offset = tiff_header_start + result.data();
|
||||
break;
|
||||
|
||||
case 0x8769:
|
||||
// EXIF SubIFD offset
|
||||
exif_sub_ifd_offset = tiff_header_start + result.data();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Jump to the EXIF SubIFD if it exists and parse all the information
|
||||
// there. Note that it's possible that the EXIF SubIFD doesn't exist.
|
||||
// The EXIF SubIFD contains most of the interesting information that a
|
||||
// typical user might want.
|
||||
if (exif_sub_ifd_offset + 4 <= len) {
|
||||
offs = exif_sub_ifd_offset;
|
||||
int num_entries = parse_value<uint16_t>(buf + offs, alignIntel);
|
||||
if (offs + 6 + 12 * num_entries > len) return PARSE_EXIF_ERROR_CORRUPT;
|
||||
offs += 2;
|
||||
while (--num_entries >= 0) {
|
||||
IFEntry result =
|
||||
parseIFEntry(buf, offs, alignIntel, tiff_header_start, len);
|
||||
switch (result.tag()) {
|
||||
case 0x829a:
|
||||
// Exposure time in seconds
|
||||
if (result.format() == 5)
|
||||
this->ExposureTime = result.val_rational().front();
|
||||
break;
|
||||
|
||||
case 0x829d:
|
||||
// FNumber
|
||||
if (result.format() == 5)
|
||||
this->FNumber = result.val_rational().front();
|
||||
break;
|
||||
|
||||
case 0x8827:
|
||||
// ISO Speed Rating
|
||||
if (result.format() == 3)
|
||||
this->ISOSpeedRatings = result.val_short().front();
|
||||
break;
|
||||
|
||||
case 0x9003:
|
||||
// Original date and time
|
||||
if (result.format() == 2)
|
||||
this->DateTimeOriginal = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x9004:
|
||||
// Digitization date and time
|
||||
if (result.format() == 2)
|
||||
this->DateTimeDigitized = result.val_string();
|
||||
break;
|
||||
|
||||
case 0x9201:
|
||||
// Shutter speed value
|
||||
if (result.format() == 5)
|
||||
this->ShutterSpeedValue = result.val_rational().front();
|
||||
break;
|
||||
|
||||
case 0x9204:
|
||||
// Exposure bias value
|
||||
if (result.format() == 5)
|
||||
this->ExposureBiasValue = result.val_rational().front();
|
||||
break;
|
||||
|
||||
case 0x9206:
|
||||
// Subject distance
|
||||
if (result.format() == 5)
|
||||
this->SubjectDistance = result.val_rational().front();
|
||||
break;
|
||||
|
||||
case 0x9209:
|
||||
// Flash used
|
||||
if (result.format() == 3) this->Flash = result.data() ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 0x920a:
|
||||
// Focal length
|
||||
if (result.format() == 5)
|
||||
this->FocalLength = result.val_rational().front();
|
||||
break;
|
||||
|
||||
case 0x9207:
|
||||
// Metering mode
|
||||
if (result.format() == 3)
|
||||
this->MeteringMode = result.val_short().front();
|
||||
break;
|
||||
|
||||
case 0x9291:
|
||||
// Subsecond original time
|
||||
if (result.format() == 2)
|
||||
this->SubSecTimeOriginal = result.val_string();
|
||||
break;
|
||||
|
||||
case 0xa002:
|
||||
// EXIF Image width
|
||||
if (result.format() == 4)
|
||||
this->ImageWidth = result.val_long().front();
|
||||
if (result.format() == 3)
|
||||
this->ImageWidth = result.val_short().front();
|
||||
break;
|
||||
|
||||
case 0xa003:
|
||||
// EXIF Image height
|
||||
if (result.format() == 4)
|
||||
this->ImageHeight = result.val_long().front();
|
||||
if (result.format() == 3)
|
||||
this->ImageHeight = result.val_short().front();
|
||||
break;
|
||||
|
||||
case 0xa20e:
|
||||
// EXIF Focal plane X-resolution
|
||||
if (result.format() == 5) {
|
||||
this->LensInfo.FocalPlaneXResolution = result.val_rational()[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xa20f:
|
||||
// EXIF Focal plane Y-resolution
|
||||
if (result.format() == 5) {
|
||||
this->LensInfo.FocalPlaneYResolution = result.val_rational()[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xa405:
|
||||
// Focal length in 35mm film
|
||||
if (result.format() == 3)
|
||||
this->FocalLengthIn35mm = result.val_short().front();
|
||||
break;
|
||||
|
||||
case 0xa432:
|
||||
// Focal length and FStop.
|
||||
if (result.format() == 5) {
|
||||
this->LensInfo.FocalLengthMin = result.val_rational()[0];
|
||||
this->LensInfo.FocalLengthMax = result.val_rational()[1];
|
||||
this->LensInfo.FStopMin = result.val_rational()[2];
|
||||
this->LensInfo.FStopMax = result.val_rational()[3];
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xa433:
|
||||
// Lens make.
|
||||
if (result.format() == 2) {
|
||||
this->LensInfo.Make = result.val_string();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xa434:
|
||||
// Lens model.
|
||||
if (result.format() == 2) {
|
||||
this->LensInfo.Model = result.val_string();
|
||||
}
|
||||
break;
|
||||
}
|
||||
offs += 12;
|
||||
}
|
||||
}
|
||||
|
||||
// Jump to the GPS SubIFD if it exists and parse all the information
|
||||
// there. Note that it's possible that the GPS SubIFD doesn't exist.
|
||||
if (gps_sub_ifd_offset + 4 <= len) {
|
||||
offs = gps_sub_ifd_offset;
|
||||
int num_entries = parse_value<uint16_t>(buf + offs, alignIntel);
|
||||
if (offs + 6 + 12 * num_entries > len) return PARSE_EXIF_ERROR_CORRUPT;
|
||||
offs += 2;
|
||||
while (--num_entries >= 0) {
|
||||
unsigned short tag, format;
|
||||
unsigned length, data;
|
||||
parseIFEntryHeader(buf + offs, alignIntel, tag, format, length, data);
|
||||
switch (tag) {
|
||||
case 1:
|
||||
// GPS north or south
|
||||
this->GeoLocation.LatComponents.direction = *(buf + offs + 8);
|
||||
if (this->GeoLocation.LatComponents.direction == 0) {
|
||||
this->GeoLocation.LatComponents.direction = '?';
|
||||
}
|
||||
if ('S' == this->GeoLocation.LatComponents.direction) {
|
||||
this->GeoLocation.Latitude = -this->GeoLocation.Latitude;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// GPS latitude
|
||||
if (format == 5 && length == 3) {
|
||||
this->GeoLocation.LatComponents.degrees = parse_value<Rational>(
|
||||
buf + data + tiff_header_start, alignIntel);
|
||||
this->GeoLocation.LatComponents.minutes = parse_value<Rational>(
|
||||
buf + data + tiff_header_start + 8, alignIntel);
|
||||
this->GeoLocation.LatComponents.seconds = parse_value<Rational>(
|
||||
buf + data + tiff_header_start + 16, alignIntel);
|
||||
this->GeoLocation.Latitude =
|
||||
this->GeoLocation.LatComponents.degrees +
|
||||
this->GeoLocation.LatComponents.minutes / 60 +
|
||||
this->GeoLocation.LatComponents.seconds / 3600;
|
||||
if ('S' == this->GeoLocation.LatComponents.direction) {
|
||||
this->GeoLocation.Latitude = -this->GeoLocation.Latitude;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// GPS east or west
|
||||
this->GeoLocation.LonComponents.direction = *(buf + offs + 8);
|
||||
if (this->GeoLocation.LonComponents.direction == 0) {
|
||||
this->GeoLocation.LonComponents.direction = '?';
|
||||
}
|
||||
if ('W' == this->GeoLocation.LonComponents.direction) {
|
||||
this->GeoLocation.Longitude = -this->GeoLocation.Longitude;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// GPS longitude
|
||||
if (format == 5 && length == 3) {
|
||||
this->GeoLocation.LonComponents.degrees = parse_value<Rational>(
|
||||
buf + data + tiff_header_start, alignIntel);
|
||||
this->GeoLocation.LonComponents.minutes = parse_value<Rational>(
|
||||
buf + data + tiff_header_start + 8, alignIntel);
|
||||
this->GeoLocation.LonComponents.seconds = parse_value<Rational>(
|
||||
buf + data + tiff_header_start + 16, alignIntel);
|
||||
this->GeoLocation.Longitude =
|
||||
this->GeoLocation.LonComponents.degrees +
|
||||
this->GeoLocation.LonComponents.minutes / 60 +
|
||||
this->GeoLocation.LonComponents.seconds / 3600;
|
||||
if ('W' == this->GeoLocation.LonComponents.direction)
|
||||
this->GeoLocation.Longitude = -this->GeoLocation.Longitude;
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
// GPS altitude reference (below or above sea level)
|
||||
this->GeoLocation.AltitudeRef = *(buf + offs + 8);
|
||||
if (1 == this->GeoLocation.AltitudeRef) {
|
||||
this->GeoLocation.Altitude = -this->GeoLocation.Altitude;
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// GPS altitude
|
||||
if (format == 5) {
|
||||
this->GeoLocation.Altitude = parse_value<Rational>(
|
||||
buf + data + tiff_header_start, alignIntel);
|
||||
if (1 == this->GeoLocation.AltitudeRef) {
|
||||
this->GeoLocation.Altitude = -this->GeoLocation.Altitude;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
// GPS degree of precision (DOP)
|
||||
if (format == 5) {
|
||||
this->GeoLocation.DOP = parse_value<Rational>(
|
||||
buf + data + tiff_header_start, alignIntel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
offs += 12;
|
||||
}
|
||||
}
|
||||
|
||||
return PARSE_EXIF_SUCCESS;
|
||||
}
|
||||
|
||||
void easyexif::EXIFInfo::clear() {
|
||||
// Strings
|
||||
ImageDescription = "";
|
||||
Make = "";
|
||||
Model = "";
|
||||
Software = "";
|
||||
DateTime = "";
|
||||
DateTimeOriginal = "";
|
||||
DateTimeDigitized = "";
|
||||
SubSecTimeOriginal = "";
|
||||
Copyright = "";
|
||||
|
||||
// Shorts / unsigned / double
|
||||
ByteAlign = 0;
|
||||
Orientation = 0;
|
||||
|
||||
BitsPerSample = 0;
|
||||
ExposureTime = 0;
|
||||
FNumber = 0;
|
||||
ISOSpeedRatings = 0;
|
||||
ShutterSpeedValue = 0;
|
||||
ExposureBiasValue = 0;
|
||||
SubjectDistance = 0;
|
||||
FocalLength = 0;
|
||||
FocalLengthIn35mm = 0;
|
||||
Flash = 0;
|
||||
MeteringMode = 0;
|
||||
ImageWidth = 0;
|
||||
ImageHeight = 0;
|
||||
|
||||
// Geolocation
|
||||
GeoLocation.Latitude = 0;
|
||||
GeoLocation.Longitude = 0;
|
||||
GeoLocation.Altitude = 0;
|
||||
GeoLocation.AltitudeRef = 0;
|
||||
GeoLocation.DOP = 0;
|
||||
GeoLocation.LatComponents.degrees = 0;
|
||||
GeoLocation.LatComponents.minutes = 0;
|
||||
GeoLocation.LatComponents.seconds = 0;
|
||||
GeoLocation.LatComponents.direction = '?';
|
||||
GeoLocation.LonComponents.degrees = 0;
|
||||
GeoLocation.LonComponents.minutes = 0;
|
||||
GeoLocation.LonComponents.seconds = 0;
|
||||
GeoLocation.LonComponents.direction = '?';
|
||||
|
||||
// LensInfo
|
||||
LensInfo.FocalLengthMax = 0;
|
||||
LensInfo.FocalLengthMin = 0;
|
||||
LensInfo.FStopMax = 0;
|
||||
LensInfo.FStopMin = 0;
|
||||
LensInfo.FocalPlaneYResolution = 0;
|
||||
LensInfo.FocalPlaneXResolution = 0;
|
||||
LensInfo.Make = "";
|
||||
LensInfo.Model = "";
|
||||
}
|
||||
163
src/external/easyexif-1.0/exif.h
vendored
Normal file
163
src/external/easyexif-1.0/exif.h
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
/**************************************************************************
|
||||
exif.h -- A simple ISO C++ library to parse basic EXIF
|
||||
information from a JPEG file.
|
||||
|
||||
Based on the description of the EXIF file format at:
|
||||
-- http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
|
||||
-- http://www.media.mit.edu/pia/Research/deepview/exif.html
|
||||
-- http://www.exif.org/Exif2-2.PDF
|
||||
|
||||
Copyright (c) 2010-2015 Mayank Lahiri
|
||||
mlahiri@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
VERSION HISTORY:
|
||||
================
|
||||
|
||||
2.2: Release December 2014
|
||||
--
|
||||
|
||||
2.1: Released July 2013
|
||||
-- fixed a bug where JPEGs without an EXIF SubIFD would not be parsed
|
||||
-- fixed a bug in parsing GPS coordinate seconds
|
||||
-- fixed makefile bug
|
||||
-- added two pathological test images from Matt Galloway
|
||||
http://www.galloway.me.uk/2012/01/uiimageorientation-exif-orientation-sample-images/
|
||||
-- split main parsing routine for easier integration into Firefox
|
||||
|
||||
2.0: Released February 2013
|
||||
-- complete rewrite
|
||||
-- no new/delete
|
||||
-- added GPS support
|
||||
|
||||
1.0: Released 2010
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
-- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
-- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __EXIF_H
|
||||
#define __EXIF_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace easyexif {
|
||||
|
||||
//
|
||||
// Class responsible for storing and parsing EXIF information from a JPEG blob
|
||||
//
|
||||
class EXIFInfo {
|
||||
public:
|
||||
// Parsing function for an entire JPEG image buffer.
|
||||
//
|
||||
// PARAM 'data': A pointer to a JPEG image.
|
||||
// PARAM 'length': The length of the JPEG image.
|
||||
// RETURN: PARSE_EXIF_SUCCESS (0) on succes with 'result' filled out
|
||||
// error code otherwise, as defined by the PARSE_EXIF_ERROR_* macros
|
||||
int parseFrom(const unsigned char *data, unsigned length);
|
||||
int parseFrom(const std::string &data);
|
||||
|
||||
// Parsing function for an EXIF segment. This is used internally by parseFrom()
|
||||
// but can be called for special cases where only the EXIF section is
|
||||
// available (i.e., a blob starting with the bytes "Exif\0\0").
|
||||
int parseFromEXIFSegment(const unsigned char *buf, unsigned len);
|
||||
|
||||
// Set all data members to default values.
|
||||
void clear();
|
||||
|
||||
// Data fields filled out by parseFrom()
|
||||
char ByteAlign; // 0 = Motorola byte alignment, 1 = Intel
|
||||
std::string ImageDescription; // Image description
|
||||
std::string Make; // Camera manufacturer's name
|
||||
std::string Model; // Camera model
|
||||
unsigned short Orientation; // Image orientation, start of data corresponds to
|
||||
// 0: unspecified in EXIF data
|
||||
// 1: upper left of image
|
||||
// 3: lower right of image
|
||||
// 6: upper right of image
|
||||
// 8: lower left of image
|
||||
// 9: undefined
|
||||
unsigned short BitsPerSample; // Number of bits per component
|
||||
std::string Software; // Software used
|
||||
std::string DateTime; // File change date and time
|
||||
std::string DateTimeOriginal; // Original file date and time (may not exist)
|
||||
std::string DateTimeDigitized; // Digitization date and time (may not exist)
|
||||
std::string SubSecTimeOriginal; // Sub-second time that original picture was taken
|
||||
std::string Copyright; // File copyright information
|
||||
double ExposureTime; // Exposure time in seconds
|
||||
double FNumber; // F/stop
|
||||
unsigned short ISOSpeedRatings; // ISO speed
|
||||
double ShutterSpeedValue; // Shutter speed (reciprocal of exposure time)
|
||||
double ExposureBiasValue; // Exposure bias value in EV
|
||||
double SubjectDistance; // Distance to focus point in meters
|
||||
double FocalLength; // Focal length of lens in millimeters
|
||||
unsigned short FocalLengthIn35mm; // Focal length in 35mm film
|
||||
char Flash; // 0 = no flash, 1 = flash used
|
||||
unsigned short MeteringMode; // Metering mode
|
||||
// 1: average
|
||||
// 2: center weighted average
|
||||
// 3: spot
|
||||
// 4: multi-spot
|
||||
// 5: multi-segment
|
||||
unsigned ImageWidth; // Image width reported in EXIF data
|
||||
unsigned ImageHeight; // Image height reported in EXIF data
|
||||
struct Geolocation_t { // GPS information embedded in file
|
||||
double Latitude; // Image latitude expressed as decimal
|
||||
double Longitude; // Image longitude expressed as decimal
|
||||
double Altitude; // Altitude in meters, relative to sea level
|
||||
char AltitudeRef; // 0 = above sea level, -1 = below sea level
|
||||
double DOP; // GPS degree of precision (DOP)
|
||||
struct Coord_t {
|
||||
double degrees;
|
||||
double minutes;
|
||||
double seconds;
|
||||
char direction;
|
||||
} LatComponents, LonComponents; // Latitude, Longitude expressed in deg/min/sec
|
||||
} GeoLocation;
|
||||
struct LensInfo_t { // Lens information
|
||||
double FStopMin; // Min aperture (f-stop)
|
||||
double FStopMax; // Max aperture (f-stop)
|
||||
double FocalLengthMin; // Min focal length (mm)
|
||||
double FocalLengthMax; // Max focal length (mm)
|
||||
double FocalPlaneXResolution; // Focal plane X-resolution
|
||||
double FocalPlaneYResolution; // Focal plane Y-resolution
|
||||
std::string Make; // Lens manufacturer
|
||||
std::string Model; // Lens model
|
||||
} LensInfo;
|
||||
|
||||
|
||||
EXIFInfo() {
|
||||
clear();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// Parse was successful
|
||||
#define PARSE_EXIF_SUCCESS 0
|
||||
// No JPEG markers found in buffer, possibly invalid JPEG file
|
||||
#define PARSE_EXIF_ERROR_NO_JPEG 1982
|
||||
// No EXIF header found in JPEG file.
|
||||
#define PARSE_EXIF_ERROR_NO_EXIF 1983
|
||||
// Byte alignment specified in EXIF file was unknown (not Motorola or Intel).
|
||||
#define PARSE_EXIF_ERROR_UNKNOWN_BYTEALIGN 1984
|
||||
// EXIF header was found, but data was corrupted.
|
||||
#define PARSE_EXIF_ERROR_CORRUPT 1985
|
||||
|
||||
#endif
|
||||
26
src/external/easyexif-1.0/test.sh
vendored
Executable file
26
src/external/easyexif-1.0/test.sh
vendored
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
make
|
||||
|
||||
DEMONAME=./demo
|
||||
|
||||
if [ ! -e ./demo ]; then
|
||||
# check if demo.exe exists, needed on windows
|
||||
if [ -e ./demo.exe ]; then
|
||||
DEMONAME=./demo.exe
|
||||
else
|
||||
echo Cannot find executable.
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for jpeg in `ls test-images/*.jpg`; do
|
||||
$DEMONAME $jpeg > /tmp/`basename $jpeg`.actual
|
||||
diff $jpeg.expected /tmp/`basename $jpeg`.actual > /tmp/diff.out
|
||||
if [[ -s /tmp/diff.out ]] ; then
|
||||
echo "FAILED ON $jpeg"
|
||||
cat /tmp/diff.out
|
||||
exit
|
||||
fi ;
|
||||
echo "PASS $jpeg"
|
||||
done
|
||||
13
src/external/easyexif.cmake
vendored
13
src/external/easyexif.cmake
vendored
@ -2,12 +2,13 @@
|
||||
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_EASYEXIF "Allow download and use of EasyExif source" ON)
|
||||
option(MESHLAB_ALLOW_BUNDLED_SOURCE_EASYEXIF "Allow use bundled source of EasyExif" ON)
|
||||
|
||||
if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_EASYEXIF)
|
||||
set(EASYEXIF_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/easyexif-1.0")
|
||||
if(MESHLAB_ALLOW_BUNDLED_SOURCE_EASYEXIF)
|
||||
set(EASYEXIF_DIR "${MESHLAB_EXTERNAL_DIR}/easyexif-1.0")
|
||||
set(EASYEXIF_CHECK "${EASYEXIF_DIR}/exif.h")
|
||||
|
||||
# just to be sure, but this library is bundled in meshlab repo and download shouldn't be necessary
|
||||
if (NOT EXISTS ${EASYEXIF_CHECK})
|
||||
set(EASYEXIF_LINK
|
||||
https://github.com/mayanklahiri/easyexif/archive/refs/tags/v1.0.zip
|
||||
@ -17,19 +18,19 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_EASYEXIF)
|
||||
NAME "EasyExif"
|
||||
LINK ${EASYEXIF_LINK}
|
||||
MD5 ${EASYEXIF_MD5}
|
||||
DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
|
||||
DIR ${MESHLAB_EXTERNAL_DIR})
|
||||
if (NOT download_and_unzip_SUCCESS)
|
||||
message(FATAL_ERROR "- EasyExif - download failed.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (EXISTS ${EASYEXIF_CHECK})
|
||||
message(STATUS "- EasyExif - using downloaded source")
|
||||
message(STATUS "- EasyExif - using bundled source")
|
||||
add_library(external-easyexif STATIC ${EASYEXIF_DIR}/exif.h ${EASYEXIF_DIR}/exif.cpp)
|
||||
target_include_directories(external-easyexif PUBLIC ${EASYEXIF_DIR})
|
||||
endif()
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"EeasyExif is required - MESHLAB_ALLOW_DOWNLOAD_SOURCE_EASYEXIF must be ON.")
|
||||
"EeasyExif is required - MESHLAB_ALLOW_BUNDLED_SOURCE_EASYEXIF must be ON.")
|
||||
endif()
|
||||
|
||||
73
src/external/glew-2.2.0/LICENSE.txt
vendored
Normal file
73
src/external/glew-2.2.0/LICENSE.txt
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
The OpenGL Extension Wrangler Library
|
||||
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
||||
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
Copyright (C) 2002, Lev Povalahev
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The name of the author may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Mesa 3-D graphics library
|
||||
Version: 7.0
|
||||
|
||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Copyright (c) 2007 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
258
src/external/glew-2.2.0/README.md
vendored
Normal file
258
src/external/glew-2.2.0/README.md
vendored
Normal file
@ -0,0 +1,258 @@
|
||||
# GLEW - The OpenGL Extension Wrangler Library
|
||||
|
||||
The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. OpenGL core and extension functionality is exposed in a single header file. GLEW has been tested on a variety of operating systems, including Windows, Linux, Mac OS X, FreeBSD, Irix, and Solaris.
|
||||
|
||||

|
||||
|
||||
http://glew.sourceforge.net/
|
||||
|
||||
https://github.com/nigels-com/glew
|
||||
|
||||
[](https://travis-ci.org/nigels-com/glew)
|
||||
[](https://gitter.im/nigels-com/glew?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[](https://sourceforge.net/projects/glew/files/latest/download)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Downloads](#downloads)
|
||||
* [Recent snapshots](#recent-snapshots)
|
||||
* [Build](#build)
|
||||
* [Linux and Mac](#linux-and-mac)
|
||||
* [Using GNU Make](#using-gnu-make)
|
||||
* [Install build tools](#install-build-tools)
|
||||
* [Build](#build-1)
|
||||
* [Linux EGL](#linux-egl)
|
||||
* [Linux OSMesa](#linux-osmesa)
|
||||
* [Linux mingw-w64](#linux-mingw-w64)
|
||||
* [Using cmake](#using-cmake)
|
||||
* [Install build tools](#install-build-tools-1)
|
||||
* [Build](#build-2)
|
||||
* [Windows](#windows)
|
||||
* [Visual Studio](#visual-studio)
|
||||
* [MSYS/Mingw](#msysmingw)
|
||||
* [MSYS2/Mingw-w64](#msys2mingw-w64)
|
||||
* [glewinfo](#glewinfo)
|
||||
* [Code Generation](#code-generation)
|
||||
* [Authors](#authors)
|
||||
* [Contributions](#contributions)
|
||||
* [Copyright and Licensing](#copyright-and-licensing)
|
||||
|
||||
## Downloads
|
||||
|
||||
Current release is [2.1.0](https://sourceforge.net/projects/glew/files/glew/2.1.0/).
|
||||
[(Change Log)](http://glew.sourceforge.net/log.html)
|
||||
|
||||
Sources available as
|
||||
[ZIP](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.zip/download) or
|
||||
[TGZ](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.tgz/download).
|
||||
|
||||
Windows binaries for [32-bit and 64-bit](https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0-win32.zip/download).
|
||||
|
||||
### Recent snapshots
|
||||
|
||||
Snapshots may contain new features, bug-fixes or new OpenGL extensions ahead of tested, official releases.
|
||||
|
||||
[glew-20200115.tgz](https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20200115.tgz/download) *GLEW 2.2.0 RC3: fixes*
|
||||
|
||||
[glew-20190928.tgz](https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20190928.tgz/download) *GLEW 2.2.0 RC2: New extensions, bug fixes*
|
||||
|
||||
## Build
|
||||
|
||||
It is highly recommended to build from a tgz or zip release snapshot.
|
||||
The code generation workflow is a complex brew of gnu make, perl and python, that works best on Linux or Mac.
|
||||
The code generation is known to work on Windows using [MSYS2](https://www.msys2.org/).
|
||||
For most end-users of GLEW the official releases are the best choice, with first class support.
|
||||
|
||||
### Linux and Mac
|
||||
|
||||
#### Using GNU Make
|
||||
|
||||
GNU make is the primary build system for GLEW, historically.
|
||||
It includes targets for building the sources and headers, for maintenance purposes.
|
||||
|
||||
##### Install build tools
|
||||
|
||||
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev`
|
||||
|
||||
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel`
|
||||
|
||||
FreeBSD: `# pkg install xorg lang/gcc git cmake gmake bash python perl5`
|
||||
|
||||
##### Build
|
||||
|
||||
$ make
|
||||
$ sudo make install
|
||||
$ make clean
|
||||
|
||||
Targets: `all, glew.lib (sub-targets: glew.lib.shared, glew.lib.static), glew.bin, clean, install, uninstall`
|
||||
|
||||
Variables: `SYSTEM=linux-clang, GLEW_DEST=/usr/local, STRIP=`
|
||||
|
||||
_Note: you may need to call `make` in the **auto** folder first_
|
||||
|
||||
##### Linux EGL
|
||||
|
||||
$ sudo apt install libegl1-mesa-dev
|
||||
$ make SYSTEM=linux-egl
|
||||
|
||||
##### Linux OSMesa
|
||||
|
||||
$ sudo apt install libosmesa-dev
|
||||
$ make SYSTEM=linux-osmesa
|
||||
|
||||
##### Linux mingw-w64
|
||||
|
||||
$ sudo apt install mingw-w64
|
||||
$ make SYSTEM=linux-mingw32
|
||||
$ make SYSTEM=linux-mingw64
|
||||
|
||||
#### Using cmake
|
||||
|
||||
The cmake build is mostly contributer maintained.
|
||||
Due to the multitude of use cases this is maintained on a _best effort_ basis.
|
||||
Pull requests are welcome.
|
||||
|
||||
*CMake 2.8.12 or higher is required.*
|
||||
|
||||
##### Install build tools
|
||||
|
||||
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev cmake git`
|
||||
|
||||
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel cmake git`
|
||||
|
||||
##### Build
|
||||
|
||||
$ cd build
|
||||
$ cmake ./cmake
|
||||
$ make -j4
|
||||
|
||||
| Target | Description |
|
||||
| ---------- | ----------- |
|
||||
| glew | Build the glew shared library. |
|
||||
| glew_s | Build the glew static library. |
|
||||
| glewinfo | Build the `glewinfo` executable (requires `BUILD_UTILS` to be `ON`). |
|
||||
| visualinfo | Build the `visualinfo` executable (requires `BUILD_UTILS` to be `ON`). |
|
||||
| install | Install all enabled targets into `CMAKE_INSTALL_PREFIX`. |
|
||||
| clean | Clean up build artifacts. |
|
||||
| all | Build all enabled targets (default target). |
|
||||
|
||||
| Variables | Description |
|
||||
| --------------- | ----------- |
|
||||
| BUILD_UTILS | Build the `glewinfo` and `visualinfo` executables. |
|
||||
| GLEW_REGAL | Build in Regal mode. |
|
||||
| GLEW_OSMESA | Build in off-screen Mesa mode. |
|
||||
| BUILD_FRAMEWORK | Build as MacOSX Framework. Setting `CMAKE_INSTALL_PREFIX` to `/Library/Frameworks` is recommended. |
|
||||
|
||||
### Windows
|
||||
|
||||
#### Visual Studio
|
||||
|
||||
Use the provided Visual Studio project file in build/vc15/
|
||||
|
||||
Projects for vc6, vc10, vc12 and vc14 are also provided
|
||||
|
||||
#### MSYS/Mingw
|
||||
|
||||
Available from [Mingw](http://www.mingw.org/)
|
||||
|
||||
Requirements: bash, make, gcc
|
||||
|
||||
$ mingw32-make
|
||||
$ mingw32-make install
|
||||
$ mingw32-make install.all
|
||||
|
||||
Alternative toolchain: `SYSTEM=mingw-win32`
|
||||
|
||||
#### MSYS2/Mingw-w64
|
||||
|
||||
Available from [Msys2](http://msys2.github.io/) and/or [Mingw-w64](http://mingw-w64.org/)
|
||||
|
||||
Requirements: bash, make, gcc
|
||||
|
||||
$ pacman -S gcc make mingw-w64-i686-gcc mingw-w64-x86_64-gcc
|
||||
$ make
|
||||
$ make install
|
||||
$ make install.all
|
||||
|
||||
Alternative toolchain: `SYSTEM=msys, SYSTEM=msys-win32, SYSTEM=msys-win64`
|
||||
|
||||
## glewinfo
|
||||
|
||||
`glewinfo` is a command-line tool useful for inspecting the capabilities of an
|
||||
OpenGL implementation and GLEW support for that. Please include `glewinfo.txt`
|
||||
with bug reports, as appropriate.
|
||||
|
||||
---------------------------
|
||||
GLEW Extension Info
|
||||
---------------------------
|
||||
|
||||
GLEW version 2.0.0
|
||||
Reporting capabilities of pixelformat 3
|
||||
Running on a Intel(R) HD Graphics 3000 from Intel
|
||||
OpenGL version 3.1.0 - Build 9.17.10.4229 is supported
|
||||
|
||||
GL_VERSION_1_1: OK
|
||||
---------------
|
||||
|
||||
GL_VERSION_1_2: OK
|
||||
---------------
|
||||
glCopyTexSubImage3D: OK
|
||||
glDrawRangeElements: OK
|
||||
glTexImage3D: OK
|
||||
glTexSubImage3D: OK
|
||||
|
||||
...
|
||||
|
||||
## Code Generation
|
||||
|
||||
A Unix or Mac environment is needed for building GLEW from scratch to
|
||||
include new extensions, or customize the code generation. The extension
|
||||
data is regenerated from the top level source directory with:
|
||||
|
||||
make extensions
|
||||
|
||||
An alternative to generating the GLEW sources from scratch is to
|
||||
download a pre-generated (unsupported) snapshot:
|
||||
|
||||
https://sourceforge.net/projects/glew/files/glew/snapshots/
|
||||
|
||||
## Authors
|
||||
|
||||
GLEW is currently maintained by [Nigel Stewart](https://github.com/nigels-com)
|
||||
with bug fixes, new OpenGL extension support and new releases.
|
||||
|
||||
GLEW was developed by [Milan Ikits](http://www.cs.utah.edu/~ikits/)
|
||||
and [Marcelo Magallon](http://wwwvis.informatik.uni-stuttgart.de/~magallon/).
|
||||
Aaron Lefohn, Joe Kniss, and Chris Wyman were the first users and also
|
||||
assisted with the design and debugging process.
|
||||
|
||||
The acronym GLEW originates from Aaron Lefohn.
|
||||
Pasi Kärkkäinen identified and fixed several problems with
|
||||
GLX and SDL. Nate Robins created the `wglinfo` utility, to
|
||||
which modifications were made by Michael Wimmer.
|
||||
|
||||
## Contributions
|
||||
|
||||
GLEW welcomes community contributions. Typically these are co-ordinated
|
||||
via [Issues](https://github.com/nigels-com/glew/issues) or
|
||||
[Pull Requests](https://github.com/nigels-com/glew/pulls) in the
|
||||
GitHub web interface.
|
||||
|
||||
Be sure to mention platform and compiler toolchain details when filing
|
||||
a bug report. The output of `glewinfo` can be quite useful for discussion
|
||||
also.
|
||||
|
||||
Generally GLEW is usually released once a year, around the time of the Siggraph
|
||||
computer graphics conference. If you're not using the current release
|
||||
version of GLEW, be sure to check if the issue or bug is fixed there.
|
||||
|
||||
## Copyright and Licensing
|
||||
|
||||
GLEW is originally derived from the EXTGL project by Lev Povalahev.
|
||||
The source code is licensed under the
|
||||
[Modified BSD License](http://glew.sourceforge.net/glew.txt), the
|
||||
[Mesa 3-D License](http://glew.sourceforge.net/mesa.txt) (MIT) and the
|
||||
[Khronos License](http://glew.sourceforge.net/khronos.txt) (MIT).
|
||||
|
||||
The automatic code generation scripts are released under the
|
||||
[GNU GPL](http://glew.sourceforge.net/gpl.txt).
|
||||
11
src/external/glew-2.2.0/glew.pc.in
vendored
Normal file
11
src/external/glew-2.2.0/glew.pc.in
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=${prefix}
|
||||
libdir=@libdir@
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: glew
|
||||
Description: The OpenGL Extension Wrangler library
|
||||
Version: @version@
|
||||
Cflags: -I${includedir} @cflags@
|
||||
Libs: -L${libdir} -l@libname@ @libgl@
|
||||
Requires: @requireslib@
|
||||
3051
src/external/glew-2.2.0/include/GL/eglew.h
vendored
Normal file
3051
src/external/glew-2.2.0/include/GL/eglew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
26427
src/external/glew-2.2.0/include/GL/glew.h
vendored
Normal file
26427
src/external/glew-2.2.0/include/GL/glew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1831
src/external/glew-2.2.0/include/GL/glxew.h
vendored
Normal file
1831
src/external/glew-2.2.0/include/GL/glxew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1468
src/external/glew-2.2.0/include/GL/wglew.h
vendored
Normal file
1468
src/external/glew-2.2.0/include/GL/wglew.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31949
src/external/glew-2.2.0/src/glew.c
vendored
Normal file
31949
src/external/glew-2.2.0/src/glew.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19031
src/external/glew-2.2.0/src/glewinfo.c
vendored
Normal file
19031
src/external/glew-2.2.0/src/glewinfo.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1297
src/external/glew-2.2.0/src/visualinfo.c
vendored
Normal file
1297
src/external/glew-2.2.0/src/visualinfo.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13
src/external/glew.cmake
vendored
13
src/external/glew.cmake
vendored
@ -2,7 +2,7 @@
|
||||
# Copyright 2019, 2020, Visual Computing Lab, ISTI - Italian National Research Council
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_GLEW "Allow download and use of GLEW source" ON)
|
||||
option(MESHLAB_ALLOW_BUNDLED_SOURCE_GLEW "Allow use bundled source of GLEW" ON)
|
||||
option(MESHLAB_ALLOW_SYSTEM_GLEW "Allow use of system-provided GLEW" ON)
|
||||
|
||||
unset(HAVE_SYSTEM_GLEW)
|
||||
@ -23,10 +23,11 @@ if(MESHLAB_ALLOW_SYSTEM_GLEW AND HAVE_SYSTEM_GLEW)
|
||||
else()
|
||||
message(FATAL_ERROR "OpenGL not found or your CMake version is too old!")
|
||||
endif()
|
||||
elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_GLEW)
|
||||
set(GLEW_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/glew-2.2.0")
|
||||
elseif(MESHLAB_ALLOW_BUNDLED_SOURCE_GLEW)
|
||||
set(GLEW_DIR "${MESHLAB_EXTERNAL_DIR}/glew-2.2.0")
|
||||
set(GLEW_CHECK "${GLEW_DIR}/src/glew.c")
|
||||
|
||||
# just to be sure, but this library is bundled in meshlab repo and download shouldn't be necessary
|
||||
if (NOT EXISTS ${GLEW_CHECK})
|
||||
set(GLEW_LINK
|
||||
https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.zip
|
||||
@ -36,14 +37,14 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_GLEW)
|
||||
NAME "GLEW"
|
||||
LINK ${GLEW_LINK}
|
||||
MD5 ${GLEW_MD5}
|
||||
DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
|
||||
DIR ${MESHLAB_EXTERNAL_DIR})
|
||||
if (NOT download_and_unzip_SUCCESS)
|
||||
message(FATAL_ERROR "- GLEW - download failed.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (EXISTS ${GLEW_CHECK})
|
||||
message(STATUS "- GLEW - using downloaded source")
|
||||
message(STATUS "- GLEW - using bundled source")
|
||||
add_library(external-glew SHARED "${GLEW_DIR}/src/glew.c")
|
||||
target_include_directories(external-glew SYSTEM PUBLIC ${GLEW_DIR}/include)
|
||||
if(TARGET OpenGL::GL)
|
||||
@ -60,5 +61,5 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_GLEW)
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"GLEW is required - at least one of MESHLAB_ALLOW_SYSTEM_GLEW or MESHLAB_ALLOW_DOWNLOAD_SOURCE_GLEW must be ON and found.")
|
||||
"GLEW is required - at least one of MESHLAB_ALLOW_SYSTEM_GLEW or MESHLAB_ALLOW_BUNDLED_SOURCE_GLEW must be ON and found.")
|
||||
endif()
|
||||
|
||||
12
src/external/muparser.cmake
vendored
12
src/external/muparser.cmake
vendored
@ -35,9 +35,19 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_MUPARSER)
|
||||
|
||||
set(ENABLE_SAMPLES OFF)
|
||||
set(MESSAGE_QUIET ON)
|
||||
add_subdirectory(${MUPARSER_DIR})
|
||||
if(NOT OPENMP_FOUND)
|
||||
set(ENABLE_OPENMP OFF)
|
||||
endif()
|
||||
add_subdirectory(${MUPARSER_DIR} EXCLUDE_FROM_ALL)
|
||||
if (APPLE AND OPENMP_FOUND)
|
||||
target_link_libraries(muparser PRIVATE OpenMP::OpenMP_CXX)
|
||||
endif()
|
||||
if(NOT OPENMP_FOUND)
|
||||
unset(ENABLE_OPENMP)
|
||||
endif()
|
||||
unset(MESSAGE_QUIET)
|
||||
unset(ENABLE_SAMPLES)
|
||||
|
||||
|
||||
add_library(external-muparser INTERFACE)
|
||||
target_link_libraries(external-muparser INTERFACE muparser)
|
||||
|
||||
21
src/external/u3d.cmake
vendored
21
src/external/u3d.cmake
vendored
@ -5,19 +5,18 @@
|
||||
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_U3D "Allow download and use of u3d source" ON)
|
||||
|
||||
if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_U3D)
|
||||
# todo - make release of u3d
|
||||
set(U3D_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/u3d-master")
|
||||
set(U3D_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/u3d-1.5.1")
|
||||
set(U3D_CHECK "${U3D_DIR}/CMakeLists.txt")
|
||||
|
||||
if (NOT EXISTS ${U3D_CHECK})
|
||||
set(U3D_LINK
|
||||
https://github.com/alemuntoni/u3d/archive/refs/heads/master.zip
|
||||
https://www.meshlab.net/data/libs/u3d-master.zip)
|
||||
#set(U3D_MD5 3b15b2f75206ea24b8991333562aa9ca)
|
||||
https://github.com/alemuntoni/u3d/archive/refs/tags/1.5.1.zip
|
||||
https://www.meshlab.net/data/libs/u3d-1.5.1.zip)
|
||||
set(U3D_MD5 3f74c48d6c69671ff074f27b7dc1b926)
|
||||
download_and_unzip(
|
||||
NAME "u3d"
|
||||
LINK ${U3D_LINK}
|
||||
#MD5 ${U3D_MD5}
|
||||
MD5 ${U3D_MD5}
|
||||
DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
|
||||
if (NOT download_and_unzip_SUCCESS)
|
||||
message(STATUS "- u3d - download failed.")
|
||||
@ -25,17 +24,23 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_U3D)
|
||||
endif()
|
||||
|
||||
if (EXISTS ${U3D_CHECK})
|
||||
message(STATUS "- u3d - using bundled source")
|
||||
message(STATUS "- u3d - using downloaded source")
|
||||
|
||||
set(U3D_BUILD_LIBIDTF_TEST OFF)
|
||||
set(U3D_BUILD_IDTF_TO_U3D_BIN OFF)
|
||||
set(U3D_BUILD_STATIC_IDTF_LIB OFF)
|
||||
set(U3D_INSTALL_LIBS OFF)
|
||||
set(MESSAGE_QUIET ON)
|
||||
add_subdirectory(${U3D_DIR})
|
||||
unset(MESSAGE_QUIET)
|
||||
unset(U3D_BUILD_LIBIDTF_TEST)
|
||||
unset(U3D_BUILD_IDTF_TO_U3D_BIN)
|
||||
install(
|
||||
TARGETS
|
||||
IDTF
|
||||
IFXCore
|
||||
IFXExporting
|
||||
IFXScheduling
|
||||
IDTF-to-U3D-converter
|
||||
DESTINATION
|
||||
${MESHLAB_LIB_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
@ -202,7 +202,7 @@ void GLArea::pasteTile()
|
||||
tileBuffer.format());
|
||||
|
||||
uchar* snapPtr = snapBuffer.bits() + (tileBuffer.bytesPerLine() * tileCol) +
|
||||
((totalCols * tileRow) * tileBuffer.byteCount());
|
||||
((totalCols * tileRow) * tileBuffer.sizeInBytes());
|
||||
uchar* tilePtr = tileBuffer.bits();
|
||||
|
||||
for (int y = 0; y < tileBuffer.height(); y++) {
|
||||
@ -2473,10 +2473,28 @@ void GLArea::setupTextureEnv( GLuint textid )
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D,textid);
|
||||
if(glas.textureMagFilter == 0 )
|
||||
switch(glas.textureWrapST)
|
||||
{
|
||||
case 0:
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||
break;
|
||||
case 1:
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT );
|
||||
break;
|
||||
case 2:
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
|
||||
if(glas.textureMagFilter == 0 )
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
else
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
||||
if(glas.textureMinFilter == 0 )
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
else
|
||||
|
||||
@ -17,9 +17,12 @@ void GLAreaSetting::initGlobalParameterList(RichParameterList& defaultGlobalPara
|
||||
|
||||
QStringList textureMinFilterModes = (QStringList() << "Nearest" << "MipMap");
|
||||
QStringList textureMagFilterModes = (QStringList() << "Nearest" << "Linear");
|
||||
QStringList textureWrapSTModes = (QStringList() << "Repeat" << "Mirrored Repeat" << "Clamp to Edge");
|
||||
|
||||
defaultGlobalParamSet.addParam(RichEnum(textureMinFilterParam() , 1,textureMinFilterModes,"MeshLab Texture Minification Filtering","MeshLab GLarea's BackGround Color(top corner)"));
|
||||
defaultGlobalParamSet.addParam(RichEnum(textureMagFilterParam() , 1,textureMagFilterModes,"MeshLab Texture Magnification Filtering","MeshLab GLarea's BackGround Color(top corner)"));
|
||||
|
||||
defaultGlobalParamSet.addParam(RichEnum(textureWrapSTParam() , 0,textureWrapSTModes,"MeshLab Texture Clamping","MeshLab Texture Clamping"));
|
||||
|
||||
defaultGlobalParamSet.addParam(RichBool(pointDistanceAttenuationParam() , true,"Perspective Varying Point Size","If true the size of the points is drawn with a size proprtional to the distance from the observer."));
|
||||
defaultGlobalParamSet.addParam(RichBool(pointSmoothParam() , false,"Antialiased Point","If true the points are drawn with small circles instead of fast squared dots."));
|
||||
defaultGlobalParamSet.addParam(RichFloat(pointSizeParam() , 2.0, "Point Size","The base size of points when drawn"));
|
||||
@ -45,6 +48,7 @@ void GLAreaSetting::updateGlobalParameterSet( const RichParameterList& rps )
|
||||
|
||||
textureMinFilter = rps.getEnum(this->textureMinFilterParam());
|
||||
textureMagFilter = rps.getEnum(this->textureMagFilterParam());
|
||||
textureWrapST = rps.getEnum(this->textureWrapSTParam());
|
||||
|
||||
pointDistanceAttenuation = rps.getBool(this->pointDistanceAttenuationParam());
|
||||
pointSmooth = rps.getBool(this->pointSmoothParam());
|
||||
|
||||
@ -57,9 +57,11 @@ public:
|
||||
|
||||
int textureMagFilter;
|
||||
int textureMinFilter;
|
||||
int textureWrapST;
|
||||
inline static QString textureMinFilterParam() {return "MeshLab::Appearance::textureMinFilter";}
|
||||
inline static QString textureMagFilterParam() {return "MeshLab::Appearance::textureMagFilter";}
|
||||
|
||||
inline static QString textureWrapSTParam() {return "MeshLab::Appearance::textureWrapST";}
|
||||
|
||||
bool pointDistanceAttenuation;
|
||||
inline static QString pointDistanceAttenuationParam() {return "MeshLab::Appearance::pointDistanceAttenuation";}
|
||||
bool pointSmooth;
|
||||
|
||||
@ -177,7 +177,7 @@ private slots:
|
||||
void reloadAllMesh();
|
||||
void openRecentMesh();
|
||||
void openRecentProj();
|
||||
bool saveAs(QString fileName = QString(),const bool saveAllPossibleAttributes = false);
|
||||
bool saveAs(QString fileName = QString(), const bool saveAllPossibleAttributes = false);
|
||||
bool save(const bool saveAllPossibleAttributes = false);
|
||||
bool saveSnapshot();
|
||||
void changeFileExtension(const QString&);
|
||||
|
||||
@ -1633,7 +1633,12 @@ bool MainWindow::openProject(QString fileName, bool append)
|
||||
}
|
||||
|
||||
meshDoc()->setBusy(false);
|
||||
if(this->GLA() == 0) return false;
|
||||
|
||||
// here we update the visibility of all the meshes.
|
||||
// yet another workaround for a problem that would be easy to solve in a well structured
|
||||
// codebase.
|
||||
if(this->GLA() == 0) return false;
|
||||
else GLA()->updateMeshSetVisibilities();
|
||||
|
||||
MultiViewer_Container* mvc = currentViewContainer();
|
||||
if (mvc != NULL)
|
||||
@ -1715,7 +1720,10 @@ void MainWindow::newProject(const QString& projName)
|
||||
{
|
||||
if (gpumeminfo == NULL)
|
||||
return;
|
||||
MultiViewer_Container *mvcont = new MultiViewer_Container(*gpumeminfo,mwsettings.highprecision,mwsettings.perbatchprimitives,mwsettings.minpolygonpersmoothrendering,mdiarea);
|
||||
|
||||
// The parent of mvcont is set to null, because mdiarea->addSubWindow
|
||||
// will put it into a QMDISubWindow that will take ownership
|
||||
MultiViewer_Container *mvcont = new MultiViewer_Container(*gpumeminfo,mwsettings.highprecision,mwsettings.perbatchprimitives,mwsettings.minpolygonpersmoothrendering,nullptr);
|
||||
connect(&mvcont->meshDoc,SIGNAL(meshAdded(int)),this,SLOT(meshAdded(int)));
|
||||
connect(&mvcont->meshDoc,SIGNAL(meshRemoved(int)),this,SLOT(meshRemoved(int)));
|
||||
connect(&mvcont->meshDoc, SIGNAL(documentUpdated()), this, SLOT(documentUpdateRequested()));
|
||||
@ -2276,34 +2284,35 @@ void MainWindow::reload()
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::exportMesh(QString fileName,MeshModel* mod,const bool saveAllPossibleAttributes)
|
||||
bool MainWindow::exportMesh(QString fileName, MeshModel* mod, const bool saveAllPossibleAttributes)
|
||||
{
|
||||
const QStringList& suffixList = PM.outputMeshFormatListDialog();
|
||||
if (fileName.isEmpty()) {
|
||||
//QHash<QString, MeshIOInterface*> allKnownFormats;
|
||||
//PM.LoadFormats( suffixList, allKnownFormats,PluginManager::EXPORT);
|
||||
//QString defaultExt = "*." + mod->suffixName().toLower();
|
||||
QString defaultExt = "*.ply";
|
||||
if (mod == NULL)
|
||||
return false;
|
||||
mod->setMeshModified(false);
|
||||
QString laylabel = "Save \"" + mod->label() + "\" Layer";
|
||||
QFileDialog* saveDialog = new QFileDialog(this,laylabel, lastUsedDirectory.path());
|
||||
//saveDialog->setOption(QFileDialog::DontUseNativeDialog);
|
||||
|
||||
QFileDialog* saveDialog = new QFileDialog(this, laylabel, lastUsedDirectory.path());
|
||||
saveDialog->setNameFilters(suffixList);
|
||||
saveDialog->setAcceptMode(QFileDialog::AcceptSave);
|
||||
saveDialog->setFileMode(QFileDialog::AnyFile);
|
||||
saveDialog->selectFile(fileName);
|
||||
QStringList matchingExtensions=suffixList.filter(defaultExt);
|
||||
|
||||
QString extension = mod->suffixName().toLower();
|
||||
if (extension.isEmpty())
|
||||
extension = "ply";
|
||||
QString defaultExt = "*." + extension;
|
||||
QStringList matchingExtensions = suffixList.filter(defaultExt);
|
||||
if(!matchingExtensions.isEmpty())
|
||||
saveDialog->selectNameFilter(matchingExtensions.last());
|
||||
//connect(saveDialog,SIGNAL(filterSelected(const QString&)),this,SLOT(changeFileExtension(const QString&)));
|
||||
saveDialog->selectNameFilter(matchingExtensions.first());
|
||||
|
||||
saveDialog->selectFile(meshDoc()->mm()->fullName());
|
||||
int dialogRet = saveDialog->exec();
|
||||
if(dialogRet==QDialog::Rejected)
|
||||
return false;
|
||||
fileName=saveDialog->selectedFiles().at(0);
|
||||
fileName = saveDialog->selectedFiles().at(0);
|
||||
QFileInfo fni(fileName);
|
||||
if(fni.suffix().isEmpty()) {
|
||||
QString ext = saveDialog->selectedNameFilter();
|
||||
@ -2439,12 +2448,12 @@ void MainWindow::changeFileExtension(const QString& st)
|
||||
|
||||
bool MainWindow::save(const bool saveAllPossibleAttributes)
|
||||
{
|
||||
return exportMesh(meshDoc()->mm()->fullName(),meshDoc()->mm(),saveAllPossibleAttributes);
|
||||
return exportMesh(meshDoc()->mm()->fullName(), meshDoc()->mm(), saveAllPossibleAttributes);
|
||||
}
|
||||
|
||||
bool MainWindow::saveAs(QString fileName,const bool saveAllPossibleAttributes)
|
||||
bool MainWindow::saveAs(QString fileName, const bool saveAllPossibleAttributes)
|
||||
{
|
||||
return exportMesh(fileName,meshDoc()->mm(),saveAllPossibleAttributes);
|
||||
return exportMesh(fileName, meshDoc()->mm(), saveAllPossibleAttributes);
|
||||
}
|
||||
|
||||
void MainWindow::readViewFromFile(QString const& filename){
|
||||
|
||||
@ -66,7 +66,7 @@ MultiViewer_Container::~MultiViewer_Container()
|
||||
|
||||
//WARNING!!!! Here just the pointer to the MLSceneGLSharedDataContext is destroyed.
|
||||
// The data contained in the GPU gets deallocated in the closeEvent function.
|
||||
delete scenecontext;
|
||||
scenecontext->deleteLater();
|
||||
}
|
||||
|
||||
int MultiViewer_Container::getNextViewerId(){
|
||||
|
||||
@ -25,9 +25,9 @@ void MutualInfo::setBins(unsigned int _nbins) {
|
||||
nbins = _nbins;
|
||||
assert(!(nbins & (nbins-1)));
|
||||
|
||||
if(histo2D) delete []histo2D;
|
||||
if(histoA) delete []histoA;
|
||||
if(histoB) delete []histoB;
|
||||
delete []histo2D;
|
||||
delete []histoA;
|
||||
delete []histoB;
|
||||
histo2D = new unsigned int[nbins*nbins];
|
||||
histoA = new unsigned int[nbins];
|
||||
histoB = new unsigned int[nbins];
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
EditSelectFactory::EditSelectFactory()
|
||||
{
|
||||
editSelect = new QAction(QIcon(":/images/select_face.png"),"Select Faces in a rectagular region", this);
|
||||
editSelect = new QAction(QIcon(":/images/select_face.png"),"Select Faces in a rectangular region", this);
|
||||
editSelectConnected = new QAction(QIcon(":/images/select_face_connected.png"),"Select Connected Components in a region", this);
|
||||
editSelectVert = new QAction(QIcon(":/images/select_vertex.png"),"Select Vertices", this);
|
||||
editSelectArea = new QAction(QIcon(":/images/select_area.png"), "Select Faces/Vertices inside polyline area", this);
|
||||
|
||||
@ -262,7 +262,7 @@ QString ExtraMeshFilterPlugin::pythonFilterName(ActionIDType f) const
|
||||
return tr("meshing_decimation_quadric_edge_collapse_with_texture");
|
||||
case FP_EXPLICIT_ISOTROPIC_REMESHING: return tr("meshing_isotropic_explicit_remeshing");
|
||||
case FP_CLUSTERING: return tr("meshing_decimation_clustering");
|
||||
case FP_REORIENT: return tr("meshing_re_orient_faces_coherentely");
|
||||
case FP_REORIENT: return tr("meshing_re_orient_faces_coherently");
|
||||
case FP_INVERT_FACES: return tr("meshing_invert_face_orientation");
|
||||
case FP_SCALE: return tr("compute_matrix_from_scaling_or_normalization");
|
||||
case FP_CENTER: return tr("compute_matrix_from_translation");
|
||||
@ -308,7 +308,7 @@ QString ExtraMeshFilterPlugin::filterName(ActionIDType filter) const
|
||||
return tr("Simplification: Quadric Edge Collapse Decimation (with texture)");
|
||||
case FP_EXPLICIT_ISOTROPIC_REMESHING: return tr("Remeshing: Isotropic Explicit Remeshing");
|
||||
case FP_CLUSTERING: return tr("Simplification: Clustering Decimation");
|
||||
case FP_REORIENT: return tr("Re-Orient all faces coherentely");
|
||||
case FP_REORIENT: return tr("Re-Orient all faces coherently");
|
||||
case FP_INVERT_FACES: return tr("Invert Faces Orientation");
|
||||
case FP_SCALE: return tr("Transform: Scale, Normalize");
|
||||
case FP_CENTER: return tr("Transform: Translate, Center, set Origin");
|
||||
@ -533,9 +533,22 @@ RichParameterList ExtraMeshFilterPlugin::initParameterList(const QAction * actio
|
||||
|
||||
|
||||
case FP_CLUSTERING:
|
||||
// TODO implement selection
|
||||
maxVal = m.cm.bbox.Diag();
|
||||
parlst.addParam(RichPercentage("Threshold",maxVal*0.01,0,maxVal,"Cell Size", "The size of the cell of the clustering grid. Smaller the cell finer the resulting mesh. For obtaining a very coarse mesh use larger values."));
|
||||
parlst.addParam(RichBool ("Selected",m.cm.sfn>0,"Affect only selected faces","If selected the filter affect only the selected faces"));
|
||||
parlst.addParam(RichPercentage(
|
||||
"Threshold",
|
||||
maxVal * 0.01,
|
||||
0,
|
||||
maxVal,
|
||||
"Cell Size",
|
||||
"The size of the cell of the clustering grid. Smaller the cell finer the resulting "
|
||||
"mesh. For obtaining a very coarse mesh use larger values."));
|
||||
//TODO: implement selection on clustering algorithm
|
||||
// parlst.addParam(RichBool(
|
||||
// "Selected",
|
||||
// m.cm.sfn > 0,
|
||||
// "Affect only selected points/faces",
|
||||
// "If selected the filter affect only the selected points/faces"));
|
||||
break;
|
||||
|
||||
case FP_CYLINDER_UNWRAP:
|
||||
@ -801,7 +814,7 @@ std::map<std::string, QVariant> ExtraMeshFilterPlugin::applyFilter(
|
||||
throw MLException("Mesh has some not 2 manifoldfaces, subdivision surfaces require manifoldness"); // text
|
||||
}
|
||||
|
||||
bool selected = par.getBool("Selected");
|
||||
bool selected = par.getBool("Selected");
|
||||
Scalarm threshold = par.getAbsPerc("Threshold");
|
||||
int iterations = par.getInt("Iterations");
|
||||
|
||||
@ -885,15 +898,19 @@ std::map<std::string, QVariant> ExtraMeshFilterPlugin::applyFilter(
|
||||
|
||||
case FP_CLUSTERING:
|
||||
{
|
||||
// TODO implement selection
|
||||
Scalarm threshold = par.getAbsPerc("Threshold");
|
||||
vcg::tri::Clustering<CMeshO, vcg::tri::AverageColorCell<CMeshO> > ClusteringGrid;
|
||||
ClusteringGrid.Init(m.cm.bbox,100000,threshold);
|
||||
if(m.cm.FN() ==0)
|
||||
vcg::tri::Clustering<CMeshO, vcg::tri::AverageColorCell<CMeshO>> ClusteringGrid(
|
||||
m.cm.bbox, 100000, threshold);
|
||||
if(m.cm.FN() == 0) {
|
||||
ClusteringGrid.AddPointSet(m.cm);
|
||||
else
|
||||
ClusteringGrid.ExtractPointSet(m.cm);
|
||||
}
|
||||
else {
|
||||
ClusteringGrid.AddMesh(m.cm);
|
||||
ClusteringGrid.ExtractMesh(m.cm);
|
||||
}
|
||||
|
||||
ClusteringGrid.ExtractMesh(m.cm);
|
||||
m.updateBoxAndNormals();
|
||||
m.clearDataMask(MeshModel::MM_FACEFACETOPO);
|
||||
} break;
|
||||
|
||||
@ -25,9 +25,9 @@ void MutualInfo::setBins(unsigned int _nbins) {
|
||||
nbins = _nbins;
|
||||
assert(!(nbins & (nbins-1)));
|
||||
|
||||
if(histo2D) delete []histo2D;
|
||||
if(histoA) delete []histoA;
|
||||
if(histoB) delete []histoB;
|
||||
delete []histo2D;
|
||||
delete []histoA;
|
||||
delete []histoB;
|
||||
histo2D = new unsigned int[nbins*nbins];
|
||||
histoA = new unsigned int[nbins];
|
||||
histoB = new unsigned int[nbins];
|
||||
|
||||
@ -140,8 +140,8 @@ RichParameterList QhullPlugin::initParameterList(const QAction* action, const Me
|
||||
RichParameterList parlst;
|
||||
switch (ID(action)) {
|
||||
case FP_QHULL_CONVEX_HULL: {
|
||||
// parlst.addParam(RichBool("reorient", false,"Re-orient all faces coherentely","Re-orient
|
||||
// all faces coherentely"));
|
||||
// parlst.addParam(RichBool("reorient", false,"Re-orient all faces coherently","Re-orient
|
||||
// all faces coherently"));
|
||||
break;
|
||||
}
|
||||
case FP_QHULL_VORONOI_FILTERING: {
|
||||
@ -214,7 +214,7 @@ RichParameterList QhullPlugin::initParameterList(const QAction* action, const Me
|
||||
"Show a triangulation of the visible points",
|
||||
"Show a triangulation of the visible points"));
|
||||
// parlst.addParam(RichBool("reorient", false,"Re-orient all faces of the CH
|
||||
// coherentely","Re-orient all faces of the CH coherentely."
|
||||
// coherently","Re-orient all faces of the CH coherently."
|
||||
// "If no Convex Hulls are selected , this value is ignored"));
|
||||
break;
|
||||
break;
|
||||
|
||||
@ -998,9 +998,9 @@ std::map<std::string, QVariant> FilterDocSampling::applyFilter(
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
tri::Clustering<CMeshO, vcg::tri::AverageColorCell<CMeshO> > ClusteringGrid;
|
||||
ClusteringGrid.Init(curMM->cm.bbox,100000,threshold);
|
||||
ClusteringGrid.AddPointSet(curMM->cm,selected);
|
||||
tri::Clustering<CMeshO, vcg::tri::AverageColorCell<CMeshO>> ClusteringGrid(
|
||||
curMM->cm.bbox, 100000, threshold);
|
||||
ClusteringGrid.AddPointSet(curMM->cm, selected);
|
||||
ClusteringGrid.ExtractPointSet(mm->cm);
|
||||
ClusteringGrid.SelectPointSet(curMM->cm);
|
||||
tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(curMM->cm);
|
||||
@ -1009,8 +1009,8 @@ std::map<std::string, QVariant> FilterDocSampling::applyFilter(
|
||||
|
||||
case 1 :
|
||||
{
|
||||
vcg::tri::Clustering<CMeshO, vcg::tri::NearestToCenter<CMeshO> > ClusteringGrid;
|
||||
ClusteringGrid.Init(curMM->cm.bbox,100000,threshold);
|
||||
vcg::tri::Clustering<CMeshO, vcg::tri::NearestToCenter<CMeshO>> ClusteringGrid(
|
||||
curMM->cm.bbox, 100000, threshold);
|
||||
ClusteringGrid.AddPointSet(curMM->cm,selected);
|
||||
ClusteringGrid.SelectPointSet(curMM->cm);
|
||||
tri::UpdateSelection<CMeshO>::FaceFromVertexLoose(curMM->cm);
|
||||
|
||||
@ -29,15 +29,6 @@
|
||||
#include "import_3ds.h"
|
||||
#include <wrap/io_trimesh/export_3ds.h>
|
||||
|
||||
#include <wrap/io_trimesh/export_obj.h>
|
||||
#include <wrap/io_trimesh/export_vrml.h>
|
||||
#include <wrap/io_trimesh/export_dxf.h>
|
||||
|
||||
#include <wrap/io_trimesh/import_obj.h>
|
||||
#include <wrap/io_trimesh/import_off.h>
|
||||
#include <wrap/io_trimesh/import_ptx.h>
|
||||
|
||||
#include <wrap/io_trimesh/export.h>
|
||||
#include <wrap/io_trimesh/io_mask.h>
|
||||
|
||||
#include <QFile>
|
||||
|
||||
@ -27,6 +27,4 @@ set(SOURCES
|
||||
|
||||
add_meshlab_plugin(io_base ${SOURCES} ${HEADERS})
|
||||
|
||||
#target_include_directories(io_base PRIVATE ${EXTERNAL_DIR}/easyexif/)
|
||||
|
||||
target_link_libraries(io_base PRIVATE OpenGL::GLU)
|
||||
|
||||
@ -1,18 +1,27 @@
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
|
||||
# Only build if we have u3d
|
||||
if(TARGET IDTF-to-U3D-converter)
|
||||
if(TARGET IDTF)
|
||||
# IDTF to U3D converter loads some dll/so files at runtime, thar may be placed in different
|
||||
# places, depending on:
|
||||
# - build or deploy stage
|
||||
# - operative system
|
||||
# The default paths are set for deploy stage (OS is detected automatically).
|
||||
# If you are building (not deploying) MeshLab and you want to test the U3D exporter, enable this
|
||||
# option.
|
||||
# Without enabling this option, the U3D exporter WILL NOT WORK ON BUILD STAGE.
|
||||
option(MESHLAB_U3D_BUILD_MODE "If you need to test u3d exporter in build mode (not deploy), enable this" OFF)
|
||||
|
||||
set(SOURCES io_u3d.cpp)
|
||||
|
||||
set(HEADERS io_u3d.h)
|
||||
|
||||
add_meshlab_plugin(io_u3d ${SOURCES} ${HEADERS})
|
||||
target_link_libraries(io_u3d PUBLIC IDTF)
|
||||
|
||||
target_link_libraries(io_u3d PUBLIC IDTF-to-U3D-converter IFXCoreStatic ${CMAKE_DL_LIBS})
|
||||
|
||||
if(MESHLAB_U3D_BUILD_MODE)
|
||||
target_compile_definitions(io_u3d PRIVATE BUILD_MODE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Skipping io_u3d - missing u3d in external directory.")
|
||||
endif()
|
||||
|
||||
@ -33,12 +33,66 @@
|
||||
#include <wrap/io_trimesh/io_mask.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include "Converter.h"
|
||||
#include <IDTF/Converter.h>
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif //_GNU_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
/**
|
||||
* @brief returns the path of the shared object file that contains this function, which is
|
||||
* the path where the shared object (libio_u3d.so) is placed in the system.
|
||||
*/
|
||||
std::string getLibPath()
|
||||
{
|
||||
Dl_info dlInfo;
|
||||
dladdr((void*)getLibPath, &dlInfo);
|
||||
if (dlInfo.dli_sname != NULL && dlInfo.dli_saddr != NULL) {
|
||||
// the full path, included libio_u3d.so
|
||||
std::string path = dlInfo.dli_fname;
|
||||
// remove from the path everything after the last occurrence of '/'
|
||||
path = path.substr(0, path.find_last_of('/'));
|
||||
return path;
|
||||
}
|
||||
else {
|
||||
return std::string(".");
|
||||
}
|
||||
}
|
||||
#elif _WIN32
|
||||
|
||||
#include "Windows.h"
|
||||
|
||||
std::string getLibPath()
|
||||
{
|
||||
char cstr[2048] = ".";
|
||||
HMODULE hm = NULL;
|
||||
|
||||
auto res = GetModuleHandleEx(
|
||||
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
|
||||
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||
(LPCSTR) &getLibPath,
|
||||
&hm);
|
||||
|
||||
if (res != 0) {
|
||||
GetModuleFileName(hm, cstr, sizeof(cstr));
|
||||
}
|
||||
std::string path(cstr);
|
||||
std::replace(path.begin(), path.end(), '\\', '/');
|
||||
path = path.substr(0, path.find_last_of('/'));
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace vcg;
|
||||
|
||||
|
||||
U3DIOPlugin::U3DIOPlugin() :
|
||||
QObject(), IOPlugin()
|
||||
{
|
||||
@ -63,6 +117,21 @@ void U3DIOPlugin::save(
|
||||
const RichParameterList & par,
|
||||
vcg::CallBackPos *)
|
||||
{
|
||||
#ifdef _WIN32 // on windows, path is the same regardless BUILD_MODE
|
||||
const std::string LIB_IDTF_PATH = getLibPath() + "/..";
|
||||
#else //_WIN32
|
||||
#ifdef BUILD_MODE
|
||||
// same position wrt plugin dir on linux and macos
|
||||
const std::string LIB_IDTF_PATH = getLibPath() + "/../../external/downloads/u3d-1.5.1";
|
||||
#else // BUILD_MODE
|
||||
#ifdef __APPLE__
|
||||
const std::string LIB_IDTF_PATH = getLibPath() + "/../Frameworks";
|
||||
#else // linux
|
||||
const std::string LIB_IDTF_PATH = getLibPath() + "/..";
|
||||
#endif
|
||||
#endif // BUILD_MODE
|
||||
#endif //_WIN32
|
||||
|
||||
vcg::tri::Allocator<CMeshO>::CompactVertexVector(m.cm);
|
||||
vcg::tri::Allocator<CMeshO>::CompactFaceVector(m.cm);
|
||||
|
||||
@ -70,7 +139,6 @@ void U3DIOPlugin::save(
|
||||
string filename = QFile::encodeName(fileName).constData();
|
||||
std::string ex = formatName.toUtf8().data();
|
||||
|
||||
|
||||
QStringList textures_to_be_restored;
|
||||
QStringList lst =
|
||||
vcg::tri::io::ExporterIDTF<CMeshO>::convertInTGATextures(
|
||||
@ -82,7 +150,7 @@ void U3DIOPlugin::save(
|
||||
m.cm.bbox.Center(),m.cm.bbox.Diag());
|
||||
saveParameters(par, _param);
|
||||
QSettings settings;
|
||||
|
||||
|
||||
//tmp idtf
|
||||
QString tmp(QDir::tempPath());
|
||||
QString curr = QDir::currentPath();
|
||||
@ -94,12 +162,17 @@ void U3DIOPlugin::save(
|
||||
|
||||
//conversion from idtf to u3d
|
||||
int resCode = 0;
|
||||
bool result = IDTFConverter::IDTFToU3d(tmp.toStdString(), filename, resCode, _param.positionQuality);
|
||||
bool result = IDTFConverter::IDTFToU3d(
|
||||
tmp.toStdString(),
|
||||
filename,
|
||||
resCode,
|
||||
LIB_IDTF_PATH,
|
||||
_param.positionQuality);
|
||||
|
||||
if(result==false) {
|
||||
throw MLException("Error saving " + QString::fromStdString(filename) + ": \n" + vcg::tri::io::ExporterU3D<CMeshO>::ErrorMsg(resCode) + " (" + QString::number(resCode) + ")");
|
||||
}
|
||||
|
||||
|
||||
//saving latex:
|
||||
QDir::setCurrent(curr);
|
||||
QString lat (fileName);
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 66a3b42a3e3a56bb3aa09699147d1bc587972551
|
||||
Subproject commit faa2e4337c25470e6d47473e0ffbdf36e6acd4bd
|
||||
Loading…
x
Reference in New Issue
Block a user