diff options
author | Marti Maria <marti.maria@littlecms.com> | 2022-12-06 20:38:09 +0100 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2022-12-06 20:38:09 +0100 |
commit | ef7bd0de652e2a3295026093225c7820611ee0c8 (patch) | |
tree | a56fd1bc129195e2eb654646ddb29751267c3f25 | |
parent | 9e910fd3af8522a73106c962804143c80d6b89cf (diff) | |
parent | 9bb6117aecf2889058c5deb3d876afd8302ca680 (diff) | |
download | lcms2-ef7bd0de652e2a3295026093225c7820611ee0c8.tar.gz |
Merge branch 'master' of https://github.com/mm2/Little-CMS
33 files changed, 633 insertions, 109 deletions
diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 0000000..3d6fa1c --- /dev/null +++ b/include/meson.build @@ -0,0 +1,8 @@ +lcms2_headers = files( + 'lcms2.h', + 'lcms2_plugin.h', +) + +install_headers(lcms2_headers) + +inc_dirs = include_directories('.') diff --git a/meson.build b/meson.build index e963e47..7e76147 100644 --- a/meson.build +++ b/meson.build @@ -1,86 +1,111 @@ -project('Little-CMS', 'c', +project( + 'Little-CMS', + 'c', version: '2.14', - meson_version: '>=0.48.0', + meson_version: '>=0.49.0', ) -library_version = '2.0.13' +version_components = meson.project_version().split('.') + +library_version = '@0@.0.@1@'.format( + version_components.get(0, 0), + version_components.get(1, 0), +) + +version_cfg = configuration_data() +version_cfg.set('LCMS2_VERSION_MAJOR', version_components.get(0, 0)) +version_cfg.set('LCMS2_VERSION_MINOR', version_components.get(1, 0)) +version_cfg.set('LCMS2_VERSION_MICRO', version_components.get(2, 0)) +version_cfg.set_quoted('LCMS2_VERSION', meson.project_version()) cc = meson.get_compiler('c') -lcms2_srcs = [ - 'src/cmsalpha.c', - 'src/cmscgats.c', - 'src/cmserr.c', - 'src/cmsgmt.c', - 'src/cmsintrp.c', - 'src/cmsio1.c', - 'src/cmsmd5.c', - 'src/cmsnamed.c', - 'src/cmspack.c', - 'src/cmsplugin.c', - 'src/cmssamp.c', - 'src/cmstypes.c', - 'src/cmswtpnt.c', - 'src/cmscam02.c', - 'src/cmscnvrt.c', - 'src/cmsgamma.c', - 'src/cmshalf.c', - 'src/cmsio0.c', - 'src/cmslut.c', - 'src/cmsmtrx.c', - 'src/cmsopt.c', - 'src/cmspcs.c', - 'src/cmsps2.c', - 'src/cmssm.c', - 'src/cmsvirt.c', - 'src/cmsxform.c', -] - -install_headers([ - 'include/lcms2.h', - 'include/lcms2_plugin.h' -]) - -inc_dirs = include_directories('include') - -deps = [ - cc.find_library('m', required: false), - dependency('threads'), -] - -cargs = ['-DHasTHREADS=1'] +cargs = [] -# Check for threadsafe variants of gmtime -if cc.has_function('gmtime_r', prefix: '#include <time.h>') - cargs += '-DHAVE_GMTIME_R=1' -elif cc.has_function('gmtime_s', prefix: '#include <time.h>') - cargs += '-DHAVE_GMTIME_S=1' +if cc.has_function_attribute('visibility:hidden') + cargs += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY=1' endif -if cc.has_function_attribute('visibility:hidden') - cargs +='-DHAVE_FUNC_ATTRIBUTE_VISIBILITY=1' +if host_machine.endian() == 'big' + cargs = '-DWORDS_BIGENDIAN=1' endif -if host_machine.system() == 'windows' - win = import('windows') - lcms2_srcs += win.compile_resources('Projects/VC2019/lcms2.rc') - cargs += '-DCMS_DLL_BUILD=1' + +# Check for threadsafe variants of gmtime +#Â MinGW needs _POSIX_C_SOURCE or _POSIX_THREAD_SAFE_FUNCTIONS defined +# to make gmtime_r available +if host_machine.system() == 'windows' and cc.get_argument_syntax() != 'msvc' + cargs += ['-D_POSIX_C_SOURCE=199503L'] endif -liblcms2_lib = library('lcms2', lcms2_srcs, - include_directories : inc_dirs, - gnu_symbol_visibility: 'hidden', - dependencies: deps, - c_args: cargs, - version: library_version, - vs_module_defs: 'src/lcms2.def', - install: true, +if cc.has_header_symbol( + 'time.h', + 'gmtime_r', + args: cargs, ) + cargs += '-DHAVE_GMTIME_R=1' +elif cc.has_header_symbol('time.h', 'gmtime_s') + if cc.links( + ''' + #include <time.h> + + int main() { + time_t t; + struct tm m; + gmtime_s(&m, &t); + return 0; + } + ''', + name: 'gmtime_s can be used', + ) + cargs += '-DHAVE_GMTIME_S=1' + endif +endif + +jpeg_dep = dependency('libjpeg', required: get_option('jpeg')) -liblcms2_dep = declare_dependency( - link_with : liblcms2_lib, - include_directories : inc_dirs +tiff_dep = dependency('libtiff-4', required: get_option('tiff')) + +if ( + not cc.compiles( + ''' + #include <emmintrin.h> + int main() { __m128i n = _mm_set1_epi8(42); } + ''', + name: 'supports SSE2 intrinsics', + ) ) + cargs += '-DCMS_DONT_USE_SSE2=1' +endif + +m_dep = cc.find_library('m', required: false) + +threads_dep = dependency('threads') + +if cc.has_function('pthread_mutex_lock', dependencies: threads_dep) + cargs += '-DHasTHREADS=1' +else + cargs += '-DHasTHREADS=0' +endif + +win = import('windows') + +deps = [m_dep, threads_dep] + +subdir('include') +subdir('src') +subdir('testbed') +subdir('utils') + +if get_option('samples') + subdir('utils/samples') +endif + +extra_libraries = [] +subdir('plugins') pkg = import('pkgconfig') -pkg.generate(liblcms2_lib) +pkg.generate(liblcms2_lib, + description: 'LCMS Color Management Library', + libraries: extra_libraries +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..5adc464 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,6 @@ +option('jpeg', type: 'feature', value: 'auto', description: 'Use JPEG') +option('tiff', type: 'feature', value: 'auto', description: 'Use LibTiff') + +option('samples', type: 'boolean', value: 'false', description: 'Build the samples') +option('fastfloat', type: 'boolean', value: 'false', description: 'Build and install the fast float plugin, use only if GPL 3.0 is acceptable') +option('threaded', type: 'boolean', value: 'false', description: 'Build and install the multi threaded plugin, use only if GPL 3.0 is acceptable') diff --git a/plugins/fast_float/meson.build b/plugins/fast_float/meson.build new file mode 100644 index 0000000..b5d2552 --- /dev/null +++ b/plugins/fast_float/meson.build @@ -0,0 +1,2 @@ +subdir('src') +subdir('testbed') diff --git a/plugins/fast_float/src/fast_8_matsh.c b/plugins/fast_float/src/fast_8_matsh.c index 893b761..f39c669 100644 --- a/plugins/fast_float/src/fast_8_matsh.c +++ b/plugins/fast_float/src/fast_8_matsh.c @@ -362,8 +362,8 @@ cmsBool Optimize8MatrixShaper(_cmsTransform2Fn* TransformFn, _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*) cmsStageData(Curve1); _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2); - // In this particular optimization, caché does not help as it takes more time to deal with - // the caché that with the pixel handling + // In this particular optimization, cache does not help as it takes more time to deal with + // the cache that with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; diff --git a/plugins/fast_float/src/fast_float_15mats.c b/plugins/fast_float/src/fast_float_15mats.c index aaa3697..19e2378 100644 --- a/plugins/fast_float/src/fast_float_15mats.c +++ b/plugins/fast_float/src/fast_float_15mats.c @@ -336,8 +336,8 @@ cmsBool OptimizeMatrixShaper15(_cmsTransform2Fn* TransformFn, _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*)cmsStageData(Curve1); _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*)cmsStageData(Curve2); - // In this particular optimization, caché does not help as it takes more time to deal with - // the caché that with the pixel handling + // In this particular optimization, cache does not help as it takes more time to deal with + // the cache that with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; // Setup the optimizarion routines diff --git a/plugins/fast_float/src/fast_float_matsh.c b/plugins/fast_float/src/fast_float_matsh.c index 1f87935..19e8aa5 100644 --- a/plugins/fast_float/src/fast_float_matsh.c +++ b/plugins/fast_float/src/fast_float_matsh.c @@ -332,7 +332,7 @@ cmsBool OptimizeFloatMatrixShaper(_cmsTransform2Fn* TransformFn, _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*) cmsStageData(Curve1); _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2); - // In this particular optimization, caché does not help as it takes more time to deal with + // In this particular optimization, cache does not help as it takes more time to deal with // the cachthat with the pixel handling *dwFlags |= cmsFLAGS_NOCACHE; diff --git a/plugins/fast_float/src/lcms2_fast_float.rc.in b/plugins/fast_float/src/lcms2_fast_float.rc.in new file mode 100644 index 0000000..18554dc --- /dev/null +++ b/plugins/fast_float/src/lcms2_fast_float.rc.in @@ -0,0 +1,52 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, multithread extensions +// Copyright (c) 1998-2022 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include <Windows.h> + +1 VERSIONINFO +FILEVERSION @LCMS2_VERSION_MAJOR@, @LCMS2_VERSION_MINOR@, @LCMS2_VERSION_MICRO@, 0 +PRODUCTVERSION @LCMS2_VERSION_MAJOR@, @LCMS2_VERSION_MINOR@, @LCMS2_VERSION_MICRO@, 0 +FILEFLAGSMASK 0x0L +#ifdef _DEBUG +FILEFLAGS VS_FF_DEBUG +#endif +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_DLL +{ + BLOCK "StringFileInfo" + { + BLOCK "040904e4" + { + VALUE "CompanyName", "Marti Maria" + VALUE "FileDescription", "Fast Float plugin" + VALUE "FileVersion", @LCMS2_VERSION@ + VALUE "InternalName", "lcms2_fast_float" + VALUE "LegalCopyright", "Copyright (C) Marti Maria 2022, GPL-3.0-or-later" + VALUE "OriginalFilename", "lcms2_fast_float.dll" + VALUE "ProductName", "LittleCMS color engine" + VALUE "ProductVersion", @LCMS2_VERSION@ + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1252 + } +} diff --git a/plugins/fast_float/src/meson.build b/plugins/fast_float/src/meson.build new file mode 100644 index 0000000..93f0b34 --- /dev/null +++ b/plugins/fast_float/src/meson.build @@ -0,0 +1,46 @@ +lcms2_fast_float_sources = files( + 'fast_16_tethra.c', + 'fast_8_curves.c', + 'fast_8_matsh.c', + 'fast_8_matsh_sse.c', + 'fast_8_tethra.c', + 'fast_float_15bits.c', + 'fast_float_15mats.c', + 'fast_float_cmyk.c', + 'fast_float_curves.c', + 'fast_float_internal.h', + 'fast_float_lab.c', + 'fast_float_matsh.c', + 'fast_float_separate.c', + 'fast_float_sup.c', + 'fast_float_tethra.c', +) + +lcms2_fast_float_incdir = include_directories('../include', '.') + +if host_machine.system() == 'windows' + lcms2_fast_float_rc = configure_file( + input: 'lcms2_fast_float.rc.in', + configuration: version_cfg, + output: 'lcms2_fast_float.rc', + ) + + lcms2_fast_float_sources += win.compile_resources(lcms2_fast_float_rc) +endif + +liblcms2_fast_float = library( + 'lcms2_fast_float', + lcms2_fast_float_sources, + gnu_symbol_visibility: 'hidden', + dependencies: liblcms2_dep, + include_directories: lcms2_fast_float_incdir, + c_args: cargs, + install: true, +) + +liblcms2_fast_float_dep = declare_dependency( + link_with: liblcms2_fast_float, + include_directories: lcms2_fast_float_incdir, +) + +extra_libraries += liblcms2_fast_float diff --git a/plugins/fast_float/testbed/fast_float_testbed.c b/plugins/fast_float/testbed/fast_float_testbed.c index addef00..005bee6 100644 --- a/plugins/fast_float/testbed/fast_float_testbed.c +++ b/plugins/fast_float/testbed/fast_float_testbed.c @@ -29,7 +29,9 @@ # include "crtdbg.h" #endif +#ifndef PROFILES_DIR #define PROFILES_DIR "../../test_profiles/" +#endif // Some pixel representations typedef struct { cmsUInt8Number r, g, b; } Scanline_rgb8bits; diff --git a/plugins/fast_float/testbed/meson.build b/plugins/fast_float/testbed/meson.build new file mode 100644 index 0000000..5aa2d1a --- /dev/null +++ b/plugins/fast_float/testbed/meson.build @@ -0,0 +1,16 @@ +fast_float_testbed_srcs = files( + 'fast_float_testbed.c', +) + +fast_float_testbed = executable( + 'fast_float_testbed', + fast_float_testbed_srcs, + dependencies: [liblcms2_fast_float_dep, liblcms2_dep], + c_args: cargs + ['-DPROFILES_DIR="@0@"'.format(profiles_dir / '')], +) + +test( + 'fast_float_testbed', + fast_float_testbed, + timeout: 600, +) diff --git a/plugins/meson.build b/plugins/meson.build new file mode 100644 index 0000000..2eb9c13 --- /dev/null +++ b/plugins/meson.build @@ -0,0 +1,9 @@ +subdir('test_profiles') + +if get_option('fastfloat') + subdir('fast_float') +endif + +if get_option('threaded') + subdir('threaded') +endif diff --git a/plugins/test_profiles/meson.build b/plugins/test_profiles/meson.build new file mode 100644 index 0000000..1eb96dc --- /dev/null +++ b/plugins/test_profiles/meson.build @@ -0,0 +1 @@ +profiles_dir = meson.current_source_dir() diff --git a/plugins/threaded/include/meson.build b/plugins/threaded/include/meson.build new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/plugins/threaded/include/meson.build @@ -0,0 +1 @@ + diff --git a/plugins/threaded/meson.build b/plugins/threaded/meson.build new file mode 100644 index 0000000..b5d2552 --- /dev/null +++ b/plugins/threaded/meson.build @@ -0,0 +1,2 @@ +subdir('src') +subdir('testbed') diff --git a/plugins/threaded/src/lcms2_threaded.rc.in b/plugins/threaded/src/lcms2_threaded.rc.in new file mode 100644 index 0000000..2c9f6b2 --- /dev/null +++ b/plugins/threaded/src/lcms2_threaded.rc.in @@ -0,0 +1,52 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, multithread extensions +// Copyright (c) 1998-2022 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include <Windows.h> + +1 VERSIONINFO +FILEVERSION @LCMS2_VERSION_MAJOR@, @LCMS2_VERSION_MINOR@, @LCMS2_VERSION_MICRO@, 0 +PRODUCTVERSION @LCMS2_VERSION_MAJOR@, @LCMS2_VERSION_MINOR@, @LCMS2_VERSION_MICRO@, 0 +FILEFLAGSMASK 0x0L +#ifdef _DEBUG +FILEFLAGS VS_FF_DEBUG +#endif +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_DLL +{ + BLOCK "StringFileInfo" + { + BLOCK "040904e4" + { + VALUE "CompanyName", "Marti Maria" + VALUE "FileDescription", "Multithread plugin" + VALUE "FileVersion", @LCMS2_VERSION@ + VALUE "InternalName", "lcms2_threaded" + VALUE "LegalCopyright", "Copyright (C) Marti Maria 2022, GPL-3.0-or-later" + VALUE "OriginalFilename", "lcms2_threaded.dll" + VALUE "ProductName", "LittleCMS color engine" + VALUE "ProductVersion", @LCMS2_VERSION@ + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1252 + } +} diff --git a/plugins/threaded/src/meson.build b/plugins/threaded/src/meson.build new file mode 100644 index 0000000..75b2796 --- /dev/null +++ b/plugins/threaded/src/meson.build @@ -0,0 +1,34 @@ +liblcms2_threaded_sources = files( + 'threaded_core.c', + 'threaded_main.c', + 'threaded_scheduler.c', + 'threaded_split.c', +) + +lcms2_threaded_incdir = include_directories('../include', '.') + +if host_machine.system() == 'windows' + lcms2_threaded_rc = configure_file( + input: 'lcms2_threaded.rc.in', + configuration: version_cfg, + output: 'lcms2_threaded.rc', + ) + + liblcms2_threaded_sources += win.compile_resources(lcms2_threaded_rc) +endif + +liblcms2_threaded = library( + 'lcms2_threaded', + liblcms2_threaded_sources, + include_directories: lcms2_threaded_incdir, + dependencies: liblcms2_dep, + c_args: cargs, + install: true, +) + +liblcms2_threaded_dep = declare_dependency( + link_with: liblcms2_threaded, + include_directories: lcms2_threaded_incdir, +) + +extra_libraries += liblcms2_threaded diff --git a/plugins/threaded/testbed/meson.build b/plugins/threaded/testbed/meson.build new file mode 100644 index 0000000..a5121ed --- /dev/null +++ b/plugins/threaded/testbed/meson.build @@ -0,0 +1,16 @@ +threaded_testbed_sources = files( + 'threaded_testbed.c', +) + +threaded_testbed = executable( + 'threaded_testbed', + threaded_testbed_sources, + dependencies: [liblcms2_threaded_dep, liblcms2_dep], + c_args: cargs + ['-DPROFILES_DIR="@0@"'.format(profiles_dir / '')], +) + +test( + 'threaded_testbed', + threaded_testbed, + timeout: 600, +) diff --git a/plugins/threaded/testbed/threaded_testbed.c b/plugins/threaded/testbed/threaded_testbed.c index 0715ab3..ef8d90e 100644 --- a/plugins/threaded/testbed/threaded_testbed.c +++ b/plugins/threaded/testbed/threaded_testbed.c @@ -29,7 +29,9 @@ # include "crtdbg.h" #endif +#ifndef PROFILES_DIR #define PROFILES_DIR "../../test_profiles/" +#endif // A fast way to convert from/to 16 <-> 8 bits #define FROM_8_TO_16(rgb) (cmsUInt16Number) ((((cmsUInt16Number) (rgb)) << 8)|(rgb)) diff --git a/src/lcms2.def b/src/lcms2.def index f3e4779..9bf2a4f 100644 --- a/src/lcms2.def +++ b/src/lcms2.def @@ -1,5 +1,3 @@ -LIBRARY LCMS2.DLL
-
EXPORTS
_cms15Fixed16toDouble = _cms15Fixed16toDouble
diff --git a/src/lcms2.rc.in b/src/lcms2.rc.in new file mode 100644 index 0000000..ae82d9e --- /dev/null +++ b/src/lcms2.rc.in @@ -0,0 +1,52 @@ +//--------------------------------------------------------------------------------- +// +// Little Color Management System, multithread extensions +// Copyright (c) 1998-2022 Marti Maria Saguer, all rights reserved +// +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +//--------------------------------------------------------------------------------- + +#include <Windows.h> + +1 VERSIONINFO +FILEVERSION @LCMS2_VERSION_MAJOR@, @LCMS2_VERSION_MINOR@, @LCMS2_VERSION_MICRO@, 0 +PRODUCTVERSION @LCMS2_VERSION_MAJOR@, @LCMS2_VERSION_MINOR@, @LCMS2_VERSION_MICRO@, 0 +FILEFLAGSMASK 0x0L +#ifdef _DEBUG +FILEFLAGS VS_FF_DEBUG +#endif +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_DLL +{ + BLOCK "StringFileInfo" + { + BLOCK "040904e4" + { + VALUE "CompanyName", "Marti Maria" + VALUE "FileDescription", "lcms color engine" + VALUE "FileVersion", @LCMS2_VERSION@ + VALUE "InternalName", "lcms2" + VALUE "LegalCopyright", "Copyright (C) Marti Maria 2022" + VALUE "OriginalFilename", "lcms2.dll" + VALUE "ProductName", "LittleCMS color engine" + VALUE "ProductVersion", @LCMS2_VERSION@ + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1252 + } +} diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..236294b --- /dev/null +++ b/src/meson.build @@ -0,0 +1,56 @@ +lcms2_srcs = files( + 'cmsalpha.c', + 'cmscam02.c', + 'cmscgats.c', + 'cmscnvrt.c', + 'cmserr.c', + 'cmsgamma.c', + 'cmsgmt.c', + 'cmshalf.c', + 'cmsintrp.c', + 'cmsio0.c', + 'cmsio1.c', + 'cmslut.c', + 'cmsmd5.c', + 'cmsmtrx.c', + 'cmsnamed.c', + 'cmsopt.c', + 'cmspack.c', + 'cmspcs.c', + 'cmsplugin.c', + 'cmsps2.c', + 'cmssamp.c', + 'cmssm.c', + 'cmstypes.c', + 'cmsvirt.c', + 'cmswtpnt.c', + 'cmsxform.c', +) + +if host_machine.system() == 'windows' + lcms2_rc = configure_file( + input: 'lcms2.rc.in', + configuration: version_cfg, + output: 'lcms2.rc', + ) + + lcms2_srcs += win.compile_resources(lcms2_rc) + cargs += '-DCMS_DLL_BUILD=1' +endif + +liblcms2_lib = library( + 'lcms2', + lcms2_srcs, + include_directories: inc_dirs, + gnu_symbol_visibility: 'hidden', + dependencies: deps, + c_args: cargs, + version: library_version, + vs_module_defs: 'lcms2.def', + install: true, +) + +liblcms2_dep = declare_dependency( + link_with: liblcms2_lib, + include_directories: [inc_dirs, include_directories('.')], +) diff --git a/testbed/meson.build b/testbed/meson.build new file mode 100644 index 0000000..c35d0fa --- /dev/null +++ b/testbed/meson.build @@ -0,0 +1,19 @@ +testcms_srcs = files( + 'testcms2.c', + 'testplugin.c', + 'zoo_icc.c', +) + +testcms = executable( + 'testcms', + testcms_srcs, + dependencies: [liblcms2_dep, m_dep], + c_args: cargs, +) + +test( + 'testcms', + testcms, + workdir: meson.current_source_dir(), + timeout: 600, +) diff --git a/testbed/testcms2.c b/testbed/testcms2.c index 40f9d65..f866bb4 100644 --- a/testbed/testcms2.c +++ b/testbed/testcms2.c @@ -3783,7 +3783,7 @@ cmsInt32Number CreateNamedColorProfile(void) // Values cmsCIELab Lab; - cmsUInt16Number PCS[3], Colorant[4]; + cmsUInt16Number PCS[3], Colorant[cmsMAXCHANNELS]; // Set profile class cmsSetProfileVersion(hProfile, 4.3); @@ -7397,22 +7397,18 @@ cmsInt32Number CheckGBD(void) static int CheckMD5(void) -{ - _cmsICCPROFILE* h; +{ cmsHPROFILE pProfile = cmsOpenProfileFromFile("sRGBlcms2.icc", "r"); cmsProfileID ProfileID1, ProfileID2, ProfileID3, ProfileID4; - - h =(_cmsICCPROFILE*) pProfile; + if (cmsMD5computeID(pProfile)) cmsGetHeaderProfileID(pProfile, ProfileID1.ID8); - if (cmsMD5computeID(pProfile)) cmsGetHeaderProfileID(pProfile,ProfileID2.ID8); + if (cmsMD5computeID(pProfile)) cmsGetHeaderProfileID(pProfile, ProfileID2.ID8); cmsCloseProfile(pProfile); - pProfile = cmsOpenProfileFromFile("sRGBlcms2.icc", "r"); - - h =(_cmsICCPROFILE*) pProfile; - if (cmsMD5computeID(pProfile)) cmsGetHeaderProfileID(pProfile, ProfileID3.ID8); + + if (cmsMD5computeID(pProfile)) cmsGetHeaderProfileID(pProfile,ProfileID3.ID8); if (cmsMD5computeID(pProfile)) cmsGetHeaderProfileID(pProfile,ProfileID4.ID8); cmsCloseProfile(pProfile); @@ -7834,41 +7830,41 @@ cmsInt32Number CheckFloatSegments(void) static cmsInt32Number CheckReadRAW(void) { - cmsInt32Number tag_size, tag_size1; - char buffer[37009]; - cmsHPROFILE hProfile; + cmsInt32Number tag_size, tag_size1; + char buffer[37009]; + cmsHPROFILE hProfile; - SubTest("RAW read on on-disk"); - hProfile = cmsOpenProfileFromFile("test1.icc", "r"); + SubTest("RAW read on on-disk"); + hProfile = cmsOpenProfileFromFile("test1.icc", "r"); - if (hProfile == NULL) - return 0; - tag_size1 = cmsReadRawTag(hProfile, cmsSigGamutTag, NULL, 0); - tag_size = cmsReadRawTag(hProfile, cmsSigGamutTag, buffer, 37009); + if (hProfile == NULL) + return 0; + tag_size1 = cmsReadRawTag(hProfile, cmsSigGamutTag, NULL, 0); + tag_size = cmsReadRawTag(hProfile, cmsSigGamutTag, buffer, 37009); - cmsCloseProfile(hProfile); + cmsCloseProfile(hProfile); - if (tag_size != 37009) - return 0; + if (tag_size != 37009) + return 0; - if (tag_size1 != 37009) - return 0; + if (tag_size1 != 37009) + return 0; - SubTest("RAW read on in-memory created profiles"); - hProfile = cmsCreate_sRGBProfile(); - tag_size1 = cmsReadRawTag(hProfile, cmsSigGreenColorantTag, NULL, 0); - tag_size = cmsReadRawTag(hProfile, cmsSigGreenColorantTag, buffer, 20); + SubTest("RAW read on in-memory created profiles"); + hProfile = cmsCreate_sRGBProfile(); + tag_size1 = cmsReadRawTag(hProfile, cmsSigGreenColorantTag, NULL, 0); + tag_size = cmsReadRawTag(hProfile, cmsSigGreenColorantTag, buffer, 20); - cmsCloseProfile(hProfile); + cmsCloseProfile(hProfile); - if (tag_size != 20) - return 0; - if (tag_size1 != 20) - return 0; + if (tag_size != 20) + return 0; + if (tag_size1 != 20) + return 0; - return 1; + return 1; } diff --git a/utils/common/meson.build b/utils/common/meson.build new file mode 100644 index 0000000..e405844 --- /dev/null +++ b/utils/common/meson.build @@ -0,0 +1,9 @@ +common_srcs = files( + 'vprf.c', + 'xgetopt.c', +) + +common_dep = declare_dependency( + sources: common_srcs, + include_directories: include_directories('.'), +) diff --git a/utils/jpgicc/meson.build b/utils/jpgicc/meson.build new file mode 100644 index 0000000..b9fc5ee --- /dev/null +++ b/utils/jpgicc/meson.build @@ -0,0 +1,17 @@ +jpgicc_sources = files( + 'iccjpeg.c', + 'jpgicc.c', +) + +jpgicc_exe = executable( + 'jpgicc', + jpgicc_sources, + dependencies: [liblcms2_dep, jpeg_dep, common_dep, m_dep], + install: true, +) + +jpgicc_man = files( + 'jpgicc.1', +) + +install_man(jpgicc_man) diff --git a/utils/linkicc/meson.build b/utils/linkicc/meson.build new file mode 100644 index 0000000..c238427 --- /dev/null +++ b/utils/linkicc/meson.build @@ -0,0 +1,16 @@ +linkicc_sources = files( + 'linkicc.c', +) + +linkicc_exe = executable( + 'linkicc', + linkicc_sources, + dependencies: [liblcms2_dep, common_dep], + install: true, +) + +linkicc_man = files( + 'linkicc.1', +) + +install_man(linkicc_man) diff --git a/utils/meson.build b/utils/meson.build new file mode 100644 index 0000000..4789323 --- /dev/null +++ b/utils/meson.build @@ -0,0 +1,6 @@ +subdir('common') +subdir('jpgicc') +subdir('linkicc') +subdir('psicc') +subdir('tificc') +subdir('transicc') diff --git a/utils/psicc/meson.build b/utils/psicc/meson.build new file mode 100644 index 0000000..89f9227 --- /dev/null +++ b/utils/psicc/meson.build @@ -0,0 +1,14 @@ +psicc_sources = files( + 'psicc.c', +) + +psicc_exe = executable( + 'psicc', + psicc_sources, + dependencies: [liblcms2_dep, common_dep], + install: true, +) + +psicc_man = files( + 'psicc.1', +) diff --git a/utils/samples/meson.build b/utils/samples/meson.build new file mode 100644 index 0000000..17ab13f --- /dev/null +++ b/utils/samples/meson.build @@ -0,0 +1,33 @@ +wtpt_srcs = files( + 'wtpt.c', +) + +wtpt_exe = executable( + 'wtpt', + wtpt_srcs, + dependencies: [liblcms2_dep, common_dep], +) + +wtpt_man = files( + 'wtpt.1', +) + +# install_man(wtpt_man) + +examples = { + 'roundtrip': files('roundtrip.c'), + 'mktiff8': files('mktiff8.c'), + # 'vericc': files('vericc.c'), + # The following are commented out because they're LCMS 1 + # 'mkgrayer': files('mkgrayer.c'), + # 'mkcmy': files('mkcmy.c'), + # 'itufax': files('itufax.c'), +} + +foreach exe, srcs : examples + executable( + exe, + srcs, + dependencies: [liblcms2_dep], + ) +endforeach diff --git a/utils/samples/wtpt.c b/utils/samples/wtpt.c index 45602f7..e19e0ff 100644 --- a/utils/samples/wtpt.c +++ b/utils/samples/wtpt.c @@ -36,6 +36,8 @@ static cmsBool lShowXYZ = TRUE; static cmsBool lShowLab = FALSE; static cmsBool lShowLCh = FALSE; +#define SW '-' + static void HandleSwitches(int argc, char *argv[]) { diff --git a/utils/tificc/meson.build b/utils/tificc/meson.build new file mode 100644 index 0000000..f078133 --- /dev/null +++ b/utils/tificc/meson.build @@ -0,0 +1,16 @@ +tificc_sources = files( + 'tificc.c', +) + +tificc_exe = executable( + 'tificc', + tificc_sources, + dependencies: [liblcms2_dep, common_dep, tiff_dep], + install: true, +) + +tificc_man = files( + 'tificc.1', +) + +install_man(tificc_man) diff --git a/utils/transicc/meson.build b/utils/transicc/meson.build new file mode 100644 index 0000000..8218a7b --- /dev/null +++ b/utils/transicc/meson.build @@ -0,0 +1,16 @@ +transicc_sources = files( + 'transicc.c', +) + +transicc_exe = executable( + 'transicc', + transicc_sources, + dependencies: [liblcms2_dep, common_dep, m_dep], + install: true, +) + +transicc_man = files( + 'transicc.1', +) + +install_man(transicc_man) |