Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
dc8352c
use vcpkg w/ auto-bootstrap
DaveyJonesBitPail Aug 6, 2025
4d2656a
use pugixml header only and don't get xerces-c via vcpkg by default
DaveyJonesBitPail Aug 6, 2025
f404722
bump version
DaveyJonesBitPail Aug 6, 2025
3f61f1c
conditionally use static msvc
DaveyJonesBitPail Aug 6, 2025
f284769
consume xerces-c via vcpkg when bootstrapped
DaveyJonesBitPail Aug 6, 2025
cad2fb7
remove unecessary pugiconfig
DaveyJonesBitPail Aug 6, 2025
bc3f72f
remove explicit vcpkg installs
DaveyJonesBitPail Aug 6, 2025
59cf2ed
add vcpkg.json to dep5
DaveyJonesBitPail Aug 6, 2025
05345f0
get vcpkg at appropriate baseline commit
DaveyJonesBitPail Aug 6, 2025
186514e
add missing parentheses
DaveyJonesBitPail Aug 6, 2025
f1211a3
add update vcpkg install step
DaveyJonesBitPail Aug 6, 2025
6e842b8
try to fix linespacing
DaveyJonesBitPail Aug 6, 2025
bad674e
stop trying to be clever and do a normal fetch...
DaveyJonesBitPail Aug 6, 2025
e0b471a
bump checkout action
DaveyJonesBitPail Aug 6, 2025
c5e92e9
try being clever again and overriding vcpkg_dir
DaveyJonesBitPail Aug 6, 2025
75ec244
Add SPDX header
DaveyJonesBitPail Aug 6, 2025
22df7fd
fix indent....
DaveyJonesBitPail Aug 6, 2025
02af2a4
handle if runner doesn't define vcpkgroot
DaveyJonesBitPail Aug 6, 2025
ee61aec
Let's try jq instead of grep and pray
DaveyJonesBitPail Aug 6, 2025
406ac77
make linux build also use vcpkg
DaveyJonesBitPail Aug 6, 2025
abd8b7d
properly capitalize libczi.... 🤦
DaveyJonesBitPail Aug 6, 2025
c1916d2
properly capitalize part 2
DaveyJonesBitPail Aug 6, 2025
767110f
bump version in tests
DaveyJonesBitPail Aug 6, 2025
601cfb8
try to make megalinter happy
DaveyJonesBitPail Aug 6, 2025
eb48638
bump version in test json files
DaveyJonesBitPail Aug 6, 2025
ab58e8c
generate appropriate inc_libCZI
DaveyJonesBitPail Aug 6, 2025
5de3d42
guard comp defs behind bootstrap flag
DaveyJonesBitPail Aug 6, 2025
f905bdb
use czicheck specific var
DaveyJonesBitPail Aug 6, 2025
8d11da5
update the var in the in file too.... 🤦
DaveyJonesBitPail Aug 6, 2025
2b64dc7
unpin libczi version
DaveyJonesBitPail Aug 6, 2025
d254688
Revert "unpin libczi version"
DaveyJonesBitPail Aug 6, 2025
9540a55
address pr comments
DaveyJonesBitPail Sep 24, 2025
8dad9a8
bump version
DaveyJonesBitPail Sep 24, 2025
8d0e4a5
blindly update version in tests
DaveyJonesBitPail Sep 24, 2025
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
59 changes: 47 additions & 12 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,55 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install dependencies (Windows)
if: ${{ (matrix.os == 'windows-latest') }}
# on Windows, we rely on vcpkg to pull in dependencies
shell: bash
run: |
vcpkg install xerces-c --triplet x64-windows-static
- name: Cache vcpkg and packages
uses: actions/cache@v4
with:
path: |
external/vcpkg
build/vcpkg_installed
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}

- name: Install dependencies (Linux)
if: ${{ (matrix.os == 'ubuntu-latest') }}
# on Linux, we use apt to get our dependencies
- name: Prep existing vcpkg installation
shell: bash
run: |
sudo apt-get install libxerces-c-dev -y
set -euo pipefail
BASELINE=$(jq -r '.["builtin-baseline"]' vcpkg.json)
echo "Detected vcpkg baseline: $BASELINE"

