1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

5 Commits

Author SHA1 Message Date
dkulikov
63915ac011 Duplicate cleaner is added to STEP writers. 2025-04-03 11:39:03 +01:00
dkulikov
709412d78a Fixing remarks 2025-04-03 11:06:07 +01:00
dkulikov
d39110dda6 Fixed broken compilation with clang/gcc 2025-04-02 16:19:52 +01:00
dkulikov
2d6e876392 Format fix 2025-04-02 16:02:50 +01:00
dkulikov
652c3f1da9 Step Export - Graph optimization (decrease the file size) #190
Functionality to remove duplicate entities from Step graph is added.
Class MergeSTEPEntities_Merger is main entry point.
Class MergeSTEPEntities_EntityProcessor implements the basic replacement
logic.
Children of MergeSTEPEntities_EntityProcessor implement the logic for
the replacement of particular step entity.

Google tests are added for new classes.
2025-04-02 15:50:20 +01:00
906 changed files with 14279 additions and 31102 deletions

View File

@@ -1,95 +0,0 @@
name: 'ASCII Code Check'
description: 'Check for non-ASCII characters in changed code files'
inputs:
base-ref:
description: 'Base reference to compare changes against'
required: true
default: 'master'
file-pattern:
description: 'Pattern to match files for ASCII check'
required: false
default: '^(src)/.*\.(cpp|hxx|cxx|lxx|h|pxx|hpp)$'
outputs:
has-non-ascii:
description: 'Whether any files contained non-ASCII characters'
value: ${{ steps.ascii-check.outputs.has_non_ascii }}
runs:
using: "composite"
steps:
- name: Get changed files
id: changed-files
shell: pwsh
run: |
$changedFiles = git diff --name-only origin/${{ inputs.base-ref }} HEAD |
Where-Object { $_ -match '${{ inputs.file-pattern }}' } |
Where-Object { Test-Path $_ }
$changedFiles | Set-Content "changed_files.txt"
if ($changedFiles.Count -gt 0) {
echo "has_files=true" >> $env:GITHUB_OUTPUT
}
- name: Check for non-ASCII characters
id: ascii-check
if: steps.changed-files.outputs.has_files == 'true'
shell: pwsh
run: |
$hasNonAscii = $false
$nonAsciiLogs = @()
$files = Get-Content "changed_files.txt" | Where-Object { Test-Path $_ }
foreach ($file in $files) {
Write-Output "Checking file: $file"
$fileContent = Get-Content -Path $file -Raw
$lineNumber = 1
$nonAsciiInFile = $false
foreach ($line in ($fileContent -split "`n")) {
# Find non-ASCII characters (char code > 127)
$nonAsciiMatches = [regex]::Matches($line, "[^\x00-\x7F]")
if ($nonAsciiMatches.Count -gt 0) {
$nonAsciiInFile = $true
$hasNonAscii = $true
foreach ($match in $nonAsciiMatches) {
$charCode = [int][char]$match.Value
$hexCode = "0x{0:X}" -f $charCode
$positionInLine = $match.Index + 1
$message = "Non-ASCII character found in '$file' at line $lineNumber, position $($positionInLine): '$($match.Value)' (Unicode: $hexCode)"
$nonAsciiLogs += $message
Write-Output $message
}
}
$lineNumber++
}
if ($nonAsciiInFile) {
Write-Output "::warning file=$file::File contains non-ASCII characters"
}
}
$nonAsciiLogs | Set-Content "non_ascii_report.txt"
if ($hasNonAscii) {
echo "has_non_ascii=true" >> $env:GITHUB_OUTPUT
}
- name: Upload non-ASCII report
if: steps.ascii-check.outputs.has_non_ascii == 'true'
uses: actions/upload-artifact@v4.6.2
with:
name: non-ascii-report
path: non_ascii_report.txt
- name: Failing step for non-ASCII issues
if: steps.ascii-check.outputs.has_non_ascii == 'true'
shell: pwsh
run: |
Write-Output "::error::Files contain non-ASCII characters. See the non-ascii-report artifact for details."
exit 1
branding:
icon: 'alert-circle'
color: 'red'

View File

@@ -10,31 +10,38 @@ runs:
choco install -y doxygen.install
shell: pwsh
- name: Download and extract 3rdparty dependencies
run: |
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/3rdparty-vc14-64.zip -OutFile 3rdparty-vc14-64.zip
Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath .
Remove-Item 3rdparty-vc14-64.zip
shell: pwsh
- name: Configure OCCT
run: |
mkdir build
cd build
cmake -T host=x64 `
-D USE_FREETYPE=ON `
-D USE_TK=OFF `
-D BUILD_USE_PCH=ON `
-D BUILD_OPT_PROFILE=Production `
-D BUILD_INCLUDE_SYMLINK=ON `
-D CMAKE_BUILD_TYPE=Release `
-D BUILD_DOC_Overview=ON `
-D BUILD_DOC_RefMan=ON `
-D BUILD_MODULE_Draw=OFF `
-D USE_D3D=OFF `
-D USE_DRACO=OFF `
-D USE_FFMPEG=OFF `
-D USE_FREEIMAGE=OFF `
-D USE_GLES2=OFF `
-D USE_OPENVR=OFF `
-D USE_VTK=OFF `
-D USE_TBB=OFF `
-D USE_RAPIDJSON=OFF `
-D USE_OPENGL=OFF `
-D USE_FREETYPE=OFF `
-D USE_TK=OFF `
-D USE_TCL=OFF `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D USE_D3D=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=ON `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=ON `
-D USE_TBB=ON `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D CMAKE_CXX_FLAGS="/W4 /WX" `
-D CMAKE_C_FLAGS="/W4 /WX" ..
shell: pwsh
@@ -47,14 +54,14 @@ runs:
shell: cmd
- name: Upload refman documentation
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4.4.3
with:
name: refman-doc
path: build/doc/refman
retention-days: 90
- name: Upload overview documentation
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4.4.3
with:
name: overview-doc
path: build/doc/overview

View File

@@ -1,85 +0,0 @@
name: 'Build OCCT'
description: 'Prepare and build OCCT on a specific platform'
inputs:
platform:
description: 'Platform (windows, macos, linux)'
required: true
compiler:
description: 'Compiler (msvc, clang, gcc)'
required: true
artifact-name:
description: 'Name of the artifact to store build results'
required: true
additional-cmake-flags:
description: 'Additional CMake flags'
required: false
default: ''
use-vtk:
description: 'Enable VTK'
required: false
default: 'true'
build-use-pch:
description: 'Enable precompiled headers'
required: false
default: 'true'
build-opt-profile:
description: 'Build optimization profile'
required: false
default: 'Production'
cmake-build-type:
description: 'CMake build type (Release, Debug, etc)'
required: false
default: 'Release'
github-token:
description: 'GitHub token for vcpkg NuGet package access'
required: true
runs:
using: "composite"
steps:
- name: Configure OCCT
uses: ./.github/actions/configure-occt
with:
platform: ${{ inputs.platform }}
compiler: ${{ inputs.compiler }}
additional-cmake-flags: ${{ inputs.additional-cmake-flags }}
use-vtk: ${{ inputs.use-vtk }}
build-use-pch: ${{ inputs.build-use-pch }}
build-opt-profile: ${{ inputs.build-opt-profile }}
cmake-build-type: ${{ inputs.cmake-build-type }}
github-token: ${{ inputs.github-token }}
- name: Upload vcpkg cache
uses: ./.github/actions/upload-vcpkg-cache
with:
artifact-name: ${{ inputs.artifact-name }}-cache
build-directory: build
- name: Build OCCT (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
cd build
cmake --build . --target install --config Release
shell: pwsh
- name: Build OCCT (macOS)
if: ${{ inputs.platform == 'macos' }}
run: |
cd build
make install -j$(sysctl -n hw.logicalcpu)
shell: bash
- name: Build OCCT (Linux)
if: ${{ inputs.platform == 'linux' }}
run: |
cd build
cmake --build . --target install --config Release -- -j
shell: bash
- name: Upload install directory
uses: actions/upload-artifact@v4.6.2
with:
name: ${{ inputs.artifact-name }}
path: install
retention-days: 7

View File

@@ -13,7 +13,7 @@ runs:
using: "composite"
steps:
- name: Download OCCT installation
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v4.1.7
with:
name: ${{ inputs.install-artifact-name }}
path: occt-install
@@ -50,7 +50,7 @@ runs:
msbuild.exe CSharp_D3D.sln /p:Configuration=Release /p:Platform=x64 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=build_d3d.log;Verbosity=detailed /m
- name: Upload CSharp Sample
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4.4.3
with:
name: csharp-sample-${{ inputs.platform }}-x64
path: samples/CSharp

View File

@@ -13,7 +13,7 @@ runs:
using: "composite"
steps:
- name: Download OCCT installation
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v4.1.7
with:
name: ${{ inputs.install-artifact-name }}
path: occt-install
@@ -47,7 +47,7 @@ runs:
)
- name: Upload MFC Sample
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4.4.3
with:
name: mfc-sample-${{ inputs.platform }}-x64
path: samples/mfc/

View File

@@ -17,16 +17,11 @@ runs:
using: "composite"
steps:
- name: Download OCCT installation
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v4.1.7
with:
name: ${{ inputs.install-artifact-name }}
path: occt-install
- name: Download vcpkg cache
uses: ./.github/actions/download-vcpkg-cache
with:
artifact-name: ${{ inputs.install-artifact-name }}-cache
- name: Install Windows dependencies
if: inputs.platform == 'windows'
shell: pwsh
@@ -89,12 +84,6 @@ runs:
run: |
cd ${{ github.workspace }}/occt-install/bin
source env.sh
# Set library paths for vcpkg dependencies
export LD_LIBRARY_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib:${{ github.workspace }}/occt-install/lib:$LD_LIBRARY_PATH"
export LIBRARY_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib:${{ github.workspace }}/occt-install/lib:$LIBRARY_PATH"
export PKG_CONFIG_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib/pkgconfig:$PKG_CONFIG_PATH"
cd ${{ github.workspace }}/samples/qt
for sample in IESample Tutorial FuncDemo; do
@@ -103,20 +92,14 @@ runs:
host=`uname -s`
export STATION=$host
export RES_DIR="${{ github.workspace }}/samples/qt/${sample}/result"
# Configure qmake with vcpkg paths
qmake $sample.pro \
"LIBS += -L${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib" \
"LIBS += -Wl,-rpath,${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib" \
"INCLUDEPATH += ${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/include"
qmake $sample.pro
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
make -j$aNbJobs release
cd ..
done
- name: Upload Qt Samples
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4.4.3
with:
name: qt-samples-${{ inputs.platform }}-x64
path: |

View File

@@ -17,16 +17,11 @@ runs:
using: "composite"
steps:
- name: Download OCCT installation
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v4.1.7
with:
name: ${{ inputs.install-artifact-name }}
path: occt-install
- name: Download vcpkg cache
uses: ./.github/actions/download-vcpkg-cache
with:
artifact-name: ${{ inputs.install-artifact-name }}-cache
- name: Install Windows dependencies
if: inputs.platform == 'windows'
shell: pwsh
@@ -45,7 +40,7 @@ runs:
run: |
git clone https://github.com/Open-Cascade-SAS/Inspector.git inspector
cd inspector
git checkout 0757c9bbe4d856a9cd26a62a453fc31879d9d054
git checkout 6da9ba776ef72a17dca3331974df4200024c7f34
- name: Configure TInspector - Windows
if: inputs.platform == 'windows'
@@ -60,7 +55,6 @@ runs:
-D 3RDPARTY_DIR=${{ github.workspace }}//3rdparty-vc14-64 `
-D OpenCASCADE_DIR=${{ github.workspace }}/occt-install `
-D INSTALL_DIR=${{ github.workspace }}/inspector/install `
-D CMAKE_POLICY_VERSION_MINIMUM=3.5 `
..
- name: Configure TInspector - Linux
@@ -70,17 +64,11 @@ runs:
cd inspector
mkdir build
cd build
export LD_LIBRARY_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib:${{ github.workspace }}/occt-install/lib:$LD_LIBRARY_PATH"
cmake -G "Unix Makefiles" \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=ON \
-D OpenCASCADE_DIR=${{ github.workspace }}/occt-install \
-D INSTALL_DIR=${{ github.workspace }}/inspector/install \
-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
-D CMAKE_LIBRARY_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib" \
-D CMAKE_INCLUDE_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/include" \
-D CMAKE_EXE_LINKER_FLAGS="-L${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib -Wl,-rpath,${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib" \
-D CMAKE_SHARED_LINKER_FLAGS="-L${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib -Wl,-rpath,${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib" \
..
- name: Build TInspector - Windows
@@ -95,14 +83,10 @@ runs:
shell: bash
run: |
cd inspector/build
# Set library paths for build and runtime
export LD_LIBRARY_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib:${{ github.workspace }}/occt-install/lib:$LD_LIBRARY_PATH"
export LIBRARY_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib:${{ github.workspace }}/occt-install/lib:$LIBRARY_PATH"
export PKG_CONFIG_PATH="${{ github.workspace }}/build/vcpkg_installed/x64-linux-dynamic/lib/pkgconfig:$PKG_CONFIG_PATH"
make install -j$(nproc)
- name: Upload TInspector installation
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4.4.3
with:
name: inspector-${{ inputs.platform }}-x64
path: inspector/install

View File

@@ -68,7 +68,7 @@ runs:
- name: Upload patch
if: steps.git-check.outputs.has_changes == 'true'
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4
with:
name: format-patch
path: format.patch

View File

@@ -1,83 +0,0 @@
name: 'CMake Basic Build'
description: 'Configure and build OCCT with basic configuration'
inputs:
generator:
description: 'CMake generator'
required: true
default: 'Ninja'
cc:
description: 'C compiler'
required: true
cxx:
description: 'C++ compiler'
required: true
build-type:
description: 'Build type (Debug, Release)'
required: false
default: 'Release'
compiler-flags:
description: 'Additional compiler flags'
required: false
default: ''
thirdparty-dir:
description: '3rd party directory'
required: false
default: ''
shell-type:
description: 'Shell type to use (powershell, msys2, bash)'
required: false
default: 'auto'
runs:
using: "composite"
steps:
- name: Configure basic build (Unix/MSYS2)
if: runner.os != 'Windows' || inputs.shell-type == 'msys2'
run: |
mkdir -p build
cd build
cmake -G "${{ inputs.generator }}" \
-D CMAKE_C_COMPILER=${{ inputs.cc }} \
-D CMAKE_CXX_COMPILER=${{ inputs.cxx }} \
${{ inputs.thirdparty-dir != '' && format('-D 3RDPARTY_DIR={0}', inputs.thirdparty-dir) || '' }} \
-D CMAKE_BUILD_TYPE=${{ inputs.build-type }} \
${{ inputs.compiler-flags }} ..
shell: ${{ inputs.shell-type == 'msys2' && 'msys2 {0}' || 'bash' }}
- name: Configure basic build (Windows PowerShell)
if: runner.os == 'Windows' && inputs.shell-type != 'msys2'
run: |
mkdir build
cd build
cmake -G "${{ inputs.generator }}" `
-D CMAKE_C_COMPILER=${{ inputs.cc }} `
-D CMAKE_CXX_COMPILER=${{ inputs.cxx }} `
${{ inputs.thirdparty-dir != '' && format('-D 3RDPARTY_DIR={0}', inputs.thirdparty-dir) || '' }} `
-D CMAKE_BUILD_TYPE=${{ inputs.build-type }} `
${{ inputs.compiler-flags }} ..
shell: pwsh
- name: Build basic (Unix/MSYS2)
if: runner.os != 'Windows' || inputs.shell-type == 'msys2'
run: |
cd build
cmake --build . --config ${{ inputs.build-type }} -- -j 4
shell: ${{ inputs.shell-type == 'msys2' && 'msys2 {0}' || 'bash' }}
- name: Build basic (Windows PowerShell)
if: runner.os == 'Windows' && inputs.shell-type != 'msys2'
run: |
cd build
cmake --build . --config ${{ inputs.build-type }}
shell: pwsh
- name: Clean up build (Unix/MSYS2)
if: runner.os != 'Windows' || inputs.shell-type == 'msys2'
run: rm -rf build
shell: ${{ inputs.shell-type == 'msys2' && 'msys2 {0}' || 'bash' }}
- name: Clean up build (Windows PowerShell)
if: runner.os == 'Windows' && inputs.shell-type != 'msys2'
run: Remove-Item -Recurse -Force build
shell: pwsh

View File

@@ -1,149 +0,0 @@
name: 'CMake Full Build'
description: 'Configure and build OCCT with full configuration (shared/static)'
inputs:
generator:
description: 'CMake generator'
required: true
default: 'Ninja'
cc:
description: 'C compiler'
required: true
cxx:
description: 'C++ compiler'
required: true
build-type:
description: 'Build type (Debug, Release)'
required: false
default: 'Release'
library-type:
description: 'Library type (Shared, Static)'
required: false
default: 'Shared'
opt-profile:
description: 'Optimization profile (Production, Default)'
required: false
default: 'Production'
compiler-flags:
description: 'Additional compiler flags'
required: false
default: ''
thirdparty-dir:
description: '3rd party directory'
required: false
default: ''
rapidjson-dir:
description: 'RapidJSON directory'
required: false
default: ''
use-vtk:
description: 'Enable VTK'
required: false
default: 'ON'
use-tbb:
description: 'Enable TBB'
required: false
default: 'ON'
with-debug:
description: 'Enable BUILD_WITH_DEBUG'
required: false
default: 'OFF'
shell-type:
description: 'Shell type to use (powershell, msys2, bash)'
required: false
default: 'auto'
runs:
using: "composite"
steps:
- name: Configure full build (Unix/MSYS2)
if: runner.os != 'Windows' || inputs.shell-type == 'msys2'
run: |
mkdir -p build
cd build
cmake -G "${{ inputs.generator }}" \
-D CMAKE_C_COMPILER=${{ inputs.cc }} \
-D CMAKE_CXX_COMPILER=${{ inputs.cxx }} \
${{ inputs.thirdparty-dir != '' && format('-D 3RDPARTY_DIR={0}', inputs.thirdparty-dir) || '' }} \
${{ inputs.rapidjson-dir != '' && format('-D 3RDPARTY_RAPIDJSON_DIR={0}', inputs.rapidjson-dir) || '' }} \
-D BUILD_USE_PCH=OFF \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=${{ inputs.opt-profile }} \
-D BUILD_LIBRARY_TYPE=${{ inputs.library-type }} \
${{ inputs.with-debug == 'ON' && '-D BUILD_WITH_DEBUG=ON' || '' }} \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ inputs.build-type }} \
-D USE_MMGR_TYPE=JEMALLOC \
-D INSTALL_DIR=${{ github.workspace }}/install-${{ inputs.build-type }} \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=${{ inputs.use-vtk }} \
-D USE_TBB=${{ inputs.use-tbb }} \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
${{ inputs.compiler-flags }} ..
shell: ${{ inputs.shell-type == 'msys2' && 'msys2 {0}' || 'bash' }}
- name: Configure full build (Windows PowerShell)
if: runner.os == 'Windows' && inputs.shell-type != 'msys2'
run: |
mkdir build
cd build
cmake -G "${{ inputs.generator }}" `
-D CMAKE_C_COMPILER=${{ inputs.cc }} `
-D CMAKE_CXX_COMPILER=${{ inputs.cxx }} `
${{ inputs.thirdparty-dir != '' && format('-D 3RDPARTY_DIR={0}', inputs.thirdparty-dir) || '' }} `
${{ inputs.rapidjson-dir != '' && format('-D 3RDPARTY_RAPIDJSON_DIR={0}', inputs.rapidjson-dir) || '' }} `
-D BUILD_USE_PCH=OFF `
-D BUILD_INCLUDE_SYMLINK=ON `
-D BUILD_OPT_PROFILE=${{ inputs.opt-profile }} `
-D BUILD_LIBRARY_TYPE=${{ inputs.library-type }} `
${{ inputs.with-debug == 'ON' && '-D BUILD_WITH_DEBUG=ON' || '' }} `
-D USE_TK=ON `
-D CMAKE_BUILD_TYPE=${{ inputs.build-type }} `
-D USE_MMGR_TYPE=JEMALLOC `
-D INSTALL_DIR=${{ github.workspace }}/install-${{ inputs.build-type }} `
-D USE_FREETYPE=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=OFF `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=${{ inputs.use-vtk }} `
-D USE_TBB=${{ inputs.use-tbb }} `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
${{ inputs.compiler-flags }} ..
shell: pwsh
- name: Build full (Unix/MSYS2)
if: runner.os != 'Windows' || inputs.shell-type == 'msys2'
run: |
cd build
cmake --build . --target install --config ${{ inputs.build-type }} -- -j 4
shell: ${{ inputs.shell-type == 'msys2' && 'msys2 {0}' || 'bash' }}
- name: Build full (Windows PowerShell)
if: runner.os == 'Windows' && inputs.shell-type != 'msys2'
run: |
cd build
cmake --build . --target install --config ${{ inputs.build-type }}
shell: pwsh
- name: Clean up build (Unix/MSYS2)
if: runner.os != 'Windows' || inputs.shell-type == 'msys2'
run: |
rm -rf build
rm -rf ${{ github.workspace }}/install-${{ inputs.build-type }}
shell: ${{ inputs.shell-type == 'msys2' && 'msys2 {0}' || 'bash' }}
- name: Clean up build (Windows PowerShell)
if: runner.os == 'Windows' && inputs.shell-type != 'msys2'
run: |
Remove-Item -Recurse -Force build
Remove-Item -Recurse -Force ${{ github.workspace }}/install-${{ inputs.build-type }}
shell: pwsh

View File

@@ -1,169 +0,0 @@
name: 'Configure OCCT'
description: 'Setup vcpkg and configure OCCT on a specific platform without building'
inputs:
platform:
description: 'Platform (windows, macos, linux)'
required: true
compiler:
description: 'Compiler (msvc, clang, gcc)'
required: true
additional-cmake-flags:
description: 'Additional CMake flags'
required: false
default: ''
use-vtk:
description: 'Enable VTK'
required: false
default: 'true'
build-use-pch:
description: 'Enable precompiled headers'
required: false
default: 'true'
build-opt-profile:
description: 'Build optimization profile'
required: false
default: 'Production'
cmake-build-type:
description: 'CMake build type (Release, Debug, etc)'
required: false
default: 'Release'
github-token:
description: 'GitHub token for vcpkg NuGet package access'
required: true
runs:
using: "composite"
steps:
- name: Setup vcpkg
uses: ./.github/actions/vcpkg-setup
with:
github-token: ${{ inputs.github-token }}
- name: Download and extract Mesa3D (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
curl -L -o mesa3d.7z https://github.com/pal1000/mesa-dist-win/releases/download/24.3.2/mesa3d-24.3.2-release-mingw.7z
7z x mesa3d.7z -omesa3d
shell: pwsh
- name: Run system-wide deployment (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
cd mesa3d
.\systemwidedeploy.cmd 1
.\systemwidedeploy.cmd 5
shell: cmd
- name: Install dependencies (Linux)
if: ${{ inputs.platform == 'linux' }}
run: sudo apt-get update && sudo apt-get install -y cmake ${{ inputs.compiler == 'clang' && 'clang' || 'gcc g++' }} make libglu1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev
shell: bash
- name: Install required packages (macOS)
if: ${{ inputs.platform == 'macos' }}
run: |
brew update || true
# temporary workaround for missing tcl-tk
brew install tcl-tk || true
# Force link any conflicting packages
brew link --overwrite python@3.12 || true
brew link --overwrite python@3.13 || true
shell: bash
- name: Configure OCCT (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
mkdir build
cd build
cmake -T ${{ inputs.compiler == 'msvc' && 'host=x64' || 'ClangCL' }} `
-D USE_FREETYPE=ON `
-D USE_TK=ON `
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} `
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} `
-D BUILD_INCLUDE_SYMLINK=ON `
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D BUILD_USE_VCPKG=ON `
-D VCPKG_TARGET_TRIPLET=x64-windows `
-D USE_D3D=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=ON `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=${{ inputs.use-vtk }} `
-D USE_TBB=ON `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D BUILD_GTEST=ON `
-D BUILD_CPP_STANDARD=C++17 `
-D INSTALL_GTEST=ON `
${{ inputs.additional-cmake-flags }} ..
echo "Configuration completed successfully for Windows"
shell: pwsh
- name: Configure OCCT (macOS)
if: ${{ inputs.platform == 'macos' }}
run: |
mkdir -p build
cd build
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
-D BUILD_INCLUDE_SYMLINK=ON \
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \
-D INSTALL_DIR=${{ github.workspace }}/install \
-D BUILD_USE_VCPKG=ON \
-D VCPKG_TARGET_TRIPLET=arm64-osx-dynamic \
-D USE_RAPIDJSON=ON \
-D USE_DRACO=ON \
-D USE_FREETYPE=ON \
-D USE_OPENGL=ON \
-D USE_FREEIMAGE=ON \
-D BUILD_GTEST=ON \
-D BUILD_CPP_STANDARD=C++17 \
-D INSTALL_GTEST=ON \
-D CMAKE_CXX_FLAGS="-Werror -Wall -Wextra" \
${{ inputs.additional-cmake-flags }} ..
echo "Configuration completed successfully for macOS"
shell: bash
- name: Configure OCCT (Linux)
if: ${{ inputs.platform == 'linux' }}
run: |
mkdir -p build
cd build
# Set environment to help vcpkg find system libraries
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH"
export CMAKE_PREFIX_PATH="/usr:/usr/local:$CMAKE_PREFIX_PATH"
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=${{ inputs.compiler == 'clang' && 'clang' || 'gcc' }} \
-D CMAKE_CXX_COMPILER=${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }} \
-D BUILD_USE_PCH=${{ inputs.build-use-pch }} \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=${{ inputs.build-opt-profile }} \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ inputs.cmake-build-type }} \
-D INSTALL_DIR=${{ github.workspace }}/install \
-D BUILD_USE_VCPKG=ON \
-D BUILD_LIBRARY_TYPE=Shared \
-D VCPKG_TARGET_TRIPLET=x64-linux-dynamic \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=ON \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=${{ inputs.use-vtk }} \
-D USE_TBB=ON \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
-D BUILD_GTEST=ON \
-D BUILD_CPP_STANDARD=C++17 \
-D INSTALL_GTEST=ON \
${{ inputs.additional-cmake-flags }} ..
echo "Configuration completed successfully for Linux"
shell: bash

View File

@@ -1,79 +0,0 @@
name: 'Download vcpkg Cache'
description: 'Download and restore vcpkg installed packages and cache'
inputs:
artifact-name:
description: 'Name of the artifact containing vcpkg cache'
required: true
build-directory:
description: 'Build directory where vcpkg_installed should be restored'
required: false
default: 'build'
runs:
using: "composite"
steps:
- name: Download vcpkg tar archive
uses: actions/download-artifact@v4.3.0
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.build-directory }}
- name: Extract vcpkg dependencies
run: |
cd ${{ inputs.build-directory }}
tar -xzf vcpkg-dependencies.tar.gz
rm vcpkg-dependencies.tar.gz
shell: bash
- name: Copy manual-link libraries and set paths for Windows
if: runner.os == 'Windows'
run: |
$vcpkg_bin = "${{ inputs.build-directory }}/vcpkg_installed/x64-windows/bin"
$vcpkg_lib = "${{ inputs.build-directory }}/vcpkg_installed/x64-windows/lib"
$vcpkg_manual = "${{ inputs.build-directory }}/vcpkg_installed/x64-windows/lib/manual-link"
# Copy manual-link DLLs to bin directory for runtime access
if (Test-Path $vcpkg_manual) {
Write-Host "Copying manual-link libraries to bin directory"
Copy-Item "$vcpkg_manual\*" "$vcpkg_bin\" -Force -ErrorAction SilentlyContinue
}
# Set library search paths
$current_path = $env:PATH
echo "PATH=$vcpkg_bin;$vcpkg_lib;$vcpkg_manual;$current_path" >> $env:GITHUB_ENV
shell: pwsh
- name: Copy manual-link libraries and set paths for Linux
if: runner.os == 'Linux'
run: |
vcpkg_lib="${{ inputs.build-directory }}/vcpkg_installed/x64-linux-dynamic/lib"
vcpkg_manual="${{ inputs.build-directory }}/vcpkg_installed/x64-linux-dynamic/lib/manual-link"
# Copy manual-link libraries to main lib directory for runtime access
if [ -d "$vcpkg_manual" ]; then
echo "Copying manual-link libraries to main lib directory"
cp -f "$vcpkg_manual"/* "$vcpkg_lib/" 2>/dev/null || true
fi
# Set library search paths
echo "LD_LIBRARY_PATH=$vcpkg_lib:$vcpkg_manual:$LD_LIBRARY_PATH" >> $GITHUB_ENV
shell: bash
- name: Copy manual-link libraries and set paths for macOS
if: runner.os == 'macOS'
run: |
vcpkg_lib="${{ inputs.build-directory }}/vcpkg_installed/arm64-osx-dynamic/lib"
vcpkg_manual="${{ inputs.build-directory }}/vcpkg_installed/arm64-osx-dynamic/lib/manual-link"
# Copy manual-link libraries to main lib directory for runtime access
if [ -d "$vcpkg_manual" ]; then
echo "Copying manual-link libraries to main lib directory"
cp -f "$vcpkg_manual"/* "$vcpkg_lib/" 2>/dev/null || true
fi
# Set library search paths
echo "DYLD_FALLBACK_LIBRARY_PATH=$vcpkg_lib:$vcpkg_manual:$DYLD_FALLBACK_LIBRARY_PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$vcpkg_lib:$vcpkg_manual:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
shell: bash

View File

@@ -1,319 +0,0 @@
name: 'Retest Failures'
description: 'Rerun failed tests and update test results'
inputs:
platform:
description: 'Platform (windows, macos, linux)'
required: true
compiler:
description: 'Compiler (msvc, clang, gcc)'
required: true
install-artifact-name:
description: 'Name of the artifact containing the install directory'
required: true
results-artifact-name:
description: 'Name of the artifact containing the test results'
required: true
test-directory-name:
description: 'Name of the directory containing test results'
required: true
runs:
using: "composite"
steps:
- name: Download previous test results (Windows)
if: ${{ inputs.platform == 'windows' }}
uses: actions/download-artifact@v4.3.0
with:
name: ${{ inputs.results-artifact-name }}
path: install/results
- name: Download previous test results (macOS/Linux)
if: ${{ inputs.platform != 'windows' }}
uses: actions/download-artifact@v4.3.0
with:
name: ${{ inputs.results-artifact-name }}
path: install/bin/results
- name: Check for test failures (Windows)
id: check_failures_windows
if: ${{ inputs.platform == 'windows' }}
shell: pwsh
run: |
$failedCount = 0
if (Test-Path "install/results/${{ inputs.test-directory-name }}/tests.log") {
$content = Get-Content "install/results/${{ inputs.test-directory-name }}/tests.log"
$totalLine = $content | Select-String "Total cases:"
if ($totalLine) {
if ($totalLine -match "FAILED") {
$failedCount = ($totalLine | ForEach-Object { $_.Line -replace '.*?(\d+) FAILED.*','$1' }) -as [int]
}
}
echo "failed_count=$failedCount" >> $env:GITHUB_OUTPUT
if ($failedCount -gt 0) {
echo "Tests failed count: $failedCount"
}
}
- name: Check for test failures (macOS/Linux)
id: check_failures_unix
if: ${{ inputs.platform != 'windows' }}
shell: bash
run: |
failed_count=0
if [ -f "install/bin/results/${{ inputs.test-directory-name }}/tests.log" ]; then
total_line=$(grep "Total cases:" install/bin/results/${{ inputs.test-directory-name }}/tests.log)
if [ ! -z "$total_line" ]; then
if [[ $total_line =~ "FAILED" ]]; then
failed_count=$(echo "$total_line" | grep -o "[0-9]* FAILED" | awk '{print $1}')
fi
fi
echo "failed_count=$failed_count" >> $GITHUB_OUTPUT
if [ "$failed_count" -gt 0 ]; then
echo "Tests failed count: $failed_count"
fi
fi
- name: Set failed count
id: check_failures
shell: ${{ inputs.platform == 'windows' && 'pwsh' || 'bash' }}
run: |
${{ inputs.platform == 'windows' && format('
echo "failed_count={0}" >> $env:GITHUB_OUTPUT
', steps.check_failures_windows.outputs.failed_count) || format('
echo "failed_count={0}" >> $GITHUB_OUTPUT
', steps.check_failures_unix.outputs.failed_count) }}
- name: Download vcpkg cache
if: steps.check_failures.outputs.failed_count > 0
uses: ./.github/actions/download-vcpkg-cache
with:
artifact-name: ${{ inputs.install-artifact-name }}-cache
- name: Install dependencies (Linux)
if: ${{ inputs.platform == 'linux' && steps.check_failures.outputs.failed_count > 0 }}
shell: bash
run: sudo apt-get update && sudo apt-get install -y cmake ${{ inputs.compiler == 'clang' && 'clang' || 'gcc g++' }} make libglu1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev fonts-noto-cjk fonts-liberation fonts-ubuntu fonts-liberation fonts-ubuntu fonts-noto-cjk fonts-ipafont-gothic fonts-ipafont-mincho fonts-unfonts-core
- name: Setup Xvfb and Mesa (Linux)
if: ${{ inputs.platform == 'linux' && steps.check_failures.outputs.failed_count > 0 }}
uses: ./.github/actions/setup-xvfb-mesa
- name: Download test data (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: pwsh
run: |
cd data
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/opencascade-dataset-7.9.0.zip -OutFile opencascade-dataset-7.9.0.zip
Expand-Archive -Path opencascade-dataset-7.9.0.zip -DestinationPath .
Remove-Item opencascade-dataset-7.9.0.zip
- name: Download test data (macOS/Linux)
if: ${{ (inputs.platform == 'macos' || inputs.platform == 'linux') && steps.check_failures.outputs.failed_count > 0 }}
shell: bash
run: |
cd data
curl -L -O https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/opencascade-dataset-7.9.0.${{ inputs.platform == 'macos' && 'tar.xz' || 'tar.xz' }}
tar -xf opencascade-dataset-7.9.0.tar.xz
- name: Download and extract install directory
if: steps.check_failures.outputs.failed_count > 0
uses: actions/download-artifact@v4.3.0
with:
name: ${{ inputs.install-artifact-name }}
path: install
- name: Download and extract Mesa3D (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: pwsh
run: |
curl -L -o mesa3d.7z https://github.com/pal1000/mesa-dist-win/releases/download/24.3.2/mesa3d-24.3.2-release-mingw.7z
7z x mesa3d.7z -omesa3d
- name: Run system-wide deployment (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: cmd
run: |
cd mesa3d
.\systemwidedeploy.cmd 1
.\systemwidedeploy.cmd 5
- name: Install CJK Fonts (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: pwsh
run: |
Invoke-WebRequest -Uri https://noto-website-2.storage.googleapis.com/pkgs/Noto-hinted.zip -OutFile Noto-hinted.zip
Expand-Archive -Path Noto-hinted.zip -DestinationPath $env:windir\Fonts
Remove-Item Noto-hinted.zip
- name: Set execute permissions on DRAWEXE (macOS/Linux)
if: ${{ (inputs.platform == 'macos' || inputs.platform == 'linux') && steps.check_failures.outputs.failed_count > 0 }}
shell: bash
run: chmod +x install/${{ inputs.platform == 'macos' && 'bin' || 'bin' }}/DRAWEXE
- name: Run regression tests (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: cmd
run: |
cd install
call env.bat vc14 win64 release
DRAWEXE.exe -v -c testgrid -regress results/${{ inputs.test-directory-name }} -outdir results/${{ inputs.test-directory-name }}-retest -parallel 0
env:
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Run regression tests (macOS/Linux)
if: ${{ (inputs.platform == 'macos' || inputs.platform == 'linux') && steps.check_failures.outputs.failed_count > 0 }}
shell: bash
run: |
cd install
cd bin
source env.sh
./DRAWEXE -v -c testgrid -regress results/${{ inputs.test-directory-name }} -outdir results/${{ inputs.test-directory-name }}-retest -parallel 0
env:
DISPLAY: ${{ inputs.platform == 'linux' && ':99' || '' }}
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Repeating failed tests (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 && steps.check_failures.outputs.failed_count < 20 }}
shell: cmd
run: |
cd install
call env.bat vc14 win64 release
# Repeat failed tests for 10 times
for /l %%i in (1,1,10) do (
DRAWEXE.exe -v -c testgrid -regress results/${{ inputs.test-directory-name }}-retest -outdir results/${{ inputs.test-directory-name }}-retest -parallel 0 -overwrite
DRAWEXE.exe -v -c "testsummarize results/${{ inputs.test-directory-name }}-retest"
)
env:
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Repeating failed tests (macOS/Linux)
if: ${{ inputs.platform != 'windows' && steps.check_failures.outputs.failed_count > 0 && steps.check_failures.outputs.failed_count < 20 }}
shell: bash
run: |
cd install
cd bin
source env.sh
# Repeat failed tests for 10 times
for i in {1..10}; do
./DRAWEXE -v -c testgrid -regress results/${{ inputs.test-directory-name }}-retest -outdir results/${{ inputs.test-directory-name }}-retest -parallel 0 -overwrite
./DRAWEXE -v -c "testsummarize results/${{ inputs.test-directory-name }}-retest"
done
env:
DISPLAY: ${{ inputs.platform == 'linux' && ':99' || '' }}
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Upload regression test results (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
uses: actions/upload-artifact@v4.4.3
with:
name: ${{ inputs.results-artifact-name }}-retest
path: install/results/${{ inputs.test-directory-name }}-retest
retention-days: 15
overwrite: true
- name: Upload regression test results (macOS/Linux)
if: ${{ inputs.platform != 'windows' && steps.check_failures.outputs.failed_count > 0 }}
uses: actions/upload-artifact@v4.4.3
with:
name: ${{ inputs.results-artifact-name }}-retest
path: install/bin/results/${{ inputs.test-directory-name }}-retest
retention-days: 15
overwrite: true
- name: Copy retest results back to original location (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: cmd
run: |
cd install\results\${{ inputs.test-directory-name }}-retest
if exist "*" (
xcopy /s /y /i . "..\${{ inputs.test-directory-name }}"
cd ..\..
call env.bat vc14 win64 release
DRAWEXE.exe -v -c "testsummarize results/${{ inputs.test-directory-name }}"
) else (
echo No retest results to copy - directory is empty
)
- name: Copy retest results back to original location (macOS/Linux)
if: ${{ inputs.platform != 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: bash
run: |
cd install/bin/results/${{ inputs.test-directory-name }}-retest
if [ "$(ls -A)" ]; then
cp -rf * ../${{ inputs.test-directory-name }}/
cd ../../
source env.sh
./DRAWEXE -v -c testsummarize results/${{ inputs.test-directory-name }}
else
echo "No retest results to copy - directory is empty"
fi
- name: Upload updated test results (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
uses: actions/upload-artifact@v4.4.3
with:
name: ${{ inputs.results-artifact-name }}
path: install/results/${{ inputs.test-directory-name }}*
retention-days: 15
overwrite: true
- name: Upload updated test results (macOS/Linux)
if : ${{ inputs.platform != 'windows' && steps.check_failures.outputs.failed_count > 0 }}
uses: actions/upload-artifact@v4.4.3
with:
name: ${{ inputs.results-artifact-name }}
path: install/bin/results/${{ inputs.test-directory-name }}*
retention-days: 15
overwrite: true
- name: Check test failures (Windows)
if: ${{ inputs.platform == 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: pwsh
run: |
cd install/results/${{ inputs.test-directory-name }}-retest
$failedCount = 0
if (Test-Path tests.log) {
$content = Get-Content tests.log
$totalLine = $content | Select-String "Total cases:"
if ($totalLine) {
if ($totalLine -match "FAILED") {
$failedCount = ($totalLine | ForEach-Object { $_.Line -replace '.*?(\d+) FAILED.*','$1' }) -as [int]
}
}
if ($failedCount -gt 0) {
Write-Error "Number of FAILED tests ($failedCount) exceeds threshold of 0"
echo "FAILED_COUNT=$failedCount" >> $env:GITHUB_ENV
exit 1
}
Write-Output "Found $failedCount FAILED tests"
}
- name: Check test failures (macOS/Linux)
if: ${{ inputs.platform != 'windows' && steps.check_failures.outputs.failed_count > 0 }}
shell: bash
run: |
cd install/bin/results/${{ inputs.test-directory-name }}-retest
if [ -f tests.log ]; then
TOTAL_LINE=$(grep "Total cases:" tests.log | tail -n1)
echo "Total line: $TOTAL_LINE"
if [[ $TOTAL_LINE =~ ([0-9]+)[[:space:]]FAILED ]]; then
FAILED_COUNT="${BASH_REMATCH[1]}"
if [ $FAILED_COUNT -gt 0 ]; then
echo "Number of FAILED tests ($FAILED_COUNT) exceeds threshold of 0"
echo "::error::Number of FAILED tests ($FAILED_COUNT) exceeds threshold of 0"
echo "FAILED_COUNT=$FAILED_COUNT" >> $GITHUB_ENV
exit 1
fi
fi
echo "Found 0 FAILED tests"
fi

View File

@@ -25,15 +25,27 @@ runs:
using: "composite"
steps:
- name: Download and extract install directory
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v4.1.7
with:
name: ${{ inputs.install-artifact-name }}
path: install
- name: Download vcpkg cache
uses: ./.github/actions/download-vcpkg-cache
with:
artifact-name: ${{ inputs.install-artifact-name }}-cache
- name: Download and extract 3rdparty dependencies for Windows
if: inputs.platform == 'windows'
shell: pwsh
run: |
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/3rdparty-vc14-64.zip -OutFile 3rdparty-vc14-64.zip
Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath .
Remove-Item 3rdparty-vc14-64.zip
- name: Install macOS dependencies
if: inputs.platform == 'macos'
shell: bash
run: |
brew update
brew install tcl-tk tbb gl2ps xerces-c \
libxmu libxi libxft libxpm \
glew freeimage draco glfw
- name: Install Linux dependencies
if: inputs.platform == 'linux'
@@ -57,7 +69,8 @@ runs:
shell: cmd
run: |
cd install
call env.bat vc14 win64 release
call env.bat ${{ inputs.compiler == 'msvc' && 'vc14' || 'clang' }} win64 release
cd bin
set GTEST_OUTPUT=""
OpenCascadeGTest.exe --gtest_output=xml:gtest_results.xml > gtest_output.log 2>&1
type gtest_output.log
@@ -73,16 +86,16 @@ runs:
run: |
cd install/bin
source env.sh
./OpenCascadeGTest --gtest_output=xml:gtest_results.xml > gtest_output.log 2>&1 || true
./OpenCascadeGTest --gtest_output=xml:gtest_results.xml > gtest_output.log 2>&1
cat gtest_output.log
- name: Upload GTest results
uses: actions/upload-artifact@v4.6.2
uses: actions/upload-artifact@v4.4.3
with:
name: gtest-results-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.artifact-suffix }}
path: |
install/**/gtest_results.xml
install/**/gtest_output.log
install/bin/gtest_results.xml
install/bin/gtest_output.log
retention-days: 15
- name: Check for test failures on Windows
@@ -90,7 +103,7 @@ runs:
id: check-failures-windows
shell: pwsh
run: |
cd install
cd install/bin
$log = Get-Content "gtest_output.log" -Raw
if ($log -match "\[\s+FAILED\s+\]") {
Write-Error "GTest failures detected in the output."

View File

@@ -1,166 +0,0 @@
name: 'Run Tests'
description: 'Run OCCT tests on a specific platform'
inputs:
platform:
description: 'Platform (windows, macos, linux)'
required: true
compiler:
description: 'Compiler (msvc, clang, gcc)'
required: true
install-artifact-name:
description: 'Name of the artifact containing the install directory'
required: true
test-directory-name:
description: 'Name of the directory to store test results'
required: true
test-script:
description: 'The test script to run'
required: true
runs:
using: "composite"
steps:
- name: Download vcpkg cache
uses: ./.github/actions/download-vcpkg-cache
with:
artifact-name: ${{ inputs.install-artifact-name }}-cache
- name: Install dependencies (Linux)
if: ${{ inputs.platform == 'linux' }}
run: sudo apt-get update && sudo apt-get install -y cmake ${{ inputs.compiler == 'gcc' && 'gcc g++' || 'clang' }} make libglu1-mesa-dev libegl1-mesa-dev fonts-noto-cjk fonts-liberation fonts-ubuntu fonts-liberation fonts-ubuntu fonts-noto-cjk fonts-ipafont-gothic fonts-ipafont-mincho fonts-unfonts-core
shell: bash
- name: Setup Xvfb and Mesa (Linux)
if: ${{ inputs.platform == 'linux' }}
uses: ./.github/actions/setup-xvfb-mesa
- name: Download and extract test data (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
cd data
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/opencascade-dataset-7.9.0.zip -OutFile opencascade-dataset-7.9.0.zip
Expand-Archive -Path opencascade-dataset-7.9.0.zip -DestinationPath .
Remove-Item opencascade-dataset-7.9.0.zip
shell: pwsh
- name: Download test data (macOS/Linux)
if: ${{ (inputs.platform == 'macos' || inputs.platform == 'linux') }}
run: |
cd data
wget -q https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/opencascade-dataset-7.9.0.tar.xz
tar -xf opencascade-dataset-7.9.0.tar.xz
shell: bash
- name: Download and extract install directory
uses: actions/download-artifact@v4.3.0
with:
name: ${{ inputs.install-artifact-name }}
path: install
- name: Download and extract Mesa3D (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
curl -L -o mesa3d.7z https://github.com/pal1000/mesa-dist-win/releases/download/24.3.2/mesa3d-24.3.2-release-mingw.7z
7z x mesa3d.7z -omesa3d
shell: pwsh
- name: Run system-wide deployment (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
cd mesa3d
.\systemwidedeploy.cmd 1
.\systemwidedeploy.cmd 5
shell: cmd
- name: Install CJK Fonts (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
Invoke-WebRequest -Uri https://noto-website-2.storage.googleapis.com/pkgs/Noto-hinted.zip -OutFile Noto-hinted.zip
Expand-Archive -Path Noto-hinted.zip -DestinationPath $env:windir\Fonts
Remove-Item Noto-hinted.zip
shell: pwsh
- name: Set LIBGL_ALWAYS_SOFTWARE environment variable (macOS)
if: ${{ inputs.platform == 'macos' }}
run: echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV
shell: bash
- name: Set execute permissions on DRAWEXE (macOS/Linux)
if: ${{ inputs.platform == 'macos' || inputs.platform == 'linux' }}
run: chmod +x install/bin/DRAWEXE
shell: bash
- name: Run tests (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
cd install
call env.bat vc14 win64 release
DRAWEXE.exe -v -f ${{ github.workspace }}/${{ inputs.test-script }}
shell: cmd
env:
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Run tests (macOS/Linux)
if: ${{ inputs.platform == 'macos' || inputs.platform == 'linux' }}
run: |
cd install
cd bin
source env.sh
./DRAWEXE -v -f ${{ github.workspace }}/${{ inputs.test-script }}
shell: bash
env:
DISPLAY: ${{ inputs.platform == 'linux' && ':99' || '' }}
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Clean up test results (Windows)
if: ${{ inputs.platform == 'windows' }}
run: |
cd install
call env.bat vc14 win64 release
DRAWEXE.exe -v -c cleanuptest results/${{ inputs.test-directory-name }}
shell: cmd
env:
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Clean up test results (macOS/Linux)
if: ${{ inputs.platform == 'macos' || inputs.platform == 'linux' }}
run: |
cd install
cd bin
source env.sh
./DRAWEXE -v -c cleanuptest results/${{ inputs.test-directory-name }}
shell: bash
env:
DISPLAY: ${{ inputs.platform == 'linux' && ':99' || '' }}
LIBGL_ALWAYS_SOFTWARE: 1
CSF_TestScriptsPath: ${{ github.workspace }}/tests
CSF_TestDataPath: ${{ github.workspace }}/data
- name: Upload test results (Windows)
if: ${{ inputs.platform == 'windows' }}
uses: actions/upload-artifact@v4.6.2
with:
name: results-${{ inputs.test-directory-name }}
path: |
install/results/**/*.log
install/results/**/*.png
install/results/**/*.html
retention-days: 15
- name: Upload test results (macOS/Linux)
if: ${{ inputs.platform == 'macos' || inputs.platform == 'linux' }}
uses: actions/upload-artifact@v4.6.2
with:
name: results-${{ inputs.test-directory-name }}
path: |
install/bin/results/**/*.log
install/bin/results/**/*.png
install/bin/results/**/*.html
retention-days: 15

View File

@@ -1,30 +0,0 @@
name: 'Setup MSYS2'
description: 'Setup MSYS2 environment for MinGW builds'
inputs:
msystem:
description: 'MSYS2 subsystem (MINGW64, CLANG64, UCRT64)'
required: true
packages:
description: 'Packages to install'
required: true
dependencies:
description: 'Additional dependencies to install'
required: true
runs:
using: "composite"
steps:
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ inputs.msystem }}
update: true
install: ${{ inputs.packages }} ${{ inputs.dependencies }}
- name: Setup environment
shell: msys2 {0}
run: |
echo "Setting up environment variables..."
echo "$MSYSTEM_PREFIX/bin" >> $GITHUB_PATH
echo "CMAKE_PREFIX_PATH=$MSYSTEM_PREFIX" >> $GITHUB_ENV

View File

@@ -1,15 +0,0 @@
name: 'Setup Ubuntu Dependencies'
description: 'Install Ubuntu dependencies and rapidjson for OCCT builds'
runs:
using: "composite"
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y ninja-build tcl-dev tk-dev cmake clang gcc g++ make libbtbb-dev libx11-dev libglu1-mesa-dev tcllib tcl-thread tcl libvtk9-dev libopenvr-dev libdraco-dev libfreeimage-dev libegl1-mesa-dev libgles2-mesa-dev libfreetype-dev libjemalloc-dev
shell: bash
- name: Install rapidjson
run: |
wget https://github.com/Tencent/rapidjson/archive/858451e5b7d1c56cf8f6d58f88cf958351837e53.zip -O rapidjson.zip
unzip rapidjson.zip
shell: bash

View File

@@ -1,30 +0,0 @@
name: 'Setup Windows MSVC Dependencies'
description: 'Download and setup 3rdparty dependencies and Mesa3D for Windows MSVC builds'
runs:
using: "composite"
steps:
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: Download and extract 3rdparty dependencies
run: |
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/3rdparty-vc14-64.zip -OutFile 3rdparty-vc14-64.zip
Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath .
Remove-Item 3rdparty-vc14-64.zip
shell: pwsh
- name: Download and extract Mesa3D
run: |
curl -L -o mesa3d.7z https://github.com/pal1000/mesa-dist-win/releases/download/24.3.2/mesa3d-24.3.2-release-mingw.7z
7z x mesa3d.7z -omesa3d
shell: pwsh
- name: Run system-wide deployment
run: |
cd mesa3d
.\systemwidedeploy.cmd 1
.\systemwidedeploy.cmd 5
shell: cmd

View File

@@ -1,134 +0,0 @@
name: 'Test Summary'
description: 'Compare test results between current branch and master'
runs:
using: "composite"
steps:
- name: Download vcpkg cache
uses: ./.github/actions/download-vcpkg-cache
with:
artifact-name: install-linux-clang-x64-cache
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y cmake clang g++ make libglu1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev
shell: bash
- name: Setup Xvfb and Mesa
uses: ./.github/actions/setup-xvfb-mesa
- name: Set environment variables
run: |
echo "DISPLAY=:99" >> $GITHUB_ENV
echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV
shell: bash
- name: Download and extract install directory
uses: actions/download-artifact@v4.3.0
with:
name: install-linux-clang-x64
path: install
- name: Set execute permissions on DRAWEXE
run: chmod +x install/bin/DRAWEXE
shell: bash
- name: Get latest workflow run ID from target branch
id: get_run_id
run: |
response=$(curl -s \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=${{ github.event.pull_request.base.ref }}&status=success")
latest_run_id=$(echo "$response" | jq -r \
--arg repo "${{ github.repository }}" \
'.workflow_runs[] | select(.name=="Build and Test OCCT on Multiple Platforms" and .head_repository.full_name==$repo) | .id' | head -n 1)
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
shell: bash
- name: Download master branch test results
env:
GH_TOKEN: ${{ github.token }}
run: |
for platform in windows-x64 macos-x64 linux-clang-x64; do
echo "Downloading results for $platform"
gh run download ${{ env.latest_run_id }} -n "results-$platform" -D "install/bin/results/master/"
done
shell: bash
- name: Download current branch test results
env:
GH_TOKEN: ${{ github.token }}
run: |
for platform in windows-x64 macos-x64 linux-clang-x64; do
echo "Downloading results for $platform"
gh run download -n "results-$platform" -D "install/bin/results/current/"
done
shell: bash
- name: Compare test results
run: |
echo "Comparing test results..."
cd install/bin
source env.sh
for platform in windows-x64 macos-x64 linux-clang-x64; do
./DRAWEXE -v -c testdiff "results/current/$platform" "results/master/$platform" &
done
wait
shell: bash
- name: Install BeautifulSoup
run: pip install beautifulsoup4
shell: bash
- name: Clean unused test images
run: |
# copy to the install/bin/results directory
cp ${{ github.workspace }}/.github/actions/scripts/cleanup_test_images.py install/bin/results
cd install/bin/results
python cleanup_test_images.py
shell: bash
- name: Upload comparison results
uses: actions/upload-artifact@v4.6.2
with:
name: test-compare-results
retention-days: 15
overwrite: true
path: |
install/bin/results/**/diff-*.html
install/bin/results/**/diff-*.log
install/bin/results/**/summary.html
install/bin/results/**/tests.log
install/bin/results/**/*.png
- name: Post performance summary to PR
if: github.repository == 'Open-Cascade-SAS/OCCT' && github.head_ref == 'IR' && github.base_ref == 'master'
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
COMMENT_FILE=$(mktemp)
# Get commit ID and commit header
COMMIT_ID=$(git rev-parse HEAD)
COMMIT_HEADER=$(git log -1 --pretty=%s)
echo -e "**Performance Test Summary**\n" > "$COMMENT_FILE"
echo -e "**Commit**: \`${COMMIT_ID}\`\n" >> "$COMMENT_FILE"
echo -e "**Title**: ${COMMIT_HEADER}\n" >> "$COMMENT_FILE"
LOG_FILES=$(find install/bin/results/current -name "diff-*.log")
if [ -z "$LOG_FILES" ]; then
echo "No diff logs found." >> "$COMMENT_FILE"
else
for log_file in $LOG_FILES; do
PLATFORM=$(basename $(dirname "$log_file"))
echo "**Platform: ${PLATFORM}**" >> "$COMMENT_FILE"
echo '```' >> "$COMMENT_FILE"
grep -E "Total (MEMORY|CPU|IMAGE) difference:" "$log_file" >> "$COMMENT_FILE" || echo "No performance summary found." >> "$COMMENT_FILE"
echo '```' >> "$COMMENT_FILE"
echo "" >> "$COMMENT_FILE"
done
fi
gh pr comment ${PR_NUMBER} --body-file "$COMMENT_FILE"
rm "$COMMENT_FILE"
shell: bash

