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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ indent_size = 4
[*.py]
indent_style = space
indent_size = 4

[meson.build]
indent_size = 2

[meson_options.txt]
indent_size = 2
8 changes: 6 additions & 2 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ jobs:

- name: Install build and test dependencies (Windows)
if: startsWith(matrix.os, 'windows')
run: pip install meson ninja
run: |
# remove broken pkg-config that causes Meson warnings
del 'C:\\Strawberry\\perl\\bin\\pkg-config'
del 'C:\\Strawberry\\perl\\bin\\pkg-config.BAT'
pip install meson ninja

- name: Build and install library
shell: bash
Expand All @@ -76,7 +80,7 @@ jobs:
esac
;;
esac
meson setup builddir --werror $setup_args
meson setup builddir --fatal-meson-warnings --werror $setup_args
DEBUG_DICT=1 meson compile -C builddir
$sudo meson install -C builddir

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
tags
# Subprojects
/subprojects/.wraplock
/subprojects/packagecache
/subprojects/check-*
/subprojects/uthash-*
60 changes: 27 additions & 33 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ project(
'buildtype=debugoptimized',
],
license : 'MIT',
meson_version : '>=0.50',
version : '1.2.0'
meson_version : '>=0.55',
version : '1.2.0',
)
if not meson.is_subproject()
meson.add_dist_script(
'scripts/dist.py'
)
meson.add_dist_script('scripts/dist.py')
endif

# project version
Expand Down Expand Up @@ -46,7 +44,7 @@ abi_version = '@0@.@1@.@2@'.format(
)
darwin_library_versions = [
abi_version_major + 1,
'@0@.@1@'.format(abi_version_major + 1, abi_version_minor)
'@0@.@1@'.format(abi_version_major + 1, abi_version_minor),
]

# ready to be pasted into source files
Expand All @@ -68,32 +66,30 @@ if host_machine.system() == 'darwin' and not cc.has_header('stdio.h')
# in advance.
# https://github.com/mesonbuild/meson/issues/5290
# https://github.com/mesonbuild/meson/issues/8206
error('Basic environment check failed. Check compiler flags; building for multiple CPU architectures is not supported.')
error(
'Basic environment check failed. Check compiler flags; building for multiple CPU architectures is not supported.',
)
endif
found_uthash = cc.check_header(
'utarray.h',
required : false
required : false,
) and cc.check_header(
'uthash.h',
required : false
required : false,
)
if found_uthash
uthash = declare_dependency()
else
# fall back to dependency() rather than subproject() so
# --wrap-mode=nofallback works
uthash = dependency(
'uthash',
fallback : ['uthash', 'uthash_dep'],
)
uthash = dependency('uthash')
endif
if get_option('tests')
check = dependency(
'check',
default_options : [
'warning_level=0',
],
fallback : ['check', 'check_dep'],
version : '>=0.9.6',
)
endif
Expand All @@ -109,10 +105,10 @@ cfg.set_quoted(
)

if cc.has_header('io.h')
cfg.set('HAVE_IO_H', '1')
cfg.set('HAVE_IO_H', '1')
endif
if cc.has_header('unistd.h')
cfg.set('HAVE_UNISTD_H', '1')
cfg.set('HAVE_UNISTD_H', '1')
endif

