Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
os:
- macos-15-intel
- macos-latest
- windows-latest

include:
- os: ubuntu-latest
Expand All @@ -29,6 +28,8 @@ jobs:
- os: ubuntu-latest
config: Debug
container: ghcr.io/viennatools/vienna-builder:suite
- os: windows-latest
config: Release+Debug

runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
Expand Down Expand Up @@ -73,7 +74,6 @@ jobs:
if ($LASTEXITCODE -ne 0) { exit 1 }
"CPM_ViennaLS_SOURCE=$((Get-Location).Path)/_viennals" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}

- name: 🖥️ Setup vcpkg (Windows)
shell: pwsh
if: ${{ matrix.os == 'windows-latest' }}
Expand All @@ -92,13 +92,32 @@ jobs:
if: ${{ startsWith(matrix.os, 'macos-') }}
run: brew install vtk embree tbb

- name: 🔑 Prepare vcpkg cache key (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
$manifest = Get-Content vcpkg.json -Raw | ConvertFrom-Json
$cacheKey = [ordered]@{
dependencies = $manifest.dependencies
features = $manifest.features
defaultFeatures = $manifest.'default-features'
overrides = $manifest.overrides
builtinBaseline = $manifest.'builtin-baseline'
}
$cacheKey | ConvertTo-Json -Depth 20 | Out-File -FilePath vcpkg-cache-key.json -Encoding utf8
Get-Content vcpkg-cache-key.json

- name: 🦥 Cache vcpkg installed (Windows)
if: ${{ matrix.os == 'windows-latest' }}
id: vcpkg-installed-cache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/vcpkg_installed
key: vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_COMMIT }}-${{ hashFiles('vcpkg.json') }}
path: |
${{ github.workspace }}/vcpkg_installed
${{ github.workspace }}/.vcpkg-bincache
key: vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_COMMIT }}-${{ hashFiles('vcpkg-cache-key.json') }}
restore-keys: |
vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_COMMIT }}-

- name: 🛠️ Build Dependencies (Windows)
if: ${{ matrix.os == 'windows-latest' && steps.vcpkg-installed-cache.outputs.cache-hit != 'true' }}
Expand All @@ -113,7 +132,8 @@ jobs:
$cpmArgs = @()
if ($env:CPM_ViennaLS_SOURCE) { $cpmArgs += "-DCPM_ViennaLS_SOURCE=$env:CPM_ViennaLS_SOURCE" }
cmake -DVIENNAPS_BUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DVCPKG_INSTALLED_DIR=${{ github.workspace }}/vcpkg_installed -DVCPKG_MANIFEST_INSTALL=OFF @cpmArgs -B build
cmake --build build --config ${{ matrix.config }}
cmake --build build --config Release --parallel
cmake --build build --config Debug --parallel

- name: 🏗️ Compile (other)
if: ${{ matrix.os != 'windows-latest' }}
Expand All @@ -122,5 +142,13 @@ jobs:
cmake --build build --config ${{ matrix.config }}

- name: 🧪 Test
if: ${{ matrix.os != 'windows-latest' }}
run: |
ctest --output-on-failure -E "Benchmark|Performance" -C ${{ matrix.config }} --test-dir build

- name: 🧪 Test (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
ctest --output-on-failure -E "Benchmark|Performance" -C Release --test-dir build
ctest --output-on-failure -E "Benchmark|Performance" -C Debug --test-dir build
28 changes: 24 additions & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,32 @@ jobs:
if: ${{ startsWith(matrix.os, 'macos-') }}
run: brew install embree tbb vtk

- name: 🔑 Prepare vcpkg cache key (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
$manifest = Get-Content vcpkg.json -Raw | ConvertFrom-Json
$cacheKey = [ordered]@{
dependencies = $manifest.dependencies
features = $manifest.features
defaultFeatures = $manifest.'default-features'
overrides = $manifest.overrides
builtinBaseline = $manifest.'builtin-baseline'
}
$cacheKey | ConvertTo-Json -Depth 20 | Out-File -FilePath vcpkg-cache-key.json -Encoding utf8
Get-Content vcpkg-cache-key.json

- name: 🦥 Cache vcpkg installed (Windows)
if: ${{ matrix.os == 'windows-latest' }}
id: vcpkg-installed-cache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/vcpkg_installed
key: vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_COMMIT }}-${{ hashFiles('vcpkg.json') }}
path: |
${{ github.workspace }}/vcpkg_installed
${{ github.workspace }}/.vcpkg-bincache
key: vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_COMMIT }}-${{ hashFiles('vcpkg-cache-key.json') }}
restore-keys: |
vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_COMMIT }}-