if [ -d "$GITHUB_WORKSPACE/external/vcpkg/.git" ]; then
echo "Using cached vcpkg at external/vcpkg"
VCPKG_DIR="$GITHUB_WORKSPACE/external/vcpkg"
elif [ -n "${VCPKG_ROOT:-}" ] && [ -d "$VCPKG_ROOT/.git" ]; then
echo "Using preinstalled vcpkg at $VCPKG_ROOT"
VCPKG_DIR="$VCPKG_ROOT"
else
echo "Performing minimal vcpkg clone..."
git clone --filter=blob:none --no-checkout https://github.com/microsoft/vcpkg.git external/vcpkg
VCPKG_DIR="$GITHUB_WORKSPACE/external/vcpkg"
fi

cd "$VCPKG_DIR"

if ! git cat-file -e "${BASELINE}^{commit}" 2>/dev/null; then
echo "Fetching baseline commit $BASELINE..."
git fetch origin "$BASELINE" --depth=1 || git fetch --unshallow
fi

git checkout "$BASELINE"

if [ ! -f ./vcpkg ] && [ ! -f ./vcpkg.exe ]; then
if [[ "$RUNNER_OS" == "Windows" ]]; then
./bootstrap-vcpkg.bat
else
./bootstrap-vcpkg.sh
fi
fi

echo "vcpkg is now at commit: $(git rev-parse HEAD)"
echo "VCPKG_DIR=$VCPKG_DIR" >> "$GITHUB_ENV"


- name: Configure CMake (Windows)
if: ${{ (matrix.os == 'windows-latest') }}
Expand All @@ -49,7 +83,7 @@ jobs:
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
# on Windows, we need to point CMake to the vcpkg-toolchain-file
cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{matrix.build}} \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_TARGET_TRIPLET=x64-windows-static \
-DCZICHECK_BUILD_TESTS=ON

Expand All @@ -58,6 +92,7 @@ jobs:
shell: bash
run: |
cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{matrix.build}} \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake" \
-DCZICHECK_BUILD_TESTS=ON

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Upstream-Name: CZICheck
Upstream-Contact: Carl Zeiss Microscopy GmbH <github.microscopy@zeiss.com>
Source: https://github.com/ZEISS/czicheck