configure_file(
Expand All @@ -134,9 +130,9 @@ add_project_arguments(

# include
version_header = configure_file(
input : 'include/dicom/version.h.in',
output : 'version.h',
configuration : version_data,
input : 'include/dicom/version.h.in',
output : 'version.h',
configuration : version_data,
)

install_headers(
Expand All @@ -150,7 +146,7 @@ library_includes = include_directories('include')
library_options = ['-DBUILDING_LIBDICOM']
dict_build = executable(
'dicom-dict-build',
['src/dicom-dict-build.c', 'src/dicom-dict-tables.c'],
files('src/dicom-dict-build.c', 'src/dicom-dict-tables.c'),
dependencies : [uthash],
include_directories : library_includes,
native : true,
Expand All @@ -160,17 +156,16 @@ dict_lookup = custom_target(
command : [dict_build, '@OUTPUT@'],
output : ['dicom-dict-lookup.c', 'dicom-dict-lookup.h'],
)
library_sources = [
dict_lookup,
'src/getopt.c',
'src/dicom.c',
'src/dicom-io.c',
library_sources = [dict_lookup] + files(
'src/dicom-data.c',
'src/dicom-dict.c',
'src/dicom-dict-tables.c',
'src/dicom-dict.c',
'src/dicom-file.c',
'src/dicom-io.c',
'src/dicom-parse.c',
]
'src/dicom.c',
'src/getopt.c',
)
libdicom = library(
'dicom',
library_sources,
Expand All @@ -179,7 +174,7 @@ libdicom = library(
version : abi_version,
darwin_versions : darwin_library_versions,
include_directories : library_includes,
gnu_symbol_visibility: 'hidden',
gnu_symbol_visibility : 'hidden',
install : true,
)
import('pkgconfig').generate(
Expand All @@ -195,9 +190,7 @@ libdicom_dep = declare_dependency(
include_directories : [library_includes, include_directories('.')],
link_with : libdicom,
)
if meson.version().version_compare('>=0.54')
meson.override_dependency('libdicom', libdicom_dep)
endif
meson.override_dependency('libdicom', libdicom_dep)

# tools
executable(
Expand Down Expand Up @@ -233,7 +226,7 @@ subdir('doc/env/bin')
custom_target(
'html',
command : [sphinx_build, '@SOURCE_ROOT@/doc/source', '@OUTPUT@'],
input : [
input : files(
'doc/source/api.rst',
'doc/source/conf.py',
'doc/source/contributing.rst',
Expand All @@ -243,7 +236,7 @@ custom_target(
'doc/source/tools.rst',
'doc/source/usage.rst',
'include/dicom/dicom.h',
],
),
output : 'html',
)

Expand All @@ -253,6 +246,7 @@ if get_option('tests')
'check_dicom',
'tests/check_dicom.c',
dependencies : [check, libdicom_dep],
build_by_default : false,
)
test('check_dicom', check_dicom)
endif
4 changes: 4 additions & 0 deletions meson.format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kwargs_force_multiline = true
sort_files = true
use_editor_config = true
wide_colon = true
3 changes: 3 additions & 0 deletions scripts/meson-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exec meson format -c meson.format -i -r
13 changes: 7 additions & 6 deletions subprojects/check.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ directory = check-0.15.2
source_url = https://github.com/libcheck/check/archive/0.15.2.tar.gz
source_filename = check-0.15.2.tar.gz
source_hash = 998d355294bb94072f40584272cf4424571c396c631620ce463f6ea97aa67d2e
patch_filename = check_0.15.2-4_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-4/get_patch
patch_hash = 3e998eb0c475613e890c9e006420fb6da5dcee27aa2ba3f331f9253648691743
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/check_0.15.2-4/check-0.15.2.tar.gz
wrapdb_version = 0.15.2-4
source_fallback_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-6/get_source/check-0.15.2.tar.gz
patch_filename = check_0.15.2-6_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-6/get_patch
patch_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/check_0.15.2-6/check_0.15.2-6_patch.zip
patch_hash = ff3bebb5801fae479ab3686d95f91a77b572751eb891d9b9804933e8b9da94eb
wrapdb_version = 0.15.2-6

[provide]
check = check_dep
dependency_names = check
11 changes: 6 additions & 5 deletions subprojects/uthash.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ directory = uthash-2.3.0
source_url = https://github.com/troydhanson/uthash/archive/v2.3.0.tar.gz
source_filename = uthash-2.3.0.tar.gz
source_hash = e10382ab75518bad8319eb922ad04f907cb20cccb451a3aa980c9d005e661acc
patch_filename = uthash_2.3.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/uthash_2.3.0-1/get_patch
patch_hash = d0b7cf9788c3735ee6a08bb649c58be1f5fad4b95e50e7681cbdf44882da9d7e
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/uthash_2.3.0-2/uthash-2.3.0.tar.gz
patch_filename = uthash_2.3.0-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/uthash_2.3.0-2/get_patch
patch_hash = d66806488ebd37246a160f62779e3eb3259b8cd35a978f7499daa0390923cd99
wrapdb_version = 2.3.0-2

[provide]
uthash = uthash_dep

dependency_names = uthash