diff options
author | Marti Maria <marti.maria@littlecms.com> | 2023-04-20 10:23:12 +0200 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2023-04-20 10:23:12 +0200 |
commit | 8769c0e85b0e57de3f55936344766873fa982350 (patch) | |
tree | 1ade79b4dd18c0ee8c464641dd4c5277bda30894 | |
parent | c61a2c798e0f3ca73d2f78e8721ae37e6a70c045 (diff) | |
download | lcms2-8769c0e85b0e57de3f55936344766873fa982350.tar.gz |
make meson compile visual studio as well
MESON now compiles with VS2022, static lib and DLL
-rw-r--r-- | meson.build | 29 | ||||
-rw-r--r-- | src/meson.build | 2 |
2 files changed, 20 insertions, 11 deletions
diff --git a/meson.build b/meson.build index f049200..086e520 100644 --- a/meson.build +++ b/meson.build @@ -21,9 +21,11 @@ version_cfg.set_quoted('LCMS2_VERSION', meson.project_version()) cc = meson.get_compiler('c') +is_visual_studio = cc.get_argument_syntax() == 'msvc' + cargs = [] -if cc.has_function_attribute('visibility:hidden') +if not is_visual_studio and cc.has_function_attribute('visibility:hidden') cargs += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY=1' endif @@ -35,7 +37,7 @@ endif # Check for threadsafe variants of gmtime # MinGW needs _POSIX_C_SOURCE or _POSIX_THREAD_SAFE_FUNCTIONS defined # to make gmtime_r and pthread_time.h available -if host_machine.system() == 'windows' and cc.get_argument_syntax() != 'msvc' +if host_machine.system() == 'windows' and not is_visual_studio cargs += ['-D_POSIX_C_SOURCE=199503L'] endif @@ -79,24 +81,31 @@ if ( 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' +if is_visual_studio + m_dep = [] + threads_dep = [] + deps = [] else - cargs += '-DHasTHREADS=0' + 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 + + deps = [m_dep, threads_dep] endif + if cc.has_header_symbol('time.h', 'timespec_get') cargs += '-DHAVE_TIMESPEC_GET=1' endif win = import('windows') -deps = [m_dep, threads_dep] - subdir('include') subdir('src') subdir('testbed') diff --git a/src/meson.build b/src/meson.build index 236294b..a3204ee 100644 --- a/src/meson.build +++ b/src/meson.build @@ -46,7 +46,7 @@ liblcms2_lib = library( dependencies: deps, c_args: cargs, version: library_version, - vs_module_defs: 'lcms2.def', + # vs_module_defs: 'lcms2.def', install: true, ) |