View File

@@ -17,13 +17,7 @@ set exclude_list [list \
"chamfer dist_angle_complex A4" \
"chamfer dist_angle_complex A5" \
"chamfer dist_angle_sequence A1" \
"chamfer dist_angle_sequence A4" \
"caf basic W12" \
"opengles3 general msaa" \
"opengles3 geom interior1" \
"opengles3 geom interior2" \
"opengles3 shadows dir2" \
"opengles3 textures alpha_mask"
"chamfer dist_angle_sequence A4"
]
set exclude_str [join $exclude_list ,]

View File

@@ -18,14 +18,7 @@ set exclude_list [list \
"chamfer dist_angle_complex A4" \
"chamfer dist_angle_complex A5" \
"chamfer dist_angle_sequence A1" \
"chamfer dist_angle_sequence A4" \
"bugs fclasses bug30775" \
"caf basic W12" \
"opengles3 general msaa" \
"opengles3 geom interior1" \
"opengles3 geom interior2" \
"opengles3 shadows dir2" \
"opengles3 textures alpha_mask"
"chamfer dist_angle_sequence A4"
]
set exclude_str [join $exclude_list ,]

View File

@@ -1,33 +0,0 @@
name: 'Upload vcpkg Cache'
description: 'Upload vcpkg installed packages and cache for reuse'
inputs:
artifact-name:
description: 'Name of the artifact to store vcpkg cache'
required: true
build-directory:
description: 'Build directory containing vcpkg_installed'
required: false
default: 'build'
runs:
using: "composite"
steps:
- name: Create vcpkg tar archive
run: |
cd ${{ inputs.build-directory }}
tar -czf vcpkg-dependencies.tar.gz \
--exclude='vcpkg_installed/*/debug' \
--exclude='vcpkg_installed/**/*.pdb' \
--exclude='vcpkg_installed/**/*.lib' \
./vcpkg_installed/
shell: bash
- name: Upload vcpkg tar archive
uses: actions/upload-artifact@v4.6.2
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.build-directory }}/vcpkg-dependencies.tar.gz
retention-days: 7
compression-level: 1

View File

@@ -1,110 +0,0 @@
name: 'Setup vcpkg'
description: 'Setup vcpkg dependencies for OCCT build on a specific platform'
inputs:
vcpkg-tag:
description: 'vcpkg tag to checkout'
required: false
default: '2025.06.13'
github-token:
description: 'GitHub token for NuGet package access'
required: true
runs:
using: "composite"
steps:
- name: Set environment variables
run: |
echo "USERNAME=Open-Cascade-SAS" >> $GITHUB_ENV
echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV
echo "VCPKG_EXE=${{ github.workspace }}/vcpkg/vcpkg" >> $GITHUB_ENV
echo "FEED_URL=https://nuget.pkg.github.com/Open-Cascade-SAS/index.json" >> $GITHUB_ENV
echo "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/Open-Cascade-SAS/index.json,readwrite" >> $GITHUB_ENV
echo "VCPKG_FEATURE_FLAGS=binarycaching,manifests,versions" >> $GITHUB_ENV
echo "VCPKG_DISABLE_COMPILER_TRACKING=1" >> $GITHUB_ENV
shell: bash
if: runner.os != 'Windows'
- name: Set environment variables (Windows)
run: |
echo "USERNAME=Open-Cascade-SAS" >> $env:GITHUB_ENV
echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $env:GITHUB_ENV
echo "VCPKG_EXE=${{ github.workspace }}/vcpkg/vcpkg" >> $env:GITHUB_ENV
echo "FEED_URL=https://nuget.pkg.github.com/Open-Cascade-SAS/index.json" >> $env:GITHUB_ENV
echo "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/Open-Cascade-SAS/index.json,readwrite" >> $env:GITHUB_ENV
echo "VCPKG_FEATURE_FLAGS=binarycaching,manifests,versions" >> $env:GITHUB_ENV
echo "VCPKG_DISABLE_COMPILER_TRACKING=1" >> $env:GITHUB_ENV
shell: pwsh
if: runner.os == 'Windows'
- name: Install required packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build curl zip unzip tar nasm autoconf mono-complete \
libx11-dev \
libxi-dev \
libxext-dev \
mesa-common-dev \
libglu1-mesa-dev \
libegl1-mesa-dev \
libgles2-mesa-dev
shell: bash
- name: Install required packages (macOS)
if: runner.os == 'macOS'
run: |
brew update || true
brew install cmake ninja nasm autoconf automake mono openexr || true
brew install --cask xquartz || true
shell: bash
- name: Set up vcpkg (Unix)
if: runner.os != 'Windows'
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
git checkout ${{ inputs.vcpkg-tag }}
./bootstrap-vcpkg.sh
shell: bash
- name: Set up vcpkg (Windows)
if: runner.os == 'Windows'
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
git checkout ${{ inputs.vcpkg-tag }}
.\bootstrap-vcpkg.bat
shell: cmd
- name: Add NuGet sources
if: runner.os == 'Windows'
run: |
.$(${{ env.VCPKG_EXE }} fetch nuget) `
sources add `
-Source "${{ env.FEED_URL }}" `
-StorePasswordInClearText `
-Name GitHubPackages `
-UserName "${{ env.USERNAME }}" `
-Password "${{ inputs.github-token }}"
.$(${{ env.VCPKG_EXE }} fetch nuget) `
setapikey "${{ inputs.github-token }}" `
-Source "${{ env.FEED_URL }}"
shell: pwsh
- name: Add NuGet sources
if: runner.os != 'Windows'
run: |
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
sources add \
-Source "${{ env.FEED_URL }}" \
-StorePasswordInClearText \
-Name GitHubPackages \
-UserName "${{ env.USERNAME }}" \
-Password "${{ inputs.github-token }}"
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
setapikey "${{ inputs.github-token }}" \
-Source "${{ env.FEED_URL }}"
shell: bash

View File

