Skip to content

Commit

Permalink
add manifest for CZIcmd and add Windows-ARM64-build (#116)
Browse files Browse the repository at this point in the history
* enable support for long paths (in CZIcmd)
* add Windows-ARM64 build
  • Loading branch information
ptahmose authored Sep 23, 2024
1 parent 4df6b90 commit 6b0fbc9
Show file tree
Hide file tree
Showing 11 changed files with 182 additions and 15 deletions.
70 changes: 58 additions & 12 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
vcpkg install azure-storage-blobs-cpp:x64-windows-static
vcpkg install azure-identity-cpp:x64-windows-static
vcpkg install rapidjson 'curl[ssl]' --triplet x64-windows-static
# for the ARM64 cross-compilation build, we also need to install the ARM64 versions of the dependencies
vcpkg install azure-storage-blobs-cpp:arm64-windows-static
vcpkg install azure-identity-cpp:arm64-windows-static
vcpkg install rapidjson 'curl[ssl]' --triplet arm64-windows-static
- name: Install dependencies (Linux)
if: ${{ (matrix.OS == 'ubuntu-latest') }}
Expand All @@ -52,25 +56,47 @@ jobs:
run: |
npm install --location=global azurite
- name: Configure CMake (Windows)
- name: Configure CMake (Windows x64)
if: ${{ (matrix.OS == 'windows-latest') }}
shell: bash
shell: pwsh
run: |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
# Note that we need to point CMake to the vcpkg-toolchain-file
cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{matrix.build}} -DLIBCZI_BUILD_CZICMD=ON -DLIBCZI_BUILD_CURL_BASED_STREAM=ON -DLIBCZI_BUILD_AZURESDK_BASED_STREAM=ON -DLIBCZI_BUILD_PREFER_EXTERNALPACKAGE_LIBCURL=ON -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static
# Note that we need to point CMake to the vcpkg-toolchain-file, and also specify the target triplet, c.f. https://learn.microsoft.com/en-us/vcpkg/concepts/triplets
# since we aim for a static build.
cmake -B "${{github.workspace}}/build" -A x64 -DCMAKE_BUILD_TYPE=${{matrix.build}} -DLIBCZI_BUILD_CZICMD=ON -DLIBCZI_BUILD_CURL_BASED_STREAM=ON -DLIBCZI_BUILD_AZURESDK_BASED_STREAM=ON -DLIBCZI_BUILD_PREFER_EXTERNALPACKAGE_LIBCURL=ON -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static
- name: Configure CMake (Windows ARM64)
if: ${{ (matrix.OS == 'windows-latest') }}
shell: pwsh
run: |
# Configure for a cross-compilation to ARM64.
# Note that since we are doing a cross compilation, we cannot execute code in order to determine platform
# characteristics like endianess and whether unaligned access is allowed. Therefore, we need to set the following
# variables manually: CRASH_ON_UNALIGNED_ACCESS=OFF and IS_BIG_ENDIAN=FALSE.
cmake -B "${{github.workspace}}/arm64build" -A ARM64 -DCMAKE_BUILD_TYPE=${{matrix.build}} -DLIBCZI_BUILD_CZICMD=ON -DLIBCZI_BUILD_CURL_BASED_STREAM=ON -DLIBCZI_BUILD_AZURESDK_BASED_STREAM=ON -DLIBCZI_BUILD_PREFER_EXTERNALPACKAGE_LIBCURL=ON -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=arm64-windows-static -DCRASH_ON_UNALIGNED_ACCESS=OFF -DIS_BIG_ENDIAN=FALSE
- name: Configure CMake (Linux)
if: ${{ (matrix.OS == 'ubuntu-latest') }}
shell: bash
run: |
cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{matrix.build}} -DLIBCZI_BUILD_CZICMD=ON -DLIBCZI_BUILD_CURL_BASED_STREAM=ON -DLIBCZI_BUILD_PREFER_EXTERNALPACKAGE_LIBCURL=OFF -DLIBCZI_BUILD_AZURESDK_BASED_STREAM=ON -DCMAKE_TOOLCHAIN_FILE="${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
- name: Build
# Build your program with the given configuration
- name: Build (Linux)
if: ${{ (matrix.OS == 'ubuntu-latest') }}
shell: bash
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build}} -j

- name: Build (Windows x64)
if: ${{ (matrix.OS == 'windows-latest') }}
shell: pwsh
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build}} -j

- name: Build (Windows ARM64)
if: ${{ (matrix.OS == 'windows-latest') }}
shell: pwsh
run: cmake --build ${{github.workspace}}/arm64build --config ${{matrix.build}} -j