Files: .github/* .gitignore README.md LICENSE CODE_OF_CONDUCT.md CONTRIBUTING.md README.md SECURITY.md cla_corporate.txt cla_individual.txt THIRD_PARTY_LICENSES.txt
Files: .github/* .gitignore README.md LICENSE CODE_OF_CONDUCT.md CONTRIBUTING.md README.md SECURITY.md cla_corporate.txt cla_individual.txt THIRD_PARTY_LICENSES.txt vcpkg.json
Copyright: 2023 Carl Zeiss Microscopy GmbH
License: MIT

Expand Down
28 changes: 22 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,44 @@

cmake_minimum_required(VERSION 3.15)

option(CZICHECK_ENABLE_VCPKG_BOOTSTRAP
"Automatically fetch and bootstrap vcpkg if no toolchain is defined" ON)

# Include the bootstrap script if the option is enabled
if(CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
include(modules/bootstrapVcpkg.cmake)
endif()

project(CZICheck
VERSION 0.6.3
VERSION 0.6.5
HOMEPAGE_URL "https://github.com/ZEISS/czicheck"
DESCRIPTION "CZICheck is a validator for CZI-documents")



if(WIN32)
# use "static C-runtime" -> https://stackoverflow.com/questions/14172856/compile-with-mt-instead-of-md-using-cmake
# Note: this requires CMAKE version 3.15+
cmake_policy(SET CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if(NOT CZICHECK_ENABLE_VCPKG_BOOTSTRAP OR VCPKG_TARGET_TRIPLET MATCHES "-static$")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

endif(WIN32)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules" ${CMAKE_MODULE_PATH})

include("${CMAKE_SOURCE_DIR}/modules/libCZI.cmake")
include("${CMAKE_SOURCE_DIR}/modules/rapidJSON.cmake")
if(NOT CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
include("${CMAKE_SOURCE_DIR}/modules/libCZI.cmake")
include("${CMAKE_SOURCE_DIR}/modules/rapidJSON.cmake")
FetchContent_GetProperties(libCZI)
set(LIBCZI_INCLUDE_DIR "${libczi_SOURCE_DIR}/Src/libCZI")
endif()

include("${CMAKE_SOURCE_DIR}/modules/pugiXML.cmake")
FetchContent_GetProperties(libCZI)
set(LIBCZI_INCLUDE_DIR "${libczi_SOURCE_DIR}/Src/libCZI")

# This option enables/disables the tests for the CZICheck-application. If enabled, the test
# runs with a ctest run (and test-data is being downloaded)
Expand Down
96 changes: 66 additions & 30 deletions CZICheck/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ function(embed_resource resource_file_name source_file_name variable_name)
file(WRITE "${source_file_name}" "${source}")
endfunction()

find_package(XercesC QUIET)
if(CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
find_package(XercesC CONFIG REQUIRED)
else()
find_package(XercesC QUIET)
endif()

if (XercesC_FOUND)
set(CZICheck_XercesCAvailable 1)
message("XercesC library available -> version: ${XercesC_VERSION}")
Expand All @@ -38,6 +43,9 @@ FetchContent_Declare(

FetchContent_MakeAvailable(cli11)

if(CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
find_package(libCZI CONFIG REQUIRED)
endif()

set(CZICHECKSRCFILES
"checkers/checkerbase.h"
Expand Down Expand Up @@ -72,53 +80,81 @@ set(CZICHECKSRCFILES
"checkers/checkerSubBlkBitmapValid.cpp"
"checkers/checkerTopographyApplianceValidation.h"
"checkers/checkerTopographyApplianceValidation.cpp"
checkerfactory.cpp
checkerfactory.h
checks.h
checks.cpp
CMakeLists.txt
cmdlineoptions.cpp
cmdlineoptions.h
consoleio.cpp
consoleio.h
CZICheck.cpp
IChecker.h
IResultGatherer.h
inc_libCZI.h
resultgatherer.cpp
resultgatherer.h
resultgathererjson.h
resultgathererjson.cpp
resultgathererxml.h
resultgathererxml.cpp
resultgathererfactory.h
resultgathererfactory.cpp
runchecks.cpp
runchecks.h
utils.h
utils.cpp
"checkerfactory.cpp"
"checkerfactory.h"
"checks.h"
"checks.cpp"
"CMakeLists.txt"
"cmdlineoptions.cpp"
"cmdlineoptions.h"
"consoleio.cpp"
"consoleio.h"
"CZICheck.cpp"
"IChecker.h"
"IResultGatherer.h"
"resultgatherer.cpp"
"resultgatherer.h"
"resultgathererjson.h"
"resultgathererjson.cpp"
"resultgathererxml.h"
"resultgathererxml.cpp"
"resultgathererfactory.h"
"resultgathererfactory.cpp"
"runchecks.cpp"
"runchecks.h"
"utils.h"
"utils.cpp"
"inc_libCZI.h"
)

add_executable(CZICheck ${CZICHECKSRCFILES} )

set_target_properties(CZICheck PROPERTIES CXX_STANDARD 17)
target_compile_definitions(CZICheck PRIVATE _LIBCZISTATICLIB)

target_link_libraries(CZICheck PRIVATE libCZIStatic CLI11::CLI11 pugixml)
target_link_libraries(CZICheck PRIVATE CLI11::CLI11)

target_include_directories(CZICheck PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

if(CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
if(TARGET libczi::libCZI)
add_library(libczi::libCZI_selected ALIAS libczi::libCZI)
elseif(TARGET libczi::libCZIStatic)
add_library(libczi::libCZI_selected ALIAS libczi::libCZIStatic)
else()
message(FATAL_ERROR "No suitable libCZI target found (neither shared nor static).")
endif()
target_link_libraries(CZICheck PRIVATE libczi::libCZI_selected)
else()
target_link_libraries(CZICheck PRIVATE libCZIStatic)
endif()
if(CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
get_target_property(_libczi_includes libczi::libCZI_selected INTERFACE_INCLUDE_DIRECTORIES)
set(_libczi_include_with_subdir "${_libczi_includes}/libCZI")
target_include_directories(CZICheck PRIVATE ${_libczi_include_with_subdir})
else()
target_include_directories(CZICheck PRIVATE ${LIBCZI_INCLUDE_DIR})
endif()
target_link_libraries(CZICheck PRIVATE pugixml)

target_include_directories(CZICheck
PRIVATE ${LIBCZI_INCLUDE_DIR}
PRIVATE ${RAPIDJSON_INCLUDE_DIRS})

if (XercesC_FOUND)
if(CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
target_link_libraries(CZICheck PRIVATE XercesC::XercesC)
else()
target_link_libraries(CZICheck PRIVATE ${XercesC_LIBRARY})
endif()
endif()
target_include_directories(CZICheck PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if (XercesC_FOUND)
if (XercesC_FOUND AND NOT CZICHECK_ENABLE_VCPKG_BOOTSTRAP)
target_include_directories(CZICheck PRIVATE ${XercesC_INCLUDE_DIR})
endif()

IF(UNIX)
# seems to be problem with glibc I'd reckon -> https://stackoverflow.com/questions/51584960/stdcall-once-throws-stdsystem-error-unknown-error-1
target_link_libraries(CZICheck PUBLIC pthread)
target_link_libraries(CZICheck PUBLIC pthread)
ENDIF(UNIX)

IF(WIN32)
Expand Down
2 changes: 1 addition & 1 deletion CZICheck/checkers/checkerbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "../inc_libCZI.h"
#include <inc_libCZI.h>
#include "../checkerfactory.h"
#include <memory>
#include <utility>
Expand Down
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/differentpixeltypeinchannel.txt.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@
],
"output_version": {
"command": "CZICheck",
"version": "0.6.3"
"version": "0.6.4"
}
}
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/differentpixeltypeinchannel.txt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@
<AggregatedResult>WARN</AggregatedResult>
<OutputVersion>
<Command>CZICheck</Command>
<Version>0.6.3</Version>
<Version>0.6.4</Version>
</OutputVersion>
</TestResults>
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/duplicate_coordinates.txt.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@
],
"output_version": {
"command": "CZICheck",
"version": "0.6.3"
"version": "0.6.4"
}
}
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/duplicate_coordinates.txt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@
<AggregatedResult>FAIL</AggregatedResult>
<OutputVersion>
<Command>CZICheck</Command>
<Version>0.6.3</Version>
<Version>0.6.4</Version>
</OutputVersion>
</TestResults>
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/edf-missing-texture.txt.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@
],
"output_version": {
"command": "CZICheck",
"version": "0.6.3"
"version": "0.6.4"
}
}
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/edf-missing-texture.txt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
<AggregatedResult>FAIL</AggregatedResult>
<OutputVersion>
<Command>CZICheck</Command>
<Version>0.6.3</Version>
<Version>0.6.4</Version>
</OutputVersion>
</TestResults>
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@
],
"output_version": {
"command": "CZICheck",
"version": "0.6.3"
"version": "0.6.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@
<AggregatedResult>FAIL</AggregatedResult>
<OutputVersion>
<Command>CZICheck</Command>
<Version>0.6.3</Version>
<Version>0.6.4</Version>
</OutputVersion>
</TestResults>
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/edf-superfluous.txt.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@
],
"output_version": {
"command": "CZICheck",
"version": "0.6.3"
"version": "0.6.4"
}
}
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/edf-superfluous.txt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
<AggregatedResult>FAIL</AggregatedResult>
<OutputVersion>
<Command>CZICheck</Command>
<Version>0.6.3</Version>
<Version>0.6.4</Version>
</OutputVersion>
</TestResults>
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/inconsistent_coordinates.txt.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@
],
"output_version": {
"command": "CZICheck",
"version": "0.6.3"
"version": "0.6.4"
}
}
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/inconsistent_coordinates.txt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@
<AggregatedResult>FAIL</AggregatedResult>
<OutputVersion>
<Command>CZICheck</Command>
<Version>0.6.3</Version>
<Version>0.6.4</Version>
</OutputVersion>
</TestResults>
2 changes: 1 addition & 1 deletion Test/CZICheckSamples/invalid_componentbitcount.txt.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@
],
"output_version": {
"command": "CZICheck",
"version": "0.6.3"
"version": "0.6.4"
}
}
Loading
Loading