@@ -1,247 +0,0 @@
# OCCT Copilot Instructions
This file provides the comprehensive guidance for AI assistants working with the Open CASCADE Technology (OCCT) C++17+ 3D CAD/CAM/CAE library.
---
## 1. Core Directives for AI Assistant
> **IMPORTANT:** These are the most critical rules. Follow them strictly.
1. **Memory Management is Paramount:**
- **ALWAYS** use `Handle(ClassName)` for any class inheriting from `Standard_Transient` (e.g., `Geom_*`, `Poly_*`, `AIS_*`, `V3d_*`). This is for reference-counted objects.
- **NEVER** use raw pointers (`ClassName*`) for these types, as it will cause memory leaks.
- **Correct:** `Handle(Geom_Circle) aCircle = new Geom_Circle(...);`
- **Wrong:** `Geom_Circle* aCircle = new Geom_Circle(...);`
2. **Check Operation Status:**
- After using an API that performs a geometric operation (e.g., `BRepAlgoAPI_Fuse`, `BRepBuilderAPI_MakeEdge`), **ALWAYS** check if the operation was successful using the `IsDone()` method before accessing the result.
- **Correct:**
```cpp
BRepAlgoAPI_Fuse aFuser(theShape1, theShape2);
if (aFuser.IsDone()) {
auto aResult = aFuser.Shape();
} else {
// Handle error
}
```
3. **Strict Naming and File Conventions:**
- Adhere to the strict `Package_ClassName` convention.
- Place new files in the correct directory: `src/Module/Toolkit/Package/`.
- After adding a file, **ALWAYS** update the corresponding `src/Module/Toolkit/FILES.cmake` file.
4. **Use Modern C++ Idioms:**
- Prefer `auto` for variable declarations where the type is clear, especially with iterators.
- Use range-based `for` loops and structured bindings where applicable.
- Use the modern `TopExp_Explorer` constructor style.
- **Correct:** `for (TopExp_Explorer anExp(theShape, TopAbs_FACE); anExp.More(); anExp.Next()) { ... }`
- **Wrong:** `for (TopExp_Explorer anExp; anExp.Init(theShape, TopAbs_FACE); anExp.More(); anExp.Next()) { ... }`
5. **Safe Type Casting:**
- When downcasting topological shapes, **ALWAYS** use the `TopoDS` helper functions to avoid errors.
- **Correct:** `auto aFace = TopoDS::Face(anExp.Current());`
- **Wrong:** `auto aFace = (const TopoDS_Face&)anExp.Current();`
6. **Handle Downcasting:**
- Use `Handle(DerivedClass)::DownCast(BaseHandle)` to safely downcast handles.
- **Correct:**
```cpp
Handle(Geom_Circle) circ = Handle(Geom_Circle)::DownCast(someCurveHandle);
```
- **Wrong:**
```cpp
// Do not use C-style casts on handles
Geom_Circle* circ = (Geom_Circle*)someHandle.Get();
```
7. **Validate Handles for Null Safety:**
- **ALWAYS** check that a `Handle(ClassName)` is not null before dereferencing it:
```cpp
if (!theHandle.IsNull()) {
// use theHandle
}
```
---
## 2. Project Overview
Open CASCADE Technology (OCCT) is a comprehensive C++ software development platform for 3D surface and solid modeling, CAD data exchange, and visualization. It's a modern C++17+ library providing services for CAD/CAM/CAE applications.
### Architecture & Source Organization
- **`src/`**: Source code, organized by a `Module/Toolkit/Package` hierarchy.
- **`tests/`**: Draw Harness test files, organized by functionality.
- **`adm/`**: Administrative and build configuration files (CMake).
- **`samples/`**: Example applications.
---
## 3. Code Conventions
### Naming Patterns
| Element Type | Pattern | Example |
| --------------------------- | ---------------------------- | -------------------------------- |
| **Classes** | `Package_ClassName` | `TopoDS_Shape`, `BRep_Builder` |
| **Public Methods** | `MethodName` | `IsDone()`, `Shape()` |
| **Private Methods** | `methodName` | `myInternalMethod()` |
| **Method Parameters** | `theParameterName` | `theShape`, `theTolerance` |
| **Local Variables** | `aVariableName` | `aBox`, `anExplorer` |
| **Class Member Fields** | `myFieldName` | `myShape`, `myIsDone` |
| **Struct Member Fields** | `FieldVariableName` | `Point`, `Value` |
| **Global Variables** | `THE_GLOBAL_VARIABLE` | `THE_DEFAULT_PRECISION` |
### Type Mappings
| OCCT Type | C++ Equivalent | Notes |
| ------------------- | -------------- | ----------------------------------- |
| `Standard_Real` | `double` | Use for all floating-point numbers. |
| `Standard_Integer` | `int` | Use for all integer values. |
| `Standard_Boolean` | `bool` | Use for `true`/`false` values. |
### Modern C++ Encouraged
This is a C++17+ codebase. Proactively use modern features to improve code quality:
- `auto`
- Range-based `for` loops
- Structured bindings: `for (const auto& [key, value] : aMap)`
- `std::optional` for optional return values where appropriate.
- `if constexpr` for compile-time conditions.
---
## 4. Step-by-Step Workflow Example: Adding a New Class and Test
This example demonstrates the end-to-end process for adding a new class `BRepTest_MyNewClass` to the `TKTopAlgo` toolkit and creating a corresponding GTest.
**1. Create Header and Source Files:**
Navigate to the correct package directory and create the files.
```bash
# Navigate to the BRepTest package in the ModelingAlgorithms module
cd src/ModelingAlgorithms/TKTopAlgo/BRepTest
touch BRepTest_MyNewClass.hxx BRepTest_MyNewClass.cxx
```
**2. Implement the Class:**
Add content to `BRepTest_MyNewClass.hxx` and `.cxx`, following all code conventions.
**3. Add Files to CMake:**
Edit the toolkit's `FILES.cmake` to register the new files.
```bash
# Edit the CMake file for TKTopAlgo
vim src/ModelingAlgorithms/TKTopAlgo/FILES.cmake
```
Add the new files to the `OCCT_<PackageName>_FILES` list:
```cmake
# In FILES.cmake
...
set (OCCT_BRepTest_FILES
...
BRepTest_MyNewClass.hxx
BRepTest_MyNewClass.cxx
...
)
```
**4. Create a GTest:**
Navigate to the GTest directory for the toolkit and create a test file.
```bash
# Navigate to the GTest directory for TKTopAlgo
cd src/ModelingAlgorithms/TKTopAlgo/GTests
touch BRepTest_MyNewClass_Test.cxx
```
Write the test implementation in the new file.
**5. Add GTest to CMake:**
Edit the same `FILES.cmake` to add the test file.
```cmake
# In FILES.cmake
...
set (OCCT_TKTopAlgo_GTests_FILES
...
GTests/BRepTest_MyNewClass_Test.cxx
...
)
```
**6. Build and Run Test:**
From the `build` directory, build the project and run the tests.
```bash
# Navigate to build directory
cd build
# Re-run CMake to pick up new files (usually not needed, but good practice)
cmake .. -DBUILD_GTEST=ON
# Build the project
cmake --build . --config Release
# Run the tests
./bin/OpenCascadeGTest --gtest_filter=*MyNewClass*
```
---
## 5. Build and Test System
### Build System (CMake)
- **Primary build system:** CMake 3.16+ recommended.
- **Build Directory:** Always build in a separate directory (e.g., `build/`).
- **Quick Build:**
```bash
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_GTEST=ON
cmake --build . --config Release --parallel
```
- **Environment:** Before running any OCCT executable (including tests), you **must** source the environment script: `source build/env.sh` (or `build\env.bat` on Windows).
### Testing Frameworks
- **Draw Harness:** Tcl-based framework for interactive testing. Located in `tests/`. Run with `build/DRAWEXE`.
- **GTest:** C++ unit testing framework. Tests are located in `src/.../GTests/`. Enable with `-DBUILD_GTEST=ON`.
---
## 6. Common Patterns & Key Packages
### Common Operations
- **Shape Creation:** Use `BRepPrimAPI_` classes (`MakeBox`, `MakeCylinder`).
- **Boolean Operations:** Use `BRepAlgoAPI_` classes (`Fuse`, `Cut`, `Common`).
- **Shape Exploration:** Use `TopExp_Explorer`.
- **Transformations:** Use `gp_Trsf` and `BRepBuilderAPI_Transform`.
### Key Packages
| Package | Purpose | Module |
| ----------- | ------------------------------------- | --------------------- |
| `gp` | Geometric Primitives (Points, Vecs) | FoundationClasses |
| `Geom` | Geometric entities (Curves, Surfaces) | ModelingData |
| `TopoDS` | Topological Data Structures (Shapes) | ModelingData |
| `TopExp` | Exploring topological shapes | ModelingData |
| `BRepAlgoAPI` | High-level modeling algorithms | ModelingAlgorithms |
| `BRepPrimAPI` | Geometric primitives creation | ModelingAlgorithms |
| `AIS` | Application Interactive Services | Visualization |
### Common Headers
```cpp
#include <Standard_Failure.hxx>
#include <Handle_Geom_Circle.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Builder.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
```
---
## 7. Key Files & Platform Notes
- **`adm/MODULES`**: Defines all modules and toolkits.
- **`src/*/FILES.cmake`**: Lists all source/header files for a toolkit. **You must edit this when adding/removing files.**
- **`build/env.sh/bat`**: The crucial environment script.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,219 @@
# This workflow validates the build on Windows using MinGW and MSYS2.
# It is triggered on pushes to the master branch.
# The workflow includes steps to install dependencies, configure, build, and clean up the project.
name: MinGW build validation
on:
push:
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
main_job:
name: Windows MinGW validation
runs-on: windows-2022
strategy:
matrix:
config:
- {
name: "GCC",
cc: "x86_64-w64-mingw32-gcc",
cxx: "x86_64-w64-mingw32-g++",
package: "mingw-w64-x86_64-toolchain",
thirdparty_dir: "/mingw64",
compiler_flags: "",
dependencies: "mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-rapidjson mingw-w64-x86_64-freetype mingw-w64-x86_64-draco mingw-w64-x86_64-freeimage mingw-w64-x86_64-tbb mingw-w64-x86_64-tk mingw-w64-x86_64-tcl mingw-w64-x86_64-openvr mingw-w64-x86_64-jemalloc mingw-w64-x86_64-mesa mingw-w64-x86_64-angleproject mingw-w64-x86_64-llvm-openmp mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-libwinpthread-git mingw-w64-cross-mingwarm64-winpthreads"
}
- {
name: "Clang",
cc: "clang",
cxx: "clang++",
package: "mingw-w64-clang-x86_64-toolchain",
thirdparty_dir: "/clang64",
compiler_flags: "-D CMAKE_CXX_FLAGS=\"-Wall -Wextra\" -D CMAKE_C_FLAGS=\"-Wall -Wextra\"",
dependencies: "mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-rapidjson mingw-w64-clang-x86_64-freetype mingw-w64-clang-x86_64-draco mingw-w64-clang-x86_64-freeimage mingw-w64-clang-x86_64-tbb mingw-w64-clang-x86_64-tk mingw-w64-clang-x86_64-tcl mingw-w64-clang-x86_64-openvr mingw-w64-clang-x86_64-jemalloc mingw-w64-clang-x86_64-mesa mingw-w64-clang-x86_64-angleproject mingw-w64-clang-x86_64-llvm-openmp mingw-w64-clang-x86_64-winpthreads-git mingw-w64-clang-x86_64-libwinpthread-git mingw-w64-cross-mingwarm64-winpthreads"
}
- {
name: "UCRT",
cc: "x86_64-w64-mingw32-gcc",
cxx: "x86_64-w64-mingw32-g++",
package: "mingw-w64-ucrt-x86_64-toolchain",
thirdparty_dir: "/ucrt64",
compiler_flags: "",
dependencies: "mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-libs mingw-w64-ucrt-x86_64-omp mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-rapidjson mingw-w64-ucrt-x86_64-freetype mingw-w64-ucrt-x86_64-draco mingw-w64-ucrt-x86_64-freeimage mingw-w64-ucrt-x86_64-tbb mingw-w64-ucrt-x86_64-tk mingw-w64-ucrt-x86_64-tcl mingw-w64-ucrt-x86_64-openvr mingw-w64-ucrt-x86_64-jemalloc mingw-w64-ucrt-x86_64-mesa mingw-w64-ucrt-x86_64-angleproject mingw-w64-ucrt-x86_64-llvm-openmp mingw-w64-ucrt-x86_64-winpthreads-git mingw-w64-ucrt-x86_64-libwinpthread-git mingw-w64-cross-mingwarm64-winpthreads"
}
build_type: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.name == 'Clang' && 'CLANG64' || matrix.config.name == 'UCRT' && 'UCRT64' || 'MINGW64' }}
update: true
install: ${{ matrix.config.package }} ${{ matrix.config.dependencies }}
- name: Setup environment
shell: msys2 {0}
run: |
echo "Checking compiler version:"
${{ matrix.config.cc }} --version
echo "Checking CMake version:"
cmake --version
echo "Setting up environment variables..."
echo "$MSYSTEM_PREFIX/bin" >> $GITHUB_PATH
echo "CMAKE_PREFIX_PATH=$MSYSTEM_PREFIX" >> $GITHUB_ENV
- name: Configure basic
shell: msys2 {0}
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D CMAKE_PREFIX_PATH=$MSYSTEM_PREFIX \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
${{ matrix.config.compiler_flags }} ..
- name: Build basic
shell: msys2 {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
shell: pwsh
run: |
Remove-Item -Recurse -Force build
- name: Configure full shared
shell: msys2 {0}
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D CMAKE_PREFIX_PATH=$MSYSTEM_PREFIX \
-D BUILD_USE_PCH=OFF \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Production \
-D BUILD_LIBRARY_TYPE=Shared \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D USE_MMGR_TYPE=JEMALLOC \
-D INSTALL_DIR="${{ github.workspace }}/install-${{ matrix.build_type }}" \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=OFF \
-D USE_TBB=OFF \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
${{ matrix.config.compiler_flags }} ..
- name: Build full shared
shell: msys2 {0}
run: |
cd build
cmake --build . --target install --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
shell: pwsh
run: |
Remove-Item -Recurse -Force build
Remove-Item -Recurse -Force ${{ github.workspace }}/install-${{ matrix.build_type }}
- name: Configure full static
shell: msys2 {0}
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D CMAKE_PREFIX_PATH=$MSYSTEM_PREFIX \
-D BUILD_USE_PCH=OFF \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Default \
-D BUILD_LIBRARY_TYPE=Static \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D USE_MMGR_TYPE=JEMALLOC \
-D INSTALL_DIR="${{ github.workspace }}/install-${{ matrix.build_type }}" \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=OFF \
-D USE_TBB=OFF \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
${{ matrix.config.compiler_flags }} ..
- name: Build full static
shell: msys2 {0}
run: |
cd build
cmake --build . --target install --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
shell: pwsh
run: |
Remove-Item -Recurse -Force build
Remove-Item -Recurse -Force ${{ github.workspace }}/install-${{ matrix.build_type }}
- name: Configure full with DEBUG define
shell: msys2 {0}
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D CMAKE_PREFIX_PATH=$MSYSTEM_PREFIX \
-D BUILD_WITH_DEBUG=ON \
-D BUILD_USE_PCH=OFF \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Production \
-D BUILD_LIBRARY_TYPE=Shared \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D INSTALL_DIR="${{ github.workspace }}/install-${{ matrix.build_type }}" \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=OFF \
-D USE_TBB=OFF \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
${{ matrix.config.compiler_flags }} ..
- name: Build full with DEBUG define
shell: msys2 {0}
run: |
cd build
cmake --build . --target install --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
shell: pwsh
run: |
Remove-Item -Recurse -Force build
Remove-Item -Recurse -Force ${{ github.workspace }}/install-${{ matrix.build_type }}

View File

@@ -0,0 +1,213 @@
# This workflow validates the build on Windows using MSVC and Clang compilers.
# It is triggered on pushes to the master branch.
# The workflow includes steps to install dependencies, configure, build, and clean up the project for different configurations.
name: MSVC build validation
on:
push:
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
main_job:
name: Windows MSVC/Clang validation
runs-on: windows-2022
strategy:
matrix:
config:
- {
name: "MSVC",
cc: "cl",
cxx: "cl",
generator: "Visual Studio 17 2022",
toolset: "host=x64",
c_flags: "/W4 /WX",
cxx_flags: "/W4 /WX"
}
- {
name: "Clang",
cc: "clang",
cxx: "clang++",
generator: "Ninja",
toolset: "",
c_flags: "-Werror -Wall -Wextra -Wno-unknown-warning-option",
cxx_flags: "-Werror -Wall -Wextra -Wno-unknown-warning-option"
}
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: Download and extract 3rdparty dependencies
run: |
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/3rdparty-vc14-64.zip -OutFile 3rdparty-vc14-64.zip
Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath .
Remove-Item 3rdparty-vc14-64.zip
shell: pwsh
- name: Download and extract Mesa3D
run: |
curl -L -o mesa3d.7z https://github.com/pal1000/mesa-dist-win/releases/download/24.3.2/mesa3d-24.3.2-release-mingw.7z
7z x mesa3d.7z -omesa3d
- name: Run system-wide deployment
run: |
cd mesa3d
.\systemwidedeploy.cmd 1
.\systemwidedeploy.cmd 5
shell: cmd
- name: Configure basic
run: |
mkdir build
cd build
cmake -G "${{ matrix.config.generator }}" ${{ matrix.config.toolset }} `
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} `
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D CMAKE_CXX_FLAGS="${{ matrix.config.cxx_flags }}" `
-D CMAKE_C_FLAGS="${{ matrix.config.c_flags }}" ..
shell: pwsh
- name: Build basic
run: |
cd build
cmake --build . --config Release
shell: pwsh
- name: Clear up after build
run: |
Remove-Item -Recurse -Force build
shell: pwsh
- name: Configure full shared
run: |
mkdir build
cd build
cmake -G "${{ matrix.config.generator }}" ${{ matrix.config.toolset }} `
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} `
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} `
-D BUILD_USE_PCH=OFF `
-D BUILD_INCLUDE_SYMLINK=ON `
-D BUILD_OPT_PROFILE=Production `
-D BUILD_LIBRARY_TYPE=Shared `
-D CMAKE_BUILD_TYPE=Debug `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D USE_MMGR_TYPE=JEMALLOC `
-D USE_FREETYPE=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=ON `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=${{ matrix.config.name == 'MSVC' && 'ON' || 'OFF' }} `
-D USE_TBB=ON `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D CMAKE_CXX_FLAGS="${{ matrix.config.cxx_flags }}" `
-D CMAKE_C_FLAGS="${{ matrix.config.c_flags }}" ..
shell: pwsh
- name: Build full shared
run: |
cd build
cmake --build . --target install --config Debug
shell: pwsh
- name: Clear up after build
run: |
Remove-Item -Recurse -Force build
Remove-Item -Recurse -Force ${{ github.workspace }}/install
shell: pwsh
- name: Configure full static
run: |
mkdir build
cd build
cmake -G "${{ matrix.config.generator }}" ${{ matrix.config.toolset }} `
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} `
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} `
-D BUILD_USE_PCH=OFF `
-D BUILD_INCLUDE_SYMLINK=ON `
-D BUILD_OPT_PROFILE=Default `
-D BUILD_LIBRARY_TYPE=Static `
-D CMAKE_BUILD_TYPE=Debug `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D USE_MMGR_TYPE=JEMALLOC `
-D USE_FREETYPE=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=ON `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=OFF `
-D USE_TBB=ON `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON `
-D CMAKE_CXX_FLAGS="${{ matrix.config.cxx_flags }}" `
-D CMAKE_C_FLAGS="${{ matrix.config.c_flags }}" ..
shell: pwsh
- name: Build full static
run: |
cd build
cmake --build . --target install --config Debug
shell: pwsh
- name: Clear up after build
run: |
Remove-Item -Recurse -Force build
Remove-Item -Recurse -Force ${{ github.workspace }}/install
shell: pwsh
- name: Configure full with DEBUG define
run: |
mkdir build
cd build
cmake -G "${{ matrix.config.generator }}" ${{ matrix.config.toolset }} `
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} `
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} `
-D BUILD_WITH_DEBUG=ON `
-D BUILD_USE_PCH=OFF `
-D BUILD_INCLUDE_SYMLINK=ON `
-D BUILD_OPT_PROFILE=Production `
-D BUILD_LIBRARY_TYPE=Shared `
-D CMAKE_BUILD_TYPE=Debug `
-D INSTALL_DIR=${{ github.workspace }}/install `
-D 3RDPARTY_DIR=${{ github.workspace }}/3rdparty-vc14-64 `
-D USE_FREETYPE=ON `
-D USE_DRACO=ON `
-D USE_FFMPEG=ON `
-D USE_FREEIMAGE=ON `
-D USE_GLES2=ON `
-D USE_OPENVR=ON `
-D USE_VTK=${{ matrix.config.name == 'MSVC' && 'ON' || 'OFF' }} `
-D USE_TBB=ON `
-D USE_RAPIDJSON=ON `
-D USE_OPENGL=ON ` ..
shell: pwsh
- name: Build full with DEBUG define
run: |
cd build
cmake --build . --target install --config Debug
shell: pwsh
- name: Clear up after build
run: |
Remove-Item -Recurse -Force build
Remove-Item -Recurse -Force ${{ github.workspace }}/install
shell: pwsh

View File

@@ -0,0 +1,180 @@
# This workflow validates the build on the latest Ubuntu version (24.04) using multiple configurations.
# It is triggered on pushes to the master branch.
# The workflow includes steps to install dependencies, configure, build, and clean up the project for different configurations.
name: Ubuntu build validation
on:
push:
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
main_job:
name: Latest ubuntu validation
runs-on: ubuntu-24.04
strategy:
matrix:
config:
- {
name: "GCC",
cc: "gcc",
cxx: "g++",
compiler_flags: ""
}
- {
name: "Clang",
cc: "clang",
cxx: "clang++",
compiler_flags: "-D CMAKE_CXX_FLAGS=\"-Werror -Wall -Wextra\" -D CMAKE_C_FLAGS=\"-Werror -Wall -Wextra\""
}
build_type: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y ninja-build tcl-dev tk-dev cmake clang gcc g++ make libbtbb-dev libx11-dev libglu1-mesa-dev tcllib tcl-thread tcl libvtk9-dev libopenvr-dev libdraco-dev libfreeimage-dev libegl1-mesa-dev libgles2-mesa-dev libfreetype-dev libjemalloc-dev
- name: Install rapidjson
run: |
wget https://github.com/Tencent/rapidjson/archive/858451e5b7d1c56cf8f6d58f88cf958351837e53.zip -O rapidjson.zip
unzip rapidjson.zip
- name: Configure basic
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
${{ matrix.config.compiler_flags }} ..
- name: Build basic
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
run: |
rm -rf build
- name: Configure full shared
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D BUILD_USE_PCH=OFF \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Production \
-D BUILD_LIBRARY_TYPE=Shared \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D USE_MMGR_TYPE=JEMALLOC \
-D INSTALL_DIR=${{ github.workspace }}/install-${{ matrix.build_type }} \
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=ON \
-D USE_TBB=ON \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
${{ matrix.config.compiler_flags }} ..
- name: Build full shared
run: |
cd build
cmake --build . --target install --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
run: |
rm -rf build
rm -rf ${{ github.workspace }}/install-${{ matrix.build_type }}
- name: Configure full static
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D BUILD_USE_PCH=OFF \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Default \
-D BUILD_LIBRARY_TYPE=Static \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D USE_MMGR_TYPE=JEMALLOC \
-D INSTALL_DIR=${{ github.workspace }}/install-${{ matrix.build_type }} \
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=OFF \
-D USE_TBB=ON \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON \
${{ matrix.config.compiler_flags }} ..
- name: Build full static
run: |
cd build
cmake --build . --target install --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
run: |
rm -rf build
rm -rf ${{ github.workspace }}/install-${{ matrix.build_type }}
- name: Configure full with DEBUG define
run: |
mkdir -p build
cd build
cmake -G "Ninja" \
-D CMAKE_C_COMPILER=${{ matrix.config.cc }} \
-D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-D BUILD_WITH_DEBUG=ON \
-D BUILD_USE_PCH=OFF \
-D BUILD_INCLUDE_SYMLINK=ON \
-D BUILD_OPT_PROFILE=Production \
-D BUILD_LIBRARY_TYPE=Shared \
-D USE_TK=ON \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D INSTALL_DIR=${{ github.workspace }}/install-${{ matrix.build_type }} \
-D 3RDPARTY_RAPIDJSON_DIR=${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53 \
-D USE_FREETYPE=ON \
-D USE_DRACO=ON \
-D USE_FFMPEG=OFF \
-D USE_FREEIMAGE=ON \
-D USE_GLES2=ON \
-D USE_OPENVR=ON \
-D USE_VTK=ON \
-D USE_TBB=ON \
-D USE_RAPIDJSON=ON \
-D USE_OPENGL=ON ..
- name: Build full with DEBUG define
run: |
cd build
cmake --build . --target install --config ${{ matrix.build_type }} -- -j 4
- name: Clear up after build
run: |
rm -rf build
rm -rf ${{ github.workspace }}/install-${{ matrix.build_type }}

View File

@@ -0,0 +1,102 @@
# This workflow validates the WebAssembly build on Ubuntu.
# It is triggered on pushes to the master branch.
# The workflow includes steps to install dependencies, configure, build, and clean up the project.
name: WebAssembly build (Ubuntu)
on:
push:
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
USERNAME: Open-Cascade-SAS
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
FEED_URL: https://nuget.pkg.github.com/Open-Cascade-SAS/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/Open-Cascade-SAS/index.json,readwrite"
EMSDK_VERSION: 3.1.74
jobs:
wasm-build:
name: WebAssembly Build
runs-on: ubuntu-24.04
strategy:
matrix:
build_type: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build curl zip unzip tar nasm autoconf mono-complete
sudo apt-get install -y libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev
- name: Setup vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
- name: Add NuGet sources
run: |
mono $(${VCPKG_EXE} fetch nuget | tail -n 1) \
sources add \
-Source "${FEED_URL}" \
-StorePasswordInClearText \
-Name GitHubPackages \
-UserName "${USERNAME}" \
-Password "${{ secrets.GITHUB_TOKEN }}"
mono $(${VCPKG_EXE} fetch nuget | tail -n 1) \
setapikey "${{ secrets.GITHUB_TOKEN }}" \
-Source "${FEED_URL}"
- name: Setup Emscripten
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${EMSDK_VERSION}
./emsdk activate ${EMSDK_VERSION}
echo "EMSDK=${{ github.workspace }}/emsdk" >> $GITHUB_ENV
echo "${{ github.workspace }}/emsdk" >> $GITHUB_PATH
echo "${{ github.workspace }}/emsdk/upstream/emscripten" >> $GITHUB_PATH
- name: Configure OCCT with vcpkg
run: |
source "${{ github.workspace }}/emsdk/emsdk_env.sh"
mkdir -p "build-${{ matrix.build_type }}"
cd "build-${{ matrix.build_type }}"
export VCPKG_ROOT="${{ github.workspace }}/vcpkg"
emcmake cmake -G "Ninja" \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=wasm32-emscripten \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE="$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DBUILD_USE_VCPKG=ON \
-DUSE_MMGR_TYPE=NATIVE \
-DBUILD_LIBRARY_TYPE=Static \
-DBUILD_MODULE_Draw=OFF \
-DUSE_FREETYPE=OFF \
-DUSE_TK=OFF \
-DUSE_TCL=OFF \
-DUSE_DRACO=ON \
-DUSE_FFMPEG=OFF \
-DUSE_FREEIMAGE=OFF \
-DUSE_OPENVR=OFF \
-DUSE_VTK=OFF \
-DUSE_TBB=OFF \
-DUSE_RAPIDJSON=ON \
-DINSTALL_DIR="${{ github.workspace }}/install-wasm-${{ matrix.build_type }}" \
-DCMAKE_CXX_FLAGS="-s WASM=1 -s EXPORTED_RUNTIME_METHODS=['ccall','cwrap'] -s ALLOW_MEMORY_GROWTH=1" \
-DCMAKE_EXECUTABLE_SUFFIX=".js" ..
- name: Build
run: |
cd build-${{ matrix.build_type }}
cmake --build . --config ${{ matrix.build_type }} --target install -- -j4

View File

@@ -0,0 +1,170 @@
# This workflow builds OCCT using vcpkg on multiple platforms (Windows, macOS, Linux).
# It builds in both Debug and Release modes.
# All dependencies except the compiler are installed using vcpkg.
# The workflow includes steps to clone vcpkg, install dependencies, configure and build.
name: Build OCCT with vcpkg
on:
push:
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
USERNAME: Open-Cascade-SAS
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
FEED_URL: https://nuget.pkg.github.com/Open-Cascade-SAS/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/Open-Cascade-SAS/index.json,readwrite"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-22.04, windows-2022, windows-2019, macos-15, macos-14, macos-13]
build_type: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Install required packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build curl zip unzip tar nasm autoconf mono-complete
sudo apt-get install -y libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev
- name: Install required packages (macOS)
if: runner.os == 'macOS'
run: |
brew update || true
brew install cmake ninja nasm autoconf mono || true
# temporary workaround for missing tcl-tk
brew install tcl-tk || true
# Force link any conflicting packages
brew link --overwrite python@3.12 || true
brew link --overwrite python@3.13 || true
- name: Install required packages (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: Set up vcpkg (Unix)
if: runner.os != 'Windows'
run: |
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
shell: bash
- name: Set up vcpkg (Windows)
if: runner.os == 'Windows'
run: |
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
shell: cmd
- name: Add NuGet sources
if: runner.os == 'Windows'
run: |
.$(${{ env.VCPKG_EXE }} fetch nuget) `
sources add `
-Source "${{ env.FEED_URL }}" `
-StorePasswordInClearText `
-Name GitHubPackages `
-UserName "${{ env.USERNAME }}" `
-Password "${{ secrets.GITHUB_TOKEN }}"
.$(${{ env.VCPKG_EXE }} fetch nuget) `
setapikey "${{ secrets.GITHUB_TOKEN }}" `
-Source "${{ env.FEED_URL }}"
shell: pwsh
- name: Add NuGet sources
if: runner.os != 'Windows'
run: |
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
sources add \
-Source "${{ env.FEED_URL }}" \
-StorePasswordInClearText \
-Name GitHubPackages \
-UserName "${{ env.USERNAME }}" \
-Password "${{ secrets.GITHUB_TOKEN }}"
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
setapikey "${{ secrets.GITHUB_TOKEN }}" \
-Source "${{ env.FEED_URL }}"
shell: bash
- name: Configure OCCT ${{ matrix.build_type }} (Unix)
if: runner.os != 'Windows'
run: |
mkdir build-${{ matrix.build_type }}
cd build-${{ matrix.build_type }}
cmake -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DBUILD_USE_VCPKG=ON \
-DUSE_MMGR_TYPE=NATIVE \
-DUSE_FREETYPE=ON \
-DUSE_TK=OFF \
-DBUILD_USE_PCH=ON \
-DBUILD_INCLUDE_SYMLINK=ON \
-DBUILD_LIBRARY_TYPE="Static" \
-DINSTALL_DIR=${{ github.workspace }}/install-${{ matrix.build_type }} \
-DUSE_DRACO=ON \
-DUSE_FFMPEG=ON \
-DUSE_FREEIMAGE=ON \
-DUSE_GLES2=OFF \
-DUSE_VTK=ON \
-DUSE_TBB=ON \
-DUSE_RAPIDJSON=ON \
-DUSE_OPENGL=ON \
-DBUILD_MODULE_Draw=OFF \
-DVCPKG_INSTALL_OPTIONS=--clean-buildtrees-after-build \
${{ runner.os != 'macOS' && '-DUSE_OPENVR=ON' || '' }} ..
shell: bash
- name: Configure OCCT ${{ matrix.build_type }} (Windows)
if: runner.os == 'Windows'
run: |
mkdir build-${{ matrix.build_type }}
cd build-${{ matrix.build_type }}
cmake -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake ^
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ^
-DBUILD_USE_VCPKG=ON ^
-DUSE_MMGR_TYPE=JEMALLOC ^
-DUSE_FREETYPE=ON ^
-DUSE_TK=OFF ^
-DBUILD_USE_PCH=ON ^
-DBUILD_INCLUDE_SYMLINK=ON ^
-DINSTALL_DIR=${{ github.workspace }}/install-${{ matrix.build_type }} ^
-DUSE_DRACO=ON ^
-DUSE_FFMPEG=OFF ^
-DUSE_FREEIMAGE=ON ^
-DUSE_GLES2=ON ^
-DUSE_OPENVR=ON ^
-DUSE_VTK=ON ^
-DUSE_TBB=ON ^
-DUSE_RAPIDJSON=ON ^
-DVCPKG_INSTALL_OPTIONS=--clean-buildtrees-after-build ^
-DUSE_OPENGL=ON ..
shell: cmd
- name: Build OCCT ${{ matrix.build_type }} (Unix)
if: runner.os != 'Windows'
run: |
cd build-${{ matrix.build_type }}
cmake --build . --target install --config ${{ matrix.build_type }}
shell: bash
- name: Build OCCT ${{ matrix.build_type }} (Windows)
if: runner.os == 'Windows'
run: |
cd build-${{ matrix.build_type }}
cmake --build . --target install --config ${{ matrix.build_type }}
shell: cmd

97
.github/workflows/code-analysis.yml vendored Normal file
View File

@@ -0,0 +1,97 @@
# This workflow performs code analysis using both CodeQL and Microsoft C++ Code Analysis.
# It is triggered on pushes to the 'master' branch and publishes warnings into the security GitHub tab.
# The workflow includes two jobs: one for CodeQL analysis on Ubuntu and another for MSVC Code Analysis on Windows.
name: Code Analysis
on:
push:
branches:
- 'master'
permissions:
contents: read
security-events: write
packages: read
env:
# Path to the CMake build directory.
build: '${{ github.workspace }}/build'
config: 'Debug'
jobs:
codeql-analyze:
name: CodeQL Analyze (C/C++)
runs-on: ubuntu-latest
steps:
# Step: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4.1.7
# Step: Install necessary dependencies for building the project
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y tcl-dev tk-dev cmake gcc g++ make libbtbb-dev libx11-dev libglu1-mesa-dev
# Step: Initialize CodeQL for scanning
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.26.5
with:
languages: c-cpp
build-mode: manual
# Step: Build the project using CMake and Make
- name: Build project
shell: bash
run: |
mkdir -p build
cd build
cmake -G "Unix Makefiles" \
-D CMAKE_C_COMPILER=gcc \
-D CMAKE_CXX_COMPILER=g++ \
-D USE_FREETYPE=OFF \
-D CMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
# Step: Perform CodeQL Analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.26.5
with:
category: "/language:c-cpp"
msvc-analyze:
name: Microsoft C++ Code Analysis
runs-on: windows-latest
steps:
# Step: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4.1.7
# Step: Install necessary dependencies using Chocolatey
- name: Install dependencies
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
choco install magicsplat-tcl-tk -y
# Step: Configure the project using CMake
- name: Configure CMake
run: |
mkdir build
cd build
cmake -D USE_FREETYPE=OFF -DCMAKE_BUILD_TYPE=${{ env.config }} ..
# Step: Run MSVC Code Analysis
- name: Run MSVC Code Analysis
uses: microsoft/msvc-code-analysis-action@v0.1.1
id: run-analysis
with:
cmakeBuildDirectory: ${{ env.build }}
buildConfiguration: ${{ env.config }}
ruleset: NativeRecommendedRules.ruleset
# Step: Upload SARIF file to GitHub Code Scanning Alerts
- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v3.26.5
with:
sarif_file: ${{ steps.run-analysis.outputs.sarif }}

View File

@@ -1,81 +0,0 @@
# This workflow runs daily on the IR branch to configure OCCT with vcpkg packages.
# It only performs configuration without building or installing, using vcpkg for dependency management.
name: Daily IR Branch vcpkg Configure
on:
schedule:
# Run daily at 02:00 UTC
- cron: '0 2 * * *'
workflow_dispatch:
# Allow manual triggering
jobs:
configure-windows:
name: Configure OCCT on Windows with MSVC
runs-on: windows-2025
if: github.repository == 'Open-Cascade-SAS/OCCT'
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
with:
ref: IR
- name: Configure OCCT
uses: ./.github/actions/configure-occt
with:
platform: windows
compiler: msvc
cmake-build-type: Release
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify configuration output
run: |
echo "::notice::Successfully configured OCCT on Windows with vcpkg packages"
configure-macos:
name: Configure OCCT on macOS with Clang
runs-on: macos-15
if: github.repository == 'Open-Cascade-SAS/OCCT'
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
with:
ref: IR
- name: Configure OCCT
uses: ./.github/actions/configure-occt
with:
platform: macos
compiler: clang
cmake-build-type: Release
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify configuration output
run: |
echo "::notice::Successfully configured OCCT on macOS with vcpkg packages"
configure-linux:
name: Configure OCCT on Ubuntu with Clang
runs-on: ubuntu-24.04
if: github.repository == 'Open-Cascade-SAS/OCCT'
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
with:
ref: IR
- name: Configure OCCT
uses: ./.github/actions/configure-occt
with:
platform: linux
compiler: clang
cmake-build-type: Release
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify configuration output
run: |
echo "::notice::Successfully configured OCCT on Linux with vcpkg packages"

View File

@@ -1,297 +0,0 @@
# Master validation workflow that combines multiple build configurations
# This workflow is triggered only on pushes to the master branch of the main repository
# It includes Windows (MSVC, MinGW), Ubuntu, vcpkg builds, and code analysis
name: Master Validation
on:
push:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
# Windows MSVC/Clang builds
windows-msvc:
if: github.repository == 'Open-Cascade-SAS/OCCT'
name: Windows MSVC/Clang validation
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
config:
- {
name: "MSVC",
cc: "cl",
cxx: "cl",
generator: "Visual Studio 17 2022",
toolset: "host=x64",
c_flags: "/W4 /WX",
cxx_flags: "/W4 /WX"
}
- {
name: "Clang",
cc: "clang",
cxx: "clang++",
generator: "Ninja",
toolset: "",
c_flags: "-Werror -Wall -Wextra -Wno-unknown-warning-option -Wno-error=cast-function-type-mismatch",
cxx_flags: "-Werror -Wall -Wextra -Wno-unknown-warning-option -Wno-error=cast-function-type-mismatch"
}
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup Windows MSVC dependencies
uses: ./.github/actions/setup-windows-msvc-deps
- name: Build basic configuration
uses: ./.github/actions/cmake-build-basic
with:
generator: ${{ matrix.config.generator }}
cc: ${{ matrix.config.cc }}
cxx: ${{ matrix.config.cxx }}
build-type: "Release"
thirdparty-dir: ${{ github.workspace }}/3rdparty-vc14-64
compiler-flags: "${{ matrix.config.toolset != '' && format('-T {0}', matrix.config.toolset) || '' }} -D CMAKE_CXX_FLAGS=\"${{ matrix.config.cxx_flags }}\" -D CMAKE_C_FLAGS=\"${{ matrix.config.c_flags }}\""
- name: Build full shared configuration
uses: ./.github/actions/cmake-build-full
with:
generator: ${{ matrix.config.generator }}
cc: ${{ matrix.config.cc }}
cxx: ${{ matrix.config.cxx }}
build-type: "Debug"
library-type: "Shared"
opt-profile: "Production"
thirdparty-dir: ${{ github.workspace }}/3rdparty-vc14-64
compiler-flags: "${{ matrix.config.toolset != '' && format('-T {0}', matrix.config.toolset) || '' }} -D CMAKE_CXX_FLAGS=\"${{ matrix.config.cxx_flags }}\" -D CMAKE_C_FLAGS=\"${{ matrix.config.c_flags }}\" -D USE_FFMPEG=ON"
use-vtk: ${{ matrix.config.name == 'MSVC' && 'ON' || 'OFF' }}
use-tbb: "ON"
# Windows MinGW builds
windows-mingw:
if: github.repository == 'Open-Cascade-SAS/OCCT'
name: Windows MinGW validation
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
config:
- {
name: "GCC",
cc: "x86_64-w64-mingw32-gcc",
cxx: "x86_64-w64-mingw32-g++",
package: "mingw-w64-x86_64-toolchain",
msystem: "MINGW64",
compiler_flags: "",
dependencies: "mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-rapidjson mingw-w64-x86_64-freetype mingw-w64-x86_64-draco mingw-w64-x86_64-freeimage mingw-w64-x86_64-tbb mingw-w64-x86_64-tk mingw-w64-x86_64-tcl mingw-w64-x86_64-openvr mingw-w64-x86_64-jemalloc mingw-w64-x86_64-mesa mingw-w64-x86_64-angleproject mingw-w64-x86_64-llvm-openmp mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-libwinpthread-git mingw-w64-cross-mingwarm64-winpthreads"
}
- {
name: "Clang",
cc: "clang",
cxx: "clang++",
package: "mingw-w64-clang-x86_64-toolchain",
msystem: "CLANG64",
compiler_flags: "-D CMAKE_CXX_FLAGS=\"-Wall -Wextra\" -D CMAKE_C_FLAGS=\"-Wall -Wextra\"",
dependencies: "mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-ninja mingw-w64-clang-x86_64-rapidjson mingw-w64-clang-x86_64-freetype mingw-w64-clang-x86_64-draco mingw-w64-clang-x86_64-freeimage mingw-w64-clang-x86_64-tbb mingw-w64-clang-x86_64-tk mingw-w64-clang-x86_64-tcl mingw-w64-clang-x86_64-openvr mingw-w64-clang-x86_64-jemalloc mingw-w64-clang-x86_64-mesa mingw-w64-clang-x86_64-angleproject mingw-w64-clang-x86_64-llvm-openmp mingw-w64-clang-x86_64-winpthreads-git mingw-w64-clang-x86_64-libwinpthread-git mingw-w64-cross-mingwarm64-winpthreads"
}
build_type: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup MSYS2
uses: ./.github/actions/setup-msys2
with:
msystem: ${{ matrix.config.msystem }}
packages: ${{ matrix.config.package }}
dependencies: ${{ matrix.config.dependencies }}
- name: Build basic configuration
uses: ./.github/actions/cmake-build-basic
with:
generator: "Ninja"
cc: ${{ matrix.config.cc }}
cxx: ${{ matrix.config.cxx }}
build-type: ${{ matrix.build_type }}
shell-type: "msys2"
compiler-flags: ${{ matrix.config.compiler_flags }}
- name: Build full shared configuration
uses: ./.github/actions/cmake-build-full
with:
generator: "Ninja"
cc: ${{ matrix.config.cc }}
cxx: ${{ matrix.config.cxx }}
build-type: ${{ matrix.build_type }}
library-type: "Shared"
opt-profile: "Production"
shell-type: "msys2"
compiler-flags: ${{ matrix.config.compiler_flags }}
use-vtk: "OFF"
use-tbb: "OFF"
# Ubuntu builds
ubuntu:
if: github.repository == 'Open-Cascade-SAS/OCCT'
name: Ubuntu validation
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
config:
- {
name: "GCC",
cc: "gcc",
cxx: "g++",
compiler_flags: ""
}
- {
name: "Clang",
cc: "clang",
cxx: "clang++",
compiler_flags: "-D CMAKE_CXX_FLAGS=\"-Werror -Wall -Wextra\" -D CMAKE_C_FLAGS=\"-Werror -Wall -Wextra\""
}
build_type: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup Ubuntu dependencies
uses: ./.github/actions/setup-ubuntu-deps
- name: Build basic configuration
uses: ./.github/actions/cmake-build-basic
with:
generator: "Ninja"
cc: ${{ matrix.config.cc }}
cxx: ${{ matrix.config.cxx }}
build-type: ${{ matrix.build_type }}
compiler-flags: ${{ matrix.config.compiler_flags }}
- name: Build full shared configuration
uses: ./.github/actions/cmake-build-full
with:
generator: "Ninja"
cc: ${{ matrix.config.cc }}
cxx: ${{ matrix.config.cxx }}
build-type: ${{ matrix.build_type }}
library-type: "Shared"
opt-profile: "Production"
compiler-flags: ${{ matrix.config.compiler_flags }}
rapidjson-dir: ${{ github.workspace }}/rapidjson-858451e5b7d1c56cf8f6d58f88cf958351837e53
use-vtk: "ON"
use-tbb: "ON"
# vcpkg builds
vcpkg:
if: github.repository == 'Open-Cascade-SAS/OCCT'
name: vcpkg validation
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04, windows-2022, windows-2025, macos-15, macos-14]
build_type: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Build OCCT with vcpkg
uses: ./.github/actions/build-occt
with:
platform: ${{ runner.os == 'Windows' && 'windows' || runner.os == 'macOS' && 'macos' || 'linux' }}
compiler: ${{ runner.os == 'Windows' && 'msvc' || 'clang' }}
artifact-name: occt-${{ matrix.os }}-${{ matrix.build_type }}
cmake-build-type: ${{ matrix.build_type }}
github-token: ${{ secrets.GITHUB_TOKEN }}
# Code analysis
codeql-analyze:
if: github.repository == 'Open-Cascade-SAS/OCCT'
name: CodeQL Analyze (C/C++)
runs-on: ubuntu-24.04
permissions:
contents: read
security-events: write
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y tcl-dev tk-dev cmake gcc g++ make libbtbb-dev libx11-dev libglu1-mesa-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.26.5
with:
languages: c-cpp
build-mode: manual
- name: Build project for analysis
uses: ./.github/actions/cmake-build-basic
with:
generator: "Unix Makefiles"
cc: "gcc"
cxx: "g++"
build-type: "Release"
compiler-flags: "-D USE_FREETYPE=OFF"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.26.5
with:
category: "/language:c-cpp"
msvc-analyze:
if: github.repository == 'Open-Cascade-SAS/OCCT'
name: Microsoft C++ Code Analysis
runs-on: windows-2025
permissions:
contents: read
security-events: write
packages: read
env:
build: '${{ github.workspace }}/build'
config: 'Debug'
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Configure OCCT for analysis
uses: ./.github/actions/configure-occt
with:
platform: 'windows'
compiler: 'msvc'
build-use-pch: 'false'
cmake-build-type: ${{ env.config }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run MSVC Code Analysis
uses: microsoft/msvc-code-analysis-action@v0.1.1
id: run-analysis
with:
cmakeBuildDirectory: ${{ env.build }}
buildConfiguration: ${{ env.config }}
ruleset: NativeRecommendedRules.ruleset
- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v3.26.5
with:
sarif_file: ${{ steps.run-analysis.outputs.sarif }}

15
.gitignore vendored
View File

@@ -56,18 +56,3 @@ win64
/build*
/install*
/tools/build*
# Coding agents instructions (keep .github/copilot-instructions.md)
/.CLAUDE.md
/.AGENT.md
/.GEMINI.md
/.COPILOT.md
/.CURSOR.md
/.CODEIUM.md
/.TABNINE.md
/.CHATGPT.md
/.BARD.md
/.PERPLEXITY.md
/.CONTINUE.md
/.AIDER.md
/.WINDSURF.md

View File

@@ -1,8 +1,5 @@
cmake_minimum_required (VERSION 3.10 FATAL_ERROR)
# Define OCCT root directory as a cache variable - works for both standalone and subproject builds
set(OCCT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Root directory of OCCT project" FORCE)
if (NOT DEFINED BUILD_USE_VCPKG)
set (BUILD_USE_VCPKG OFF CACHE BOOL "Use vcpkg for 3rdparty libraries.")
if (CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg.cmake")
@@ -34,7 +31,7 @@ if (BUILD_USE_VCPKG)
message(FATAL_ERROR "VCPKG_ROOT is not defined. Please set it to the path of vcpkg root directory.")
endif()
set (VCPKG_MANIFEST_DIR "${OCCT_ROOT_DIR}/adm/vcpkg/ports/opencascade")
set (VCPKG_MANIFEST_DIR "${CMAKE_SOURCE_DIR}/adm/vcpkg")
# Disable default features for vcpkg manifest
set (VCPKG_MANIFEST_NO_DEFAULT_FEATURES 1)
@@ -61,35 +58,41 @@ else()
PROJECT (OCCT)
endif()
set (CMAKE_MODULE_PATH "${OCCT_ROOT_DIR}/adm/cmake")
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
set (CMAKE_SUPPRESS_REGENERATION TRUE)
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
# set using C++ standard
set (BUILD_CPP_STANDARD "C++17" CACHE STRING "Select using c++ standard.")
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++17" "C++20" "C++23 C++26")
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
# Set desired C++ standard
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
set (CMAKE_CXX_STANDARD 11)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
set (CMAKE_CXX_STANDARD 14)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
set (CMAKE_CXX_STANDARD 17)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
set (CMAKE_CXX_STANDARD 20)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
set (CMAKE_CXX_STANDARD 23)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++26")
set (CMAKE_CXX_STANDARD 26)
else()
message (WARNING "C++ standard is not set or invalid. Set to C++17.")
set (CMAKE_CXX_STANDARD 17)
else ()
message (FATAL_ERROR, "misprint in c++ standard name")
endif()
if (DEFINED BUILD_GTEST AND BUILD_GTEST AND CMAKE_CXX_STANDARD LESS 14)
set (CMAKE_CXX_STANDARD 14)
message (STATUS "Info: C++14 standard is required for GTest. Set to C++14.")
endif()
set (CMAKE_CXX_STANDARD_REQUIRED ON)
# include cmake file
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
include (${OCCT_ROOT_DIR}/${BEING_INCLUDED_FILE}.cmake)
include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake)
endmacro()
# set using memory manager option for TKernel
@@ -263,30 +266,7 @@ if (NOT INSTALL_DIR_LAYOUT)
else()
set (INSTALL_DIR_LAYOUT "Unix" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE)
endif()
SET_PROPERTY(CACHE INSTALL_DIR_LAYOUT PROPERTY STRINGS Windows Unix Vcpkg)
endif()
# Define layout boolean variables for optimization
set(LAYOUT_IS_WINDOWS FALSE)
set(LAYOUT_IS_UNIX FALSE)
set(LAYOUT_IS_VCPKG FALSE)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows")
set(LAYOUT_IS_WINDOWS TRUE)
elseif ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set(LAYOUT_IS_UNIX TRUE)
elseif ("${INSTALL_DIR_LAYOUT}" STREQUAL "Vcpkg")
set(LAYOUT_IS_VCPKG TRUE)
endif()
# set project name for install directories (only used for vcpkg layout)
if (LAYOUT_IS_VCPKG)
if (NOT DEFINED OCCT_PROJECT_NAME)
set (OCCT_PROJECT_NAME "opencascade" CACHE STRING "${OCCT_PROJECT_NAME_DESCR}")
endif()
else()
# unset the variable if it was previously set for vcpkg but layout changed
OCCT_CHECK_AND_UNSET (OCCT_PROJECT_NAME)
SET_PROPERTY(CACHE INSTALL_DIR_LAYOUT PROPERTY STRINGS Windows Unix)
endif()
# check INSTALL_DIR_LAYOUT changes and update INSTALL_DIR_* paths if necessary
@@ -297,16 +277,6 @@ elseif (NOT "${INSTALL_DIR_LAYOUT_PREV}" STREQUAL "${INSTALL_DIR_LAYOUT}")
# The structure of install folder should be reset due to changed layout
OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS ()
# Manage OCCT_PROJECT_NAME based on layout
if (LAYOUT_IS_VCPKG)
if (NOT DEFINED OCCT_PROJECT_NAME)
set (OCCT_PROJECT_NAME "opencascade" CACHE STRING "${OCCT_PROJECT_NAME_DESCR}")
endif()
else()
# unset OCCT_PROJECT_NAME if layout changed from vcpkg to something else
OCCT_CHECK_AND_UNSET (OCCT_PROJECT_NAME)
endif()
# Unset INSTALL_DIR_WITH_VERSION on windows
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows")
OCCT_CHECK_AND_UNSET (INSTALL_DIR_WITH_VERSION)
@@ -342,7 +312,7 @@ elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}")
set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
endif()
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
if (NOT DEFINED INSTALL_DIR_WITH_VERSION_PREV)
set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE)
elseif (NOT "${INSTALL_DIR_WITH_VERSION_PREV}" STREQUAL "${INSTALL_DIR_WITH_VERSION}")
@@ -357,12 +327,10 @@ endif()
set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
set (BIN_LETTER "")
if (NOT LAYOUT_IS_VCPKG)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (BIN_LETTER "d")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set (BIN_LETTER "i")
endif()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (BIN_LETTER "d")
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set (BIN_LETTER "i")
endif()
# the list of being built toolkits
@@ -501,33 +469,12 @@ else()
OCCT_CHECK_AND_UNSET (BUILD_YACCLEX)
endif()
# Set 3RDPARTY_DIR based on layout
if (LAYOUT_IS_VCPKG)
if (NOT DEFINED 3RDPARTY_DIR)
# For vcpkg layout, set 3RDPARTY_DIR to vcpkg installed directory for path replacement
if (BUILD_USE_VCPKG AND VCPKG_INSTALLED_DIR AND VCPKG_TARGET_TRIPLET)
set (3RDPARTY_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH ${3RDPARTY_DIR_DESCR})
else()
set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR})
endif()
else()
file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR)
set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_DIR)
set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR})
get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE)
else()
# For non-vcpkg layouts, 3RDPARTY_DIR should be user-defined or empty
if (NOT DEFINED 3RDPARTY_DIR)
set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR})
# If using vcpkg with Windows layout, set to vcpkg installed directory for proper path replacement
if (BUILD_USE_VCPKG AND VCPKG_INSTALLED_DIR AND VCPKG_TARGET_TRIPLET)
set (3RDPARTY_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH ${3RDPARTY_DIR_DESCR} FORCE)
else()
get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE)
endif()
else()
file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR)
set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE)
endif()
file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR)
set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE)
endif()
# search for CSF variable in EXTERNLIB of each being used toolkit
@@ -543,18 +490,10 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
set (OCCT_3RDPARTY_CMAKE_LIST)
# define CSF variable
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
# Tcl (mandatory for Draw Harness)
if (USE_TCL)
message (STATUS "Info: TCL is used by OCCT")
if (CAN_USE_TK AND USE_TK)
OCCT_ADD_VCPKG_FEATURE ("tcltk")
else()
OCCT_ADD_VCPKG_FEATURE ("tcl")
OCCT_UNSET_VCPKG_FEATURE ("tcltk")
endif()
OCCT_ADD_VCPKG_FEATURE ("tcl")
list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/tcl")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
@@ -565,6 +504,7 @@ endif()
# Tk (optional for Draw Harness)
if (CAN_USE_TK AND USE_TK)
message (STATUS "Info: TK is used by OCCT")
OCCT_ADD_VCPKG_FEATURE ("tk")
list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/tk")
else()
if (NOT CAN_USE_TK)
@@ -572,6 +512,7 @@ else()
endif()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
OCCT_CHECK_AND_UNSET ("INSTALL_TK")
OCCT_UNSET_VCPKG_FEATURE ("tk")
endif()
# Xlib
@@ -742,12 +683,7 @@ if (CAN_USE_RAPIDJSON AND USE_RAPIDJSON)
elseif (NOT CAN_USE_RAPIDJSON)
OCCT_CHECK_AND_UNSET ("USE_RAPIDJSON")
OCCT_UNSET_VCPKG_FEATURE ("rapidjson")
else()
list (REMOVE_ITEM BUILD_TOOLKITS TKDEGLTF)
list (REMOVE_ITEM BUILD_TOOLKITS TKXSDRAWGLTF)
message(STATUS "Info: TKDEGLTF and TKXSDRAWGLTF toolkits excluded due to RapidJSON usage is disabled")
endif()
if (NOT CAN_USE_RAPIDJSON OR BUILD_USE_VCPKG)
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_RAPIDJSON")
OCCT_CHECK_AND_UNSET ("INSTALL_RAPIDJSON")
@@ -823,17 +759,6 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_JEMALLOC")
endif()
# GTest
if (BUILD_GTEST)
OCCT_ADD_VCPKG_FEATURE ("gtest")
list (APPEND OCCT_3RDPARTY_CMAKE_LIST "adm/cmake/gtest")
else()
OCCT_UNSET_VCPKG_FEATURE ("gtest")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GTEST")
OCCT_CHECK_AND_UNSET_GROUP ("GTest")
OCCT_CHECK_AND_UNSET ("INSTALL_GTEST")
endif()
# qt for samples
if (BUILD_SAMPLES_QT)
# check qt 3rdparty path
@@ -853,19 +778,20 @@ if (BUILD_USE_VCPKG)
project (OCCT)
endif()
if (APPLE)
# set Apple specific variables
occt_set_apple_csf_vars()
endif()
# copying clang-format file to the root of the project
file(COPY ${CMAKE_SOURCE_DIR}/.clang-format DESTINATION ${CMAKE_SOURCE_DIR})
# Get all used variables: OS_WITH_BIT, COMPILER
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
# define CSF variable
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
# do not define INSTALL_DIR_BIN for win.
# Leave library structure for win: <prefix>/win64/vc10/bin(d)
if (NOT DEFINED INSTALL_DIR_BIN)
if (LAYOUT_IS_UNIX OR LAYOUT_IS_VCPKG)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_BIN "bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}")
else()
set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}")
@@ -874,11 +800,8 @@ endif()
# define folder containing all shell/batch scripts
if (NOT DEFINED INSTALL_DIR_SCRIPT)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_SCRIPT "${INSTALL_DIR_BIN}" CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}")
elseif (LAYOUT_IS_VCPKG)
# For vcpkg, scripts should follow same debug/release pattern as binaries
set (INSTALL_DIR_SCRIPT "$<IF:$<CONFIG:Debug>,debug/bin,bin>" CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}")
else()
set (INSTALL_DIR_SCRIPT "." CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}")
endif()
@@ -886,7 +809,7 @@ endif()
# place the libraries to <prefix>/lib folder for unix and leave old structure for windows
if (NOT DEFINED INSTALL_DIR_LIB)
if (LAYOUT_IS_UNIX OR LAYOUT_IS_VCPKG)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_LIB "lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}")
else()
set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}")
@@ -896,13 +819,11 @@ endif()
# OCCT headers: <prefix>/inc for windows,
# <prefix>/include/opencascade-7.0.0 for unix
if (NOT DEFINED INSTALL_DIR_INCLUDE)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_INCLUDE "include/opencascade" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}")
if (INSTALL_DIR_WITH_VERSION)
set (INSTALL_DIR_INCLUDE "include/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}" FORCE)
endif()
elseif (LAYOUT_IS_VCPKG)
set (INSTALL_DIR_INCLUDE "include" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}")
else()
set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}")
endif()
@@ -911,13 +832,11 @@ endif()
# OCCT resources: <prefix>/src for windows,
# <prefix>/share/opencascade-7.0.0/resources for unix
if (NOT DEFINED INSTALL_DIR_RESOURCE)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_RESOURCE "share/opencascade/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}")
if (INSTALL_DIR_WITH_VERSION)
set (INSTALL_DIR_RESOURCE "share/opencascade-${OCC_VERSION_STRING_EXT}/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}" FORCE)
endif()
elseif (LAYOUT_IS_VCPKG)
set (INSTALL_DIR_RESOURCE "share/${OCCT_PROJECT_NAME}" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}")
else()
set (INSTALL_DIR_RESOURCE "src" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}")
endif()
@@ -925,13 +844,11 @@ endif()
# OCCT data
if (NOT DEFINED INSTALL_DIR_DATA)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_DATA "share/opencascade/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}")
if (INSTALL_DIR_WITH_VERSION)
set (INSTALL_DIR_DATA "share/opencascade-${OCC_VERSION_STRING_EXT}/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}" FORCE)
endif()
elseif (LAYOUT_IS_VCPKG)
set (INSTALL_DIR_DATA "share/${OCCT_PROJECT_NAME}" CACHE PATH "${INSTALL_DIR_DATA_DESCR}")
else()
set (INSTALL_DIR_DATA "data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}")
endif()
@@ -939,13 +856,11 @@ endif()
# OCCT samples
if (NOT DEFINED INSTALL_DIR_SAMPLES)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_SAMPLES "share/opencascade/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}")
if (INSTALL_DIR_WITH_VERSION)
set (INSTALL_DIR_SAMPLES "share/opencascade-${OCC_VERSION_STRING_EXT}/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}" FORCE)
endif()
elseif (LAYOUT_IS_VCPKG)
set (INSTALL_DIR_SAMPLES "share/${OCCT_PROJECT_NAME}/samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}")
else()
set (INSTALL_DIR_SAMPLES "samples" CACHE PATH "${INSTALL_DIR_SAMPLES_DESCR}")
endif()
@@ -953,13 +868,11 @@ endif()
# OCCT tests
if (NOT DEFINED INSTALL_DIR_TESTS)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_TESTS "share/opencascade/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}")
if (INSTALL_DIR_WITH_VERSION)
set (INSTALL_DIR_TESTS "share/opencascade-${OCC_VERSION_STRING_EXT}/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}" FORCE)
endif()
elseif (LAYOUT_IS_VCPKG)
set (INSTALL_DIR_TESTS "share/${OCCT_PROJECT_NAME}/tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}")
else()
set (INSTALL_DIR_TESTS "tests" CACHE PATH "${INSTALL_DIR_TESTS_DESCR}")
endif()
@@ -967,13 +880,11 @@ endif()
# OCCT doc
if (NOT DEFINED INSTALL_DIR_DOC)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
set (INSTALL_DIR_DOC "share/doc/opencascade" CACHE PATH "${INSTALL_DIR_DOC_DESCR}")
if (INSTALL_DIR_WITH_VERSION)
set (INSTALL_DIR_DOC "share/doc/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_DOC_DESCR}" FORCE)
endif()
elseif (LAYOUT_IS_VCPKG)
set (INSTALL_DIR_DOC "share/${OCCT_PROJECT_NAME}/doc" CACHE PATH "${INSTALL_DIR_DOC_DESCR}")
else()
set (INSTALL_DIR_DOC "doc" CACHE PATH "${INSTALL_DIR_DOC_DESCR}")
endif()
@@ -981,14 +892,12 @@ endif()
# define folder containing CMake configuration files
if (NOT DEFINED INSTALL_DIR_CMAKE)
if (LAYOUT_IS_UNIX)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
if (INSTALL_DIR_WITH_VERSION)
set (INSTALL_DIR_CMAKE "lib/cmake/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}")
else()
set (INSTALL_DIR_CMAKE "lib/cmake/opencascade" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}")
endif()
elseif (LAYOUT_IS_VCPKG)
set (INSTALL_DIR_CMAKE "share/${OCCT_PROJECT_NAME}" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}")
else()
set (INSTALL_DIR_CMAKE "cmake" CACHE PATH "${INSTALL_DIR_CMAKE_DESCR}")
endif()
@@ -998,7 +907,7 @@ endif()
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_resources")
# install LICENSE_LGPL_21.txt and OCCT_LGPL_EXCEPTION.txt files
if (LAYOUT_IS_UNIX OR LAYOUT_IS_VCPKG)
if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
OCCT_INSTALL_FILE_OR_DIR ("LICENSE_LGPL_21.txt" "${INSTALL_DIR_DOC}")
OCCT_INSTALL_FILE_OR_DIR ("OCCT_LGPL_EXCEPTION.txt" "${INSTALL_DIR_DOC}")
else()
@@ -1076,63 +985,34 @@ endif()
# build directories
if (SINGLE_GENERATOR)
if (LAYOUT_IS_VCPKG)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
endif()
else()
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
endif()
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
endif()
endif()
if (LAYOUT_IS_VCPKG)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin")
endif()
else()
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
endif()
if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
endif()
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header files into ${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE} ...")
message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...")
# collect all the headers to <binary dir>/inc folder
COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}" "src" "${INSTALL_DIR_INCLUDE}")
@@ -1179,6 +1059,7 @@ if (INSTALL_SAMPLES)
OCCT_INSTALL_FILE_OR_DIR ("samples/java" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/ocafsamples" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt" "${INSTALL_DIR_SAMPLES}")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code" "${INSTALL_DIR_SAMPLES}/OCCTOverview")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/FuncDemo" RENAME "env.${SCRIPT_EXT}")
install (FILES "${CMAKE_BINARY_DIR}/env.samples.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SAMPLES}/qt/IESample" RENAME "env.${SCRIPT_EXT}")
@@ -1196,14 +1077,13 @@ if (${DRAWEXE_INDEX} GREATER -1)
OCCT_INSTALL_FILE_OR_DIR ("data/" "${INSTALL_DIR_DATA}")
OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR_SAMPLES}")
install (FILES "${OCCT_ROOT_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}"
install (FILES "${CMAKE_SOURCE_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR_SCRIPT}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# copy draw script to CMake binary folder
OCCT_COPY_FILE_OR_DIR ("adm/templates/draw.${SCRIPT_EXT}" "${CMAKE_BINARY_DIR}")
endif()
OCCT_MAKE_COMPILER_BITNESS()
set (SUB_CUSTOM_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.${SCRIPT_EXT}")
if (WIN32)
@@ -1242,103 +1122,8 @@ endforeach()
# write current custom.bat/sh (for install directory)
set (SUB_CUSTOM_BUILD_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.install.${SCRIPT_EXT}")
# Set custom bin/lib paths variable for template
if (LAYOUT_IS_VCPKG)
# For vcpkg layout, paths need to handle debug/release structure
# Debug builds: scripts in debug/bin, need to go ../../ to reach root
# Release builds: scripts in bin, need to go ../ to reach root
if (WIN32)
set (OCCT_CUSTOM_BIN_LIB_PATHS "set \"CSF_OCCTBinPath=%CASROOT%\\bin\"
set \"CSF_OCCTLibPath=%CASROOT%\\lib\"
if exist \"%SCRIPTROOT%\\..\\..\\include\" (
set \"CASCONTENTROOT=%SCRIPTROOT%\\..\\..\"
) else (
set \"CASCONTENTROOT=%SCRIPTROOT%\\..\"
)
set \"CSF_OCCTIncludePath=%CASCONTENTROOT%\\include\"
set \"CSF_OCCTResourcePath=%CASCONTENTROOT%\\share\\${OCCT_PROJECT_NAME}\"
set \"CSF_OCCTDataPath=%CASCONTENTROOT%\\share\\${OCCT_PROJECT_NAME}\"
set \"CSF_OCCTSamplesPath=%CASCONTENTROOT%\\share\\${OCCT_PROJECT_NAME}\\samples\"
set \"CSF_OCCTTestsPath=%CASCONTENTROOT%\\share\\${OCCT_PROJECT_NAME}\\tests\"
set \"CSF_OCCTDocPath=%CASCONTENTROOT%\\share\\${OCCT_PROJECT_NAME}\\doc\"")
else()
set (OCCT_CUSTOM_BIN_LIB_PATHS "export CSF_OCCTBinPath=\"\${CASROOT}/bin\"
export CSF_OCCTLibPath=\"\${CASROOT}/lib\"
if [ -d \"\${aScriptPath}/../../include\" ]; then
export CASCONTENTROOT=\$(cd \"\${aScriptPath}/../..\" && pwd)
else
export CASCONTENTROOT=\$(cd \"\${aScriptPath}/..\" && pwd)
fi
export CSF_OCCTIncludePath=\"\${CASCONTENTROOT}/include\"
export CSF_OCCTResourcePath=\"\${CASCONTENTROOT}/share/${OCCT_PROJECT_NAME}\"
export CSF_OCCTDataPath=\"\${CASCONTENTROOT}/share/${OCCT_PROJECT_NAME}\"
export CSF_OCCTSamplesPath=\"\${CASCONTENTROOT}/share/${OCCT_PROJECT_NAME}/samples\"
export CSF_OCCTTestsPath=\"\${CASCONTENTROOT}/share/${OCCT_PROJECT_NAME}/tests\"
export CSF_OCCTDocPath=\"\${CASCONTENTROOT}/share/${OCCT_PROJECT_NAME}/doc\"")
endif()
# For vcpkg, we handle all paths in the bin/lib paths logic above
set (OCCT_CUSTOM_ADDITIONAL_PATHS "")
else()
# For other layouts, use CASROOT with full paths including build-specific suffixes
if (WIN32)
set (OCCT_CUSTOM_BIN_LIB_PATHS "set \"CSF_OCCTBinPath=%CASROOT%/${INSTALL_DIR_BIN}%3\"
set \"CSF_OCCTLibPath=%CASROOT%/${INSTALL_DIR_LIB}%3\"")
set (OCCT_CUSTOM_ADDITIONAL_PATHS "set \"CSF_OCCTIncludePath=%CASROOT%/${INSTALL_DIR_INCLUDE}\"
set \"CSF_OCCTResourcePath=%CASROOT%/${INSTALL_DIR_RESOURCE}\"
set \"CSF_OCCTDataPath=%CASROOT%/${INSTALL_DIR_DATA}\"
set \"CSF_OCCTSamplesPath=%CASROOT%/${INSTALL_DIR_SAMPLES}\"
set \"CSF_OCCTTestsPath=%CASROOT%/${INSTALL_DIR_TESTS}\"
set \"CSF_OCCTDocPath=%CASROOT%/${INSTALL_DIR_DOC}\"")
else()
set (OCCT_CUSTOM_BIN_LIB_PATHS "export CSF_OCCTBinPath=\"\${CASROOT}/${INSTALL_DIR_BIN}\"
export CSF_OCCTLibPath=\"\${CASROOT}/${INSTALL_DIR_LIB}\"")
set (OCCT_CUSTOM_ADDITIONAL_PATHS "export CSF_OCCTIncludePath=\"\${CASROOT}/${INSTALL_DIR_INCLUDE}\"
export CSF_OCCTResourcePath=\"\${CASROOT}/${INSTALL_DIR_RESOURCE}\"
export CSF_OCCTDataPath=\"\${CASROOT}/${INSTALL_DIR_DATA}\"
export CSF_OCCTSamplesPath=\"\${CASROOT}/${INSTALL_DIR_SAMPLES}\"
export CSF_OCCTTestsPath=\"\${CASROOT}/${INSTALL_DIR_TESTS}\"
export CSF_OCCTDocPath=\"\${CASROOT}/${INSTALL_DIR_DOC}\"")
endif()
endif()
OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.install.${SCRIPT_EXT}.in" "${SUB_CUSTOM_BUILD_NAME}" "${SUB_CUSTOM_NAME}" "${INSTALL_DIR_SCRIPT}")
# Set build directory paths for custom.build script
if (LAYOUT_IS_VCPKG)
# For vcpkg, use simple bin/lib paths
if (WIN32)
set (OCCT_CUSTOM_BUILD_BIN_LIB_PATHS "set \"CSF_OCCTBinPath=@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\"
set \"CSF_OCCTLibPath=@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@\"
if [\"@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\"] == [\"\"] (
set \"CSF_OCCTBinPath=@CMAKE_BINARY_DIR@/bin\"
set \"CSF_OCCTLibPath=@CMAKE_BINARY_DIR@/lib\"
)")
else()
set (OCCT_CUSTOM_BUILD_BIN_LIB_PATHS "export CSF_OCCTBinPath=\"@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\"
export CSF_OCCTLibPath=\"@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@\"")
endif()
else()
# For other layouts, use traditional paths with suffixes
if (WIN32)
set (OCCT_CUSTOM_BUILD_BIN_LIB_PATHS "set \"CSF_OCCTBinPath=@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\"
set \"CSF_OCCTLibPath=@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@\"
if [\"@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\"] == [\"\"] (
set \"CSF_OCCTBinPath=@CMAKE_BINARY_DIR@/win%ARCH%/%VCVER%/bin%3\"
set \"CSF_OCCTLibPath=@CMAKE_BINARY_DIR@/win%ARCH%/%VCVER%/lib%3\"
)")
else()
set (OCCT_CUSTOM_BUILD_BIN_LIB_PATHS "export CSF_OCCTBinPath=\"@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\"
export CSF_OCCTLibPath=\"@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@\"")
endif()
endif()
# Expand OCCT_CUSTOM_BUILD_BIN_LIB_PATHS variable to resolve nested @...@ variables
if (OCCT_CUSTOM_BUILD_BIN_LIB_PATHS)
string(CONFIGURE "${OCCT_CUSTOM_BUILD_BIN_LIB_PATHS}" OCCT_CUSTOM_BUILD_BIN_LIB_PATHS @ONLY)
endif()
# write current custom.bat/sh (for build directory)
OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME}")
@@ -1348,16 +1133,6 @@ if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
endif()
if (WIN32)
# Set custom script path variable for Windows template
if (LAYOUT_IS_VCPKG)
# For vcpkg, scripts are in same directory - use existing SCRIPTROOT variable
set (OCCT_CUSTOM_SCRIPT_PATH "custom.${SCRIPT_EXT}")
set (OCCT_CUSTOM_SCRIPT_PREFIX "%SCRIPTROOT%/")
else()
# For other layouts, use CASROOT with full path
set (OCCT_CUSTOM_SCRIPT_PATH "custom.${SCRIPT_EXT}")
set (OCCT_CUSTOM_SCRIPT_PREFIX "%CASROOT%/")
endif()
# env script for draw in building environment
OCCT_CONFIGURE ("adm/templates/env.${SCRIPT_EXT}.in" "env.${SCRIPT_EXT}")
# install env script
@@ -1368,20 +1143,6 @@ if (WIN32)
else()
set (SUB_ENV_NAME "env.${SCRIPT_EXT}")
set (SUB_ENV_BUILD_NAME "env.install.${SCRIPT_EXT}")
# Set custom script path variable for template
if (LAYOUT_IS_VCPKG)
# For vcpkg, scripts are in same directory - use existing path variables
set (OCCT_CUSTOM_SCRIPT_PATH "custom.${SCRIPT_EXT}")
if (WIN32)
set (OCCT_CUSTOM_SCRIPT_PREFIX "%SCRIPTROOT%/")
else()
set (OCCT_CUSTOM_SCRIPT_PREFIX "\${aScriptPath}/")
endif()
else()
# For other layouts, use CASROOT with full path
set (OCCT_CUSTOM_SCRIPT_PATH "${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}")
set (OCCT_CUSTOM_SCRIPT_PREFIX "\${CASROOT}/")
endif()
# install env script
OCCT_CONFIGURE_AND_INSTALL ("adm/templates/env.install.${SCRIPT_EXT}.in" "${SUB_ENV_BUILD_NAME}" "${SUB_ENV_NAME}" "${INSTALL_DIR_SCRIPT}")
# env script for draw in building environment
@@ -1413,13 +1174,13 @@ if (BUILD_SAMPLES_QT)
endforeach()
## Copy sources of OCCTOverview for using in the sample
OCCT_INSTALL_FILE_OR_DIR ("samples/qt/OCCTOverview/code/DataExchangeSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt/OCCTOverview/code/OcafSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt/OCCTOverview/code/GeometrySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt/OCCTOverview/code/TopologySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt/OCCTOverview/code/TriangulationSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt/OCCTOverview/code/Viewer2dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/qt/OCCTOverview/code/Viewer3dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/DataExchangeSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/OcafSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/GeometrySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/TopologySamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/TriangulationSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/Viewer2dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
OCCT_INSTALL_FILE_OR_DIR ("samples/OCCTOverview/code/Viewer3dSamples.cxx" "${INSTALL_DIR_SAMPLES}/OCCTOverview/code")
endif()
@@ -1435,6 +1196,7 @@ endforeach()
# Setup Google Test integration if enabled
if (BUILD_GTEST)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gtest")
enable_testing()
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_gtest")
@@ -1448,6 +1210,11 @@ if (BUILD_GTEST)
# Set environment variables for all tests
OCCT_SET_GTEST_ENVIRONMENT()
else()
# Disable GTest integration if not enabled
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GTEST")
OCCT_CHECK_AND_UNSET_GROUP ("GTest")
OCCT_CHECK_AND_UNSET ("INSTALL_GTEST")
endif()
if (BUILD_DOC_Overview OR BUILD_DOC_RefMan)
@@ -1480,7 +1247,7 @@ endif()
message (STATUS "Info: \(${CURRENT_TIME}\) OCCT toolkits processed")
# samples do not support patch usage
if (BUILD_SAMPLES_MFC OR BUILD_SAMPLES_QT)
set (OCCT_ROOT ${OCCT_ROOT_DIR})
set (OCCT_ROOT ${CMAKE_SOURCE_DIR})
endif()
if (BUILD_SAMPLES_MFC)
@@ -1498,18 +1265,6 @@ endif()
OCCT_MODULES_AND_TOOLKITS (SAMPLES "SAMPLES_TOOLKITS" OCCT_SAMPLES)
# Load sample configuration files
foreach (OCCT_SAMPLE ${OCCT_SAMPLES})
foreach (BUILD_SAMPLE_TOOLKIT ${${OCCT_SAMPLE}_SAMPLES_TOOLKITS})
OCCT_INCLUDE_CMAKE_FILE (samples/${OCCT_SAMPLE}/${BUILD_SAMPLE_TOOLKIT}/PACKAGES)
OCCT_INCLUDE_CMAKE_FILE (samples/${OCCT_SAMPLE}/${BUILD_SAMPLE_TOOLKIT}/EXTERNLIB)
OCCT_INCLUDE_CMAKE_FILE (samples/${OCCT_SAMPLE}/${BUILD_SAMPLE_TOOLKIT}/FILES)
foreach (PACKAGE ${OCCT_${BUILD_SAMPLE_TOOLKIT}_LIST_OF_PACKAGES})
OCCT_INCLUDE_CMAKE_FILE (samples/${OCCT_SAMPLE}/${PACKAGE}/FILES)
endforeach()
endforeach()
endforeach()
if (BUILD_SAMPLES_QT)
if (BUILD_SAMPLES_QT)
if (NOT Qt5_FOUND OR "${Qt5Gui_EGL_INCLUDE_DIRS}" STREQUAL "" OR NOT WIN32)
@@ -1582,7 +1337,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
endforeach()
set (SET_OpenCASCADE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
set (SET_OpenCASCADE_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
configure_file("${OCCT_ROOT_DIR}/adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in" "OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in" "OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" @ONLY)
endforeach()
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
@@ -1626,7 +1381,7 @@ if (APPLE)
endif()
# Configure and install cmake config file
configure_file("${OCCT_ROOT_DIR}/adm/templates/OpenCASCADEConfig.cmake.in" "OpenCASCADEConfig.cmake" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADEConfig.cmake.in" "OpenCASCADEConfig.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/OpenCASCADEConfig.cmake" DESTINATION "${INSTALL_DIR_CMAKE}")
# Configure cmake version file

View File

@@ -38,7 +38,11 @@ endmacro()
# vcpkg processing
if (BUILD_USE_VCPKG)
find_package (draco CONFIG REQUIRED)
set(CSF_Draco draco::draco)
set (3RDPARTY_DRACO_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}")
SEARCH_DRACO_LIB()
list (APPEND 3RDPARTY_INCLUDE_DIRS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/draco")
return()
endif()

View File

@@ -33,11 +33,11 @@ if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/Fl
endif()
# remove old general version of FlexLexer
if (EXISTS ${OCCT_ROOT_DIR}/${RELATIVE_SOURCES_DIR}/FlexLexer/FlexLexer.h)
message (STATUS "Info: remove old FLEX header file: ${OCCT_ROOT_DIR}/src/FlexLexer/FlexLexer.h")
file(REMOVE ${OCCT_ROOT_DIR}/src/FlexLexer/FlexLexer.h)
if (EXISTS ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/FlexLexer/FlexLexer.h)
message (STATUS "Info: remove old FLEX header file: ${CMAKE_SOURCE_DIR}/src/FlexLexer/FlexLexer.h")
file(REMOVE ${CMAKE_SOURCE_DIR}/src/FlexLexer/FlexLexer.h)
endif()
# install copy of FlexLexer.h locally to allow further building without flex
if (FLEX_INCLUDE_DIR AND EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
configure_file("${FLEX_INCLUDE_DIR}/FlexLexer.h" "${OCCT_ROOT_DIR}/src/FlexLexer/FlexLexer.h" @ONLY NEWLINE_STYLE LF)
configure_file("${FLEX_INCLUDE_DIR}/FlexLexer.h" "${CMAKE_SOURCE_DIR}/src/FlexLexer/FlexLexer.h" @ONLY NEWLINE_STYLE LF)
endif()

View File

@@ -113,8 +113,37 @@ if (WIN32)
set (CSF_OpenGlLibs "opengl32.lib")
set (CSF_OpenGlesLibs "libEGL libGLESv2")
else()
if (APPLE)
# Will be called later
set (CSF_objc "objc")
# frameworks
if (IOS)
find_library (Appkit_LIB NAMES UIKit)
set (CSF_Appkit ${Appkit_LIB})
else()
find_library (Appkit_LIB NAMES AppKit)
set (CSF_Appkit ${Appkit_LIB})
endif()
OCCT_CHECK_AND_UNSET (Appkit_LIB)
find_library (IOKit_LIB NAMES IOKit)
set (CSF_IOKit ${IOKit_LIB})
OCCT_CHECK_AND_UNSET (IOKit_LIB)
if (IOS)
find_library (OpenGlesLibs_LIB NAMES OpenGLES)
set (CSF_OpenGlesLibs ${OpenGlesLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlesLibs_LIB)
elseif (USE_XLIB)
set (CSF_OpenGlLibs "GL")
set (CSF_XwLibs "X11")
else()
find_library (OpenGlLibs_LIB NAMES OpenGL)
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
endif()
elseif (EMSCRIPTEN)
set (CSF_ThreadLibs "pthread rt stdc++")
set (CSF_OpenGlesLibs "EGL GLESv2")
@@ -134,59 +163,7 @@ else()
set (CSF_OpenGlesLibs "EGL GLESv2")
set (CSF_dl "dl")
if (USE_FREETYPE)
set (CSF_fontconfig "fontconfig expat")
set (CSF_fontconfig "fontconfig")
endif()
endif()
endif()
# Updates APPLE variables
function(occt_set_apple_csf_vars)
set (CSF_objc "objc" PARENT_SCOPE)
# frameworks
if (IOS)
find_library (Appkit_LIB NAMES UIKit)
if (Appkit_LIB)
set (CSF_Appkit ${Appkit_LIB} PARENT_SCOPE)
else()
set (CSF_Appkit "UIKit" PARENT_SCOPE)
endif()
else()
find_library (Appkit_LIB NAMES AppKit)
if (Appkit_LIB)
set (CSF_Appkit ${Appkit_LIB} PARENT_SCOPE)
else()
set (CSF_Appkit "AppKit" PARENT_SCOPE)
endif()
endif()
OCCT_CHECK_AND_UNSET (Appkit_LIB)
find_library (IOKit_LIB NAMES IOKit)
if (IOKit_LIB)
set (CSF_IOKit ${IOKit_LIB} PARENT_SCOPE)
else()
set (CSF_IOKit "IOKit" PARENT_SCOPE)
endif()
OCCT_CHECK_AND_UNSET (IOKit_LIB)
if (IOS)
find_library (OpenGlesLibs_LIB NAMES OpenGLES)
if (OpenGlesLibs_LIB)
set (CSF_OpenGlesLibs ${OpenGlesLibs_LIB} PARENT_SCOPE)
else()
set (CSF_OpenGlesLibs "OpenGLES" PARENT_SCOPE)
endif()
OCCT_CHECK_AND_UNSET (OpenGlesLibs_LIB)
elseif (USE_XLIB)
set (CSF_OpenGlLibs "GL" PARENT_SCOPE)
set (CSF_XwLibs "X11" PARENT_SCOPE)
else()
find_library (OpenGlLibs_LIB NAMES OpenGL)
if (OpenGlLibs_LIB)
set (CSF_OpenGlLibs ${OpenGlLibs_LIB} PARENT_SCOPE)
else()
set (CSF_OpenGlLibs "OpenGL" PARENT_SCOPE)
endif()
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
endif()
endfunction()

View File

@@ -151,27 +151,15 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPIL
# /GL (whole program optimization) is similar to -flto (Link Time Optimization) in GCC/Clang.
# /GF (eliminate duplicate strings) doesn't have a direct equivalent in GCC/Clang, but the compilers do string pooling automatically.
# /Gy (enable function-level linking) is similar to -ffunction-sections in GCC/Clang.
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
# Apply LTO optimization on all platforms
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
# Apply function sections only on non-macOS platforms
if (NOT APPLE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer -flto -ffunction-sections")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -fomit-frame-pointer -flto -ffunction-sections")
# Link-Time Code Generation (LTCG) is required for Whole Program Optimization
# Link-Time Code Generation(LTCG) is requared for Whole Program Optimisation(GL)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto")
# Add garbage collection sections only on Linux (not on macOS or Windows)
if (NOT WIN32 AND NOT APPLE)
if (NOT WIN32)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")

View File

@@ -258,7 +258,7 @@ endfunction()
# Function to load file lists for documentation
function(OCCT_DOC_LOAD_FILE_LISTS)
# Load list of HTML documentation files
set(FILES_HTML_PATH "${OCCT_ROOT_DIR}/dox/FILES_HTML.txt")
set(FILES_HTML_PATH "${CMAKE_SOURCE_DIR}/dox/FILES_HTML.txt")
if(EXISTS ${FILES_HTML_PATH})
file(STRINGS ${FILES_HTML_PATH} HTML_FILES REGEX "^[^#]+")
set(OCCT_DOC_HTML_FILES ${HTML_FILES} PARENT_SCOPE)
@@ -267,7 +267,7 @@ function(OCCT_DOC_LOAD_FILE_LISTS)
endif()
# Load list of PDF documentation files
set(FILES_PDF_PATH "${OCCT_ROOT_DIR}/dox/FILES_PDF.txt")
set(FILES_PDF_PATH "${CMAKE_SOURCE_DIR}/dox/FILES_PDF.txt")
if(EXISTS ${FILES_PDF_PATH})
file(STRINGS ${FILES_PDF_PATH} PDF_FILES REGEX "^[^#]+")
set(OCCT_DOC_PDF_FILES ${PDF_FILES} PARENT_SCOPE)
@@ -317,9 +317,9 @@ function(OCCT_DOC_CONFIGURE_DOXYGEN OUTPUT_DIR CONFIG_FILE DOC_TYPE)
# Use existing Doxygen template file as base
if(DOC_TYPE STREQUAL "OVERVIEW")
set(TEMPLATE_DOXYFILE "${OCCT_ROOT_DIR}/dox/resources/occt_ug_html.doxyfile")
set(TEMPLATE_DOXYFILE "${CMAKE_SOURCE_DIR}/dox/resources/occt_ug_html.doxyfile")
else()
set(TEMPLATE_DOXYFILE "${OCCT_ROOT_DIR}/dox/resources/occt_rm.doxyfile")
set(TEMPLATE_DOXYFILE "${CMAKE_SOURCE_DIR}/dox/resources/occt_rm.doxyfile")
endif()
# Define Doxygen parameters that need to be overridden from the template
@@ -355,7 +355,7 @@ function(OCCT_DOC_CONFIGURE_DOXYGEN OUTPUT_DIR CONFIG_FILE DOC_TYPE)
# Additional parameters based on the document type
if(DOC_TYPE STREQUAL "OVERVIEW")
# Settings for Overview documentation
file(APPEND ${DOXYGEN_CONFIG_FILE} "PROJECT_LOGO = ${OCCT_ROOT_DIR}/dox/resources/occ_logo.png\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "PROJECT_LOGO = ${CMAKE_SOURCE_DIR}/dox/resources/occ_logo.png\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "EXTRACT_ALL = NO\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "EXTRACT_PRIVATE = NO\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "EXTRACT_STATIC = NO\n")
@@ -374,27 +374,27 @@ function(OCCT_DOC_CONFIGURE_DOXYGEN OUTPUT_DIR CONFIG_FILE DOC_TYPE)
if(DEFINED OCCT_OVERVIEW_FILES)
file(APPEND ${DOXYGEN_CONFIG_FILE} "INPUT = ${OCCT_OVERVIEW_FILES}\n")
else()
file(APPEND ${DOXYGEN_CONFIG_FILE} "INPUT = ${OCCT_ROOT_DIR}/dox\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "INPUT = ${CMAKE_SOURCE_DIR}/dox\n")
endif()
# Collect image directories for overview
set(OVERVIEW_INPUT_DIRS ${OCCT_ROOT_DIR}/dox)
set(OVERVIEW_INPUT_DIRS ${CMAKE_SOURCE_DIR}/dox)
OCCT_DOC_COLLECT_IMAGE_DIRS("${OVERVIEW_INPUT_DIRS}" OVERVIEW_IMAGE_DIRS)
# Image path for overview
if(OVERVIEW_IMAGE_DIRS)
string(REPLACE ";" " " OVERVIEW_IMAGE_DIRS_STR "${OVERVIEW_IMAGE_DIRS}")
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${OVERVIEW_IMAGE_DIRS_STR} ${OCCT_ROOT_DIR}/dox/resources\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${OVERVIEW_IMAGE_DIRS_STR} ${CMAKE_SOURCE_DIR}/dox/resources\n")
else()
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${OCCT_ROOT_DIR}/dox/resources\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${CMAKE_SOURCE_DIR}/dox/resources\n")
endif()
# Example paths
file(APPEND ${DOXYGEN_CONFIG_FILE} "EXAMPLE_PATH = ${OCCT_ROOT_DIR}/src ${OCCT_ROOT_DIR}/samples\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "EXAMPLE_PATH = ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/samples\n")
else()
# Settings for Reference Manual
file(APPEND ${DOXYGEN_CONFIG_FILE} "PROJECT_NAME = \"Open CASCADE Technology Reference Manual\"\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "PROJECT_LOGO = ${OCCT_ROOT_DIR}/dox/resources/occ_logo.png\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "PROJECT_LOGO = ${CMAKE_SOURCE_DIR}/dox/resources/occ_logo.png\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "BUILTIN_STL_SUPPORT = YES\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "EXTRACT_PRIVATE = NO\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "EXTRACT_PACKAGE = YES\n")
@@ -407,14 +407,14 @@ function(OCCT_DOC_CONFIGURE_DOXYGEN OUTPUT_DIR CONFIG_FILE DOC_TYPE)
# Input files for reference manual - CRITICAL FOR PROPER GENERATION
file(APPEND ${DOXYGEN_CONFIG_FILE} "\n# Input files for reference manual\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "INPUT = ${OCCT_ROOT_DIR}/src\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "INPUT = ${CMAKE_SOURCE_DIR}/src\n")
# If generating documentation for specific modules
if(DEFINED OCCT_DOC_MODULES)
set(MODULE_PATHS "")
foreach(MODULE ${OCCT_DOC_MODULES})
foreach(TOOLKIT ${${MODULE}_TOOLKITS})
list(APPEND MODULE_PATHS "${OCCT_ROOT_DIR}/src/${TOOLKIT}")
list(APPEND MODULE_PATHS "${CMAKE_SOURCE_DIR}/src/${TOOLKIT}")
endforeach()
endforeach()
string(REPLACE ";" " " MODULE_PATHS_STR "${MODULE_PATHS}")
@@ -422,14 +422,14 @@ function(OCCT_DOC_CONFIGURE_DOXYGEN OUTPUT_DIR CONFIG_FILE DOC_TYPE)
endif()
# Configure image path for reference manual
set(REFMAN_INPUT_DIRS ${OCCT_ROOT_DIR}/src)
set(REFMAN_INPUT_DIRS ${CMAKE_SOURCE_DIR}/src)
OCCT_DOC_COLLECT_IMAGE_DIRS("${REFMAN_INPUT_DIRS}" REFMAN_IMAGE_DIRS)
if(REFMAN_IMAGE_DIRS)
string(REPLACE ";" " " REFMAN_IMAGE_DIRS_STR "${REFMAN_IMAGE_DIRS}")
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${REFMAN_IMAGE_DIRS_STR} ${OCCT_ROOT_DIR}/dox/resources\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${REFMAN_IMAGE_DIRS_STR} ${CMAKE_SOURCE_DIR}/dox/resources\n")
else()
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${OCCT_ROOT_DIR}/dox/resources\n")
file(APPEND ${DOXYGEN_CONFIG_FILE} "IMAGE_PATH = ${CMAKE_SOURCE_DIR}/dox/resources\n")
endif()
# Add main page file if generated
@@ -444,8 +444,8 @@ function(OCCT_DOC_CONFIGURE_DOXYGEN OUTPUT_DIR CONFIG_FILE DOC_TYPE)
endif()
# Custom CSS
if(EXISTS "${OCCT_ROOT_DIR}/dox/resources/custom.css")
file(APPEND ${DOXYGEN_CONFIG_FILE} "HTML_EXTRA_STYLESHEET = ${OCCT_ROOT_DIR}/dox/resources/custom.css\n")
if(EXISTS "${CMAKE_SOURCE_DIR}/dox/resources/custom.css")
file(APPEND ${DOXYGEN_CONFIG_FILE} "HTML_EXTRA_STYLESHEET = ${CMAKE_SOURCE_DIR}/dox/resources/custom.css\n")
endif()
# Set paths for dot tool
@@ -600,7 +600,7 @@ function(OCCT_SETUP_DOC_TARGETS)
file(MAKE_DIRECTORY "${REFMAN_OUTPUT_DIR}/html")
# Copy index file to provide fast access to HTML documentation
file(COPY "${OCCT_ROOT_DIR}/dox/resources/index.html" DESTINATION "${REFMAN_OUTPUT_DIR}")
file(COPY "${CMAKE_SOURCE_DIR}/dox/resources/index.html" DESTINATION "${REFMAN_OUTPUT_DIR}")
# Generate main page for reference manual
OCCT_DOC_GENERATE_MAIN_PAGE(${REFMAN_OUTPUT_DIR} "main_page.dox")
@@ -613,7 +613,7 @@ function(OCCT_SETUP_DOC_TARGETS)
add_custom_target(RefMan
COMMAND ${DOXYGEN_EXECUTABLE} ${REFMAN_OUTPUT_DIR}/Doxyfile
COMMENT "Generating Reference Manual with Doxygen"
WORKING_DIRECTORY ${OCCT_ROOT_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM
)
@@ -640,12 +640,12 @@ function(OCCT_SETUP_DOC_TARGETS)
add_custom_target(Overview
COMMAND ${DOXYGEN_EXECUTABLE} ${OVERVIEW_OUTPUT_DIR}/Doxyfile
COMMENT "Generating Overview documentation with Doxygen"
WORKING_DIRECTORY ${OCCT_ROOT_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM
)
# Copy index file to provide fast access to HTML documentation
file(COPY "${OCCT_ROOT_DIR}/dox/resources/index.html" DESTINATION "${OVERVIEW_OUTPUT_DIR}")
file(COPY "${CMAKE_SOURCE_DIR}/dox/resources/index.html" DESTINATION "${OVERVIEW_OUTPUT_DIR}")
# Add custom command to copy generated documentation to install location if required
if(INSTALL_DOC_Overview)
@@ -655,7 +655,7 @@ function(OCCT_SETUP_DOC_TARGETS)
# Create overview.html only for windows
if(WIN32)
install(FILES "${OCCT_ROOT_DIR}/dox/resources/overview.html"
install(FILES "${CMAKE_SOURCE_DIR}/dox/resources/overview.html"
DESTINATION "${INSTALL_DIR_DOC}")
endif()
endif()

View File

@@ -135,29 +135,29 @@ function(OCCT_SET_GTEST_ENVIRONMENT)
set(TEST_ENVIRONMENT
"CSF_LANGUAGE=us"
"MMGT_CLEAR=1"
"CSF_SHMessage=${OCCT_ROOT_DIR}/resources/SHMessage"
"CSF_MDTVTexturesDirectory=${OCCT_ROOT_DIR}/resources/Textures"
"CSF_ShadersDirectory=${OCCT_ROOT_DIR}/resources/Shaders"
"CSF_XSMessage=${OCCT_ROOT_DIR}/resources/XSMessage"
"CSF_TObjMessage=${OCCT_ROOT_DIR}/resources/TObj"
"CSF_StandardDefaults=${OCCT_ROOT_DIR}/resources/StdResource"
"CSF_PluginDefaults=${OCCT_ROOT_DIR}/resources/StdResource"
"CSF_XCAFDefaults=${OCCT_ROOT_DIR}/resources/StdResource"
"CSF_TObjDefaults=${OCCT_ROOT_DIR}/resources/StdResource"
"CSF_StandardLiteDefaults=${OCCT_ROOT_DIR}/resources/StdResource"
"CSF_IGESDefaults=${OCCT_ROOT_DIR}/resources/XSTEPResource"
"CSF_STEPDefaults=${OCCT_ROOT_DIR}/resources/XSTEPResource"
"CSF_XmlOcafResource=${OCCT_ROOT_DIR}/resources/XmlOcafResource"
"CSF_MIGRATION_TYPES=${OCCT_ROOT_DIR}/resources/StdResource/MigrationSheet.txt"
"CSF_OCCTResourcePath=${OCCT_ROOT_DIR}/resources"
"CSF_OCCTDataPath=${OCCT_ROOT_DIR}/data"
"CSF_OCCTDocPath=${OCCT_ROOT_DIR}/doc"
"CSF_OCCTSamplesPath=${OCCT_ROOT_DIR}/samples"
"CSF_OCCTTestsPath=${OCCT_ROOT_DIR}/tests"
"CSF_SHMessage=${CMAKE_SOURCE_DIR}/resources/SHMessage"
"CSF_MDTVTexturesDirectory=${CMAKE_SOURCE_DIR}/resources/Textures"
"CSF_ShadersDirectory=${CMAKE_SOURCE_DIR}/resources/Shaders"
"CSF_XSMessage=${CMAKE_SOURCE_DIR}/resources/XSMessage"
"CSF_TObjMessage=${CMAKE_SOURCE_DIR}/resources/TObj"
"CSF_StandardDefaults=${CMAKE_SOURCE_DIR}/resources/StdResource"
"CSF_PluginDefaults=${CMAKE_SOURCE_DIR}/resources/StdResource"
"CSF_XCAFDefaults=${CMAKE_SOURCE_DIR}/resources/StdResource"
"CSF_TObjDefaults=${CMAKE_SOURCE_DIR}/resources/StdResource"
"CSF_StandardLiteDefaults=${CMAKE_SOURCE_DIR}/resources/StdResource"
"CSF_IGESDefaults=${CMAKE_SOURCE_DIR}/resources/XSTEPResource"
"CSF_STEPDefaults=${CMAKE_SOURCE_DIR}/resources/XSTEPResource"
"CSF_XmlOcafResource=${CMAKE_SOURCE_DIR}/resources/XmlOcafResource"
"CSF_MIGRATION_TYPES=${CMAKE_SOURCE_DIR}/resources/StdResource/MigrationSheet.txt"
"CSF_OCCTResourcePath=${CMAKE_SOURCE_DIR}/resources"
"CSF_OCCTDataPath=${CMAKE_SOURCE_DIR}/data"
"CSF_OCCTDocPath=${CMAKE_SOURCE_DIR}/doc"
"CSF_OCCTSamplesPath=${CMAKE_SOURCE_DIR}/samples"
"CSF_OCCTTestsPath=${CMAKE_SOURCE_DIR}/tests"
"CSF_OCCTBinPath=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
"CSF_OCCTLibPath=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}"
"CSF_OCCTIncludePath=${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE}"
"CASROOT=${OCCT_ROOT_DIR}"
"CASROOT=${CMAKE_SOURCE_DIR}"
)
# Build PATH environment variable
@@ -215,12 +215,12 @@ function(OCCT_SET_GTEST_ENVIRONMENT)
endif()
# Add DrawResources related environment if it exists
if(EXISTS "${OCCT_ROOT_DIR}/resources/DrawResources")
list(APPEND TEST_ENVIRONMENT "DRAWHOME=${OCCT_ROOT_DIR}/resources/DrawResources")
list(APPEND TEST_ENVIRONMENT "CSF_DrawPluginDefaults=${OCCT_ROOT_DIR}/resources/DrawResources")
if(EXISTS "${CMAKE_SOURCE_DIR}/resources/DrawResources")
list(APPEND TEST_ENVIRONMENT "DRAWHOME=${CMAKE_SOURCE_DIR}/resources/DrawResources")
list(APPEND TEST_ENVIRONMENT "CSF_DrawPluginDefaults=${CMAKE_SOURCE_DIR}/resources/DrawResources")
if(EXISTS "${OCCT_ROOT_DIR}/resources/DrawResources/DrawDefault")
list(APPEND TEST_ENVIRONMENT "DRAWDEFAULT=${OCCT_ROOT_DIR}/resources/DrawResources/DrawDefault")
if(EXISTS "${CMAKE_SOURCE_DIR}/resources/DrawResources/DrawDefault")
list(APPEND TEST_ENVIRONMENT "DRAWDEFAULT=${CMAKE_SOURCE_DIR}/resources/DrawResources/DrawDefault")
endif()
endif()

View File

@@ -3,9 +3,9 @@
if(OCCT_MACROS_ALREADY_INCLUDED)
return()
endif()
set(OCCT_MACROS_ALREADY_INCLUDED 1)
macro (OCCT_CHECK_AND_UNSET VARNAME)
if (DEFINED ${VARNAME})
unset (${VARNAME} CACHE)
@@ -34,16 +34,16 @@ endmacro()
function (FILE_TO_LIST FILE_NAME FILE_CONTENT)
set (LOCAL_FILE_CONTENT)
if (EXISTS "${OCCT_ROOT_DIR}/${FILE_NAME}")
file (STRINGS "${OCCT_ROOT_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
if (EXISTS "${CMAKE_SOURCE_DIR}/${FILE_NAME}")
file (STRINGS "${CMAKE_SOURCE_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
endif()
set (${FILE_CONTENT} ${LOCAL_FILE_CONTENT} PARENT_SCOPE)
endfunction()
function(FIND_FOLDER_OR_FILE FILE_OR_FOLDER_NAME RESULT_PATH)
if (EXISTS "${OCCT_ROOT_DIR}/${FILE_OR_FOLDER_NAME}")
set (${RESULT_PATH} "${OCCT_ROOT_DIR}/${FILE_OR_FOLDER_NAME}" PARENT_SCOPE)
if (EXISTS "${CMAKE_SOURCE_DIR}/${FILE_OR_FOLDER_NAME}")
set (${RESULT_PATH} "${CMAKE_SOURCE_DIR}/${FILE_OR_FOLDER_NAME}" PARENT_SCOPE)
else()
set (${RESULT_PATH} "" PARENT_SCOPE)
endif()
@@ -72,9 +72,24 @@ endmacro()
macro (OCCT_MAKE_COMPILER_SHORT_NAME)
if (MSVC)
if (MSVC_VERSION LESS 1914)
message (FATAL_ERROR "Microsoft Visual C++ 19.14 (VS 2017 15.7) or newer is required for C++17 support")
message (AUTHOR_WARNING "Microsoft Visual C++ 19.14 (VS 2017 15.7) or newer is required for C++17 support")
endif()
if ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
if ((MSVC_VERSION EQUAL 1300) OR (MSVC_VERSION EQUAL 1310))
set (COMPILER vc7)
elseif (MSVC_VERSION EQUAL 1400)
set (COMPILER vc8)
elseif (MSVC_VERSION EQUAL 1500)
set (COMPILER vc9)
elseif (MSVC_VERSION EQUAL 1600)
set (COMPILER vc10)
elseif (MSVC_VERSION EQUAL 1700)
set (COMPILER vc11)
elseif (MSVC_VERSION EQUAL 1800)
set (COMPILER vc12)
elseif (MSVC_VERSION EQUAL 1900)
set (COMPILER vc14)
elseif ((MSVC_VERSION GREATER 1900) AND (MSVC_VERSION LESS 2000))
# Since Visual Studio 15 (2017), its version diverged from version of
# compiler which is 14.1; as that compiler uses the same run-time as 14.0,
# we keep its id as "vc14" to be compatible
@@ -84,28 +99,28 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
endif()
elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message (FATAL_ERROR "GCC version 8.0 or newer is required for C++17 support")
message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support")
endif()
set (COMPILER gcc)
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message (FATAL_ERROR "GCC version 8.0 or newer is required for C++17 support")
message (AUTHOR_WARNING "GCC version 8.0 or newer is required for C++17 support")
endif()
set (COMPILER gxx)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
if(APPLE)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0)
message (FATAL_ERROR "Apple Clang version 11.0.0 or newer is required for C++17 support")
message (AUTHOR_WARNING "Apple Clang version 11.0.0 or newer is required for C++17 support")
endif()
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
message (FATAL_ERROR "Clang version 7.0 or newer is required for C++17 support")
message (AUTHOR_WARNING "Clang version 7.0 or newer is required for C++17 support")
endif()
endif()
set (COMPILER clang)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.1.1)
message (FATAL_ERROR "Intel C++ Compiler version 17.1.1 or newer is required for C++17 support")
message (AUTHOR_WARNING "Intel C++ Compiler version 17.1.1 or newer is required for C++17 support")
endif()
set (COMPILER icc)
else()
@@ -156,7 +171,7 @@ function (FIND_SUBDIRECTORY ROOT_DIRECTORY DIRECTORY_SUFFIX SUBDIRECTORY_NAME)
endfunction()
function (OCCT_ORIGIN_AND_PATCHED_FILES RELATIVE_PATH SEARCH_TEMPLATE RESULT)
file (GLOB ORIGIN_FILES "${OCCT_ROOT_DIR}/${RELATIVE_PATH}/${SEARCH_TEMPLATE}")
file (GLOB ORIGIN_FILES "${CMAKE_SOURCE_DIR}/${RELATIVE_PATH}/${SEARCH_TEMPLATE}")
set (${RESULT} ${ORIGIN_FILES} PARENT_SCOPE)
endfunction()
@@ -213,15 +228,15 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
endfunction()
macro (OCCT_INSTALL_FILE_OR_DIR BEING_INSTALLED_OBJECT DESTINATION_PATH)
if (IS_DIRECTORY "${OCCT_ROOT_DIR}/${BEING_INSTALLED_OBJECT}")
install (DIRECTORY "${OCCT_ROOT_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
if (IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}")
install (DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
else()
install (FILES "${OCCT_ROOT_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
install (FILES "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
endif()
endmacro()
macro (OCCT_CONFIGURE_AND_INSTALL BEING_CONGIRUGED_FILE BUILD_NAME INSTALL_NAME DESTINATION_PATH)
configure_file("${OCCT_ROOT_DIR}/${BEING_CONGIRUGED_FILE}" "${BUILD_NAME}" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/${BEING_CONGIRUGED_FILE}" "${BUILD_NAME}" @ONLY)
install(FILES "${OCCT_BINARY_DIR}/${BUILD_NAME}" DESTINATION "${DESTINATION_PATH}" RENAME ${INSTALL_NAME})
endmacro()
@@ -253,7 +268,7 @@ function (EXTRACT_PACKAGE_FILES RELATIVE_PATH OCCT_PACKAGE RESULT_FILES RESULT_I
set (OCCT_PACKAGE_FILES "${OCCT_${OCCT_PACKAGE}_FILES}")
# collect and search for the files in the package directory or patched one
# FILE only contains filename that must to be inside package or patched directory
# FILE contains inly filename that must to be inside package or patched directory
set (FILE_PATH_LIST)
foreach (OCCT_FILE ${OCCT_PACKAGE_FILES})
@@ -343,8 +358,8 @@ endfunction()
function (FILE_TO_LIST FILE_NAME FILE_CONTENT)
set (LOCAL_FILE_CONTENT)
if (EXISTS "${OCCT_ROOT_DIR}/${FILE_NAME}")
file (STRINGS "${OCCT_ROOT_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
if (EXISTS "${CMAKE_SOURCE_DIR}/${FILE_NAME}")
file (STRINGS "${CMAKE_SOURCE_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
endif()
set (${FILE_CONTENT} ${LOCAL_FILE_CONTENT} PARENT_SCOPE)
@@ -354,7 +369,7 @@ function (COLLECT_AND_INSTALL_OCCT_HEADER_FILES THE_ROOT_TARGET_OCCT_DIR THE_OCC
set (OCCT_USED_PACKAGES)
# consider patched header.in template
set (TEMPLATE_HEADER_PATH "${OCCT_ROOT_DIR}/adm/templates/header.in")
set (TEMPLATE_HEADER_PATH "${CMAKE_SOURCE_DIR}/adm/templates/header.in")
set (OCCT_HEADER_FILES_COMPLETE)
foreach(OCCT_TOOLKIT ${THE_OCCT_BUILD_TOOLKITS})
@@ -366,11 +381,6 @@ function (COLLECT_AND_INSTALL_OCCT_HEADER_FILES THE_ROOT_TARGET_OCCT_DIR THE_OCC
list (FILTER HEADER_FILES_FILTERING INCLUDE REGEX ".+[.](h|g|p|lxx|hxx|pxx|hpp|gxx)$")
list (APPEND OCCT_HEADER_FILES_COMPLETE ${HEADER_FILES_FILTERING})
endforeach()
# parse root of the toolkit file
EXTRACT_PACKAGE_FILES (${THE_RELATIVE_PATH} ${OCCT_TOOLKIT} ALL_FILES _)
set (HEADER_FILES_FILTERING ${ALL_FILES})
list (FILTER HEADER_FILES_FILTERING INCLUDE REGEX ".+[.](h|g|p|lxx|hxx|pxx|hpp|gxx)$")
list (APPEND OCCT_HEADER_FILES_COMPLETE ${HEADER_FILES_FILTERING})
endforeach()
# Check that copying is done and match the include installation type.
@@ -428,29 +438,27 @@ function(ADD_PRECOMPILED_HEADER INPUT_TARGET PRECOMPILED_HEADER THE_IS_PRIVATE)
if (NOT BUILD_USE_PCH)
return()
endif()
# Angular bracket syntax is achieved using $<ANGLE-R> for closing bracket
if (${THE_IS_PRIVATE})
target_precompile_headers(${INPUT_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:<${PRECOMPILED_HEADER}$<ANGLE-R>>")
target_precompile_headers(${INPUT_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${PRECOMPILED_HEADER}>")
else()
target_precompile_headers(${INPUT_TARGET} PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:<${PRECOMPILED_HEADER}$<ANGLE-R>>")
target_precompile_headers(${INPUT_TARGET} PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${PRECOMPILED_HEADER}>")
endif()
endfunction()
macro (OCCT_COPY_FILE_OR_DIR BEING_COPIED_OBJECT DESTINATION_PATH)
# first of all, copy original files
if (EXISTS "${OCCT_ROOT_DIR}/${BEING_COPIED_OBJECT}")
file (COPY "${OCCT_ROOT_DIR}/${BEING_COPIED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
if (EXISTS "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}")
file (COPY "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
endif()
endmacro()
macro (OCCT_CONFIGURE BEING_CONGIRUGED_FILE FINAL_NAME)
configure_file("${OCCT_ROOT_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
endmacro()
macro (OCCT_ADD_SUBDIRECTORY BEING_ADDED_DIRECTORY)
if (EXISTS "${OCCT_ROOT_DIR}/${BEING_ADDED_DIRECTORY}/CMakeLists.txt")
add_subdirectory (${OCCT_ROOT_DIR}/${BEING_ADDED_DIRECTORY})
if (EXISTS "${CMAKE_SOURCE_DIR}/${BEING_ADDED_DIRECTORY}/CMakeLists.txt")
add_subdirectory (${CMAKE_SOURCE_DIR}/${BEING_ADDED_DIRECTORY})
else()
message (STATUS "${BEING_ADDED_DIRECTORY} directory is not included")
endif()
@@ -518,7 +526,7 @@ macro(OCCT_GET_GIT_HASH)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${OCCT_ROOT_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
ERROR_VARIABLE GIT_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -527,7 +535,7 @@ macro(OCCT_GET_GIT_HASH)
# Check if working directory is clean
execute_process(
COMMAND ${GIT_EXECUTABLE} status --porcelain
WORKING_DIRECTORY ${OCCT_ROOT_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_STATUS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
@@ -630,7 +638,7 @@ macro (FLEX_AND_BISON_TARGET_APPLY THE_PACKAGE_NAME RELATIVE_SOURCES_DIR)
continue()
endif()
# Note: files are generated in original source directory (not in patch!)
set (FLEX_BISON_TARGET_DIR "${OCCT_ROOT_DIR}/${RELATIVE_SOURCES_DIR}/${THE_PACKAGE_NAME}")
set (FLEX_BISON_TARGET_DIR "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${THE_PACKAGE_NAME}")
# choose appropriate extension for generated files: "cxx" if source file contains
# instruction to generate C++ code, "c" otherwise
set (BISON_OUTPUT_FILE_EXT "c")
@@ -664,7 +672,7 @@ macro (FLEX_AND_BISON_TARGET_APPLY THE_PACKAGE_NAME RELATIVE_SOURCES_DIR)
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
endif()
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${OCCT_ROOT_DIR}/${RELATIVE_SOURCES_DIR}/=")
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"
COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME} -L")
ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
@@ -696,17 +704,13 @@ macro (OCCT_UPDATE_TARGET_FILE)
endmacro()
macro (OCCT_INSERT_CODE_FOR_TARGET)
if (LAYOUT_IS_VCPKG)
install(CODE "set (OCCT_INSTALL_BIN_LETTER \"\")")
else()
install(CODE "if (\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$\")
set (OCCT_INSTALL_BIN_LETTER \"\")
elseif (\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo])$\")
set (OCCT_INSTALL_BIN_LETTER \"i\")
elseif (\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\")
set (OCCT_INSTALL_BIN_LETTER \"d\")
endif()")
endif()
install(CODE "if (\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$\")
set (OCCT_INSTALL_BIN_LETTER \"\")
elseif (\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo])$\")
set (OCCT_INSTALL_BIN_LETTER \"i\")
elseif (\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\")
set (OCCT_INSTALL_BIN_LETTER \"d\")
endif()")
endmacro()
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
@@ -832,12 +836,12 @@ function (PROCESS_CSF_LIBRARIES CURRENT_CSF LIST_NAME TARGET_NAME)
foreach (RELEASE_DIR ${FOUND_RELEASE_DIRS})
get_filename_component(RELEASE_DIR_ABS "${RELEASE_DIR}" ABSOLUTE)
target_link_directories(${TARGET_NAME} PRIVATE "$<$<CONFIG:RELEASE>:${RELEASE_DIR_ABS}>;$<$<CONFIG:RELWITHDEBINFO>:${RELEASE_DIR_ABS}>")
target_link_directories(${TARGET_NAME} PUBLIC "$<$<CONFIG:RELEASE>:${RELEASE_DIR_ABS}>;$<$<CONFIG:RELWITHDEBINFO>:${RELEASE_DIR_ABS}>")
endforeach()
foreach (DEBUG_DIR ${FOUND_DEBUG_DIRS})
get_filename_component(DEBUG_DIR_ABS "${DEBUG_DIR}" ABSOLUTE)
target_link_directories(${TARGET_NAME} PRIVATE "$<$<CONFIG:DEBUG>:${DEBUG_DIR_ABS}>")
target_link_directories(${TARGET_NAME} PUBLIC "$<$<CONFIG:DEBUG>:${DEBUG_DIR_ABS}>")
endforeach()
endfunction()
macro(OCCT_ADD_VCPKG_FEATURE THE_FEATURE)

View File

@@ -3,8 +3,8 @@
macro (OCCT_GENERATE_CONTENT_ONLY CurrentResource)
set (RESOURCE_FILES)
set (isResDirectory FALSE)
if (IS_DIRECTORY "${OCCT_ROOT_DIR}/resources/${CurrentResource}")
file (STRINGS "${OCCT_ROOT_DIR}/resources/${CurrentResource}/FILES" RESOURCE_FILES)
if (IS_DIRECTORY "${CMAKE_SOURCE_DIR}/resources/${CurrentResource}")
file (STRINGS "${CMAKE_SOURCE_DIR}/resources/${CurrentResource}/FILES" RESOURCE_FILES)
set (CurrentResource_Directory "${CurrentResource}")
set (isResDirectory TRUE)
else()
@@ -27,11 +27,11 @@ macro (OCCT_GENERATE_CONTENT_ONLY CurrentResource)
string (REPLACE "." "_" CurrentResource_FileName "${CurrentResource_FileName}")
set (HEADER_FILE_NAME "${CurrentResource_Directory}_${CurrentResource_FileName}.pxx")
message(STATUS "Info. Generating header file from resource file: ${OCCT_ROOT_DIR}/resources/${CurrentResource_Directory}/${RESOURCE_FILE}")
message(STATUS "Info. Generating header file from resource file: ${CMAKE_SOURCE_DIR}/resources/${CurrentResource_Directory}/${RESOURCE_FILE}")
# generate content for header file
set (OCCT_HEADER_FILE_CONTENT "// This file has been automatically generated from resource file resources/${CurrentResource_Directory}/${RESOURCE_FILE}\n\n")
# read resource file
file (STRINGS "${OCCT_ROOT_DIR}/resources/${CurrentResource_Directory}/${RESOURCE_FILE}" RESOURCE_FILE_LINES_LIST)
file (STRINGS "${CMAKE_SOURCE_DIR}/resources/${CurrentResource_Directory}/${RESOURCE_FILE}" RESOURCE_FILE_LINES_LIST)
set (OCCT_HEADER_FILE_CONTENT "${OCCT_HEADER_FILE_CONTENT}static const char ${CurrentResource_Directory}_${CurrentResource_FileName}[] =")
foreach (line IN LISTS RESOURCE_FILE_LINES_LIST)
string (REPLACE "\"" "\\\"" line "${line}")
@@ -43,7 +43,7 @@ macro (OCCT_GENERATE_CONTENT_ONLY CurrentResource)
if (EXISTS "${HEADER_FILE}")
file (REMOVE "${HEADER_FILE}")
endif()
configure_file ("${OCCT_ROOT_DIR}/adm/templates/header.in" "${HEADER_FILE}" @ONLY NEWLINE_STYLE LF)
configure_file ("${CMAKE_SOURCE_DIR}/adm/templates/header.in" "${HEADER_FILE}" @ONLY NEWLINE_STYLE LF)
endif()
endforeach()
endif()

View File

@@ -96,7 +96,7 @@ string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
set (USED_RCFILE "")
if (MSVC)
set (USED_RCFILE "${CMAKE_BINARY_DIR}/resources/${PROJECT_NAME}.rc")
configure_file("${OCCT_ROOT_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
endif()
set (CURRENT_MODULE)
@@ -120,13 +120,8 @@ endif (USE_QT)
if (EXECUTABLE_PROJECT)
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (LAYOUT_IS_VCPKG)
install (TARGETS ${PROJECT_NAME}
DESTINATION "$<IF:$<CONFIG:Debug>,debug/${INSTALL_DIR_BIN},${INSTALL_DIR_BIN}>")
else()
install (TARGETS ${PROJECT_NAME}
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
endif()
install (TARGETS ${PROJECT_NAME}
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
if (EMSCRIPTEN)
install(FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.wasm DESTINATION "${INSTALL_DIR_BIN}/${OCCT_INSTALL_BIN_LETTER}")
@@ -156,21 +151,12 @@ else()
set (CMAKE_SHARED_LIBRARY_SUFFIX "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
if (LAYOUT_IS_VCPKG)
install (TARGETS ${PROJECT_NAME}
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "$<IF:$<CONFIG:Debug>,debug/${INSTALL_DIR_BIN},${INSTALL_DIR_BIN}>"
ARCHIVE DESTINATION "$<IF:$<CONFIG:Debug>,debug/${INSTALL_DIR_LIB},${INSTALL_DIR_LIB}>"
LIBRARY DESTINATION "$<IF:$<CONFIG:Debug>,debug/${INSTALL_DIR_LIB},${INSTALL_DIR_LIB}>"
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
else()
install (TARGETS ${PROJECT_NAME}
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
endif()
install (TARGETS ${PROJECT_NAME}
EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
if (NOT WIN32)
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
@@ -295,14 +281,14 @@ if(IS_VTK_9XX)
string (REGEX REPLACE "vtk" "VTK::" USED_TOOLKITS_BY_CURRENT_PROJECT "${USED_TOOLKITS_BY_CURRENT_PROJECT}")
endif()
target_link_libraries (${PROJECT_NAME} PUBLIC ${USED_TOOLKITS_BY_CURRENT_PROJECT} PRIVATE ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
target_link_libraries (${PROJECT_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT} ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
if (USE_QT)
foreach (PROJECT_LIBRARY_DEBUG ${PROJECT_LIBRARIES_DEBUG})
target_link_libraries (${PROJECT_NAME} PRIVATE debug ${PROJECT_LIBRARY_DEBUG})
target_link_libraries (${PROJECT_NAME} debug ${PROJECT_LIBRARY_DEBUG})
endforeach()
foreach (PROJECT_LIBRARY_RELEASE ${PROJECT_LIBRARIES_RELEASE})
target_link_libraries (${PROJECT_NAME} PRIVATE optimized ${PROJECT_LIBRARY_RELEASE})
target_link_libraries (${PROJECT_NAME} optimized ${PROJECT_LIBRARY_RELEASE})
endforeach()
endif()

View File

@@ -0,0 +1,18 @@
if ("${TARGET_FOLDER}" STREQUAL "")
set (EXECUTABLE_PROJECT ON)
set (USE_QT ON)
set (RELATIVE_DIR "samples/qt")
set (MODULES_LIST ${OCCT_SAMPLES})
set (TARGET_FOLDER "Samples")
set (TOOLKITS_NAME_SUFFIX "SAMPLES_TOOLKITS")
include_directories("${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE}/${RELATIVE_DIR}")
else()
unset (USE_QT)
unset (RELATIVE_DIR)
unset (EXECUTABLE_PROJECT)
unset (MODULES_LIST)
unset (TARGET_FOLDER)
unset (TOOLKITS_NAME_SUFFIX)
endif("${TARGET_FOLDER}" STREQUAL "")

View File

@@ -79,24 +79,8 @@ macro (FIND_AND_WRAP_TS_FILE RESOURCE_FILE_NAME TARGET_FOLDER QM_FILES)
endmacro()
macro (FIND_AND_INSTALL_QT_RESOURCES OCCT_PACKAGE RESOURCE_FILES)
# Package name is now the sample name (e.g., "Tutorial")
set(PACKAGE_NAME ${OCCT_PACKAGE})
# Get files from CMAKE variables with proper location
set(ALL_FILES ${OCCT_${PACKAGE_NAME}_FILES})
set(FILES_LOCATION ${OCCT_${PACKAGE_NAME}_FILES_LOCATION})
# Filter for .ts and .qrc files with full paths
set(TS_FILES)
set(QRC_FILES)
foreach(FILE ${ALL_FILES})
if(FILE MATCHES ".+[.]ts$")
list(APPEND TS_FILES "${FILES_LOCATION}/${FILE}")
endif()
if(FILE MATCHES ".+[.]qrc$")
list(APPEND QRC_FILES "${FILES_LOCATION}/${FILE}")
endif()
endforeach()
file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" TS_FILES REGEX ".+[.]ts")
file (STRINGS "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/FILES" QRC_FILES REGEX ".+[.]qrc")
string (FIND "${OCCT_PACKAGE}" "/" _index)
if (_index GREATER -1)
@@ -108,17 +92,19 @@ macro (FIND_AND_INSTALL_QT_RESOURCES OCCT_PACKAGE RESOURCE_FILES)
#message("QRC files are: ${QRC_FILES} in ${OCCT_PACKAGE}")
foreach (QRC_FILE ${QRC_FILES})
if (EXISTS ${QRC_FILE})
FIND_AND_WRAP_RESOURCE_FILE(${QRC_FILE} RCC_FILES)
set (QRC_FILE_RELATIVE "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${QRC_FILE}")
if (EXISTS ${QRC_FILE_RELATIVE})
FIND_AND_WRAP_RESOURCE_FILE(${QRC_FILE_RELATIVE} RCC_FILES)
list (APPEND ${RESOURCE_FILES} "${RCC_FILES}")
endif()
endforeach()
#message("TS files are: ${TS_FILES} in ${OCCT_PACKAGE}")
foreach (TS_FILE ${TS_FILES})
FIND_AND_WRAP_TS_FILE(${TS_FILE} "${TARGET_FOLDER}/${CURRENT_MODULE}" QM_FILES)
if (EXISTS ${TS_FILE})
list (APPEND ${RESOURCE_FILES} "${TS_FILE}")
set (TS_FILE_RELATIVE "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${TS_FILE}")
FIND_AND_WRAP_TS_FILE(${TS_FILE_RELATIVE} "${TARGET_FOLDER}/${CURRENT_MODULE}" QM_FILES)
if (EXISTS ${TS_FILE_RELATIVE})
list (APPEND ${RESOURCE_FILES} "${TS_FILE_RELATIVE}")
list (APPEND ${RESOURCE_FILES} "${QM_FILES}")
endif()
endforeach()

View File

@@ -71,12 +71,7 @@ if (WIN32)
# Get installed configuration of tbb
get_target_property (TARGET_TBB_IMPORT_CONFS TBB::tbb IMPORTED_CONFIGURATIONS)
# Prioritize RELEASE configuration if available
if (";${TARGET_TBB_IMPORT_CONFS};" MATCHES ";RELEASE;")
set (CHOSEN_IMPORT_CONF "RELEASE")
else()
list (GET TARGET_TBB_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
endif()
list (GET TARGET_TBB_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)
@@ -209,12 +204,7 @@ else ()
# Get installed configuration of tbb
get_target_property (TARGET_TBB_IMPORT_CONFS TBB::tbb IMPORTED_CONFIGURATIONS)
# Prioritize RELEASE configuration if available
if (";${TARGET_TBB_IMPORT_CONFS};" MATCHES ";RELEASE;")
set (CHOSEN_IMPORT_CONF "RELEASE")
else()
list (GET TARGET_TBB_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
endif()
list (GET TARGET_TBB_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB)

View File

@@ -17,7 +17,6 @@ endif()
if (BUILD_USE_VCPKG)
set (3RDPARTY_TCL_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tcl" FORCE)
set (3RDPARTY_TCL_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE FILEPATH "The directory containing headers of tcl" FORCE)
set (3RDPARTY_TCL_LIBRARY_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" CACHE FILEPATH "The directory containing tcl library" FORCE)
endif()
# tcl library file (with absolute path)
@@ -183,7 +182,7 @@ endif()
if (3RDPARTY_TCL_LIBRARY AND EXISTS "${3RDPARTY_TCL_LIBRARY}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_TCL_LIBRARY_DIR}")
elseif(NOT BUILD_USE_VCPKG)
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_TCL_LIBRARY_DIR)
endif()

View File

@@ -18,11 +18,11 @@ if (NOT DEFINED 3RDPARTY_TK_INCLUDE_DIR)
set (3RDPARTY_TK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of tk")
endif()
if (BUILD_USE_VCPKG)
set (3RDPARTY_TK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tk" FORCE)
set (3RDPARTY_TCLTK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tcltk" FORCE)
set (3RDPARTY_TK_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE FILEPATH "The directory containing headers of tk" FORCE)
endif()
# if (BUILD_USE_VCPKG)
# set (3RDPARTY_TK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tk" FORCE)
# set (3RDPARTY_TCLTK_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" CACHE PATH "The directory containing tcltk" FORCE)
# set (3RDPARTY_TK_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE FILEPATH "The directory containing headers of tk" FORCE)
# endif()
if (BUILD_SHARED_LIBS)
# tk library file (with absolute path)

View File

@@ -1,9 +1,5 @@
# variable description
set (OCCT_PROJECT_NAME_DESCR
"Project name used in install directory paths for Unix and vcpkg layouts.
Allows customization of directory structure for different package names.")
set (BUILD_LIBRARY_TYPE_DESCR
"Specifies the type of library to be created. 'Shared' libraries
are linked dynamically and loaded at runtime. 'Static' libraries
@@ -60,7 +56,7 @@ set (INSTALL_DIR_WITH_VERSION_DESCR
set (INSTALL_DIR_LAYOUT_DESCR
"Defines structure of OCCT files (binaries, resources, headers etc.) for the install directory.
Three variants are predefined: for Windows (standard OCCT layout), for Unix operating systems (standard Linux layout), and for vcpkg (standard vcpkg layout without 'd' and 'i' suffixes).
Two variants are predefined: for Windows (standard OCCT layout) and for Unix operating systems (standard Linux layout).
If needed, layout can be customized with INSTALL_DIR_* variables.")
set (INSTALL_DIR_BIN_DESCR

View File

@@ -19,4 +19,4 @@
set (OCC_VERSION_MAJOR 8 )
set (OCC_VERSION_MINOR 0 )
set (OCC_VERSION_MAINTENANCE 0 )
set (OCC_VERSION_DEVELOPMENT "rc1" )
set (OCC_VERSION_DEVELOPMENT "dev" )

View File

@@ -1,41 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@X_COMPILER_BITNESS@'">
<LocalDebuggerEnvironment>CASROOT=@OCCT_ROOT_DIR@
<LocalDebuggerEnvironment>CASROOT=@CMAKE_SOURCE_DIR@
CSF_FPE=@BUILD_ENABLE_FPE_SIGNAL_HANDLER@
CSF_OCCTResourcePath=@OCCT_ROOT_DIR@/resources
DRAWHOME=@OCCT_ROOT_DIR@/resources/DrawResources
CSF_OCCTDataPath=@OCCT_ROOT_DIR@/data
CSF_OCCTSamplesPath=@OCCT_ROOT_DIR@/samples
CSF_OCCTTestsPath=@OCCT_ROOT_DIR@/tests
CSF_OCCTDocPath=@OCCT_ROOT_DIR@/doc
CSF_OCCTResourcePath=@CMAKE_SOURCE_DIR@/resources
DRAWHOME=@CMAKE_SOURCE_DIR@/resources/DrawResources
CSF_OCCTDataPath=@CMAKE_SOURCE_DIR@/data
CSF_OCCTSamplesPath=@CMAKE_SOURCE_DIR@/samples
CSF_OCCTTestsPath=@CMAKE_SOURCE_DIR@/tests
CSF_OCCTDocPath=@CMAKE_SOURCE_DIR@/doc
PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;%PATH%
</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>@CMAKE_BINARY_DIR@</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|@X_COMPILER_BITNESS@'">
<LocalDebuggerEnvironment>CASROOT=@OCCT_ROOT_DIR@
<LocalDebuggerEnvironment>CASROOT=@CMAKE_SOURCE_DIR@
CSF_FPE=@BUILD_ENABLE_FPE_SIGNAL_HANDLER@
CSF_OCCTResourcePath=@OCCT_ROOT_DIR@/resources
CSF_OCCTDataPath=@OCCT_ROOT_DIR@/data
CSF_OCCTSamplesPath=@OCCT_ROOT_DIR@/samples
CSF_OCCTTestsPath=@OCCT_ROOT_DIR@/tests
CSF_OCCTDocPath=@OCCT_ROOT_DIR@/doc
CSF_OCCTResourcePath=@CMAKE_SOURCE_DIR@/resources
CSF_OCCTDataPath=@CMAKE_SOURCE_DIR@/data
CSF_OCCTSamplesPath=@CMAKE_SOURCE_DIR@/samples
CSF_OCCTTestsPath=@CMAKE_SOURCE_DIR@/tests
CSF_OCCTDocPath=@CMAKE_SOURCE_DIR@/doc
PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;%PATH%
</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>@CMAKE_BINARY_DIR@</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@X_COMPILER_BITNESS@'">
<LocalDebuggerEnvironment>CASROOT=@OCCT_ROOT_DIR@
<LocalDebuggerEnvironment>CASROOT=@CMAKE_SOURCE_DIR@
CSF_FPE=@BUILD_ENABLE_FPE_SIGNAL_HANDLER@
DRAWHOME=@OCCT_ROOT_DIR@/resources/DrawResources
CSF_OCCTResourcePath=@OCCT_ROOT_DIR@/resources
CSF_OCCTDataPath=@OCCT_ROOT_DIR@/data
CSF_OCCTSamplesPath=@OCCT_ROOT_DIR@/samples
CSF_OCCTTestsPath=@OCCT_ROOT_DIR@/tests
CSF_OCCTDocPath=@OCCT_ROOT_DIR@/doc
DRAWHOME=@CMAKE_SOURCE_DIR@/resources/DrawResources
CSF_OCCTResourcePath=@CMAKE_SOURCE_DIR@/resources
CSF_OCCTDataPath=@CMAKE_SOURCE_DIR@/data
CSF_OCCTSamplesPath=@CMAKE_SOURCE_DIR@/samples
CSF_OCCTTestsPath=@CMAKE_SOURCE_DIR@/tests
CSF_OCCTDocPath=@CMAKE_SOURCE_DIR@/doc
PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;%PATH%
</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>

View File

@@ -17,12 +17,11 @@ set (OpenCASCADE_MAINTENANCE_VERSION "@OCC_VERSION_MAINTENANCE@")
set (OpenCASCADE_DEVELOPMENT_VERSION "@OCC_VERSION_DEVELOPMENT@")
# Compute the installation prefix from this OpenCASCADEConfig.cmake file
# location, by going up one level + one level if "cmake" + one level if "lib" + one level if "share".
# location, by going up one level + one level if "cmake" + one level if "lib".
# This is made to support different locations of CMake files:
# - in UNIX style: $INSTALL_DIR/lib/cmake/@OCCT_PROJECT_NAME@-<version>
# - in UNIX style: $INSTALL_DIR/lib/cmake/opencascade-<version>
# - in Windows style: $INSTALL_DIR/cmake
# - in vcpkg style: $INSTALL_DIR/share/@OCCT_PROJECT_NAME@
# - in Android style: $INSTALL_DIR/libs/$CMAKE_ANDROID_ARCH_ABI/cmake/@OCCT_PROJECT_NAME@-<version>
# - in Android style: $INSTALL_DIR/libs/$CMAKE_ANDROID_ARCH_ABI/cmake/opencascade-<version>
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
if (OpenCASCADE_INSTALL_PREFIX MATCHES "/cmake$")
@@ -31,9 +30,6 @@ endif()
if (OpenCASCADE_INSTALL_PREFIX MATCHES "/lib(32|64)?$")
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
endif()
if (OpenCASCADE_INSTALL_PREFIX MATCHES "/share$")
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
endif()
if (OpenCASCADE_INSTALL_PREFIX MATCHES "/libs/${CMAKE_ANDROID_ARCH_ABI}$")
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)
get_filename_component (OpenCASCADE_INSTALL_PREFIX "${OpenCASCADE_INSTALL_PREFIX}" PATH)

View File

@@ -25,16 +25,23 @@ if /I "%VCVER%" == "@COMPILER@" (
rem CSF_OCCTBinPath and CSF_OCCTLibPath are defined differently for
rem multiple and single configuration builds
@OCCT_CUSTOM_BUILD_BIN_LIB_PATHS@
set "CSF_OCCTBinPath=@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"
if ["@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"] == [""] (
set "CSF_OCCTBinPath=@CMAKE_BINARY_DIR@/win%ARCH%/%VCVER%/bin%3"
)
set "CSF_OCCTLibPath=@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@"
if ["@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@"] == [""] (
set "CSF_OCCTLibPath=@CMAKE_BINARY_DIR@/win%ARCH%/%VCVER%/lib%3"
)
set "CSF_OCCTIncludePath=@CMAKE_BINARY_DIR@/@INSTALL_DIR_INCLUDE@"
set "CSF_OCCTResourcePath=@OCCT_ROOT_DIR@/resources"
set "CSF_OCCTDataPath=@OCCT_ROOT_DIR@/data"
set "CSF_OCCTSamplesPath=@OCCT_ROOT_DIR@/samples"
set "CSF_OCCTTestsPath=@OCCT_ROOT_DIR@/tests"
set "CSF_OCCTDocPath=@OCCT_ROOT_DIR@/doc"
set "CSF_OCCTIncludePath=@CMAKE_BINARY_DIR@/inc"
set "CSF_OCCTResourcePath=@CMAKE_SOURCE_DIR@/resources"
set "CSF_OCCTDataPath=@CMAKE_SOURCE_DIR@/data"
set "CSF_OCCTSamplesPath=@CMAKE_SOURCE_DIR@/samples"
set "CSF_OCCTTestsPath=@CMAKE_SOURCE_DIR@/tests"
set "CSF_OCCTDocPath=@CMAKE_SOURCE_DIR@/doc"
rem for compatibility with external application using CASROOT
set "CASROOT=@OCCT_ROOT_DIR@"
set "CASROOT=@CMAKE_SOURCE_DIR@"
)
)

View File

@@ -14,25 +14,24 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"
export JEMALLOC_DIR="@3RDPARTY_JEMALLOC_LIBRARY_DIR@"
if [ "x@3RDPARTY_QT_DIR@" != "x" ]; then
if [ "x@3RDPARTY_QT_DIR" != "x" ]; then
export QTDIR="@3RDPARTY_QT_DIR@"
fi
export TCL_VERSION_WITH_DOT="@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
export TK_VERSION_WITH_DOT="@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
# CSF_OCCTBinPath and CSF_OCCTLibPath are defined differently for
# multiple and single configuration builds
@OCCT_CUSTOM_BUILD_BIN_LIB_PATHS@
export CSF_OCCTBinPath="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"
export CSF_OCCTLibPath="@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@"
export CSF_OCCTIncludePath="@CMAKE_BINARY_DIR@/@INSTALL_DIR_INCLUDE@"
export CSF_OCCTResourcePath="@OCCT_ROOT_DIR@/resources"
export CSF_OCCTDataPath="@OCCT_ROOT_DIR@/data"
export CSF_OCCTSamplesPath="@OCCT_ROOT_DIR@/samples"
export CSF_OCCTTestsPath="@OCCT_ROOT_DIR@/tests"
export CSF_OCCTDocPath="@OCCT_ROOT_DIR@/doc"
export CSF_OCCTResourcePath="@CMAKE_SOURCE_DIR@/resources"
export CSF_OCCTDataPath="@CMAKE_SOURCE_DIR@/data"
export CSF_OCCTSamplesPath="@CMAKE_SOURCE_DIR@/samples"
export CSF_OCCTTestsPath="@CMAKE_SOURCE_DIR@/tests"
export CSF_OCCTDocPath="@CMAKE_SOURCE_DIR@/doc"
# for compatibility with external application using CASROOT
export CASROOT="@OCCT_ROOT_DIR@"
export CASROOT="@CMAKE_SOURCE_DIR@"
fi
fi

View File

@@ -25,9 +25,15 @@ if /I "%VCVER%" == "@COMPILER@" (
set "TCL_VERSION_WITH_DOT=@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
set "TK_VERSION_WITH_DOT=@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
@OCCT_CUSTOM_BIN_LIB_PATHS@
set "CSF_OCCTBinPath=%CASROOT%/@INSTALL_DIR_BIN@%3"
set "CSF_OCCTLibPath=%CASROOT%/@INSTALL_DIR_LIB@%3"
@OCCT_CUSTOM_ADDITIONAL_PATHS@
set "CSF_OCCTIncludePath=%CASROOT%/@INSTALL_DIR_INCLUDE@"
set "CSF_OCCTResourcePath=%CASROOT%/@INSTALL_DIR_RESOURCE@"
set "CSF_OCCTDataPath=%CASROOT%/@INSTALL_DIR_DATA@"
set "CSF_OCCTSamplesPath=%CASROOT%/@INSTALL_DIR_SAMPLES@"
set "CSF_OCCTTestsPath=%CASROOT%/@INSTALL_DIR_TESTS@"
set "CSF_OCCTDocPath=%CASROOT%/@INSTALL_DIR_DOC@"
)
)

View File

@@ -21,10 +21,14 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TCL_VERSION_WITH_DOT="@3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT@"
export TK_VERSION_WITH_DOT="@3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT@"
# Set paths based on layout
@OCCT_CUSTOM_BIN_LIB_PATHS@
@OCCT_CUSTOM_ADDITIONAL_PATHS@
export CSF_OCCTBinPath="${CASROOT}/@INSTALL_DIR_BIN@"
export CSF_OCCTLibPath="${CASROOT}/@INSTALL_DIR_LIB@"
export CSF_OCCTIncludePath="${CASROOT}/@INSTALL_DIR_INCLUDE@"
export CSF_OCCTResourcePath="${CASROOT}/@INSTALL_DIR_RESOURCE@"
export CSF_OCCTDataPath="${CASROOT}/@INSTALL_DIR_DATA@"
export CSF_OCCTSamplesPath="${CASROOT}/@INSTALL_DIR_SAMPLES@"
export CSF_OCCTTestsPath="${CASROOT}/@INSTALL_DIR_TESTS@"
export CSF_OCCTDocPath="${CASROOT}/@INSTALL_DIR_DOC@"
fi
fi

View File

@@ -141,8 +141,8 @@ if /I ["%1"] == ["vc141"] set "VCVER=vc14"
if /I ["%1"] == ["vc142"] set "VCVER=vc14"
if /I ["%1"] == ["vc143"] set "VCVER=vc14"
if exist "@OCCT_CUSTOM_SCRIPT_PREFIX@@OCCT_CUSTOM_SCRIPT_PATH@" (
call "@OCCT_CUSTOM_SCRIPT_PREFIX@@OCCT_CUSTOM_SCRIPT_PATH@" %VCVER% %ARCH% %CASDEB%
if exist "%CASROOT%\custom.bat" (
call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
)
if not ["%QTDIR%"] == [""] (
@@ -166,8 +166,10 @@ if not "%CSF_OCCTBinPath%" == "" (
set "PATH=%CSF_OCCTBinPath%;%PATH%"
)
if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%"
if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%"
if not ["%TK_DIR%"] == ["%TCL_DIR%"] (
if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%"
if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%"
)
rem ----- Set envoronment variables used by OCCT -----
set CSF_LANGUAGE=us

View File

@@ -34,7 +34,7 @@ shopt -u nocasematch
# ----- Set path to 3rd party and OCCT libraries -----
anArch=`uname -m`
if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ] && [ "$anArch" != "aarch64" ] && [ "$anArch" != "arm64" ]; then
if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ] && [ "$anArch" != "aarch64"]; then
export ARCH="32";
else
export ARCH="64";
@@ -43,13 +43,14 @@ fi
aSystem=`uname -s`
if [ "$aSystem" == "Darwin" ]; then
export WOKSTATION="mac";
export ARCH="64";
else
export WOKSTATION="lin";
fi
# ----- Set local settings -----
if [ -e "@OCCT_CUSTOM_SCRIPT_PREFIX@@OCCT_CUSTOM_SCRIPT_PATH@" ]; then
source "@OCCT_CUSTOM_SCRIPT_PREFIX@@OCCT_CUSTOM_SCRIPT_PATH@" "${CASDEB}" "${ARCH}"
if [ -e "${CASROOT}/@INSTALL_DIR_SCRIPT@/custom.sh" ]; then
source "${CASROOT}/@INSTALL_DIR_SCRIPT@/custom.sh" "${CASDEB}" "${ARCH}"
fi
THRDPARTY_PATH=""

View File

@@ -21,4 +21,4 @@ export RES_DIR=${aSamplePath}/${STATION}/res
export PATH=${QTDIR}/bin:${PATH}
export "CSF_OCCTOverviewSampleCodePath=${aSamplePath}/../../qt/OCCTOverview/code"
export "CSF_OCCTOverviewSampleCodePath=${aSamplePath}/../../OCCTOverview/code"

View File

@@ -60,7 +60,7 @@ shopt -u nocasematch
# ----- Setup Environment Variables -----
anArch=`uname -m`
if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ] && [ "$anArch" != "aarch64" ] && [ "$anArch" != "arm64" ]; then
if [ "$anArch" != "x86_64" ] && [ "$anArch" != "ia64" ]; then
export ARCH="32";
else
export ARCH="64";
@@ -68,6 +68,7 @@ fi
if [ "$aSystem" == "Darwin" ]; then
export WOKSTATION="mac";
export ARCH="64";
else
export WOKSTATION="lin";
fi

View File

@@ -32,7 +32,7 @@ if [ ! -f "$EXE_PATH" ]; then
exit 1
fi
export CSF_OCCTOverviewSampleCodePath="${CSF_OCCTSamplesPath}/qt/OCCTOverview/code"
export CSF_OCCTOverviewSampleCodePath="${CSF_OCCTSamplesPath}/OCCTOverview/code"
cd ${aCurrentPath}
"$EXE_PATH"

View File

@@ -0,0 +1,25 @@
diff --git a/configure b/configure
index 89af70d..405680e 100755
--- a/configure
+++ b/configure
@@ -5480,15 +5480,17 @@ case $target_os in
;;
win32|win64)
disable symver
- if enabled shared; then
+# if enabled shared; then
# Link to the import library instead of the normal static library
# for shared libs.
LD_LIB='%.lib'
# Cannot build both shared and static libs with MSVC or icl.
- disable static
- fi
+# disable static
+# fi
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
shlibdir_default="$bindir_default"
+ LIBPREF=""
+ LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'

View File

@@ -0,0 +1,13 @@
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index fe424b6..2df70df 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -60,6 +60,8 @@
#include <sys/resource.h>
#endif
#ifdef _WIN32
+#define _WIN32_WINNT 0x0502
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

View File

@@ -0,0 +1,40 @@
diff --git a/configure b/configure
index 405680e..cc5bf29 100755
--- a/configure
+++ b/configure
@@ -4111,6 +4111,9 @@ for opt do
--libfuzzer=*)
libfuzzer_path="$optval"
;;
+ --debug)
+ enable debug_configure
+ ;;
*)
optname="${opt%%=*}"
optname="${optname#--}"
@@ -6316,7 +6319,11 @@ fi
enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
check_lib zlib zlib.h zlibVersion -lz; }
-enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
+if enabled debug_configure; then
+ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2d
+else
+ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
+fi
enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma
# On some systems dynamic loading requires no extra linker flags
@@ -6434,7 +6441,11 @@ enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8
enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
-enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+if enabled debug_configure; then
+ enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+else
+ enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+fi
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init

View File

@@ -0,0 +1,49 @@
diff --git a/configure b/configure
index cc5bf29..ee26559 100755
--- a/configure
+++ b/configure
@@ -6406,7 +6406,8 @@ if enabled libmfx; then
fi
enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
-enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
+enabled libmp3lame && { check_lib libmp3lame lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs ||
+ require libmp3lame lame/lame.h lame_set_VBR_quality -llibmp3lame-static -llibmpghip-static $libm_extralibs; }
enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei ||
@@ -6446,7 +6447,7 @@ if enabled debug_configure; then
else
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
fi
-enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
+enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr -lm
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
@@ -6527,6 +6528,8 @@ enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal"
enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel ||
check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
+ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -lAdvapi32 -lOle32 -lCfgmgr32||
+ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -pthread -ldl ||
die "ERROR: opencl not found"; } &&
{ test_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
test_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
@@ -6550,6 +6553,7 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -lcrypt32 -lAdvapi32 -lUser32||
die "ERROR: openssl not found"; }
enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init
enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create &&
@@ -6811,7 +6815,7 @@ enabled amf &&
if enabled libc_iconv; then
check_func_headers iconv.h iconv
elif enabled iconv; then
- check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
+ check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv || check_lib iconv iconv.h iconv -liconv -llibcharset
fi
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"

View File

@@ -0,0 +1,15 @@
diff --git a/configure b/configure
index ee26559..f2c83b7 100755
--- a/configure
+++ b/configure
@@ -4496,6 +4496,10 @@ msvc_common_flags(){
-march=*) ;;
-lz) echo zlib.lib ;;
-lx264) echo libx264.lib ;;
+ -lx265) echo libx265.lib ;;
+ -lmp3lame) echo libmp3lame.lib ;;
+ -liconv) echo iconv.lib ;;
+ -lm) ;;
-lstdc++) ;;
-l*) echo ${flag#-l}.lib ;;
-LARGEADDRESSAWARE) echo $flag ;;

View File

@@ -0,0 +1,13 @@
diff --git a/configure b/configure
index f2c83b7..5e42b12 100755
--- a/configure
+++ b/configure
@@ -6379,7 +6379,7 @@ enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
- { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
+ { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac -lm -lstdc++ &&
warn "using libfdk without pkg-config"; } }
flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs

View File

@@ -0,0 +1,13 @@
diff --git a/configure b/configure
index 5e42b12..d8f059f 100755
--- a/configure
+++ b/configure
@@ -6497,7 +6497,7 @@ enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
- { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
+ { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs -ldl" &&
warn "using libx264 without pkg-config"; } } &&
require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
check_cpp_condition libx262 x264.h "X264_MPEG2"

View File

@@ -0,0 +1,16 @@
diff --git a/configure b/configure
index d8f059f..f3688ad 100755
--- a/configure
+++ b/configure
@@ -6501,7 +6501,10 @@ enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x
warn "using libx264 without pkg-config"; } } &&
require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
check_cpp_condition libx262 x264.h "X264_MPEG2"
-enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
+enabled libx265 && { check_pkg_config libx265 x265 x265.h x265_api_get ||
+ { { check_lib libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++ -lgcc_s -lgcc -lrt -lnuma" ||
+ require libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++"; } &&
+ warn "using libx265 without pkg-config"; } } &&
require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get

View File

@@ -0,0 +1,12 @@
diff --git a/configure b/configure
index f3688ad..26e512e 100755
--- a/configure
+++ b/configure
@@ -6556,6 +6556,7 @@ enabled omx_rpi && { test_code cc OMX_Core.h OMX_IndexConfigBrcmVideoR
enabled omx && require_headers OMX_Core.h
enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto $pthreads_extralibs -ldl ||
check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||

View File

@@ -0,0 +1,16 @@
diff --git a/libavcodec/mf_utils.c b/libavcodec/mf_utils.c
index eeabd0c..ea3a03b 100644
--- a/libavcodec/mf_utils.c
+++ b/libavcodec/mf_utils.c
@@ -22,6 +22,11 @@
#define _WIN32_WINNT 0x0602
#endif
+#if !defined(WINVER) || WINVER < 0x0602
+#undef WINVER
+#define WINVER 0x0602
+#endif
+
#include "mf_utils.h"
#include "libavutil/pixdesc.h"

View File

@@ -0,0 +1,23 @@
diff --git a/configure b/configure
index 26e512e..c0377b6 100755
--- a/configure
+++ b/configure
@@ -3674,6 +3674,18 @@ vpp_qsv_filter_select="qsvvpp"
xfade_opencl_filter_deps="opencl"
yadif_cuda_filter_deps="ffnvcodec"
yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
+ametadata_filter_deps="avformat"
+metadata_filter_deps="avformat"
+headphone_filter_deps="avcodec"
+headphone_filter_select="fft"
+showspatial_filter_deps="avcodec"
+showspatial_filter_select="fft"
+superequalizer_filter_deps="avcodec"
+superequalizer_filter_select="rdft"
+surround_filter_deps="avcodec"
+surround_filter_select="rdft"
+sinc_filter_deps="avcodec"
+sinc_filter_select="rdft"
# examples
avio_list_dir_deps="avformat avutil"

View File

@@ -0,0 +1,13 @@
diff --git a/configure b/configure
index c0377b6..62753ef 100755
--- a/configure
+++ b/configure
@@ -6526,7 +6526,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z
enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
{ test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion
+enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion
enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init ||
check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init ||
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||

View File

@@ -0,0 +1,30 @@
diff --git a/compat/cuda/ptx2c.sh b/compat/cuda/ptx2c.sh
index 48452379c2..1c486dc30e 100755
--- a/compat/cuda/ptx2c.sh
+++ b/compat/cuda/ptx2c.sh
@@ -26,9 +26,10 @@ OUT="$1"
IN="$2"
NAME="$(basename "$IN" | sed 's/\..*//')"
-printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
+printf "const char %s_ptx[] = {\\" "$NAME" > "$OUT"
echo >> "$OUT"
-sed -e "$(printf 's/\r//g')" -e 's/["\\]/\\&/g' -e "$(printf 's/^/\t"/')" -e 's/$/\\n"/' < "$IN" >> "$OUT"
-echo ";" >> "$OUT"
+xxd -i < "$IN" >> "$OUT"
+echo " ,0x00" >> "$OUT"
+echo "};" >> "$OUT"
exit 0
diff --git a/configure b/configure
index 6190d06b0b..48fb73738e 100755
--- a/configure
+++ b/configure
@@ -1046,6 +1046,7 @@ test_nvcc(){
tmpo_=$TMPO
[ -x "$(command -v cygpath)" ] && tmpcu_=$(cygpath -m $tmpcu_) && tmpo_=$(cygpath -m $tmpo_)
test_cmd $nvcc $nvccflags "$@" $NVCC_C $(nvcc_o $tmpo_) $tmpcu_
+ test_cmd xxd
}
check_nvcc() {

View File

@@ -0,0 +1,13 @@
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 1fc0a00..06b2ff0 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -224,7 +224,7 @@ static av_cold int aom_free(AVCodecContext *avctx)
static av_cold int av1_init(AVCodecContext *avctx)
{
- return aom_init(avctx, &aom_codec_av1_dx_algo);
+ return aom_init(avctx, aom_codec_av1_dx());
}
AVCodec ff_libaom_av1_decoder = {

View File

@@ -0,0 +1,33 @@
diff --git a/configure b/configure
index 62753ef..018764e 100755
--- a/configure
+++ b/configure
@@ -6508,11 +6508,8 @@ enabled libvpx && {
enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
- { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs -ldl" &&
- warn "using libx264 without pkg-config"; } } &&
- require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
- check_cpp_condition libx262 x264.h "X264_MPEG2"
+enabled libx264 && check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
+ require_cpp_condition libx264 x264.h "X264_BUILD >= 158"
enabled libx265 && { check_pkg_config libx265 x265 x265.h x265_api_get ||
{ { check_lib libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++ -lgcc_s -lgcc -lrt -lnuma" ||
require libx265 x265.h x265_api_get "-lx265 $pthreads_extralibs $libm_extralibs -ldl -lstdc++"; } &&
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ddc497..0152d30 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -32,10 +32,6 @@
#include "packet_internal.h"
#include "atsc_a53.h"
-#if defined(_MSC_VER)
-#define X264_API_IMPORTS 1
-#endif
-
#include <x264.h>
#include <float.h>
#include <math.h>

View File

@@ -0,0 +1,28 @@
diff --git a/libswscale/aarch64/yuv2rgb_neon.S b/libswscale/aarch64/yuv2rgb_neon.S
index f4b220f..af677af 100644
--- a/libswscale/aarch64/yuv2rgb_neon.S
+++ b/libswscale/aarch64/yuv2rgb_neon.S
@@ -169,19 +169,19 @@ function ff_\ifmt\()_to_\ofmt\()_neon, export=1
sqdmulh v26.8H, v26.8H, v0.8H // ((Y1*(1<<3) - y_offset) * y_coeff) >> 15
sqdmulh v27.8H, v27.8H, v0.8H // ((Y2*(1<<3) - y_offset) * y_coeff) >> 15
-.ifc \ofmt,argb // 1 2 3 0
+.ifc \ofmt,argb
compute_rgba v5.8B,v6.8B,v7.8B,v4.8B, v17.8B,v18.8B,v19.8B,v16.8B
.endif
-.ifc \ofmt,rgba // 0 1 2 3
+.ifc \ofmt,rgba
compute_rgba v4.8B,v5.8B,v6.8B,v7.8B, v16.8B,v17.8B,v18.8B,v19.8B
.endif
-.ifc \ofmt,abgr // 3 2 1 0
+.ifc \ofmt,abgr
compute_rgba v7.8B,v6.8B,v5.8B,v4.8B, v19.8B,v18.8B,v17.8B,v16.8B
.endif
-.ifc \ofmt,bgra // 2 1 0 3
+.ifc \ofmt,bgra
compute_rgba v6.8B,v5.8B,v4.8B,v7.8B, v18.8B,v17.8B,v16.8B,v19.8B
.endif

View File

@@ -0,0 +1,43 @@
From c534d9f72a89542ed639071b1ae15893aadf1f18 Mon Sep 17 00:00:00 2001
From: rcombs <rcombs@rcombs.me>
Date: Sat, 16 Apr 2022 03:41:29 -0500
Subject: [PATCH] lavc/h264_ps: always include the stop bit in [s|p]ps->data
The VideoToolbox hwaccel needs the entire NAL (including the stop bit),
but ff_h2645_packet_split may remove it. Detect this case by looking for
bit counts divisible by 8 and insert a stop-bit-only 0x80 byte.
Signed-off-by: rcombs <rcombs@rcombs.me>
---
libavcodec/h264_ps.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 051f06692c..e16da68dec 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -351,6 +351,10 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
}
memcpy(sps->data, gb->buffer, sps->data_size);
+ // Re-add the removed stop bit (may be used by hwaccels).
+ if (!(gb->size_in_bits & 7) && sps->data_size < sizeof(sps->data))
+ sps->data[sps->data_size++] = 0x80;
+
profile_idc = get_bits(gb, 8);
constraint_set_flags |= get_bits1(gb) << 0; // constraint_set0_flag
constraint_set_flags |= get_bits1(gb) << 1; // constraint_set1_flag
@@ -775,6 +779,10 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
}
memcpy(pps->data, gb->buffer, pps->data_size);
+ // Re-add the removed stop bit (may be used by hwaccels).
+ if (!(bit_length & 7) && pps->data_size < sizeof(pps->data))
+ pps->data[pps->data_size++] = 0x80;
+
pps->sps_id = get_ue_golomb_31(gb);
if ((unsigned)pps->sps_id >= MAX_SPS_COUNT ||
!ps->sps_list[pps->sps_id]) {
--
2.20.1

View File

@@ -0,0 +1,22 @@
Subject: [PATCH] fix d3d11
---
Index: qsv.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -383,7 +383,11 @@
int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
const char *load_plugins, int gpu_copy)
{
+#if CONFIG_D3D11VA
+ mfxIMPL impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;
+#else
mfxIMPL impl = MFX_IMPL_AUTO_ANY;
+#endif
mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
mfxInitParam init_par = { MFX_IMPL_AUTO_ANY };

View File

@@ -0,0 +1,165 @@
# Distributed under the OSI-approved BSD 3-Clause License.
#
#.rst:
# FindFFMPEG
# --------
#
# Find the FFPMEG libraries
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# The following variables will be defined:
#
# ``FFMPEG_FOUND``
# True if FFMPEG found on the local system
#
# ``FFMPEG_INCLUDE_DIRS``
# Location of FFMPEG header files
#
# ``FFMPEG_LIBRARY_DIRS``
# Location of FFMPEG libraries
#
# ``FFMPEG_LIBRARIES``
# List of the FFMPEG libraries found
#
#
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
include(CMakeFindDependencyMacro)
if(NOT FFMPEG_FOUND)
# Compute the installation path relative to this file.
get_filename_component(SEARCH_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH)
get_filename_component(SEARCH_PATH "${SEARCH_PATH}" PATH)
if(SEARCH_PATH STREQUAL "/")
set(SEARCH_PATH "")
endif()
set(FFMPEG_VERSION "@FFMPEG_VERSION@")
function(append_dependencies out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "DEBUG" "NAMES" "")
if(${arg_DEBUG})
set(config DEBUG)
set(path "${CURRENT_INSTALLED_DIR}/debug/lib/")
else()
set(config RELEASE)
set(path "${CURRENT_INSTALLED_DIR}/lib/")
endif()
foreach(lib_name ${arg_NAMES})
if("${lib_name}" STREQUAL "-pthread")
list(APPEND ${out} "-pthread")
elseif("${lib_name}" STREQUAL "-pthreads")
list(APPEND ${out} "-pthreads")
elseif("${lib_name}" STREQUAL "gcc")
list(APPEND ${out} "-lgcc")
elseif("${lib_name}" STREQUAL "gcc_s")
list(APPEND ${out} "-lgcc_s")
elseif("${lib_name}" STREQUAL "stdc++")
list(APPEND ${out} "-lstdc++")
else()
# first look in ${path} specifically to ensure we find the right release/debug variant
find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" PATHS "${path}" NO_DEFAULT_PATH)
# if not found there, must be a system dependency, so look elsewhere
find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" REQUIRED)
list(APPEND ${out} "${FFMPEG_DEPENDENCY_${lib_name}_${config}}")
endif()
endforeach()
set("${out}" "${${out}}" PARENT_SCOPE)
endfunction()
macro(FFMPEG_FIND varname shortname headername)
if(NOT FFMPEG_${varname}_INCLUDE_DIRS)
find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATHS ${SEARCH_PATH}/include NO_DEFAULT_PATH)
endif()
if(NOT FFMPEG_${varname}_LIBRARY)
find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATHS ${SEARCH_PATH}/lib/ NO_DEFAULT_PATH)
find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS ${SEARCH_PATH}/debug/lib/ NO_DEFAULT_PATH)
get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY)
get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY)
select_library_configurations(FFMPEG_${varname})
set(FFMPEG_${varname}_LIBRARY ${FFMPEG_${varname}_LIBRARY} CACHE STRING "")
endif()
if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS)
set(FFMPEG_${varname}_FOUND TRUE BOOL)
list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_${varname}_INCLUDE_DIRS})
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_${varname}_LIBRARY})
list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR})
endif()
endmacro(FFMPEG_FIND)
if(@ENABLE_AVDEVICE@)
FFMPEG_FIND(libavdevice avdevice avdevice.h)
endif()
if(@ENABLE_AVFILTER@)
FFMPEG_FIND(libavfilter avfilter avfilter.h)
endif()
if(@ENABLE_AVFORMAT@)
FFMPEG_FIND(libavformat avformat avformat.h)
endif()
if(@ENABLE_AVCODEC@)
FFMPEG_FIND(libavcodec avcodec avcodec.h)
endif()
if(@ENABLE_AVRESAMPLE@)
FFMPEG_FIND(libavresample avresample avresample.h)
endif()
if(@ENABLE_POSTPROC@)
FFMPEG_FIND(libpostproc postproc postprocess.h)
endif()
if(@ENABLE_SWRESAMPLE@)
FFMPEG_FIND(libswresample swresample swresample.h)
endif()
if(@ENABLE_SWSCALE@)
FFMPEG_FIND(libswscale swscale swscale.h)
endif()
FFMPEG_FIND(libavutil avutil avutil.h)
if (FFMPEG_libavutil_FOUND)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS)
set(FFMPEG_libavutil_VERSION "@LIBAVUTIL_VERSION@" CACHE STRING "")
if(FFMPEG_libavcodec_FOUND)
set(FFMPEG_libavcodec_VERSION "@LIBAVCODEC_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavdevice_FOUND)
set(FFMPEG_libavdevice_VERSION "@LIBAVDEVICE_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavfilter_FOUND)
set(FFMPEG_libavfilter_VERSION "@LIBAVFILTER_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavformat_FOUND)
set(FFMPEG_libavformat_VERSION "@LIBAVFORMAT_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libavresample_FOUND)
set(FFMPEG_libavresample_VERSION "@LIBAVRESAMPLE_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libswresample_FOUND)
set(FFMPEG_libswresample_VERSION "@LIBSWRESAMPLE_VERSION@" CACHE STRING "")
endif()
if(FFMPEG_libswscale_FOUND)
set(FFMPEG_libswscale_VERSION "@LIBSWSCALE_VERSION@" CACHE STRING "")
endif()
append_dependencies(FFMPEG_DEPS_LIBRARY_RELEASE NAMES "@FFMPEG_DEPENDENCIES_RELEASE@")
append_dependencies(FFMPEG_DEPS_LIBRARY_DEBUG NAMES "@FFMPEG_DEPENDENCIES_DEBUG@" DEBUG)
if(FFMPEG_DEPS_LIBRARY_RELEASE OR FFMPEG_DEPS_LIBRARY_DEBUG)
select_library_configurations(FFMPEG_DEPS)
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_DEPS_LIBRARY})
endif()
set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES})
set(FFMPEG_FOUND TRUE CACHE BOOL "")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "")
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "")
set(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBRARY_DIRS} CACHE STRING "")
endif()
find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_LIBRARY_DIRS FFMPEG_INCLUDE_DIRS)
endif()

View File

@@ -0,0 +1,126 @@
#!/bin/sh
set -e
export PATH="/usr/bin:$PATH"
command -v cygpath >/dev/null && have_cygpath=1
cygpath() {
if [ -n "$have_cygpath" ]; then
command cygpath "$@"
else
eval _p='$'$#
printf '%s\n' "$_p"
fi
}
move_binary() {
SOURCE=$1
TARGET=$2
BINARY=$3
# run lipo over the command to check whether it really
# is a binary that we need to merge architectures
lipo $SOURCE/$BINARY -info &> /dev/null || return 0
# get the directory name the file is in
DIRNAME=$(dirname $BINARY)
# ensure the directory to move the binary to exists
mkdir -p $TARGET/$DIRNAME
# now finally move the binary
mv $SOURCE/$BINARY $TARGET/$BINARY
}
move_binaries() {
SOURCE=$1
TARGET=$2
[ ! -d $SOURCE ] && return 0
pushd $SOURCE
for BINARY in $(find . -type f); do
move_binary $SOURCE $TARGET $BINARY
done
popd
}
merge_binaries() {
TARGET=$1
SOURCE=$2
shift
shift
pushd $SOURCE/$1
BINARIES=$(find . -type f)
popd
for BINARY in $BINARIES; do
COMMAND="lipo -create -output $TARGET/$BINARY"
for ARCH in $@; do
COMMAND="$COMMAND -arch $ARCH $SOURCE/$ARCH/$BINARY"
done
$($COMMAND)
done
}
export PKG_CONFIG_PATH="$(cygpath -p "${PKG_CONFIG_PATH}")"
# Export HTTP(S)_PROXY as http(s)_proxy:
[ -n "$HTTP_PROXY" ] && export http_proxy="$HTTP_PROXY"
[ -n "$HTTPS_PROXY" ] && export https_proxy="$HTTPS_PROXY"
PATH_TO_BUILD_DIR=$( cygpath "@BUILD_DIR@")
PATH_TO_SRC_DIR=$( cygpath "@SOURCE_PATH@")
PATH_TO_PACKAGE_DIR=$(cygpath "@INST_PREFIX@")
JOBS=@VCPKG_CONCURRENCY@
OSX_ARCHS="@OSX_ARCHS@"
OSX_ARCH_COUNT=0@OSX_ARCH_COUNT@
# Default to hardware concurrency if unset.
: ${JOBS:=$(nproc)}
build_ffmpeg() {
echo "=== CONFIGURING ==="
sh "$PATH_TO_SRC_DIR/configure" "--prefix=$PATH_TO_PACKAGE_DIR" "--cc=$CC" @CONFIGURE_OPTIONS@ $@
echo "=== BUILDING ==="
make -j${JOBS} V=1
echo "=== INSTALLING ==="
make install
}
cd "$PATH_TO_BUILD_DIR"
if [ $OSX_ARCH_COUNT -gt 1 ]; then
for ARCH in $OSX_ARCHS; do
echo "=== CLEANING FOR $ARCH ==="
make clean && make distclean
build_ffmpeg --enable-cross-compile --arch=$ARCH --extra-cflags=-arch --extra-cflags=$ARCH --extra-ldflags=-arch --extra-ldflags=$ARCH
echo "=== COLLECTING BINARIES FOR $ARCH ==="
move_binaries $PATH_TO_PACKAGE_DIR/lib $PATH_TO_BUILD_DIR/stage/$ARCH/lib
move_binaries $PATH_TO_PACKAGE_DIR/bin $PATH_TO_BUILD_DIR/stage/$ARCH/bin
done
echo "=== MERGING ARCHITECTURES ==="
merge_binaries $PATH_TO_PACKAGE_DIR $PATH_TO_BUILD_DIR/stage $OSX_ARCHS
else
build_ffmpeg
fi

View File

@@ -0,0 +1,826 @@
if(VCPKG_TARGET_IS_WINDOWS)
set(PATCHES 0017-Patch-for-ticket-9019-CUDA-Compile-Broken-Using-MSVC.patch) # https://trac.ffmpeg.org/ticket/9019
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ffmpeg/ffmpeg
REF n4.4.5
SHA512 09338a10b31f0e551735b9aa57e2c22ceae15bbbca1ee04535587ff55f181e187a77ede4e70d8cd0e1e7c85fb27a7e513c93b91848013e997263d58780b8fa49
HEAD_REF master
PATCHES
0001-create-lib-libraries.patch
0003-fix-windowsinclude.patch
0004-fix-debug-build.patch
0006-fix-StaticFeatures.patch
0007-fix-lib-naming.patch
0009-Fix-fdk-detection.patch
0010-Fix-x264-detection.patch
0011-Fix-x265-detection.patch
#0012-Fix-ssl-110-detection.patch
0013-define-WINVER.patch
0014-avfilter-dependency-fix.patch # https://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/275819.html
0015-Fix-xml2-detection.patch
${PATCHES}
0018-libaom-Dont-use-aom_codec_av1_dx_algo.patch
0019-libx264-Do-not-explicitly-set-X264_API_IMPORTS.patch
0020-fix-aarch64-libswscale.patch
0022-fix-m1-hardware-decode-nal-bits.patch # remove in next version
0023-fix-qsv-init.patch # remove in next version (5.x)
)
if (SOURCE_PATH MATCHES " ")
message(FATAL_ERROR "Error: ffmpeg will not build with spaces in the path. Please use a directory with no spaces")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
# ffmpeg nasm build gives link error on x86, so fall back to yasm
vcpkg_find_acquire_program(YASM)
get_filename_component(YASM_EXE_PATH "${YASM}" DIRECTORY)
vcpkg_add_to_path("${YASM_EXE_PATH}")
else()
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY)
vcpkg_add_to_path("${NASM_EXE_PATH}")
endif()
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
#We're assuming that if we're building for Windows we're using MSVC
set(INCLUDE_VAR "INCLUDE")
set(LIB_PATH_VAR "LIB")
else()
set(INCLUDE_VAR "CPATH")
set(LIB_PATH_VAR "LIBRARY_PATH")
endif()
set(OPTIONS "--enable-pic --disable-doc --enable-debug --enable-runtime-cpudetect")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(OPTIONS "${OPTIONS} --disable-asm --disable-x86asm")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(OPTIONS "${OPTIONS} --enable-asm --disable-x86asm")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(OPTIONS "${OPTIONS} --enable-asm --enable-x86asm")
endif()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_acquire_msys(MSYS_ROOT)
set(SHELL "${MSYS_ROOT}/usr/bin/bash.exe")
else()
set(SHELL /bin/sh)
endif()
if(VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
string(APPEND OPTIONS " --target-os=mingw32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
string(APPEND OPTIONS " --target-os=mingw64")
endif()
elseif(VCPKG_TARGET_IS_LINUX)
string(APPEND OPTIONS " --target-os=linux")
elseif(VCPKG_TARGET_IS_WINDOWS)
string(APPEND OPTIONS " --target-os=win32")
elseif(VCPKG_TARGET_IS_OSX)
string(APPEND OPTIONS " --target-os=darwin")
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
string(APPEND OPTIONS " --target-os=android")
else()
endif()
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
if(VCPKG_DETECTED_MSVC)
set(OPTIONS "--toolchain=msvc ${OPTIONS}")
# This is required because ffmpeg depends upon optimizations to link correctly
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -O2")
string(REGEX REPLACE "(^| )-RTC1( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
string(REGEX REPLACE "(^| )-Od( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
string(REGEX REPLACE "(^| )-Ob0( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
endif()
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -I \"${CURRENT_INSTALLED_DIR}/include\"")
string(APPEND VCPKG_COMBINED_C_FLAGS_RELEASE " -I \"${CURRENT_INSTALLED_DIR}/include\"")
set(_csc_PROJECT_PATH ffmpeg)
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
set(FFMPEG_PKGCONFIG_MODULES libavutil)
if("nonfree" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-nonfree")
endif()
if("gpl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-gpl")
endif()
if("version3" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-version3")
endif()
if("amf" IN_LIST FEATURES)
# Do nothing
else()
set(OPTIONS "${OPTIONS} --disable-amf")
endif()
if("ffmpeg" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-ffmpeg")
else()
set(OPTIONS "${OPTIONS} --disable-ffmpeg")
endif()
if("ffplay" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-ffplay")
else()
set(OPTIONS "${OPTIONS} --disable-ffplay")
endif()
if("ffprobe" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-ffprobe")
else()
set(OPTIONS "${OPTIONS} --disable-ffprobe")
endif()
if (NOT "alsa" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --disable-alsa")
endif()
if("avcodec" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avcodec")
set(ENABLE_AVCODEC ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavcodec)
else()
set(OPTIONS "${OPTIONS} --disable-avcodec")
set(ENABLE_AVCODEC OFF)
endif()
if("avdevice" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avdevice")
set(ENABLE_AVDEVICE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavdevice)
else()
set(OPTIONS "${OPTIONS} --disable-avdevice")
set(ENABLE_AVDEVICE OFF)
endif()
if("avformat" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avformat")
set(ENABLE_AVFORMAT ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavformat)
else()
set(OPTIONS "${OPTIONS} --disable-avformat")
set(ENABLE_AVFORMAT OFF)
endif()
if("avfilter" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avfilter")
set(ENABLE_AVFILTER ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavfilter)
else()
set(OPTIONS "${OPTIONS} --disable-avfilter")
set(ENABLE_AVFILTER OFF)
endif()
if("postproc" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-postproc")
set(ENABLE_POSTPROC ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libpostproc)
else()
set(OPTIONS "${OPTIONS} --disable-postproc")
set(ENABLE_POSTPROC OFF)
endif()
if("swresample" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-swresample")
set(ENABLE_SWRESAMPLE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libswresample)
else()
set(OPTIONS "${OPTIONS} --disable-swresample")
set(ENABLE_SWRESAMPLE OFF)
endif()
if("swscale" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-swscale")
set(ENABLE_SWSCALE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libswscale)
else()
set(OPTIONS "${OPTIONS} --disable-swscale")
set(ENABLE_SWSCALE OFF)
endif()
set(ENABLE_AVRESAMPLE OFF)
if("avresample" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avresample")
set(ENABLE_AVRESAMPLE ON)
list(APPEND FFMPEG_PKGCONFIG_MODULES libavresample)
endif()
set(STATIC_LINKAGE OFF)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(STATIC_LINKAGE ON)
endif()
if("aom" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libaom")
else()
set(OPTIONS "${OPTIONS} --disable-libaom")
endif()
if("ass" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libass")
else()
set(OPTIONS "${OPTIONS} --disable-libass")
endif()
if("avisynthplus" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-avisynth")
else()
set(OPTIONS "${OPTIONS} --disable-avisynth")
endif()
if("bzip2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-bzlib")
else()
set(OPTIONS "${OPTIONS} --disable-bzlib")
endif()
if("dav1d" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libdav1d")
else()
set(OPTIONS "${OPTIONS} --disable-libdav1d")
endif()
if("fdk-aac" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfdk-aac")
else()
set(OPTIONS "${OPTIONS} --disable-libfdk-aac")
endif()
if("fontconfig" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfontconfig")
else()
set(OPTIONS "${OPTIONS} --disable-libfontconfig")
endif()
if("freetype" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfreetype")
else()
set(OPTIONS "${OPTIONS} --disable-libfreetype")
endif()
if("fribidi" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libfribidi")
else()
set(OPTIONS "${OPTIONS} --disable-libfribidi")
endif()
if("iconv" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-iconv")
else()
set(OPTIONS "${OPTIONS} --disable-iconv")
endif()
if("ilbc" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libilbc")
else()
set(OPTIONS "${OPTIONS} --disable-libilbc")
endif()
if("lzma" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-lzma")
else()
set(OPTIONS "${OPTIONS} --disable-lzma")
endif()
if("mp3lame" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmp3lame")
else()
set(OPTIONS "${OPTIONS} --disable-libmp3lame")
endif()
if("modplug" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmodplug")
else()
set(OPTIONS "${OPTIONS} --disable-libmodplug")
endif()
if("nvcodec" IN_LIST FEATURES)
#Note: the --enable-cuda option does not actually require the cuda sdk or toolset port dependency as ffmpeg uses runtime detection and dynamic loading
set(OPTIONS "${OPTIONS} --enable-cuda --enable-nvenc --enable-nvdec --enable-cuvid --enable-ffnvcodec")
else()
set(OPTIONS "${OPTIONS} --disable-cuda --disable-nvenc --disable-nvdec --disable-cuvid --disable-ffnvcodec")
endif()
if("opencl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-opencl")
else()
set(OPTIONS "${OPTIONS} --disable-opencl")
endif()
if("opengl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-opengl")
else()
set(OPTIONS "${OPTIONS} --disable-opengl")
endif()
if("openh264" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenh264")
else()
set(OPTIONS "${OPTIONS} --disable-libopenh264")
endif()
if("openjpeg" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenjpeg")
else()
set(OPTIONS "${OPTIONS} --disable-libopenjpeg")
endif()
if("openmpt" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopenmpt")
else()
set(OPTIONS "${OPTIONS} --disable-libopenmpt")
endif()
if("openssl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-openssl")
else()
set(OPTIONS "${OPTIONS} --disable-openssl")
endif()
if("opus" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libopus")
else()
set(OPTIONS "${OPTIONS} --disable-libopus")
endif()
if("sdl2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-sdl2")
else()
set(OPTIONS "${OPTIONS} --disable-sdl2")
endif()
if("snappy" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsnappy")
else()
set(OPTIONS "${OPTIONS} --disable-libsnappy")
endif()
if("soxr" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsoxr")
else()
set(OPTIONS "${OPTIONS} --disable-libsoxr")
endif()
if("speex" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libspeex")
else()
set(OPTIONS "${OPTIONS} --disable-libspeex")
endif()
if("ssh" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libssh")
else()
set(OPTIONS "${OPTIONS} --disable-libssh")
endif()
if("tensorflow" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtensorflow")
else()
set(OPTIONS "${OPTIONS} --disable-libtensorflow")
endif()
if("tesseract" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtesseract")
else()
set(OPTIONS "${OPTIONS} --disable-libtesseract")
endif()
if("theora" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libtheora")
else()
set(OPTIONS "${OPTIONS} --disable-libtheora")
endif()
if("vorbis" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libvorbis")
else()
set(OPTIONS "${OPTIONS} --disable-libvorbis")
endif()
if("vpx" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libvpx")
else()
set(OPTIONS "${OPTIONS} --disable-libvpx")
endif()
if("webp" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libwebp")
else()
set(OPTIONS "${OPTIONS} --disable-libwebp")
endif()
if("x264" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libx264")
else()
set(OPTIONS "${OPTIONS} --disable-libx264")
endif()
if("x265" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libx265")
else()
set(OPTIONS "${OPTIONS} --disable-libx265")
endif()
if("xml2" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libxml2")
else()
set(OPTIONS "${OPTIONS} --disable-libxml2")
endif()
if("zlib" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-zlib")
else()
set(OPTIONS "${OPTIONS} --disable-zlib")
endif()
if ("srt" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libsrt")
else()
set(OPTIONS "${OPTIONS} --disable-libsrt")
endif()
if ("qsv" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libmfx --enable-encoder=h264_qsv --enable-decoder=h264_qsv")
endif()
if (VCPKG_TARGET_IS_OSX)
set(OPTIONS "${OPTIONS} --disable-vdpau") # disable vdpau in OSX
endif()
if(VCPKG_TARGET_IS_IOS)
set(OPTIONS "${OPTIONS} --disable-audiotoolbox") # disable AudioToolbox on iOS
endif()
set(OPTIONS_CROSS " --enable-cross-compile")
# ffmpeg needs --cross-prefix option to use appropriate tools for cross-compiling.
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*-)gcc$")
string(APPEND OPTIONS_CROSS " --cross-prefix=${CMAKE_MATCH_1}")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
string(APPEND OPTIONS_CROSS " --arch=x86_64")
else()
string(APPEND OPTIONS_CROSS " --arch=${VCPKG_TARGET_ARCHITECTURE}")
endif()
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_find_acquire_program(GASPREPROCESSOR)
foreach(GAS_PATH ${GASPREPROCESSOR})
get_filename_component(GAS_ITEM_PATH ${GAS_PATH} DIRECTORY)
set(ENV{PATH} "$ENV{PATH}${VCPKG_HOST_PATH_SEPARATOR}${GAS_ITEM_PATH}")
endforeach(GAS_PATH)
endif()
endif()
if(VCPKG_TARGET_IS_UWP)
set(ENV{LIBPATH} "$ENV{LIBPATH};$ENV{_WKITS10}references\\windows.foundation.foundationcontract\\2.0.0.0\\;$ENV{_WKITS10}references\\windows.foundation.universalapicontract\\3.0.0.0\\")
string(APPEND OPTIONS " --disable-programs")
string(APPEND OPTIONS " --extra-cflags=-DWINAPI_FAMILY=WINAPI_FAMILY_APP --extra-cflags=-D_WIN32_WINNT=0x0A00")
string(APPEND OPTIONS " --extra-ldflags=-APPCONTAINER --extra-ldflags=WindowsApp.lib")
endif()
# Note: --disable-optimizations can't be used due to https://ffmpeg.org/pipermail/libav-user/2013-March/003945.html
set(OPTIONS_DEBUG "--debug")
set(OPTIONS_RELEASE "")
set(OPTIONS "${OPTIONS} ${OPTIONS_CROSS}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(OPTIONS "${OPTIONS} --disable-static --enable-shared")
endif()
if(VCPKG_TARGET_IS_MINGW)
set(OPTIONS "${OPTIONS} --extra_cflags=-D_WIN32_WINNT=0x0601")
elseif(VCPKG_TARGET_IS_WINDOWS)
set(OPTIONS "${OPTIONS} --extra-cflags=-DHAVE_UNISTD_H=0")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(OPTIONS "${OPTIONS} --pkg-config-flags=--static")
endif()
set(ENV_LIB_PATH "$ENV{${LIB_PATH_VAR}}")
get_filename_component(CC_path "${VCPKG_DETECTED_CMAKE_C_COMPILER}" DIRECTORY)
get_filename_component(CC_filename "${VCPKG_DETECTED_CMAKE_C_COMPILER}" NAME)
set(ENV{CC} "${CC_filename}")
if(CC_path)
vcpkg_add_to_path(PREPEND "${CC_path}")
endif()
message(STATUS "Building Options: ${OPTIONS}")
# Release build
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Building Release Options: ${OPTIONS_RELEASE}")
set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/lib${VCPKG_HOST_PATH_SEPARATOR}${ENV_LIB_PATH}")
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
message(STATUS "Building ${_csc_PROJECT_PATH} for Release")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
# We use response files here as the only known way to handle spaces in paths
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/cflags.rsp")
file(WRITE "${crsp}" "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
set(ldrsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/ldflags.rsp")
file(WRITE "${ldrsp}" "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}")
set(ENV{CFLAGS} "@${crsp}")
# All tools except the msvc arm{,64} assembler accept @... as response file syntax.
# For that assembler, there is no known way to pass in flags. We must hope that not passing flags will work acceptably.
if(NOT VCPKG_DETECTED_MSVC OR NOT VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
set(ENV{ASFLAGS} "@${crsp}")
endif()
set(ENV{LDFLAGS} "@${ldrsp}")
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_RELEASE}")
set(INST_PREFIX "${CURRENT_PACKAGES_DIR}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/build.sh.in" "${BUILD_DIR}/build.sh" @ONLY)
vcpkg_execute_required_process(
COMMAND "${SHELL}" ./build.sh
WORKING_DIRECTORY "${BUILD_DIR}"
LOGNAME "build-${TARGET_TRIPLET}-rel"
)
endif()
# Debug build
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Building Debug Options: ${OPTIONS_DEBUG}")
set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/debug/lib${VCPKG_HOST_PATH_SEPARATOR}${ENV_LIB_PATH}")
set(ENV{LDFLAGS} "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig")
message(STATUS "Building ${_csc_PROJECT_PATH} for Debug")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/cflags.rsp")
file(WRITE "${crsp}" "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
set(ldrsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/ldflags.rsp")
file(WRITE "${ldrsp}" "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
set(ENV{CFLAGS} "@${crsp}")
if(NOT VCPKG_DETECTED_MSVC OR NOT VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
set(ENV{ASFLAGS} "@${crsp}")
endif()
set(ENV{LDFLAGS} "@${ldrsp}")
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_DEBUG}")
set(INST_PREFIX "${CURRENT_PACKAGES_DIR}/debug")
configure_file("${CMAKE_CURRENT_LIST_DIR}/build.sh.in" "${BUILD_DIR}/build.sh" @ONLY)
vcpkg_execute_required_process(
COMMAND "${SHELL}" ./build.sh
WORKING_DIRECTORY "${BUILD_DIR}"
LOGNAME "build-${TARGET_TRIPLET}-dbg"
)
endif()
if(VCPKG_TARGET_IS_WINDOWS)
file(GLOB DEF_FILES "${CURRENT_PACKAGES_DIR}/lib/*.def" "${CURRENT_PACKAGES_DIR}/debug/lib/*.def")
if(NOT VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(LIB_MACHINE_ARG /machine:ARM)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(LIB_MACHINE_ARG /machine:ARM64)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(LIB_MACHINE_ARG /machine:x86)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(LIB_MACHINE_ARG /machine:x64)
else()
message(FATAL_ERROR "Unsupported target architecture")
endif()
foreach(DEF_FILE ${DEF_FILES})
get_filename_component(DEF_FILE_DIR "${DEF_FILE}" DIRECTORY)
get_filename_component(DEF_FILE_NAME "${DEF_FILE}" NAME)
string(REGEX REPLACE "-[0-9]*\\.def" "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" OUT_FILE_NAME "${DEF_FILE_NAME}")
file(TO_NATIVE_PATH "${DEF_FILE}" DEF_FILE_NATIVE)
file(TO_NATIVE_PATH "${DEF_FILE_DIR}/${OUT_FILE_NAME}" OUT_FILE_NATIVE)
message(STATUS "Generating ${OUT_FILE_NATIVE}")
vcpkg_execute_required_process(
COMMAND lib.exe "/def:${DEF_FILE_NATIVE}" "/out:${OUT_FILE_NATIVE}" ${LIB_MACHINE_ARG}
WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}"
LOGNAME "libconvert-${TARGET_TRIPLET}"
)
endforeach()
endif()
file(GLOB EXP_FILES "${CURRENT_PACKAGES_DIR}/lib/*.exp" "${CURRENT_PACKAGES_DIR}/debug/lib/*.exp")
file(GLOB LIB_FILES "${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" "${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
if(VCPKG_TARGET_IS_MINGW)
file(GLOB LIB_FILES_2 "${CURRENT_PACKAGES_DIR}/bin/*.lib" "${CURRENT_PACKAGES_DIR}/debug/bin/*.lib")
endif()
set(files_to_remove ${EXP_FILES} ${LIB_FILES} ${LIB_FILES_2} ${DEF_FILES})
if(files_to_remove)
file(REMOVE ${files_to_remove})
endif()
endif()
if("ffmpeg" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ffmpeg AUTO_CLEAN)
endif()
if("ffprobe" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ffprobe AUTO_CLEAN)
endif()
if("ffplay" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES ffplay AUTO_CLEAN)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
vcpkg_copy_pdbs()
if (VCPKG_TARGET_IS_WINDOWS)
set(_dirs "/")
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
list(APPEND _dirs "/debug/")
endif()
foreach(_debug IN LISTS _dirs)
foreach(PKGCONFIG_MODULE IN LISTS FFMPEG_PKGCONFIG_MODULES)
set(PKGCONFIG_FILE "${CURRENT_PACKAGES_DIR}${_debug}lib/pkgconfig/${PKGCONFIG_MODULE}.pc")
# remove redundant cygwin style -libpath entries
execute_process(
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -u "${CURRENT_INSTALLED_DIR}"
OUTPUT_VARIABLE CYG_INSTALLED_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
vcpkg_replace_string("${PKGCONFIG_FILE}" "-libpath:${CYG_INSTALLED_DIR}${_debug}lib/pkgconfig/../../lib " "")
# transform libdir, includedir, and prefix paths from cygwin style to windows style
file(READ "${PKGCONFIG_FILE}" PKGCONFIG_CONTENT)
foreach(PATH_NAME prefix libdir includedir)
string(REGEX MATCH "${PATH_NAME}=[^\n]*" PATH_VALUE "${PKGCONFIG_CONTENT}")
string(REPLACE "${PATH_NAME}=" "" PATH_VALUE "${PATH_VALUE}")
if(NOT PATH_VALUE)
message(FATAL_ERROR "failed to find pkgconfig variable ${PATH_NAME}")
endif()
execute_process(
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -w "${PATH_VALUE}"
OUTPUT_VARIABLE FIXED_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
file(TO_CMAKE_PATH "${FIXED_PATH}" FIXED_PATH)
vcpkg_replace_string("${PKGCONFIG_FILE}" "${PATH_NAME}=${PATH_VALUE}" "${PATH_NAME}=${FIXED_PATH}")
endforeach()
# list libraries with -l flag (so pkgconf knows they are libraries and not just linker flags)
foreach(LIBS_ENTRY Libs Libs.private)
string(REGEX MATCH "${LIBS_ENTRY}: [^\n]*" LIBS_VALUE "${PKGCONFIG_CONTENT}")
if(NOT LIBS_VALUE)
message(FATAL_ERROR "failed to find pkgconfig entry ${LIBS_ENTRY}")
endif()
string(REPLACE "${LIBS_ENTRY}: " "" LIBS_VALUE "${LIBS_VALUE}")
if(LIBS_VALUE)
set(LIBS_VALUE_OLD "${LIBS_VALUE}")
string(REGEX REPLACE "([^ ]+)[.]lib" "-l\\1" LIBS_VALUE "${LIBS_VALUE}")
set(LIBS_VALUE_NEW "${LIBS_VALUE}")
vcpkg_replace_string("${PKGCONFIG_FILE}" "${LIBS_ENTRY}: ${LIBS_VALUE_OLD}" "${LIBS_ENTRY}: ${LIBS_VALUE_NEW}")
endif()
endforeach()
endforeach()
endforeach()
endif()
vcpkg_fixup_pkgconfig()
# Handle dependencies
x_vcpkg_pkgconfig_get_modules(PREFIX FFMPEG_PKGCONFIG MODULES ${FFMPEG_PKGCONFIG_MODULES} LIBS)
function(append_dependencies_from_libs out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "LIBS" "")
string(REGEX REPLACE "[ ]+" ";" contents "${arg_LIBS}")
list(FILTER contents EXCLUDE REGEX "^-framework$")
list(FILTER contents EXCLUDE REGEX "^-L.+")
list(FILTER contents EXCLUDE REGEX "^-libpath:.+")
list(TRANSFORM contents REPLACE "^-Wl,-framework," "-l")
list(FILTER contents EXCLUDE REGEX "^-Wl,.+")
list(TRANSFORM contents REPLACE "^-l" "")
list(FILTER contents EXCLUDE REGEX "^avresample$")
list(FILTER contents EXCLUDE REGEX "^avutil$")
list(FILTER contents EXCLUDE REGEX "^avcodec$")
list(FILTER contents EXCLUDE REGEX "^avdevice$")
list(FILTER contents EXCLUDE REGEX "^avfilter$")
list(FILTER contents EXCLUDE REGEX "^avformat$")
list(FILTER contents EXCLUDE REGEX "^postproc$")
list(FILTER contents EXCLUDE REGEX "^swresample$")
list(FILTER contents EXCLUDE REGEX "^swscale$")
list(FILTER contents EXCLUDE REGEX "^atomic$")
if(VCPKG_TARGET_IS_WINDOWS)
list(TRANSFORM contents TOLOWER)
endif()
if(contents)
list(APPEND "${out}" "${contents}")
set("${out}" "${${out}}" PARENT_SCOPE)
endif()
endfunction()
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_RELEASE LIBS "${FFMPEG_PKGCONFIG_LIBS_RELEASE}")
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_DEBUG LIBS "${FFMPEG_PKGCONFIG_LIBS_DEBUG}")
# must remove duplicates from the front to respect link order so reverse first
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_RELEASE)
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_DEBUG)
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
message(STATUS "Dependencies (release): ${FFMPEG_DEPENDENCIES_RELEASE}")
message(STATUS "Dependencies (debug): ${FFMPEG_DEPENDENCIES_DEBUG}")
# Handle version strings
function(extract_regex_from_file out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "FILE;REGEX" "")
file(READ "${arg_FILE}" contents)
if (contents MATCHES "${arg_REGEX}")
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
message(FATAL_ERROR "Could not identify match group in regular expression \"${arg_REGEX}\"")
endif()
else()
message(FATAL_ERROR "Could not find line matching \"${arg_REGEX}\" in file \"${arg_FILE}\"")
endif()
set("${out}" "${CMAKE_MATCH_1}" PARENT_SCOPE)
endfunction()
function(extract_version_from_component out)
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "COMPONENT" "")
string(TOLOWER "${arg_COMPONENT}" component_lower)
string(TOUPPER "${arg_COMPONENT}" component_upper)
extract_regex_from_file(major_version
FILE "${SOURCE_PATH}/${component_lower}/version.h"
REGEX "#define ${component_upper}_VERSION_MAJOR[ ]+([0-9]+)"
)
extract_regex_from_file(minor_version
FILE "${SOURCE_PATH}/${component_lower}/version.h"
REGEX "#define ${component_upper}_VERSION_MINOR[ ]+([0-9]+)"
)
extract_regex_from_file(micro_version
FILE "${SOURCE_PATH}/${component_lower}/version.h"
REGEX "#define ${component_upper}_VERSION_MICRO[ ]+([0-9]+)"
)
set("${out}" "${major_version}.${minor_version}.${micro_version}" PARENT_SCOPE)
endfunction()
extract_regex_from_file(FFMPEG_VERSION
FILE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libavutil/ffversion.h"
REGEX "#define FFMPEG_VERSION[ ]+\"(.+)\""
)
extract_version_from_component(LIBAVUTIL_VERSION
COMPONENT libavutil)
extract_version_from_component(LIBAVCODEC_VERSION
COMPONENT libavcodec)
extract_version_from_component(LIBAVDEVICE_VERSION
COMPONENT libavdevice)
extract_version_from_component(LIBAVFILTER_VERSION
COMPONENT libavfilter)
extract_version_from_component( LIBAVFORMAT_VERSION
COMPONENT libavformat)
extract_version_from_component(LIBAVRESAMPLE_VERSION
COMPONENT libavresample)
extract_version_from_component(LIBSWRESAMPLE_VERSION
COMPONENT libswresample)
extract_version_from_component(LIBSWSCALE_VERSION
COMPONENT libswscale)
# Handle copyright
file(STRINGS "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-out.log" LICENSE_STRING REGEX "License: .*" LIMIT_COUNT 1)
if(LICENSE_STRING STREQUAL "License: LGPL version 2.1 or later")
set(LICENSE_FILE "COPYING.LGPLv2.1")
elseif(LICENSE_STRING STREQUAL "License: LGPL version 3 or later")
set(LICENSE_FILE "COPYING.LGPLv3")
elseif(LICENSE_STRING STREQUAL "License: GPL version 2 or later")
set(LICENSE_FILE "COPYING.GPLv2")
elseif(LICENSE_STRING STREQUAL "License: GPL version 3 or later")
set(LICENSE_FILE "COPYING.GPLv3")
elseif(LICENSE_STRING STREQUAL "License: nonfree and unredistributable")
set(LICENSE_FILE "COPYING.NONFREE")
file(WRITE "${SOURCE_PATH}/${LICENSE_FILE}" "${LICENSE_STRING}")
else()
message(FATAL_ERROR "Failed to identify license (${LICENSE_STRING})")
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/FindFFMPEG.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/FindFFMPEG.cmake" @ONLY)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/${LICENSE_FILE}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@@ -0,0 +1,6 @@
To use ffmpeg add the following to your CMake project:
find_package(FFMPEG REQUIRED)
target_include_directories(main PRIVATE ${FFMPEG_INCLUDE_DIRS})
target_link_directories(main PRIVATE ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(main PRIVATE ${FFMPEG_LIBRARIES})

View File

@@ -0,0 +1,8 @@
set(FFMPEG_PREV_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
cmake_policy(SET CMP0012 NEW)
_find_package(${ARGS})
set(CMAKE_MODULE_PATH ${FFMPEG_PREV_MODULE_PATH})

View File

@@ -0,0 +1,676 @@
{
"name": "ffmpeg",
"version": "4.4.5",
"port-version": 0,
"description": [
"a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
"FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations."
],
"homepage": "https://ffmpeg.org",
"license": null,
"dependencies": [
{
"name": "vcpkg-cmake-get-vars",
"host": true
},
{
"name": "vcpkg-pkgconfig-get-modules",
"host": true
}
],
"default-features": [
"avcodec",
"avdevice",
"avfilter",
"avformat",
"swresample",
"swscale"
],
"features": {
"all": {
"description": "Build with all allowed dependencies selected that are compatible with the lgpl license",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avdevice",
"avfilter",
"avformat",
"avresample",
"bzip2",
"freetype",
"iconv",
"lzma",
"mp3lame",
"openjpeg",
"opus",
"snappy",
"soxr",
"speex",
"swresample",
"swscale",
"theora",
"vorbis",
"vpx",
"webp",
"xml2",
"zlib"
]
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"alsa"
],
"platform": "linux"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"sdl2"
],
"platform": "!osx"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"ass"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"fontconfig"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"fribidi"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"modplug"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"opencl"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"openh264"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"srt"
],
"platform": "!uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"ilbc"
],
"platform": "!(arm & uwp)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"ssh"
],
"platform": "!(uwp | arm)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"tensorflow"
],
"platform": "x64 & !static & !uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"aom"
],
"platform": "!(windows & arm & !uwp)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"dav1d"
],
"platform": "!(uwp | arm | x86 | osx)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"opengl"
],
"platform": "!uwp & !(arm64 & windows)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"tesseract"
],
"platform": "!(windows & arm) & !static & !uwp"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"nvcodec"
],
"platform": "linux | (!osx & !uwp & !(arm64 & windows))"
}
]
},
"all-gpl": {
"description": "Build with all allowed dependencies selected that are compatible with the gpl license",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"all",
"gpl",
"postproc"
]
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"x264"
],
"platform": "!(arm & windows)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"x265"
],
"platform": "!uwp & !(arm & windows)"
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avisynthplus"
],
"platform": "windows & !arm & !uwp & !static"
}
]
},
"all-nonfree": {
"description": "Build with all allowed dependencies selected with a non-redistributable license",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"all-gpl",
"fdk-aac",
"nonfree",
"openssl"
]
}
]
},
"alsa": {
"description": "Enable ALSA support",
"dependencies": [
"alsa"
]
},
"amf": {
"description": "AMD AMF codec support",
"dependencies": [
"amd-amf"
]
},
"aom": {
"description": "AV1 video encoding/decoding via libaom support in ffmpeg",
"dependencies": [
"aom"
]
},
"ass": {
"description": "Libass subtitles rendering, needed for subtitles and ass filter support in ffmpeg",
"dependencies": [
"libass"
]
},
"avcodec": {
"description": "Build the avcodec library"
},
"avdevice": {
"description": "Build the avdevice library",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avformat"
]
}
]
},
"avfilter": {
"description": "Build the avfilter library"
},
"avformat": {
"description": "Build the avformat library",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec"
]
}
]
},
"avisynthplus": {
"description": "Reading of AviSynth script files",
"supports": "windows & !static",
"dependencies": [
"avisynthplus",
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
}
]
},
"avresample": {
"description": "Build the avresample library"
},
"bzip2": {
"description": "Bzip2 support",
"dependencies": [
"bzip2"
]
},
"dav1d": {
"description": "AV1 decoding via libdav1d",
"supports": "!osx",
"dependencies": [
"dav1d"
]
},
"fdk-aac": {
"description": "AAC de/encoding via libfdk-aac, **including GPL-incompatible patent-encumbered HE-AAC**. If you do not require HE-AAC, use the built-in FFmpeg AAC codec.",
"dependencies": [
{
"name": "fdk-aac",
"default-features": false,
"features": [
"he-aac"
]
},
{
"name": "ffmpeg",
"default-features": false,
"features": [
"nonfree"
]
}
]
},
"ffmpeg": {
"description": "Build the ffmpeg application",
"supports": "!uwp",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avfilter",
"avformat"
]
}
]
},
"ffplay": {
"description": "Build the ffplay application",
"supports": "!uwp",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avfilter",
"avformat",
"sdl2",
"swresample",
"swscale"
]
}
]
},
"ffprobe": {
"description": "Build the ffprobe application",
"supports": "!uwp",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avformat"
]
}
]
},
"fontconfig": {
"description": "Useful for drawtext filter",
"dependencies": [
"fontconfig"
]
},
"freetype": {
"description": "Needed for drawtext filter",
"dependencies": [
"freetype"
]
},
"fribidi": {
"description": "Improves drawtext filter",
"dependencies": [
"fribidi"
]
},
"gpl": {
"description": "Allow use of GPL code, the resulting libs and binaries will be under GPL"
},
"iconv": {
"description": "Iconv support",
"dependencies": [
"libiconv"
]
},
"ilbc": {
"description": "iLBC de/encoding via libilbc",
"dependencies": [
"libilbc"
]
},
"lzma": {
"description": "lzma support",
"dependencies": [
"liblzma"
]
},
"modplug": {
"description": "ModPlug via libmodplug",
"dependencies": [
"libmodplug"
]
},
"mp3lame": {
"description": "MP3 encoding via libmp3lame",
"dependencies": [
"mp3lame"
]
},
"nonfree": {
"description": "Allow use of nonfree code, the resulting libs and binaries will be unredistributable"
},
"nvcodec": {
"description": "Nvidia video decoding/encoding acceleration",
"supports": "linux | (!osx & !uwp & !(arm64 & windows))",
"dependencies": [
"ffnvcodec"
]
},
"opencl": {
"description": "OpenCL processing",
"supports": "!uwp",
"dependencies": [
"opencl"
]
},
"opengl": {
"description": "OpenGL rendering",
"supports": "!uwp",
"dependencies": [
"opengl",
"opengl-registry"
]
},
"openh264": {
"description": "H.264 de/encoding via openh264",
"dependencies": [
"openh264"
]
},
"openjpeg": {
"description": "JPEG 2000 de/encoding via OpenJPEG",
"dependencies": [
"openjpeg"
]
},
"openmpt": {
"description": "Decoding tracked files via libopenmpt",
"dependencies": [
"libopenmpt"
]
},
"openssl": {
"description": "Needed for https support if gnutls, libtls or mbedtls is not used",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"nonfree"
]
},
"openssl"
]
},
"opus": {
"description": "Opus de/encoding via libopus",
"dependencies": [
"opus"
]
},
"postproc": {
"description": "Build the postproc library",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
}
]
},
"qsv": {
"description": "Intel QSV Codec",
"dependencies": [
"mfx-dispatch"
]
},
"sdl2": {
"description": "Sdl2 support",
"dependencies": [
{
"name": "sdl2",
"default-features": false,
"features": [
"x11"
],
"platform": "linux"
},
{
"name": "sdl2",
"platform": "!linux"
}
]
},
"snappy": {
"description": "Snappy compression, needed for hap encoding",
"dependencies": [
"snappy"
]
},
"soxr": {
"description": "Include libsoxr resampling",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"swresample"
]
},
"soxr"
]
},
"speex": {
"description": "Speex de/encoding via libspeex",
"dependencies": [
"speex"
]
},
"srt": {
"description": "Haivision SRT protocol",
"supports": "!uwp",
"dependencies": [
"libsrt"
]
},
"ssh": {
"description": "SFTP protocol via libssh",
"dependencies": [
"libssh"
]
},
"swresample": {
"description": "Build the swresample library"
},
"swscale": {
"description": "Build the swscale library"
},
"tensorflow": {
"description": "TensorFlow as a DNN module backend for DNN based filters like sr",
"supports": "!static",
"dependencies": [
"tensorflow"
]
},
"tesseract": {
"description": "Tesseract, needed for ocr filter",
"supports": "!static",
"dependencies": [
"tesseract"
]
},
"theora": {
"description": "Theora encoding via libtheora",
"dependencies": [
"libtheora"
]
},
"version3": {
"description": "Upgrade (L)GPL to version 3"
},
"vorbis": {
"description": "Vorbis en/decoding via libvorbis, native implementation exists",
"dependencies": [
"libvorbis"
]
},
"vpx": {
"description": "VP8 and VP9 de/encoding via libvpx",
"dependencies": [
"libvpx"
]
},
"webp": {
"description": "WebP encoding via libwebp",
"dependencies": [
"libwebp"
]
},
"x264": {
"description": "H.264 encoding via x264",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
},
"x264"
]
},
"x265": {
"description": "HEVC encoding via x265",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
},
"x265"
]
},
"xml2": {
"description": "XML parsing using the C library libxml2, needed for dash demuxing support",
"dependencies": [
"libxml2"
]
},
"zlib": {
"description": "zlib support",
"dependencies": [
"zlib"
]
}
}
}

View File

@@ -0,0 +1,13 @@
diff --git a/configure.ac b/configure.ac
index f6d25f334..3115504e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1592,7 +1592,7 @@ fi
[enable_uaf_detection="0"]
)
if test "x$enable_uaf_detection" = "x1" ; then
- AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ])
+ AC_DEFINE([JEMALLOC_UAF_DETECTION], [ ], ["enable UAF"])
fi
AC_SUBST([enable_uaf_detection])

View File

@@ -0,0 +1,58 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO jemalloc/jemalloc
REF 54eaed1d8b56b1aa528be3bdd1877e59c56fa90c
SHA512 527bfbf5db9a5c2b7b04df4785b6ae9d445cff8cb17298bf3e550c88890d2bd7953642d8efaa417580610508279b527d3a3b9e227d17394fd2013c88cb7ae75a
HEAD_REF master
PATCHES
fix-configure-ac.patch
preprocessor.patch
)
if(VCPKG_TARGET_IS_WINDOWS)
set(opts "ac_cv_search_log=none required" "--without-private-namespace")
endif()
set (opts "${opts}" "--disable-initial-exec-tls")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
NO_WRAPPERS
OPTIONS ${opts}
)
vcpkg_install_make()
if(VCPKG_TARGET_IS_WINDOWS)
file(COPY "${SOURCE_PATH}/include/msvc_compat/strings.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/jemalloc/msvc_compat")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/jemalloc/jemalloc.h" "<strings.h>" "\"msvc_compat/strings.h\"")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/jemalloc.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/bin")
file(RENAME "${CURRENT_PACKAGES_DIR}/lib/jemalloc.dll" "${CURRENT_PACKAGES_DIR}/bin/jemalloc.dll")
endif()
if(NOT VCPKG_BUILD_TYPE)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/jemalloc.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/bin")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/jemalloc.dll" "${CURRENT_PACKAGES_DIR}/debug/bin/jemalloc.dll")
endif()
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/jemalloc.pc" "install_suffix=" "install_suffix=_s")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/jemalloc.pc" "install_suffix=" "install_suffix=_s")
endif()
endif()
endif()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@@ -0,0 +1,12 @@
diff --git a/configure.ac b/configure.ac
index 3115504e2..ffb504b08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -749,6 +749,7 @@ case "${host}" in
so="dll"
if test "x$je_cv_msvc" = "xyes" ; then
importlib="lib"
+ JE_APPEND_VS(CPPFLAGS, -DJEMALLOC_NO_PRIVATE_NAMESPACE)
DSO_LDFLAGS="-LD"
EXTRA_LDFLAGS="-link -DEBUG"
CTARGET='-Fo$@'

View File

@@ -0,0 +1,8 @@
{
"name": "jemalloc",
"version": "5.3.0",
"port-version": 1,
"description": "jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support",
"homepage": "https://jemalloc.net/",
"license": "BSD-2-Clause"
}

View File

@@ -1,86 +0,0 @@
# Get git information for ABI validation
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../.."
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
RESULT_VARIABLE GIT_RESULT
)
if(NOT GIT_RESULT EQUAL 0)
set(GIT_COMMIT_HASH "unknown")
endif()
set(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(BUILD_TYPE "Shared")
else()
set(BUILD_TYPE "Static")
endif()
set (BUILD_CPP_STANDARD "C++17")
if ("cpp20" IN_LIST FEATURES)
set (BUILD_CPP_STANDARD "C++20")
elseif ("cpp23" IN_LIST FEATURES)
set (BUILD_CPP_STANDARD "C++23")
endif()
set (BUILD_OPT_PROFILE "Default")
if ("optimized" IN_LIST FEATURES)
set (BUILD_OPT_PROFILE "Production")
endif()
set (BUILD_MODULE_Draw OFF)
if ("tcl" IN_LIST FEATURES OR "tcltk" IN_LIST FEATURES)
set (BUILD_MODULE_Draw ON)
endif()
set (USE_MMGR_TYPE "NATIVE")
if ("jemalloc" IN_LIST FEATURES)
set (USE_MMGR_TYPE "JEMALLOC")
endif()
# Feature mapping to CMake options
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
angle USE_GLES2
opengl USE_OPENGL
freeimage USE_FREEIMAGE
freetype USE_FREETYPE
rapidjson USE_RAPIDJSON
tbb USE_TBB
vtk USE_VTK
tcltk USE_TK
draco USE_DRACO
ffmpeg USE_FFMPEG
openvr USE_OPENVR
gtest BUILD_GTEST
pch BUILD_USE_PCH
d3d USE_D3D
docs BUILD_DOC_Overview
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_LIBRARY_TYPE=${BUILD_TYPE}
-DINSTALL_DIR_LAYOUT=Vcpkg
-DBUILD_USE_VCPKG=ON
-DBUILD_CPP_STANDARD=${BUILD_CPP_STANDARD}
-DBUILD_OPT_PROFILE=${BUILD_OPT_PROFILE}
-DBUILD_MODULE_Draw=${BUILD_MODULE_Draw}
-DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}
MAYBE_UNUSED_VARIABLES
-DUSE_HASH=${GIT_COMMIT_HASH}
)
vcpkg_cmake_install()
vcpkg_install_copyright(
FILE_LIST
"${SOURCE_PATH}/LICENSE_LGPL_21.txt"
"${SOURCE_PATH}/OCCT_LGPL_EXCEPTION.txt"
)

View File

@@ -1,167 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "opencascade",
"version": "8.0.0",
"description": "Open CASCADE Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE.",
"homepage": "https://github.com/Open-Cascade-SAS/OCCT",
"documentation": "https://dev.opencascade.org/doc/overview/html",
"license": "LGPL-2.1",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
{
"name": "tcl"
},
{
"name": "freetype",
"platform": "!uwp"
},
{
"name": "angle",
"platform": "uwp"
},
{
"name": "opengl",
"platform": "!(android | ios | uwp | wasm32)"
}
],
"features": {
"angle": {
"description": "Enables OpenGL ES 2.0 through ANGLE project. Required for 3D visualization in OCCT on UWP platform where desktop OpenGL is not available.",
"dependencies": [
{
"name": "angle",
"platform": "!(linux & !static)"
}
]
},
"opengl": {
"description": "Enables OpenGL support for 3D visualization toolkit. Required for OCCT's OpenGL rendering pipeline and graphical display drivers.",
"dependencies": [
"opengl"
]
},
"tcl": {
"description": "Enables Tcl scripting support for OCCT's DRAWEXE test harness and command-line interface. Provides access to OCCT's geometric algorithms through scripting.",
"dependencies": [
"tcl"
]
},
"tcltk": {
"description": "Enables Tcl/Tk GUI support for DRAWEXE test harness. Provides windowed interface for OCCT's geometric modeling and visualization tools.",
"dependencies": [
{
"name": "tcl",
"features": [
"tk"
]
},
{
"name": "libx11",
"platform": "!windows"
}
]
},
"freeimage": {
"description": "Enables FreeImage support for advanced image file format handling (TIFF, PNG, JPEG, etc.) in OCCT's imaging and visualization components.",
"dependencies": [
"freeimage"
]
},
"freetype": {
"description": "Enables FreeType font rendering engine for high-quality text display in OCCT's 3D visualization and technical drawing output.",
"supports": "!uwp",
"dependencies": [
"fontconfig",
{
"name": "freetype",
"default-features": false
}
]
},
"rapidjson": {
"description": "Enables RapidJSON for efficient JSON parsing and serialization in OCCT's glTF 2.0 import/export functionality.",
"dependencies": [
"rapidjson"
]
},
"tbb": {
"description": "Enables Intel Threading Building Blocks for optimized parallel computing. Replaces OCCT's default threading with TBB's task-based parallelism for better performance.",
"dependencies": [
"tbb"
]
},
"vtk": {
"description": "Enables VTK (Visualization Toolkit) integration for advanced scientific visualization capabilities and mesh processing in OCCT.",
"dependencies": [
{
"name": "vtk",
"default-features": false,
"features": [
"opengl"
]
}
]
},
"draco": {
"description": "Enables Google Draco geometry compression for efficient mesh storage and transmission in OCCT's glTF 2.0 import/export workflow.",
"dependencies": [
"draco"
]
},
"ffmpeg": {
"description": "Enables FFmpeg multimedia framework for video encoding/decoding and animation export capabilities in OCCT's visualization pipeline.",
"dependencies": [
"ffmpeg"
]
},
"openvr": {
"description": "Enables OpenVR SDK integration for virtual reality support in OCCT's 3D visualization, allowing immersive CAD model exploration.",
"dependencies": [
"openvr"
]
},
"jemalloc": {
"description": "Enables jemalloc high-performance memory allocator as replacement for system malloc. Improves memory usage patterns for large-scale CAD operations.",
"dependencies": [
"jemalloc"
]
},
"gtest": {
"description": "Enables Google Test framework for building OCCT's unit test suite. Required for running automated tests and validation of OCCT functionality.",
"dependencies": [
"gtest"
]
},
"pch": {
"description": "Enables precompiled headers to improve compilation speed. Creates shared headers that are compiled once and reused across multiple source files."
},
"cpp20": {
"description": "Enables C++20 standard compilation mode for OCCT. Provides access to latest C++20 features including concepts and modules."
},
"cpp23": {
"description": "Enables C++23 standard compilation mode for OCCT. Provides access to the latest C++23 features including improved constexpr and new standard library components."
},
"optimized": {
"description": "Enables production-level optimizations for maximum performance. Applies aggressive compiler optimizations and removes debug symbols."
},
"d3d": {
"description": "Enables Direct3D support for 3D visualization on Windows. Provides alternative graphics backend to OpenGL for Windows-specific applications.",
"supports": "windows"
},
"docs": {
"description": "Enables documentation generation using Doxygen. Creates HTML reference manual and overview documentation for OCCT API.",
"dependencies": [
"doxygen"
]
}
}
}

View File

@@ -1,415 +0,0 @@
From da6b5b83ef997f550155d9087c5e7b289168fb1b Mon Sep 17 00:00:00 2001
From: dpasukhi <dpasukhi@opencascade.com>
Date: Sat, 5 Jul 2025 11:36:01 +0100
Subject: [PATCH] Add support for building and installing Tk in Makefiles for
Unix and Windows
---
unix/Makefile.in | 94 +++++++++++++++++++++++++++++++++++++++++++++--
win/Makefile.in | 68 ++++++++++++++++++++++++++++++++++
win/makefile.vc | 96 +++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 249 insertions(+), 9 deletions(-)
diff --git a/unix/Makefile.in b/unix/Makefile.in
index bc743b3892..dfdcf35acd 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -232,6 +232,7 @@ TOOL_DIR = $(TOP_DIR)/tools
UNIX_DIR = $(TOP_DIR)/unix
MAC_OSX_DIR = $(TOP_DIR)/macosx
PKGS_DIR = $(TOP_DIR)/pkgs
+EXTRADIR = $(TOP_DIR)/extra
# Must be absolute because of the cd dltest $(DLTEST_DIR)/configure below.
DLTEST_DIR = @TCL_SRC_DIR@/unix/dltest
# Must be absolute to so the corresponding tcltest's tcl_library is absolute.
@@ -622,7 +623,7 @@ SRCS = $(GENERIC_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \
# Start of rules
#--------------------------------------------------------------------------
-all: binaries libraries doc packages
+all: binaries libraries doc packages extra
binaries: ${LIB_FILE} ${TCL_EXE}
@@ -666,13 +667,13 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in
#tclConfig.h: $(UNIX_DIR)/tclConfig.h.in
# $(SHELL) config.status
-clean: clean-packages
+clean: clean-packages clean-extra
rm -rf *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \
errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \
minizip${HOST_EXEEXT} *.${HOST_OBJEXT} *.zip *.vfs
(cd dltest ; $(MAKE) clean)
-distclean: distclean-packages clean
+distclean: distclean-packages clean distclean-extra
rm -rf Makefile config.status config.cache config.log tclConfig.sh \
tclConfig.h *.plist Tcl.framework tcl.pc tclUuid.h
(cd dltest ; $(MAKE) distclean)
@@ -795,7 +796,7 @@ INSTALL_EXTRA_TARGETS = @EXTRA_INSTALL@
INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_TARGETS) \
$(INSTALL_PACKAGE_TARGETS) $(INSTALL_EXTRA_TARGETS)
-install: $(INSTALL_TARGETS)
+install: $(INSTALL_TARGETS) install-extra
install-strip:
$(MAKE) $(INSTALL_TARGETS) \
@@ -1725,6 +1726,7 @@ PKG_CFG_ARGS = @PKG_CFG_ARGS@
# cannot use absolute paths due to issues in nested configure when path to
# build dir contains spaces).
PKG_DIR = ./pkgs
+EXTRA_BUILD_DIR = ./extra
configure-packages:
@for i in $(PKGS_DIR)/*; do \
@@ -2151,6 +2153,89 @@ BUILD_HTML = \
--useversion=$(HTML_VERSION) --htmldir="$(HTML_INSTALL_DIR)" \
--srcdir=$(TOP_DIR)/.. $(BUILD_HTML_FLAGS)
+#--------------------------------------------------------------------------
+# Extra packages build targets (for TK and other extras)
+#--------------------------------------------------------------------------
+
+extra:
+ @if test -d "$(EXTRADIR)"; then \
+ for extradir in $(EXTRADIR)/*; do \
+ if test -d "$$extradir/unix" && test -f "$$extradir/unix/configure"; then \
+ extrapkg=`basename $$extradir`; \
+ echo "Building extra package '$$extrapkg'"; \
+ mkdir -p "$(EXTRA_BUILD_DIR)/$$extrapkg"; \
+ TCL_BUILD_DIR="`pwd`"; \
+ if test ! -f "$(EXTRA_BUILD_DIR)/$$extrapkg/Makefile"; then \
+ echo "Configuring extra package '$$extrapkg'"; \
+ (cd "$(EXTRA_BUILD_DIR)/$$extrapkg" && \
+ "$$extradir/unix/configure" \
+ --prefix="$(prefix)" \
+ --exec-prefix="$(exec_prefix)" \
+ --with-tcl="$$TCL_BUILD_DIR" \
+ CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" \
+ LDFLAGS="$(LDFLAGS)" \
+ CC="$(CC)") || exit $$?; \
+ fi; \
+ echo "Building extra package '$$extrapkg'"; \
+ (cd "$(EXTRA_BUILD_DIR)/$$extrapkg" && \
+ $(MAKE) \
+ TCL_LIBRARY=$(TCL_LIBRARY) \
+ CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" \
+ LDFLAGS="$(LDFLAGS)" \
+ CC="$(CC)") || exit $$?; \
+ fi; \
+ done; \
+ else \
+ echo "No extra directory found at $(EXTRADIR) - skipping extra builds"; \
+ fi
+
+install-extra:
+ @if test -d "$(EXTRADIR)"; then \
+ for extradir in $(EXTRADIR)/*; do \
+ if test -d "$$extradir/unix" && test -f "$$extradir/unix/configure"; then \
+ extrapkg=`basename $$extradir`; \
+ if test -f "$(EXTRA_BUILD_DIR)/$$extrapkg/Makefile"; then \
+ echo "Installing extra package '$$extrapkg'"; \
+ (cd "$(EXTRA_BUILD_DIR)/$$extrapkg" && $(MAKE) install \
+ DESTDIR="$(INSTALL_ROOT)" \
+ prefix="$(prefix)" \
+ exec_prefix="$(exec_prefix)" \
+ TCL_LIBRARY=$(TCL_LIBRARY) \
+ CFLAGS="$(CFLAGS)" \
+ CPPFLAGS="$(CPPFLAGS)" \
+ LDFLAGS="$(LDFLAGS)" \
+ CC="$(CC)") || exit $$?; \
+ fi; \
+ fi; \
+ done; \
+ else \
+ echo "No extra directory found - skipping extra installs"; \
+ fi
+
+clean-extra:
+ @if test -d "$(EXTRA_BUILD_DIR)"; then \
+ for extrapkg in $(EXTRA_BUILD_DIR)/*; do \
+ if test -d "$$extrapkg" && test -f "$$extrapkg/Makefile"; then \
+ echo "Cleaning extra package in $$extrapkg"; \
+ (cd "$$extrapkg" && $(MAKE) clean) || exit $$?; \
+ fi; \
+ done; \
+ fi
+
+distclean-extra:
+ @if test -d "$(EXTRA_BUILD_DIR)"; then \
+ for extrapkg in $(EXTRA_BUILD_DIR)/*; do \
+ if test -d "$$extrapkg" && test -f "$$extrapkg/Makefile"; then \
+ echo "Distcleaning extra package in $$extrapkg"; \
+ (cd "$$extrapkg" && $(MAKE) distclean) || exit $$?; \
+ fi; \
+ rm -rf "$$extrapkg"; \
+ done; \
+ rm -rf "$(EXTRA_BUILD_DIR)"; \
+ fi
+
#--------------------------------------------------------------------------
# The list of all the targets that do not correspond to real files. This stops
# 'make' from getting confused when someone makes an error in a rule.
@@ -2166,6 +2251,7 @@ BUILD_HTML = \
.PHONY: install-tzdata install-msgs
.PHONY: packages configure-packages test-packages clean-packages
.PHONY: dist-packages distclean-packages install-packages
+.PHONY: extra install-extra clean-extra distclean-extra
#--------------------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/win/Makefile.in b/win/Makefile.in
index 8dd107670f..f0cf267329 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -129,6 +129,11 @@ ROOT_DIR_WIN_NATIVE = $(shell cd '$(ROOT_DIR)' ; pwd -W 2>/dev/null || pwd -P)
ZLIB_DIR_NATIVE = $(shell $(CYGPATH) '$(ZLIB_DIR)')
TOMMATH_DIR_NATIVE = $(shell $(CYGPATH) '$(TOMMATH_DIR)')
+# Tk-related directories (TKDIR can be set by user)
+TK_SRC_DIR = $(TKDIR)
+TK_BUILD_TOP = $(TKDIR)/win
+CONFIG_INSTALL_DIR = $(LIB_INSTALL_DIR)
+
# Fully qualify library path so that `make test`
# does not depend on the current directory.
LIBRARY_DIR1 = $(shell cd '$(ROOT_DIR_NATIVE)/library' ; pwd -P)
@@ -432,6 +437,34 @@ TCL_OBJS = ${GENERIC_OBJS} ${WIN_OBJS} @ZLIB_OBJS@ $(TOMMATH_OBJS)
TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n]
all: binaries libraries doc packages
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \
+ echo "TKDIR detected - automatically building Tk..."; \
+ echo "========== TK BUILD PARAMETERS =========="; \
+ echo "TKDIR=$(TKDIR)"; \
+ echo "TCLDIR=$(TOP_DIR)"; \
+ echo "prefix=$(prefix)"; \
+ echo "exec_prefix=$(exec_prefix)"; \
+ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VER)${EXESUFFIX}"; \
+ echo "=========================================="; \
+ if test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "Building Tk using existing Makefile..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE)) || exit $$?; \
+ elif test -f "$(TK_SRC_DIR)/win/configure"; then \
+ echo "Configuring and building Tk..."; \
+ mkdir -p "$(TK_BUILD_TOP)"; \
+ (cd "$(TK_BUILD_TOP)" && \
+ "$(TK_SRC_DIR)/win/configure" \
+ --prefix="$(prefix)" \
+ --exec-prefix="$(exec_prefix)" \
+ --with-tcl="$(CONFIG_INSTALL_DIR)" && \
+ $(MAKE)) || exit $$?; \
+ else \
+ echo "ERROR: Tk configure script not found at $(TK_SRC_DIR)/win/configure"; \
+ exit 1; \
+ fi; \
+ else \
+ echo "TKDIR not set or directory does not exist - skipping Tk build"; \
+ fi
# Test-suite helper (can be used to test Tcl from build directory with all expected modules).
# To start from windows shell use:
@@ -648,6 +681,27 @@ gentommath_h:
> "$(GENERIC_DIR_NATIVE)/tclTomMath.h"
install: all install-binaries install-libraries install-doc install-packages
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)"; then \
+ echo "TKDIR detected - automatically installing Tk..."; \
+ echo "========== TK INSTALL PARAMETERS =========="; \
+ echo "TKDIR=$(TKDIR)"; \
+ echo "TCLDIR=$(TOP_DIR)"; \
+ echo "prefix=$(prefix)"; \
+ echo "exec_prefix=$(exec_prefix)"; \
+ echo "DESTDIR=$(INSTALL_ROOT)"; \
+ echo "TCL_TCLSH=$(BIN_INSTALL_DIR)/tclsh$(VER)${EXESUFFIX}"; \
+ echo "==========================================="; \
+ if test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "Installing Tk..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) install DESTDIR="$(INSTALL_ROOT)") || exit $$?; \
+ else \
+ echo "ERROR: Tk Makefile not found at $(TK_BUILD_TOP)/Makefile"; \
+ echo "Please run 'make all' first to build Tk"; \
+ exit 1; \
+ fi; \
+ else \
+ echo "TKDIR not set or directory does not exist - skipping Tk install"; \
+ fi
install-binaries: binaries
@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)"; \
@@ -848,10 +902,24 @@ clean: cleanhelp clean-packages
$(RM) $(TCLSH) $(CAT32) $(TEST_EXE_FILE) $(TEST_DLL_FILE) tcltest.cmd tcltest.sh
$(RM) *.pch *.ilk *.pdb *.zip
$(RMDIR) *.vfs
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "TKDIR detected - automatically cleaning Tk..."; \
+ echo "Cleaning Tk build..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) clean) || exit $$?; \
+ else \
+ echo "TKDIR not set, directory does not exist, or no Tk build to clean"; \
+ fi
distclean: distclean-packages clean
$(RM) Makefile config.status config.cache config.log tclConfig.sh \
tcl.hpj config.status.lineno tclsh.exe.manifest tclUuid.h
+ @if test -n "$(TKDIR)" && test -d "$(TKDIR)" && test -f "$(TK_BUILD_TOP)/Makefile"; then \
+ echo "TKDIR detected - automatically distcleaning Tk..."; \
+ echo "Distcleaning Tk build..."; \
+ (cd "$(TK_BUILD_TOP)" && $(MAKE) distclean) || exit $$?; \
+ else \
+ echo "TKDIR not set, directory does not exist, or no Tk build to distclean"; \
+ fi
#
# Bundled package targets
diff --git a/win/makefile.vc b/win/makefile.vc
index c88c0ec3dc..cbdad89ba8 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -420,6 +420,7 @@ TCLSTUBOBJS = \
### the left side of implicit rules.
TOMMATHDIR = $(ROOT)\libtommath
PKGSDIR = $(ROOT)\pkgs
+WINDIR = $(ROOT)\win
# Additional include and C macro definitions for the implicit rules
# defined in rules.vc
@@ -438,6 +439,7 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif
+
#---------------------------------------------------------------------
# Project specific targets
# There are 4 primary build configurations to consider from the combination
@@ -466,18 +468,24 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
# release - Everything that builds as part of a release
#---------------------------------------------------------------------
-release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs
-all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) pkgs
+release: setup $(TCLSH) $(TCLSTUBLIB) dlls setpath pkgs tk-build
+all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) setpath pkgs
core: setup $(TCLLIB) $(TCLSTUBLIB)
shell: setup $(TCLSH)
dlls: setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll
tcltest: setup $(TCLTEST) dlls $(CAT32)
-install: install-binaries install-libraries install-docs install-pkgs
+install: setpath install-binaries install-libraries install-docs install-pkgs tk-build tk-install
!if $(SYMBOLS)
install: install-pdbs
!endif
setup: default-setup
+# Add TCL win directory to PATH for current session
+setpath:
+ @echo Adding $(WINDIR) to PATH
+ @set PATH=$(WINDIR);$(PATH)
+ @echo PATH updated for current session
+
test: test-core test-pkgs
test-core: setup $(TCLTEST) dlls $(CAT32)
set TCL_LIBRARY=$(ROOT:\=/)/library
@@ -569,6 +577,84 @@ pkgs:
popd \
)
+tk-build:
+!if defined(TKDIR)
+ @echo TKDIR detected - building Tk...
+ @echo ========== TK BUILD PARAMETERS ==========
+ @echo TKDIR=$(TKDIR)
+ @echo TCLDIR=$(ROOT)
+!if defined(INSTALLDIR)
+ @echo INSTALLDIR=$(INSTALLDIR)
+!endif
+ @echo OPTS=$(OPTS)
+ @echo STATS=$(STATS)
+ @echo CHECKS=$(CHECKS)
+ @echo MACHINE=$(MACHINE)
+ @echo ==========================================
+ @if exist "$(TKDIR)\win\makefile.vc" ( \
+ pushd "$(TKDIR)\win" & \
+ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) OPTS=$(OPTS) STATS=$(STATS) CHECKS=$(CHECKS) MACHINE=$(MACHINE) & \
+ popd \
+ ) else ( \
+ echo ERROR: Tk makefile.vc not found at $(TKDIR)\win\makefile.vc & \
+ exit 1 \
+ )
+!else
+ @echo TKDIR not set or directory does not exist - skipping Tk build
+!endif
+
+tk-install:
+!if defined(TKDIR) && defined(INSTALLDIR)
+ @echo TKDIR detected - installing Tk...
+ @echo ========== TK INSTALL PARAMETERS ==========
+ @echo TKDIR=$(TKDIR)
+ @echo TCLDIR=$(ROOT)
+ @echo INSTALLDIR=$(INSTALLDIR)
+ @echo OPTS=$(OPTS)
+ @echo STATS=$(STATS)
+ @echo CHECKS=$(CHECKS)
+ @echo MACHINE=$(MACHINE)
+ @echo ===========================================
+ @if exist "$(TKDIR)\win\makefile.vc" ( \
+ pushd "$(TKDIR)\win" & \
+ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) INSTALLDIR=$(INSTALLDIR) OPTS=$(OPTS) STATS=$(STATS) CHECKS=$(CHECKS) MACHINE=$(MACHINE) install & \
+ popd \
+ ) else ( \
+ echo ERROR: Tk makefile.vc not found at $(TKDIR)\win\makefile.vc & \
+ exit 1 \
+ )
+!else
+ @echo TKDIR not set, INSTALLDIR not set, or directory does not exist - skipping Tk install
+!endif
+
+tk-clean:
+!if defined(TKDIR)
+ @echo TKDIR detected - cleaning Tk build...
+ @if exist "$(TKDIR)\win\makefile.vc" ( \
+ pushd "$(TKDIR)\win" & \
+ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) clean & \
+ popd \
+ ) else ( \
+ echo No Tk makefile found to clean \
+ )
+!else
+ @echo TKDIR not set or directory does not exist - skipping Tk clean
+!endif
+
+tk-distclean:
+!if defined(TKDIR)
+ @echo TKDIR detected - distcleaning Tk build...
+ @if exist "$(TKDIR)\win\makefile.vc" ( \
+ pushd "$(TKDIR)\win" & \
+ $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) distclean & \
+ popd \
+ ) else ( \
+ echo No Tk makefile found to distclean \
+ )
+!else
+ @echo TKDIR not set or directory does not exist - skipping Tk distclean
+!endif
+
test-pkgs:
@for /d %d in ($(PKGSDIR)\*) do \
@if exist "%~fd\win\makefile.vc" ( \
@@ -1058,8 +1144,8 @@ tidy:
@echo Removing $(TCLREGLIB) ...
@if exist $(TCLREGLIB) del $(TCLREGLIB)
-clean: default-clean clean-pkgs
-hose: default-hose hose-pkgs
+clean: default-clean clean-pkgs tk-clean
+hose: default-hose hose-pkgs tk-distclean
realclean: hose
.PHONY:
--
2.43.0

View File

@@ -0,0 +1,27 @@
From 85842ba83b70d99f90ee3fff8c956e82d17759f2 Mon Sep 17 00:00:00 2001
From: Marek Roszko <mark.roszko@gmail.com>
Date: Tue, 18 Aug 2020 23:11:27 -0400
Subject: [PATCH] Remove broken exist check for shell install
---
win/makefile.vc | 2 --
1 file changed, 2 deletions(-)
diff --git a/win/makefile.vc b/win/makefile.vc
index f5d2f4a..6bffe32 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -869,10 +869,8 @@ install-binaries:
@$(CPY) "$(TCLLIB)" "$(BIN_INSTALL_DIR)\"
!endif
@$(CPY) "$(TCLIMPLIB)" "$(LIB_INSTALL_DIR)\"
-!if exist($(TCLSH))
@echo Installing $(TCLSHNAME)
@$(CPY) "$(TCLSH)" "$(BIN_INSTALL_DIR)\"
-!endif
@echo Installing $(TCLSTUBLIBNAME)
@$(CPY) "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)\"
--
2.28.0.windows.1

View File

@@ -1,55 +1,20 @@
vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
REPO tcl/Tcl
REF 8.6.16
FILENAME tcl8.6.16-src.tar.gz
SHA512 434c92f8181fb8dca6bc065b0f1f5078779086f19adf008818c90a3108596c63465ef43e9f3c1cfb3d4151a9de244d0bf0e6ee5b40e714b1ddca4a78eb43050b
PATCHES
0001-Support-Tk.patch
REF 8.6.15
FILENAME tcl8.6.15-src.tar.gz
SHA512 9ae652823084899091467744da5a35d0fdfb453c055baea96af1bb181d161abe58b83382315cc3abee5fd57acc4ad5028df486a3e53645a28d1467e9c8d1d23e
)
set(USE_TCL_TK OFF)
set (TKDIR_WIN "")
if ("tk" IN_LIST FEATURES)
set (TKDIR_WIN "TKDIR=../extra/tk.8.6.16-src")
vcpkg_from_sourceforge(
OUT_SOURCE_PATH TK_SOURCE_PATH
REPO tcl/Tcl
REF 8.6.16
FILENAME tk8.6.16-src.tar.gz
SHA512 b7d37bee25f826f156137a04859ac756c682f1dd155ec9629119dc3690509ce1b6e308e23b291f2debbc10f3b1650993fea66463e5445c505860a10acac901d0
)
# Copy TK to TCL package source path (SOURCE_PATH/extra/tk) if TK is used
if (NOT EXISTS "${SOURCE_PATH}/extra/tk.8.6.16-src")
file(MAKE_DIRECTORY "${SOURCE_PATH}/extra/tk.8.6.16-src")
file(COPY ${TK_SOURCE_PATH}/ DESTINATION "${SOURCE_PATH}/extra/tk.8.6.16-src")
endif()
set (USE_TCL_TK ON)
endif()
# Copy TK to TCL package source path if TK is used
# Use Windows NMAKE build for MSVC, but Unix build for MinGW
if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
if (VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(TCL_BUILD_MACHINE_STR MACHINE=AMD64)
set(TCL_BUILD_ARCH_STR ARCH=AMD64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(TCL_BUILD_MACHINE_STR MACHINE=ARM64)
set(TCL_BUILD_ARCH_STR ARCH=ARM64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(TCL_BUILD_MACHINE_STR MACHINE=IX86)
set(TCL_BUILD_ARCH_STR ARCH=IX86)
else()
# Default fallback for unknown architectures
set(TCL_BUILD_MACHINE_STR MACHINE=IX86)
set(TCL_BUILD_ARCH_STR ARCH=IX86)
endif()
# Handle features
set(TCL_BUILD_OPTS OPTS=)
set(TCL_BUILD_OPTS OPTS=pdbs)
set(TCL_BUILD_STATS STATS=none)
set(TCL_BUILD_CHECKS CHECKS=none)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
@@ -77,57 +42,109 @@ if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
PROJECT_SUBPATH win
OPTIONS
${TCL_BUILD_MACHINE_STR}
${TCL_BUILD_ARCH_STR}
${TCL_BUILD_STATS}
${TCL_BUILD_CHECKS}
${TKDIR_WIN}
OPTIONS_DEBUG
${TCL_BUILD_OPTS},symbols,pdbs
${TCL_BUILD_OPTS},symbols
INSTALLDIR=${CURRENT_PACKAGES_DIR}/debug
SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0
OPTIONS_RELEASE
release
${TCL_BUILD_OPTS}
INSTALLDIR=${CURRENT_PACKAGES_DIR}
SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0
)
# Install
# Note: tcl shell requires it to be in a folder adjacent to the /lib/ folder, i.e. in a /bin/ folder
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)
file(GLOB_RECURSE TOOL_BIN
"${CURRENT_PACKAGES_DIR}/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/bin/*.dll"
)
file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/bin/")
# Remove .exes only after copying
file(GLOB_RECURSE TOOL_EXES
${CURRENT_PACKAGES_DIR}/bin/*.exe
)
file(REMOVE ${TOOL_EXES})
file(GLOB_RECURSE TOOLS
"${CURRENT_PACKAGES_DIR}/lib/dde1.4/*"
"${CURRENT_PACKAGES_DIR}/lib/nmake/*"
"${CURRENT_PACKAGES_DIR}/lib/reg1.3/*"
"${CURRENT_PACKAGES_DIR}/lib/tcl8/*"
"${CURRENT_PACKAGES_DIR}/lib/tcl8.6/*"
"${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0/*"
)
foreach(TOOL ${TOOLS})
get_filename_component(DST_DIR ${TOOL} PATH)
file(COPY "${TOOL}" DESTINATION ${DST_DIR})
endforeach()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/dde1.4"
"${CURRENT_PACKAGES_DIR}/lib/nmake"
"${CURRENT_PACKAGES_DIR}/lib/reg1.3"
"${CURRENT_PACKAGES_DIR}/lib/tcl8"
"${CURRENT_PACKAGES_DIR}/lib/tcl8.6"
"${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0"
)
file(CHMOD_RECURSE
"${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/tzdata"
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ WORLD_WRITE
)
endif()
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
file(GLOB_RECURSE TOOL_BIN
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/debug/bin/*.dll"
)
file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/bin/")
# Remove .exes only after copying
file(GLOB_RECURSE EXES
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
)
file(REMOVE ${EXES})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/dde1.4"
"${CURRENT_PACKAGES_DIR}/debug/lib/nmake"
"${CURRENT_PACKAGES_DIR}/debug/lib/reg1.3"
"${CURRENT_PACKAGES_DIR}/debug/lib/tcl8"
"${CURRENT_PACKAGES_DIR}/debug/lib/tcl8.6"
"${CURRENT_PACKAGES_DIR}/debug/lib/tdbcsqlite31.1.0"
)
file(CHMOD_RECURSE
"${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/tzdata"
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ WORLD_WRITE
)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file (REMOVE ${CURRENT_PACKAGES_DIR}/bin/zlib1.dll)
file (REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/zlib1.dll)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
else()
set (TCL_PROJECT_SUBPATH unix)
if (VCPKG_TARGET_IS_MINGW)
set (TCL_PROJECT_SUBPATH win)
endif()
# file(REMOVE "${SOURCE_PATH}/${TCL_PROJECT_SUBPATH}/configure")
# For MinGW and other Unix-like environments on Windows, use unix build path
# MinGW can use either win/ (with MinGW-compatible Makefiles) or unix/ (with autotools)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_SUBPATH ${TCL_PROJECT_SUBPATH}
AUTOCONFIG
PROJECT_SUBPATH unix
)
# Build with explicit X11 paths for Tk when needed
if(USE_TCL_TK AND NOT VCPKG_TARGET_IS_WINDOWS)
vcpkg_build_make(
ENVIRONMENT
"CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include"
"LDFLAGS=-L${CURRENT_INSTALLED_DIR}/lib"
)
vcpkg_install_make(
ENVIRONMENT
"CPPFLAGS=-I${CURRENT_INSTALLED_DIR}/include"
"LDFLAGS=-L${CURRENT_INSTALLED_DIR}/lib"
)
else()
vcpkg_install_make()
endif()
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
@@ -136,9 +153,4 @@ endif()
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/tclConfig.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/tclConfig.sh")
# Remove TK configuration files if TK was built
if(USE_TCL_TK)
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/tkConfig.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/tkConfig.sh")
endif()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.terms")

View File

@@ -20,9 +20,6 @@
},
"utfmax": {
"description": "Forces Tcl_UniChar to be a 32-bit quantity in stead of 16-bits"
},
"tk" : {
"description": "Enables optional usage of Tk. Part of the module-foundation-classes."
}
}
}

View File

@@ -1,9 +0,0 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_FIXUP_ELF_RPATH ON)
set(VCPKG_BUILD_TYPE "release")

View File

@@ -13,9 +13,6 @@
}
],
"overlay-ports": [
"../../ports"
],
"overlay-triplets": [
"../../triplets"
]
}
"./ports"
]
}

121
adm/vcpkg/vcpkg.json Normal file
View File

@@ -0,0 +1,121 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "opencascade",
"version": "7.8.1",
"description": "Open CASCADE Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE.",
"homepage": "https://github.com/Open-Cascade-SAS/OCCT",
"documentation": "https://github.com/Open-Cascade-SAS/OCCT/wiki",
"license": "LGPL-2.1",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
{
"name": "tcl"
},
{
"name": "freetype",
"platform": "!uwp"
},
{
"name": "angle",
"platform": "uwp"
},
{
"name": "opengl",
"platform": "!(android | ios | uwp | wasm32)"
}
],
"features": {
"angle": {
"description": "Enables optional usage of ANGLE. Part of the module-visualization.",
"dependencies": [
"angle"
]
},
"opengl": {
"description": "Enables optional usage of OpenGL. Part of the module-visualization.",
"dependencies": [
"opengl"
]
},
"tcl": {
"description": "Enables optional usage of Tcl. Part of the module-foundation-classes.",
"dependencies": [
"tcl"
]
},
"freeimage": {
"description": "Enables optional usage of FreeImage. Part of the module-visualization.",
"dependencies": [
"freeimage"
]
},
"freetype": {
"description": "Enables optional usage of FreeType. Part of the module-visualization.",
"supports": "!uwp",
"dependencies": [
"fontconfig",
{
"name": "freetype",
"default-features": false
}
]
},
"rapidjson": {
"description": "Enables optional usage of RapidJSON. Part of the module-data-exchange.",
"dependencies": [
"rapidjson"
]
},
"tbb": {
"description": "Enables optional usage of TBB. Part of the module-foundation-classes.",
"dependencies": [
"tbb"
]
},
"vtk": {
"description": "Enables optional usage of VTK. Part of the module-visualization.",
"dependencies": [
{
"name": "vtk",
"default-features": false,
"features": [
"opengl"
]
}
]
},
"draco": {
"description": "Enables optional usage of Draco. Part of the module-data-exchange.",
"dependencies": [
"draco"
]
},
"ffmpeg": {
"description": "Enables optional usage of FFmpeg. Part of the module-visualization.",
"dependencies": [
"ffmpeg"
]
},
"openvr": {
"description": "Enables optional usage of OpenVR. Part of the module-visualization.",
"dependencies": [
"openvr"
]
},
"jemalloc": {
"description": "Enables optional usage of jemalloc. Part of the module-foundation-classes.",
"dependencies": [
"jemalloc"
]
}
}
}

View File

@@ -1,7 +1,7 @@
project (Overview)
# directory that contains all raw OCCT overview articles (markdown format)
set (OCCT_OVERVIEW_DIR "${OCCT_ROOT_DIR}/dox")
set (OCCT_OVERVIEW_DIR "${CMAKE_SOURCE_DIR}/dox")
# directory that contains resources for the generation of OCCT documentation
set (OCCT_OVERVIEW_RESOURCE_DIR "${OCCT_OVERVIEW_DIR}/resources")
@@ -43,7 +43,7 @@ configure_file ("${OCCT_OVERVIEW_RESOURCE_DIR}/occt_ug_html.doxyfile" "${OCCT_CO
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_NUMBER = ${OCC_VERSION_STRING_EXT}")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nOUTPUT_DIRECTORY = ${OCCT_GENERATED_OVERVIEW_DIR}/.")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_LOGO = ${OCCT_OVERVIEW_DIR}/resources/occ_logo.png")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nEXAMPLE_PATH = ${OCCT_ROOT_DIR}/src")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nEXAMPLE_PATH = ${CMAKE_SOURCE_DIR}/src")
set (OCCT_ARTICLE_PARAM_INPUT "INPUT =")
set (OCCT_ARTICLE_PARAM_IMAGEPATH "IMAGE_PATH = ${OCCT_OVERVIEW_DIR}/resources/ ")

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