- name: Test
shell: bash
working-directory: ${{github.workspace}}/build
Expand All @@ -91,8 +117,8 @@ jobs:
cd azurite
# now use the CZIcmd executable to create a test CZI file
"$czicmd" --command CreateCZI --createbounds "C0:2T0:2" --generatorpixeltype Gray8 --compressionopts "zstd1:ExplicitLevel=2;PreProcess=HiLoByteUnpack" --createsubblocksize "1024x1024" -o test --bitmapgenerator default
# start Azurite in the background
azurite --inMemoryPersistence --silent &
# start Azurite in the background (we start only the blob-service, as we only need this for the tests)
azurite-blob --inMemoryPersistence --silent &
# create a blob container "testcontainer"
az storage container create --name testcontainer --connection-string "$AZURE_BLOB_STORE_CONNECTION_STRING"
# upload the test CZI file to the container
Expand All @@ -107,9 +133,9 @@ jobs:
ctest --debug -C ${{matrix.build}}
# note that we leave the Azurite process running, as we want to use it with the code-coverage step as well
- name: Upload CZICmd as artifact (Windows)
- name: Prepare CZICmd as artifact (Windows x64)
working-directory: ${{github.workspace}}/build
if: ${{ (matrix.OS == 'windows-latest') && ( matrix.build == 'Release') }}
if: ${{ (matrix.OS == 'windows-latest') && (matrix.build == 'Release') }}
shell: bash
run: |
mkdir release
Expand All @@ -121,7 +147,7 @@ jobs:
- name: Upload CZICmd as artifact (Linux)
working-directory: ${{github.workspace}}/build
if: ${{ (matrix.OS == 'ubuntu-latest') && ( matrix.build == 'Release') }}
if: ${{ (matrix.OS == 'ubuntu-latest') && (matrix.build == 'Release') }}
shell: bash
run: |
mkdir release
Expand All @@ -138,6 +164,25 @@ jobs:
path: ${{ env.artifactPath }}/
name: ${{ env.artifactName }}

- name: Prepare CZICmd as artifact (Windows ARM64)
working-directory: ${{github.workspace}}/arm64build
if: ${{ (matrix.OS == 'windows-latest') && (matrix.build == 'Release') }}
shell: bash
run: |
mkdir release
name="CZICmd-windows-arm64-$(git describe --always)"
mkdir "release/${name}"
cp Src/CZICmd/Release/CZIcmd.exe "release/${name}/"
echo "artifactName=${name}" >> "$GITHUB_ENV"
echo "artifactPath=${{github.workspace}}/arm64build/release/${name}" >> "$GITHUB_ENV"
- name: Upload artifacts (Windows ARM64)
if: ${{ (matrix.OS == 'windows-latest') && (matrix.build == 'Release') }}
uses: actions/upload-artifact@v4
with:
path: ${{ env.artifactPath }}/
name: ${{ env.artifactName }}

# Coverage collection based on https://about.codecov.io/blog/how-to-set-up-codecov-with-c-plus-plus-and-github-actions/
- name: Prepare Coverage
if: ${{ (matrix.OS == 'windows-latest') && (matrix.build == 'Debug') }}
Expand All @@ -153,7 +198,8 @@ jobs:

- name: Upload Coverage
uses: codecov/codecov-action@v4
if: ${{ (matrix.OS == 'windows-latest') && (matrix.build == 'Debug') }}
# Note: we want to upload coverage only for the upstream-repository, not for forks
if: ${{ (github.repository == 'ZEISS/libczi') && (matrix.OS == 'windows-latest') && (matrix.build == 'Debug') }}
with:
files: ./coverage.xml
fail_ci_if_error: true
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW) # enable new "MSVC runtime library selection" (https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)

project(libCZI
VERSION 0.62.2
VERSION 0.62.3
HOMEPAGE_URL "https://github.com/ZEISS/libczi"
DESCRIPTION "libCZI is an Open Source Cross-Platform C++ library to read and write CZI")

Expand Down
15 changes: 14 additions & 1 deletion Src/CZICmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ set (CZICMDSRCFILES
executePlaneScan.h
executePlaneScan.cpp
executeBase.h
executeBase.cpp)
executeBase.cpp
CZIcmd.manifest # the manifest is needed to allow long paths on windows, see https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd
# CMake will merge the manifest with a linker generated one (and ignore it on non-Windows platforms)
CZIcmd.rc # the rc file (containing version information, only relevant for Windows)
)

add_executable(CZIcmd ${CZICMDSRCFILES})

Expand Down Expand Up @@ -151,6 +155,15 @@ configure_file (
"${CMAKE_CURRENT_BINARY_DIR}/CZIcmd_Config.h"
)

set(czicmd_PROJECT_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION}) # the string given for the project description in the main CMakeLists.txt
set(czicmd_VERSION_MAJOR ${libCZI_VERSION_MAJOR})
set(czicmd_VERSION_MINOR ${libCZI_VERSION_MINOR})
set(czicmd_VERSION_PATCH ${libCZI_VERSION_PATCH})
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/resource_data.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/resource_data.h"
)


