mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-01 17:36:21 +03:00
Testing - Samples build on GH #331
Add GitHub Action to build CSharp sample on Windows Add MFC and Qt sample build actions Improve CASROOT assignment logic in env.build.sh and env.install.sh for better compatibility with binary directories
This commit is contained in:
parent
9d727d09f4
commit
a5aa7bcd91
57
.github/actions/build-sample-csharp/action.yml
vendored
Normal file
57
.github/actions/build-sample-csharp/action.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
name: 'Build CSharp Sample'
|
||||
description: 'Build CSharp sample using OCCT installation'
|
||||
|
||||
inputs:
|
||||
platform:
|
||||
description: 'Build platform (windows)'
|
||||
required: true
|
||||
install-artifact-name:
|
||||
description: 'OCCT installation artifact name'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download OCCT installation
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
name: ${{ inputs.install-artifact-name }}
|
||||
path: occt-install
|
||||
|
||||
- name: Build CSharp Sample
|
||||
if: inputs.platform == 'windows'
|
||||
shell: cmd
|
||||
run: |
|
||||
REM Setup environment
|
||||
call "${{ github.workspace }}\occt-install\env.bat" vc14 win64 Release
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" x64
|
||||
set "PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE;%PATH%"
|
||||
|
||||
cd ${{ github.workspace }}/samples/CSharp
|
||||
|
||||
REM First upgrade solutions to VS2022
|
||||
echo "Upgrading solution files to VS2022..."
|
||||
devenv.exe CSharp.sln /upgrade
|
||||
devenv.exe CSharp_D3D.sln /upgrade
|
||||
|
||||
REM Update project platform toolset
|
||||
powershell -Command "(Get-Content OCCTProxy\OCCTProxy.vcxproj) -replace '<PlatformToolset>v100</PlatformToolset>', '<PlatformToolset>v143</PlatformToolset>' | Set-Content OCCTProxy\OCCTProxy.vcxproj"
|
||||
powershell -Command "(Get-Content OCCTProxy_D3D\OCCTProxy_D3D.vcxproj) -replace '<PlatformToolset>v100</PlatformToolset>', '<PlatformToolset>v143</PlatformToolset>' | Set-Content OCCTProxy_D3D\OCCTProxy_D3D.vcxproj"
|
||||
|
||||
REM Restore NuGet packages
|
||||
echo "Upgrading solution files..."
|
||||
msbuild.exe CSharp.sln -t:Restore -p:Configuration=Release -p:Platform=x64 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=restore_csharp.log;Verbosity=detailed
|
||||
msbuild.exe CSharp_D3D.sln -t:Restore -p:Configuration=Release -p:Platform=x64 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=restore_d3d.log;Verbosity=detailed
|
||||
|
||||
REM Build solutions with real-time console output
|
||||
echo "Building CSharp.sln..."
|
||||
msbuild.exe CSharp.sln /p:Configuration=Release /p:Platform=x64 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=build_csharp.log;Verbosity=detailed /m
|
||||
echo "Building CSharp_D3D.sln..."
|
||||
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.4.3
|
||||
with:
|
||||
name: csharp-sample-${{ inputs.platform }}-x64
|
||||
path: samples/CSharp
|
||||
retention-days: 7
|
54
.github/actions/build-sample-mfc/action.yml
vendored
Normal file
54
.github/actions/build-sample-mfc/action.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
name: 'Build MFC Sample'
|
||||
description: 'Build MFC sample using OCCT installation'
|
||||
|
||||
inputs:
|
||||
platform:
|
||||
description: 'Build platform (windows)'
|
||||
required: true
|
||||
install-artifact-name:
|
||||
description: 'OCCT installation artifact name'
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download OCCT installation
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
name: ${{ inputs.install-artifact-name }}
|
||||
path: occt-install
|
||||
|
||||
- name: Build MFC Sample
|
||||
if: inputs.platform == 'windows'
|
||||
shell: cmd
|
||||
run: |
|
||||
REM Setup environment
|
||||
call "${{ github.workspace }}\occt-install\env.bat" vc14 win64 Release
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" x64
|
||||
|
||||
cd ${{ github.workspace }}/samples/mfc/standard
|
||||
set "PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE;%PATH%"
|
||||
|
||||
REM First restore the solution
|
||||
echo "Restoring solution..."
|
||||
msbuild.exe ALL-vc14.sln -t:Restore -p:Configuration=Release -p:Platform=x64 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=restore.log;Verbosity=detailed
|
||||
|
||||
REM Build solution with detailed logging
|
||||
echo "Building solution..."
|
||||
msbuild.exe ALL-vc14.sln /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=build.log;Verbosity=detailed /m
|
||||
|
||||
REM Display logs if build fails
|
||||
if errorlevel 1 (
|
||||
echo "Build failed. Contents of restore.log:"
|
||||
type restore.log
|
||||
echo "Contents of build.log:"
|
||||
type build.log
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
- name: Upload MFC Sample
|
||||
uses: actions/upload-artifact@v4.4.3
|
||||
with:
|
||||
name: mfc-sample-${{ inputs.platform }}-x64
|
||||
path: samples/mfc/
|
||||
retention-days: 7
|
108
.github/actions/build-sample-qt/action.yml
vendored
Normal file
108
.github/actions/build-sample-qt/action.yml
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
name: 'Build Qt Sample'
|
||||
description: 'Build Qt samples using OCCT installation'
|
||||
|
||||
inputs:
|
||||
platform:
|
||||
description: 'Build platform (windows/linux)'
|
||||
required: true
|
||||
install-artifact-name:
|
||||
description: 'OCCT installation artifact name'
|
||||
required: true
|
||||
thirdparty_url:
|
||||
description: 'URL to download 3rdparty dependencies'
|
||||
required: false
|
||||
default: 'https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/3rdparty-vc14-64.zip'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download OCCT installation
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
name: ${{ inputs.install-artifact-name }}
|
||||
path: occt-install
|
||||
|
||||
- name: Install Windows dependencies
|
||||
if: inputs.platform == 'windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
Invoke-WebRequest -Uri ${{ inputs.thirdparty_url }} -OutFile 3rdparty-vc14-64.zip
|
||||
Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath .
|
||||
Remove-Item 3rdparty-vc14-64.zip
|
||||
|
||||
- name: Install Linux dependencies
|
||||
if: inputs.platform == 'linux'
|
||||
shell: bash
|
||||
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 tcllib tcl-thread tcl libvtk9-dev libopenvr-dev libdraco-dev libfreeimage-dev libegl1-mesa-dev libgles2-mesa-dev libfreetype-dev qtbase5-dev qt5-qmake qtbase5-dev-tools qtdeclarative5-dev qttools5-dev qttools5-dev-tools
|
||||
|
||||
- name: Setup MSBuild
|
||||
if: inputs.platform == 'windows'
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Build Qt Samples - Windows
|
||||
if: inputs.platform == 'windows'
|
||||
shell: cmd
|
||||
run: |
|
||||
REM Setup environment
|
||||
cd ${{ github.workspace }}/occt-install/
|
||||
call env.bat vc14 win64 Release
|
||||
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" x64
|
||||
|
||||
REM Setup Qt environment
|
||||
set "QTDIR=${{ github.workspace }}\3rdparty-vc14-64\qt5.11.2-vc14-64"
|
||||
set "PATH=%QTDIR%\bin;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE;%PATH%"
|
||||
|
||||
cd ${{ github.workspace }}/samples/qt
|
||||
|
||||
for %%s in (IESample Tutorial FuncDemo) do (
|
||||
cd %%s
|
||||
echo "Generating project for %%s..."
|
||||
qmake -tp vc -r -o %%s.sln %%s0.pro
|
||||
|
||||
echo "Restoring %%s..."
|
||||
msbuild.exe %%s.sln -t:Restore -p:Configuration=Release -p:Platform=x64 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=%%s_restore.log;Verbosity=detailed
|
||||
|
||||
echo "Building %%s..."
|
||||
msbuild.exe %%s.sln /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /consoleloggerparameters:Verbosity=normal;Summary /flp:LogFile=%%s_build.log;Verbosity=detailed /m
|
||||
|
||||
REM Display logs if build fails
|
||||
if errorlevel 1 (
|
||||
echo "Build failed for %%s. Contents of restore log:"
|
||||
type %%s_restore.log
|
||||
echo "Contents of build log:"
|
||||
type %%s_build.log
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
cd ..
|
||||
)
|
||||
|
||||
- name: Build Qt Samples - Linux
|
||||
if: inputs.platform == 'linux'
|
||||
shell: bash
|
||||
run: |
|
||||
cd ${{ github.workspace }}/occt-install/bin
|
||||
source env.sh
|
||||
cd ${{ github.workspace }}/samples/qt
|
||||
|
||||
for sample in IESample Tutorial FuncDemo; do
|
||||
cd $sample
|
||||
aQMakePath=`which qmake`
|
||||
host=`uname -s`
|
||||
export STATION=$host
|
||||
export RES_DIR="${{ github.workspace }}/samples/qt/${sample}/result"
|
||||
qmake $sample.pro
|
||||
aNbJobs="$(getconf _NPROCESSORS_ONLN)"
|
||||
make -j$aNbJobs release
|
||||
cd ..
|
||||
done
|
||||
|
||||
- name: Upload Qt Samples
|
||||
uses: actions/upload-artifact@v4.4.3
|
||||
with:
|
||||
name: qt-samples-${{ inputs.platform }}-x64
|
||||
path: |
|
||||
samples/qt/
|
||||
samples/qt/
|
||||
retention-days: 7
|
4
.github/actions/build-tinspector/action.yml
vendored
4
.github/actions/build-tinspector/action.yml
vendored
@ -16,9 +16,6 @@ inputs:
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: Download OCCT installation
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
@ -33,7 +30,6 @@ runs:
|
||||
Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath .
|
||||
Remove-Item 3rdparty-vc14-64.zip
|
||||
|
||||
|
||||
- name: Install Linux dependencies
|
||||
if: inputs.platform == 'linux'
|
||||
shell: bash
|
||||
|
@ -85,6 +85,7 @@ jobs:
|
||||
-D CMAKE_BUILD_TYPE=Release `
|
||||
-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 `
|
||||
@ -159,6 +160,7 @@ jobs:
|
||||
-D CMAKE_BUILD_TYPE=Release `
|
||||
-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 `
|
||||
@ -430,6 +432,66 @@ jobs:
|
||||
platform: linux
|
||||
install-artifact-name: install-linux-clang-x64
|
||||
|
||||
build-csharp-windows:
|
||||
name: Build CSharp Sample on Windows
|
||||
needs: prepare-and-build-windows-x64
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: Build CSharp Sample
|
||||
uses: ./.github/actions/build-sample-csharp
|
||||
with:
|
||||
platform: windows
|
||||
install-artifact-name: install-windows-x64
|
||||
|
||||
build-mfc-windows:
|
||||
name: Build MFC Sample on Windows
|
||||
needs: prepare-and-build-windows-x64
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: Build MFC Sample
|
||||
uses: ./.github/actions/build-sample-mfc
|
||||
with:
|
||||
platform: windows
|
||||
install-artifact-name: install-windows-x64
|
||||
|
||||
build-qt-windows:
|
||||
name: Build Qt Sample on Windows
|
||||
needs: prepare-and-build-windows-x64
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: Build Qt Sample
|
||||
uses: ./.github/actions/build-sample-qt
|
||||
with:
|
||||
platform: windows
|
||||
install-artifact-name: install-windows-x64
|
||||
|
||||
build-qt-linux:
|
||||
name: Build Qt Sample on Linux
|
||||
needs: prepare-and-build-linux-clang-x64
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
- name: Build Qt Sample
|
||||
uses: ./.github/actions/build-sample-qt
|
||||
with:
|
||||
platform: linux
|
||||
install-artifact-name: install-linux-clang-x64
|
||||
|
||||
test-windows-x64:
|
||||
name: Test on Windows (x64)
|
||||
runs-on: windows-2022
|
||||
|
@ -23,7 +23,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
|
||||
|
||||
export CSF_OCCTBinPath="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@"
|
||||
export CSF_OCCTLibPath="@CMAKE_ARCHIVE_OUTPUT_DIRECTORY@"
|
||||
export CSF_OCCTIncludePath="@CMAKE_BINARY_DIR@/inc"
|
||||
export CSF_OCCTIncludePath="@CMAKE_BINARY_DIR@/@INSTALL_DIR_INCLUDE@"
|
||||
export CSF_OCCTResourcePath="@CMAKE_SOURCE_DIR@/src"
|
||||
export CSF_OCCTDataPath="@CMAKE_SOURCE_DIR@/data"
|
||||
export CSF_OCCTSamplesPath="@CMAKE_SOURCE_DIR@/samples"
|
||||
|
@ -1,10 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
aCurrentPath="$PWD"
|
||||
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
|
||||
cd ${aCurrentPath}
|
||||
|
||||
# ----- For compatibility with external application using CASROOT -----
|
||||
if [ "${CASROOT}" == "" ]; then
|
||||
export CASROOT="${aScriptPath}"
|
||||
# Get the last directory name from the path
|
||||
lastDir=$(basename "$aScriptPath")
|
||||
# Check if last directory is exactly bin, bind, or bini
|
||||
if [ "$lastDir" = "bin" ] || [ "$lastDir" = "bind" ] || [ "$lastDir" = "bini" ]; then
|
||||
# If path contains binary folder, go one level up
|
||||
export CASROOT=$(cd "$aScriptPath/.." && pwd)
|
||||
else
|
||||
# Keep current location
|
||||
export CASROOT="${aScriptPath}"
|
||||
fi
|
||||
cd ${aCurrentPath}
|
||||
fi
|
||||
|
||||
# ----- Define path to 3rdparty products -----
|
||||
|
@ -1,10 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
aCurrentPath="$PWD"
|
||||
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
|
||||
cd ${aCurrentPath}
|
||||
|
||||
# ----- For compatibility with external application using CASROOT -----
|
||||
if [ "${CASROOT}" == "" ]; then
|
||||
export CASROOT="@INSTALL_DIR@"
|
||||
# Get the last directory name from the path
|
||||
lastDir=$(basename "$aScriptPath")
|
||||
# Check if last directory is exactly bin, bind, or bini
|
||||
if [ "$lastDir" = "bin" ] || [ "$lastDir" = "bind" ] || [ "$lastDir" = "bini" ]; then
|
||||
# If path contains binary folder, go one level up
|
||||
export CASROOT=$(cd "$aScriptPath/.." && pwd)
|
||||
else
|
||||
# Keep current location
|
||||
export CASROOT="${aScriptPath}"
|
||||
fi
|
||||
cd ${aCurrentPath}
|
||||
fi
|
||||
|
||||
# ----- Define path to 3rdparty products -----
|
||||
|
@ -3,7 +3,11 @@ CONFIG += debug_and_release qt
|
||||
|
||||
TARGET = FuncDemo
|
||||
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
isEmpty(CSF_OCCTSamplesPath) {
|
||||
SAMPLESROOT = $$PWD/..
|
||||
} else {
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
}
|
||||
|
||||
HEADERS = src/*.h
|
||||
SOURCES = src/*.cpp
|
||||
|
@ -3,7 +3,11 @@ CONFIG += debug_and_release qt
|
||||
|
||||
TARGET = IESample
|
||||
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
isEmpty(CSF_OCCTSamplesPath) {
|
||||
SAMPLESROOT = $$PWD/..
|
||||
} else {
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
}
|
||||
|
||||
HEADERS = $${SAMPLESROOT}/Common/src/*.h \
|
||||
$${SAMPLESROOT}/Interface/src/*.h
|
||||
|
@ -9,7 +9,11 @@ greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
|
||||
TARGET = OCCTOverview
|
||||
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
isEmpty(CSF_OCCTSamplesPath) {
|
||||
SAMPLESROOT = $$PWD/..
|
||||
} else {
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
}
|
||||
|
||||
|
||||
HEADERS = ./src/*.h \
|
||||
|
@ -3,7 +3,11 @@ CONFIG += debug_and_release qt
|
||||
|
||||
TARGET = Tutorial
|
||||
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
isEmpty(CSF_OCCTSamplesPath) {
|
||||
SAMPLESROOT = $$PWD/..
|
||||
} else {
|
||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||
}
|
||||
|
||||
HEADERS = src/*.h \
|
||||
$${SAMPLESROOT}/Common/src/*.h \
|
||||
|
Loading…
x
Reference in New Issue
Block a user