diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 386c8c16..4ee2838d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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') }} @@ -52,14 +56,25 @@ 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') }} @@ -67,10 +82,21 @@ jobs: 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 @@ -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 @@ -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 @@ -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 @@ -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') }} @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a505067..9ed88a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/Src/CZICmd/CMakeLists.txt b/Src/CZICmd/CMakeLists.txt index 5d0057a1..f8f8ce37 100644 --- a/Src/CZICmd/CMakeLists.txt +++ b/Src/CZICmd/CMakeLists.txt @@ -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}) @@ -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 diff --git a/Src/CZICmd/CZIcmd.ico b/Src/CZICmd/CZIcmd.ico new file mode 100644 index 00000000..8490fa31 Binary files /dev/null and b/Src/CZICmd/CZIcmd.ico differ diff --git a/Src/CZICmd/CZIcmd.ico.license b/Src/CZICmd/CZIcmd.ico.license new file mode 100644 index 00000000..039a59a0 --- /dev/null +++ b/Src/CZICmd/CZIcmd.ico.license @@ -0,0 +1,3 @@ +// SPDX-FileCopyrightText: 2024 Carl Zeiss Microscopy GmbH +// +// SPDX-License-Identifier: LGPL-3.0-or-later \ No newline at end of file diff --git a/Src/CZICmd/CZIcmd.manifest b/Src/CZICmd/CZIcmd.manifest new file mode 100644 index 00000000..1579142f --- /dev/null +++ b/Src/CZICmd/CZIcmd.manifest @@ -0,0 +1,10 @@ + + + + + + + true + + + \ No newline at end of file diff --git a/Src/CZICmd/CZIcmd.manifest.license b/Src/CZICmd/CZIcmd.manifest.license new file mode 100644 index 00000000..039a59a0 --- /dev/null +++ b/Src/CZICmd/CZIcmd.manifest.license @@ -0,0 +1,3 @@ +// SPDX-FileCopyrightText: 2024 Carl Zeiss Microscopy GmbH +// +// SPDX-License-Identifier: LGPL-3.0-or-later \ No newline at end of file diff --git a/Src/CZICmd/CZIcmd.rc b/Src/CZICmd/CZIcmd.rc new file mode 100644 index 00000000..fc16b5c7 --- /dev/null +++ b/Src/CZICmd/CZIcmd.rc @@ -0,0 +1,73 @@ +// SPDX-FileCopyrightText: 2024 Carl Zeiss Microscopy GmbH +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#include + +#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 +///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/Src/CZICmd/CZIcmd_Config.h.in b/Src/CZICmd/CZIcmd_Config.h.in index cf0145cc..80fc6cfd 100644 --- a/Src/CZICmd/CZIcmd_Config.h.in +++ b/Src/CZICmd/CZIcmd_Config.h.in @@ -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 diff --git a/Src/CZICmd/resource_data.h.in b/Src/CZICmd/resource_data.h.in new file mode 100644 index 00000000..4e0f0f16 --- /dev/null +++ b/Src/CZICmd/resource_data.h.in @@ -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@.@czicmd_VERSION_PATCH@.0" +#define RC_PRODUCTVERSION_STRING "@czicmd_VERSION_MAJOR@.@czicmd_VERSION_MINOR@.@czicmd_VERSION_PATCH@.0" + +#define RC_FILEDESCRIPTION_STR "@czicmd_PROJECT_DESCRIPTION@" \ No newline at end of file diff --git a/Src/libCZI/Doc/version-history.markdown b/Src/libCZI/Doc/version-history.markdown index 87a4bcc4..8dccdb00 100644 --- a/Src/libCZI/Doc/version-history.markdown +++ b/Src/libCZI/Doc/version-history.markdown @@ -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 \ No newline at end of file