# checking platform -> https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/Checking-Platform
# -> https://stackoverflow.com/questions/9160335/os-specific-instructions-in-cmake-how-to
Expand Down
Binary file added Src/CZICmd/CZIcmd.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions Src/CZICmd/CZIcmd.ico.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// SPDX-FileCopyrightText: 2024 Carl Zeiss Microscopy GmbH
//
// SPDX-License-Identifier: LGPL-3.0-or-later
10 changes: 10 additions & 0 deletions Src/CZICmd/CZIcmd.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- enable support for long paths -->
<assemblyIdentity version="1.0.0.0" name="CZIcmd"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>
3 changes: 3 additions & 0 deletions Src/CZICmd/CZIcmd.manifest.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// SPDX-FileCopyrightText: 2024 Carl Zeiss Microscopy GmbH
//
// SPDX-License-Identifier: LGPL-3.0-or-later
73 changes: 73 additions & 0 deletions Src/CZICmd/CZIcmd.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// SPDX-FileCopyrightText: 2024 Carl Zeiss Microscopy GmbH
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#include <resource_data.h>

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION RC_FILEVERSION_1ST_NUMBER, RC_FILEVERSION_2ND_NUMBER, RC_FILEVERSION_3RD_NUMBER, RC_FILEVERSION_4TH_NUMBER
PRODUCTVERSION RC_PRODUCTVERSION_1ST_NUMBER, RC_PRODUCTVERSION_2ND_NUMBER, RC_PRODUCTVERSION_3RD_NUMBER, RC_PRODUCTVERSION_4TH_NUMBER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "0c0004b0"
BEGIN
VALUE "CompanyName", "Carl Zeiss Microscopy GmbH"
VALUE "FileDescription", RC_FILEDESCRIPTION_STR
VALUE "FileVersion", RC_FILEVERSION_STRING
VALUE "InternalName", "CZIcmd.exe"
VALUE "LegalCopyright", "Copyright (C) 2024"
VALUE "OriginalFilename", "CZIcmd.exe"
VALUE "ProductName", "CZIcmd - test and demo application for libCZI"
VALUE "ProductVersion", RC_PRODUCTVERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0xc00, 1200
END
END


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APPLICATION_ICON ICON "CZIcmd.ico"

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
2 changes: 1 addition & 1 deletion Src/CZICmd/CZIcmd_Config.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2017-2022 Carl Zeiss Microscopy GmbH
// SPDX-FileCopyrightText: 2017-2024 Carl Zeiss Microscopy GmbH
//
// SPDX-License-Identifier: LGPL-3.0-or-later

Expand Down
18 changes: 18 additions & 0 deletions Src/CZICmd/resource_data.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: 2024 Carl Zeiss Microscopy GmbH
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#define RC_FILEVERSION_1ST_NUMBER @czicmd_VERSION_MAJOR@
#define RC_FILEVERSION_2ND_NUMBER @czicmd_VERSION_MINOR@
#define RC_FILEVERSION_3RD_NUMBER @czicmd_VERSION_PATCH@
#define RC_FILEVERSION_4TH_NUMBER 0

#define RC_PRODUCTVERSION_1ST_NUMBER @czicmd_VERSION_MAJOR@
#define RC_PRODUCTVERSION_2ND_NUMBER @czicmd_VERSION_MINOR@
#define RC_PRODUCTVERSION_3RD_NUMBER @czicmd_VERSION_PATCH@
#define RC_PRODUCTVERSION_4TH_NUMBER 0

#define RC_FILEVERSION_STRING "@czicmd_VERSION_MAJOR@.@czicmd_VERSION_MINOR@.@[email protected]"
#define RC_PRODUCTVERSION_STRING "@czicmd_VERSION_MAJOR@.@czicmd_VERSION_MINOR@.@[email protected]"

#define RC_FILEDESCRIPTION_STR "@czicmd_PROJECT_DESCRIPTION@"
1 change: 1 addition & 0 deletions Src/libCZI/Doc/version-history.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ version history {#version_history}
0.62.0 | [112](https://github.com/ZEISS/libczi/pull/112) | add Azure-SDK based reader for reading from Azure Blob Storage, raise requirement to C++14 for building libCZI (previously C++11 was sufficient) because Azure-SDK requires C++14
0.62.1 | [114](https://github.com/ZEISS/libczi/pull/114) | improve build system fixing issues with msys2 and mingw-w64, cosmetic changes
0.62.2 | [115](https://github.com/ZEISS/libczi/pull/115) | enabling building with clang on windows
0.62.3 | [116](https://github.com/ZEISS/libczi/pull/116) | enable long paths on Windows for CZIcmd, add Windows-ARM64 build

0 comments on commit 6b0fbc9

Please sign in to comment.