Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
78 changes: 71 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -174,3 +176,65 @@ 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/cygwin-install-action@v6
with:
install-dir: 'C:\cygwin64'
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

3 changes: 3 additions & 0 deletions cmake/Lcms2Plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/fast_float/src/fast_8_curves.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/fast_float/src/fast_float_cmyk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 5 additions & 0 deletions plugins/fast_float/src/fast_float_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 10 additions & 1 deletion plugins/fast_float/src/fast_float_sup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion plugins/fast_float/src/fast_float_tethra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading