From 299661d51baaa154016c702def1afaf94cef3b4e Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Fri, 27 Mar 2026 15:13:08 +0100 Subject: [PATCH 1/3] test cygwin --- .github/workflows/build.yml | 77 +++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 842b3b20..c7fa3a59 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,14 +107,15 @@ jobs: - uses: actions/checkout@v6.0.2 - name: Install packages - run: sudo apt-get -y install build-essential cmake + run: sudo apt-get -y install build-essential cmake ninja-build - name: Configure run: | cmake -B build \ + -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DLCMS2_FAST_FLOAT=ON \ - -DLCMS2_THREADED=ON \ + -DLCMS2_WITH_FASTFLOAT=ON \ + -DLCMS2_WITH_THREADS=ON \ -DLCMS2_BUILD_TESTS=ON - name: Build @@ -134,9 +135,10 @@ jobs: - name: Configure run: | cmake -B build \ + -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DLCMS2_FAST_FLOAT=ON \ - -DLCMS2_THREADED=ON \ + -DLCMS2_WITH_FASTFLOAT=ON \ + -DLCMS2_WITH_THREADS=ON \ -DLCMS2_BUILD_TESTS=ON - name: Build @@ -164,8 +166,8 @@ jobs: - name: Configure run: | cmake -B build -A ${{ matrix.arch }} ` - -DLCMS2_FAST_FLOAT=ON ` - -DLCMS2_THREADED=ON ` + -DLCMS2_WITH_FASTFLOAT=ON ` + -DLCMS2_WITH_THREADS=ON ` -DLCMS2_BUILD_TESTS=ON - name: Build @@ -174,3 +176,64 @@ jobs: - name: Run tests run: ctest --test-dir build -C Release --output-on-failure + MSYS2-cmake: + strategy: + matrix: + sys: [ MINGW64, UCRT64 ] + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v6.0.2 + + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.sys }} + update: true + pacboy: cmake:p gcc:p ninja:p + + - name: Configure + run: | + cmake -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DLCMS2_WITH_FASTFLOAT=ON \ + -DLCMS2_WITH_THREADS=ON \ + -DLCMS2_BUILD_TESTS=ON + + - name: Build + run: cmake --build build --parallel + + - name: Run tests + run: ctest --test-dir build --output-on-failure + + Cygwin-cmake: + runs-on: windows-latest + env: + CHERE_INVOKING: "1" + defaults: + run: + shell: C:\cygwin64\bin\bash.exe --login -eo pipefail -o igncr '{0}' + steps: + - uses: actions/checkout@v6.0.2 + + - uses: cygwin/install-action@v4 + with: + packages: cmake ninja gcc-core gcc-g++ + + - name: Configure + run: | + cmake -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DLCMS2_WITH_FASTFLOAT=ON \ + -DLCMS2_WITH_THREADS=ON \ + -DLCMS2_BUILD_TESTS=ON + + - name: Build + run: cmake --build build --parallel + + - name: Run tests + run: ctest --test-dir build --output-on-failure + From 8e04a2d2fa0537b5494c1b022eea3453b7efdaf6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Mar 2026 14:33:28 +0000 Subject: [PATCH 2/3] Fix failing CI tests: Cygwin action name, macOS ARM64 SSE2, Win32 calling convention Agent-Logs-Url: https://github.com/mm2/Little-CMS/sessions/7fb1fcb8-2590-447b-8b27-0c00950e1c22 Co-authored-by: mm2 <199618+mm2@users.noreply.github.com> --- .github/workflows/build.yml | 3 ++- cmake/Lcms2Plugins.cmake | 3 +++ plugins/fast_float/src/fast_8_curves.c | 2 +- plugins/fast_float/src/fast_float_15bits.c | 2 +- plugins/fast_float/src/fast_float_cmyk.c | 2 +- plugins/fast_float/src/fast_float_internal.h | 7 ++++++- plugins/fast_float/src/fast_float_tethra.c | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7fa3a59..1852c8a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -218,8 +218,9 @@ jobs: steps: - uses: actions/checkout@v6.0.2 - - uses: cygwin/install-action@v4 + - uses: cygwin/cygwin-install-action@v6 with: + install-dir: 'C:\cygwin64' packages: cmake ninja gcc-core gcc-g++ - name: Configure diff --git a/cmake/Lcms2Plugins.cmake b/cmake/Lcms2Plugins.cmake index 93a8a8bd..b3054bc0 100644 --- a/cmake/Lcms2Plugins.cmake +++ b/cmake/Lcms2Plugins.cmake @@ -65,6 +65,9 @@ function(lcms2_add_plugins) "${PROJECT_SOURCE_DIR}/plugins/fast_float/include" "${PROJECT_SOURCE_DIR}/plugins/fast_float/src/../include" ) + if(LCMS2_DEFINE_CMS_DONT_USE_SSE2) + target_compile_definitions(lcms2_fast_float PRIVATE CMS_DONT_USE_SSE2=1) + endif() endif() if(LCMS2_WITH_THREADED_PLUGIN) diff --git a/plugins/fast_float/src/fast_8_curves.c b/plugins/fast_float/src/fast_8_curves.c index 145d95ca..b5e94ad1 100644 --- a/plugins/fast_float/src/fast_8_curves.c +++ b/plugins/fast_float/src/fast_8_curves.c @@ -408,7 +408,7 @@ cmsBool Optimize8ByJoiningCurves(_cmsTransform2Fn* TransformFn, *dwFlags |= cmsFLAGS_NOCACHE; *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; *UserData = Data; - *FreeUserData = _cmsFree; + *FreeUserData = _fast_float_free_user_data; // Maybe the curves are linear at the end if (nChans == 1) diff --git a/plugins/fast_float/src/fast_float_15bits.c b/plugins/fast_float/src/fast_float_15bits.c index f754277e..59c0a610 100644 --- a/plugins/fast_float/src/fast_float_15bits.c +++ b/plugins/fast_float/src/fast_float_15bits.c @@ -469,7 +469,7 @@ cmsUInt8Number* PackNBytesSwapDither(CMSREGISTER struct _cmstransform_struct* C // The factory for 15 bits. This function returns a pointer to specialized function // that would deal with the asked format. It return a pointer to NULL if the format // is not supported. This is the basis of formatter plug-in for 15 bit formats. -CMSCHECKPOINT cmsFormatter CMSEXPORT Formatter_15Bit_Factory(cmsUInt32Number Type, +CMSCHECKPOINT cmsFormatter Formatter_15Bit_Factory(cmsUInt32Number Type, cmsFormatterDirection Dir, cmsUInt32Number dwFlags) { diff --git a/plugins/fast_float/src/fast_float_cmyk.c b/plugins/fast_float/src/fast_float_cmyk.c index 125d4798..f6597017 100644 --- a/plugins/fast_float/src/fast_float_cmyk.c +++ b/plugins/fast_float/src/fast_float_cmyk.c @@ -380,7 +380,7 @@ cmsBool OptimizeCLUTCMYKTransform(_cmsTransform2Fn* TransformFn, *Lut = OptimizedLUT; *TransformFn = FloatCMYKCLUTEval; *UserData = pcmyk; - *FreeDataFn = _cmsFree; + *FreeDataFn = _fast_float_free_user_data; *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; return TRUE; diff --git a/plugins/fast_float/src/fast_float_internal.h b/plugins/fast_float/src/fast_float_internal.h index 01114a12..5e5311c4 100644 --- a/plugins/fast_float/src/fast_float_internal.h +++ b/plugins/fast_float/src/fast_float_internal.h @@ -175,7 +175,7 @@ CMSCHECKPOINT void CMSEXPORT _cmsComputeComponentIncrements(cmsUInt32Number Form cmsUInt32Number ComponentPointerIncrements[]); // 15 bits formatters -CMSCHECKPOINT cmsFormatter CMSEXPORT Formatter_15Bit_Factory(cmsUInt32Number Type, +CMSCHECKPOINT cmsFormatter Formatter_15Bit_Factory(cmsUInt32Number Type, cmsFormatterDirection Dir, cmsUInt32Number dwFlags); @@ -273,5 +273,10 @@ cmsBool OptimizeCLUTLabTransform(_cmsTransform2Fn* TransformFn, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags); +// Wrapper for _cmsFree that matches the _cmsFreeUserDataFn calling convention. +// On Win32, _cmsFree uses __stdcall (CMSEXPORT) but _cmsFreeUserDataFn is __cdecl. +// Using _cmsFree directly as a _cmsFreeUserDataFn would cause a calling convention +// mismatch on 32-bit Windows builds. This wrapper uses the default (cdecl) convention. +cmsINLINE void _fast_float_free_user_data(cmsContext ContextID, void* Data) { _cmsFree(ContextID, Data); } #endif diff --git a/plugins/fast_float/src/fast_float_tethra.c b/plugins/fast_float/src/fast_float_tethra.c index 7eaa4e77..a0378cea 100644 --- a/plugins/fast_float/src/fast_float_tethra.c +++ b/plugins/fast_float/src/fast_float_tethra.c @@ -349,7 +349,7 @@ cmsBool OptimizeCLUTRGBTransform(_cmsTransform2Fn* TransformFn, *Lut = OptimizedLUT; *TransformFn = FloatCLUTEval; *UserData = pfloat; - *FreeDataFn = _cmsFree; + *FreeDataFn = _fast_float_free_user_data; *dwFlags &= ~cmsFLAGS_CAN_CHANGE_FORMATTER; return TRUE; From eaf4668e9deb480b717222bd3608a50661fb7063 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Mar 2026 14:45:39 +0000 Subject: [PATCH 3/3] Restore CMSEXPORT on Formatter_15Bit_Factory; fix Win32 calling convention via cdecl wrapper Agent-Logs-Url: https://github.com/mm2/Little-CMS/sessions/2fc208bf-ae3b-4814-b8ca-eba52c359e3c Co-authored-by: mm2 <199618+mm2@users.noreply.github.com> --- plugins/fast_float/src/fast_float_15bits.c | 2 +- plugins/fast_float/src/fast_float_internal.h | 2 +- plugins/fast_float/src/fast_float_sup.c | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/fast_float/src/fast_float_15bits.c b/plugins/fast_float/src/fast_float_15bits.c index 59c0a610..f754277e 100644 --- a/plugins/fast_float/src/fast_float_15bits.c +++ b/plugins/fast_float/src/fast_float_15bits.c @@ -469,7 +469,7 @@ cmsUInt8Number* PackNBytesSwapDither(CMSREGISTER struct _cmstransform_struct* C // The factory for 15 bits. This function returns a pointer to specialized function // that would deal with the asked format. It return a pointer to NULL if the format // is not supported. This is the basis of formatter plug-in for 15 bit formats. -CMSCHECKPOINT cmsFormatter Formatter_15Bit_Factory(cmsUInt32Number Type, +CMSCHECKPOINT cmsFormatter CMSEXPORT Formatter_15Bit_Factory(cmsUInt32Number Type, cmsFormatterDirection Dir, cmsUInt32Number dwFlags) { diff --git a/plugins/fast_float/src/fast_float_internal.h b/plugins/fast_float/src/fast_float_internal.h index 5e5311c4..2dc07780 100644 --- a/plugins/fast_float/src/fast_float_internal.h +++ b/plugins/fast_float/src/fast_float_internal.h @@ -175,7 +175,7 @@ CMSCHECKPOINT void CMSEXPORT _cmsComputeComponentIncrements(cmsUInt32Number Form cmsUInt32Number ComponentPointerIncrements[]); // 15 bits formatters -CMSCHECKPOINT cmsFormatter Formatter_15Bit_Factory(cmsUInt32Number Type, +CMSCHECKPOINT cmsFormatter CMSEXPORT Formatter_15Bit_Factory(cmsUInt32Number Type, cmsFormatterDirection Dir, cmsUInt32Number dwFlags); diff --git a/plugins/fast_float/src/fast_float_sup.c b/plugins/fast_float/src/fast_float_sup.c index ba523f24..d491354b 100644 --- a/plugins/fast_float/src/fast_float_sup.c +++ b/plugins/fast_float/src/fast_float_sup.c @@ -83,11 +83,20 @@ cmsBool Floating_Point_Transforms_Dispatcher(_cmsTransform2Fn* TransformFn, return FALSE; } +// On Win32, CMSEXPORT expands to __stdcall but cmsFormatterFactory is __cdecl. +// This wrapper has the cdecl calling convention so it can be stored in the plugin struct. +static cmsFormatter Formatter_15Bit_Factory_wrapper(cmsUInt32Number Type, + cmsFormatterDirection Dir, + cmsUInt32Number dwFlags) +{ + return Formatter_15Bit_Factory(Type, Dir, dwFlags); +} + // The Plug-in entry points static cmsPluginFormatters PluginFastFloat = { { cmsPluginMagicNumber, REQUIRED_LCMS_VERSION, cmsPluginFormattersSig, NULL }, - Formatter_15Bit_Factory + Formatter_15Bit_Factory_wrapper }; static cmsPluginTransform PluginList = {