- name: 🛠️ Build Dependencies (Windows)
if: ${{ matrix.os == 'windows-latest' && steps.vcpkg-installed-cache.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -148,6 +167,7 @@ jobs:
path: venv

package:
if: ${{ github.event_name == 'release' || github.event.inputs.publish == 'true' || github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false

Expand Down Expand Up @@ -246,8 +266,8 @@ jobs:
CIBW_ARCHS_WINDOWS: auto64
CIBW_ARCHS_MACOS: ${{ matrix.archs }}
CIBW_BEFORE_TEST: >-
python -m pip install "ViennaLS>=5.8.2" ||
python -m pip install "git+https://github.com/ViennaTools/ViennaLS.git@v5.8.2#egg=ViennaLS"
python -m pip install "ViennaLS>=5.8.3" ||
python -m pip install "git+https://github.com/ViennaTools/ViennaLS.git@v5.8.3#egg=ViennaLS"
CIBW_TEST_COMMAND: >-
python -c "import viennaps;
print(viennaps.__file__);
Expand Down
55 changes: 2 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(
ViennaPS
LANGUAGES CXX C
VERSION 4.6.0)
VERSION 4.6.1)

# --------------------------------------------------------------------------------------------------------
# Include guards
Expand Down Expand Up @@ -175,65 +175,14 @@ if(VIENNAPS_BUILD_PYTHON)
set(CMAKE_SKIP_INSTALL_RULES TRUE)
endif()

# VTK 9.0.1's FindOpenSlide module is not idempotent: a second VTK package load
# tries to recreate OpenSlide::OpenSlide. Prefer this tiny config package while
# configuring ViennaLS so repeated OpenSlide discovery reuses the existing target.
set(_VIENNAPS_HAD_CMAKE_FIND_PACKAGE_PREFER_CONFIG FALSE)
if(DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
set(_VIENNAPS_HAD_CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
set(_VIENNAPS_PREVIOUS_CMAKE_FIND_PACKAGE_PREFER_CONFIG "${CMAKE_FIND_PACKAGE_PREFER_CONFIG}")
endif()

set(_VIENNAPS_HAD_OPENSLIDE_DIR FALSE)
if(DEFINED OpenSlide_DIR)
set(_VIENNAPS_HAD_OPENSLIDE_DIR TRUE)
set(_VIENNAPS_PREVIOUS_OPENSLIDE_DIR "${OpenSlide_DIR}")
endif()

if(TARGET OpenSlide::OpenSlide)
set(_VIENNAPS_OPENSLIDE_CONFIG_GUARD_DIR "${PROJECT_BINARY_DIR}/cmake/openslide-config-guard")
file(MAKE_DIRECTORY "${_VIENNAPS_OPENSLIDE_CONFIG_GUARD_DIR}")
file(
WRITE "${_VIENNAPS_OPENSLIDE_CONFIG_GUARD_DIR}/OpenSlideConfig.cmake"
"if(TARGET OpenSlide::OpenSlide)\n set(OpenSlide_FOUND TRUE)\n return()\nendif()\nset(OpenSlide_FOUND FALSE)\n"
)
set(OpenSlide_DIR "${_VIENNAPS_OPENSLIDE_CONFIG_GUARD_DIR}")
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
endif()

# VTK was bundled via CPM add_subdirectory (Linux Python path): VTK::CommonCore exists
# but VTK_FOUND is unset. Suppress find_package(VTK) inside ViennaLS so it falls to
# its CPM path, CPM sees VTK already downloaded (VTK_ADDED=FALSE), skips add_subdirectory,
# and the existing targets are reused — no system-VTK conflict.
if(TARGET VTK::CommonCore AND NOT VTK_FOUND)
set(CMAKE_DISABLE_FIND_PACKAGE_VTK TRUE)
endif()

CPMAddPackage(
NAME ViennaLS
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaLS"
GIT_TAG v5.8.2
GIT_TAG v5.8.3
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}
OPTIONS "VIENNALS_PRECOMPILE_HEADERS ${VIENNAPS_PRECOMPILE_HEADERS}"
"VIENNALS_VTK_RENDERING ${VIENNAPS_VTK_RENDERING}" "VIENNALS_USE_GPU ${VIENNAPS_USE_GPU}")

unset(CMAKE_DISABLE_FIND_PACKAGE_VTK)
if(_VIENNAPS_HAD_CMAKE_FIND_PACKAGE_PREFER_CONFIG)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG "${_VIENNAPS_PREVIOUS_CMAKE_FIND_PACKAGE_PREFER_CONFIG}")
else()
unset(CMAKE_FIND_PACKAGE_PREFER_CONFIG)
endif()
if(_VIENNAPS_HAD_OPENSLIDE_DIR)
set(OpenSlide_DIR "${_VIENNAPS_PREVIOUS_OPENSLIDE_DIR}")
else()
unset(OpenSlide_DIR)
endif()
unset(_VIENNAPS_HAD_CMAKE_FIND_PACKAGE_PREFER_CONFIG)
unset(_VIENNAPS_PREVIOUS_CMAKE_FIND_PACKAGE_PREFER_CONFIG)
unset(_VIENNAPS_HAD_OPENSLIDE_DIR)
unset(_VIENNAPS_PREVIOUS_OPENSLIDE_DIR)
unset(_VIENNAPS_OPENSLIDE_CONFIG_GUARD_DIR)

if(_VIENNAPS_HAD_CMAKE_SKIP_INSTALL_RULES)
set(CMAKE_SKIP_INSTALL_RULES "${_VIENNAPS_PREVIOUS_CMAKE_SKIP_INSTALL_RULES}")
else()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consum

* Installation with CPM
```cmake
CPMAddPackage("gh:viennatools/viennaps@4.6.0")
CPMAddPackage("gh:viennatools/viennaps@4.6.1")
```

* With a local installation
Expand Down
Loading
Loading