Conversation
There was a problem hiding this comment.
Pull Request Overview
Enable MinGW compatibility by normalizing Windows header casing and conditionally enabling Windowscodecs support when not cross-compiling.
- Switch all
#include <Windows.h>to lowercase<windows.h>for MinGW. - Introduce
LIBCZI_HAVE_WINCODECS_APIto guard Windowscodecs features and adjust CMake linking. - Exclude the JPEG-XR decoder (
CWicJpgxrDecoder) when Windowscodecs is disabled.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Src/libCZI/utilities.cpp | Lowercased <Windows.h> include. |
| Src/libCZI/libCZI_Site.cpp | Wrapped JPXR decoder case in #if LIBCZI_HAVE_WINCODECS_API. |
| Src/libCZI/decoder_wic.h | Added LIBCZI_HAVE_WINCODECS_API to include guard. |
| Src/libCZI/decoder_wic.cpp | Updated implementation guard to require new macro. |
| Src/libCZI/StreamsLib/windowsfileinputstream.h | Lowercased <Windows.h> include. |
| Src/libCZI/StreamImpl.h | Lowercased <Windows.h> include. |
| Src/libCZI/CMakeLists.txt | Split Windowscodecs linking under new config flag. |
| CMakeLists.txt | Bumped version to 0.66.1 and defined LIBCZI_HAVE_WINCODECS_API. |
| Src/JxrDecode/jxrlib/image/encode/strenc.c | Lowercased commented-out windows.h include. |
| Src/CZICmd/utils.cpp | Lowercased <Windows.h> include. |
| Src/CZICmd/CZIcmd.cpp | Lowercased <Windows.h> include. |
| Src/CZICmd/BitmapGenGdiplus.h | Lowercased <Windows.h> include. |
Comments suppressed due to low confidence (2)
CMakeLists.txt:89
- Please update the project documentation (e.g., README or docs) to describe the new
LIBCZI_HAVE_WINCODECS_APIoption and its effect on cross-compilation.
# Determine whether we are cross-compiling to Windows. When cross-compiling, there is insufficient support
Src/libCZI/libCZI_Site.cpp:62
- Add unit tests to cover both branches of
LIBCZI_HAVE_WINCODECS_API, ensuring the JPEG-XR decoder is correctly included or excluded.
#if LIBCZI_HAVE_WINCODECS_API
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #139 +/- ##
==========================================
+ Coverage 66.08% 67.35% +1.26%
==========================================
Files 88 87 -1
Lines 11265 11053 -212
==========================================
Hits 7445 7445
+ Misses 3820 3608 -212
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@Agapanthus |
|
@Agapanthus |
|
Thank you for your feedback and sorry for the delay. I've now updated the version history and sent you the CLA. |
|
Thanks for the CLA. Some initial thoughts on your PR:
It would be great to have this improved, or at least documented.
|
| #include <libCZI_Config.h> | ||
|
|
||
| #if LIBCZI_WINDOWSAPI_AVAILABLE | ||
| #if LIBCZI_WINDOWSAPI_AVAILABLE && LIBCZI_HAVE_WINCODECS_API |
There was a problem hiding this comment.
I don't see how this define would be propagated into the compilation. I'd don't see that the libCZI_Config.h.in mechanism is used - which would be the preferred way I guess. And I don't see it otherwise passed to the compiler (e.g. with target_compile_definitions).
Am I missing something here?
STOP - Read this First!
Reporting a security vulnerability?
Check out the project's security policy.
Fill out and Adjust this Template
Description
#include <Windows.h>to#include <windows.h>.Windowscodecsis limited when cross-compiling.LIBCZI_HAVE_WINCODECS_API, has been added to only enable this feature when compiling for Windows on Windows.libcziwill not link againstWindowscodecs, and theCWicJpgxrDecoderwill be excluded from compilation.Type of change
How Has This Been Tested?
libcziusing MSVC, GCC, and GCC-mingw.Checklist: