From edee18eab3fc153a5d658a1ccd987eb0de343bee Mon Sep 17 00:00:00 2001 From: Dominik Loidolt <dominik.loidolt@univie.ac.at> Date: Mon, 14 Feb 2022 10:53:15 +0000 Subject: [PATCH] adopt build sytem to windows --- lib/meson.build | 3 ++- meson.build | 3 ++- test/cmp_tool/cmp_tool_integration_test.py | 11 +++++++++-- test/meson.build | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/meson.build b/lib/meson.build index 02487b0..21f72ad 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -17,5 +17,6 @@ cmplib_sources = files([ cmp_lib = static_library('cmp_lib', sources : cmplib_sources, include_directories : incdir, - c_args : ['-DDEBUGLEVEL=1'] + c_args : ['-DDEBUGLEVEL=1'], + install : 'true' # linking under windows mingw only works if this is set ) diff --git a/meson.build b/meson.build index 59f2c05..295699f 100644 --- a/meson.build +++ b/meson.build @@ -4,11 +4,12 @@ project('cmp_tool', 'c', default_options : ['warning_level=3', 'c_std=gnu99'] ) -if host_machine.system() == 'windows' and cc.get_id() == 'gcc' +if host_machine.system() == 'windows' and meson.get_compiler('c').get_id() == 'gcc' # by default, MinGW on win32 behaves as if it ignores __attribute__((packed)), # you need to add -mno-ms-bitfields to make it work as expected. # See: https://wintermade.it/blog/posts/__attribute__packed-on-windows-is-ignored-with-mingw.html add_project_arguments('-mno-ms-bitfields', language : 'c') + add_global_link_arguments('-static', language: 'c') endif subdir('include') diff --git a/test/cmp_tool/cmp_tool_integration_test.py b/test/cmp_tool/cmp_tool_integration_test.py index 72d32c4..9804d41 100755 --- a/test/cmp_tool/cmp_tool_integration_test.py +++ b/test/cmp_tool/cmp_tool_integration_test.py @@ -1136,6 +1136,11 @@ def test_model_fiel_erros(): "longlonglonglonglonglonglonglonglonglonglonglonglong" "longlonglonglonglonglonglonglonglonglonglonglonglong" "longlonglonglonglonglonglonglonglonglong") + if sys.platform == 'win32' or sys.platform == 'cygwin': + output_prefix = ("longlonglonglonglonglonglonglonglonglonglonglonglong" + "longlonglonglonglonglonglonglonglonglonglonglonglong" + "longlonglonglonglonglonglonglonglonglonglonglonglong" + "longlonglonglonglonglonglonglonglonglonglong") returncode, stdout, stderr = call_cmp_tool( " -c "+cfg_file_name+" -d "+data_file_name + " -m "+model_file_name+" -o "+output_prefix) assert(returncode == EXIT_FAILURE) @@ -1147,8 +1152,10 @@ def test_model_fiel_erros(): "Compress data ... DONE\n" + "Write compressed data to file %s.cmp ... DONE\n" %(output_prefix) + "Write updated model to file %s_upmodel.dat ... FAILED\n" %(output_prefix)) - assert(stderr == "cmp_tool: %s_upmodel.dat: File name too long\n" % (output_prefix)) - # + if sys.platform == 'win32' or sys.platform == 'cygwin': + assert(stderr == "cmp_tool: %s_upmodel.dat: No such file or directory\n" % (output_prefix)) + else: + assert(stderr == "cmp_tool: %s_upmodel.dat: File name too long\n" % (output_prefix)) finally: del_file(data_file_name) diff --git a/test/meson.build b/test/meson.build index 617df9c..ea06655 100644 --- a/test/meson.build +++ b/test/meson.build @@ -32,7 +32,7 @@ endif subdir('cmp_tool') -cunit_dep = dependency('cunit') +cunit_dep = dependency('cunit', required : false) if cunit_dep.found() subdir('cmp_icu') endif -- GitLab