diff options
-rw-r--r-- | libjaylink/meson.build | 69 | ||||
-rw-r--r-- | meson.build | 87 | ||||
-rw-r--r-- | meson_options.txt | 3 |
3 files changed, 159 insertions, 0 deletions
diff --git a/libjaylink/meson.build b/libjaylink/meson.build new file mode 100644 index 0000000..2cbc42b --- /dev/null +++ b/libjaylink/meson.build @@ -0,0 +1,69 @@ +sources = [ + 'buffer.c', + 'c2.c', + 'core.c', + 'device.c', + 'discovery.c', + 'discovery_tcp.c', + 'emucom.c', + 'error.c', + 'fileio.c', + 'jtag.c', + 'list.c', + 'log.c', + 'socket.c', + 'spi.c', + 'strutil.c', + 'swd.c', + 'swo.c', + 'target.c', + 'transport.c', + 'transport_tcp.c', + 'util.c', + 'version.c', +] + +if have_usb + sources += ['discovery_usb.c', 'transport_usb.c'] +endif + +version_h = configure_file( + input: 'version.h.in', + output: 'version.h', + configuration: { + 'JAYLINK_VERSION_PACKAGE_MAJOR': package_version['major'], + 'JAYLINK_VERSION_PACKAGE_MINOR': package_version['minor'], + 'JAYLINK_VERSION_PACKAGE_MICRO': package_version['micro'], + 'JAYLINK_VERSION_PACKAGE': package_version_string, + 'JAYLINK_VERSION_LIBRARY_CURRENT': library_version['current'], + 'JAYLINK_VERSION_LIBRARY_REVISION': library_version['revision'], + 'JAYLINK_VERSION_LIBRARY_AGE': library_version['age'], + 'JAYLINK_VERSION_LIBRARY': library_version_string, + } +) + +install_headers([ + version_h, + 'libjaylink.h', + ], + subdir: 'libjaylink' +) + +jaylink = shared_library( + 'jaylink', + sources, + dependencies: [libusb], + version: library_version_string, + include_directories: include_dirs, + install: true, +) + +pkg = import('pkgconfig') + +pkg.generate( + jaylink, + name: meson.project_name(), + url: project_url, + description: project_description, + requires_private: [libusb], +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..1c7c59c --- /dev/null +++ b/meson.build @@ -0,0 +1,87 @@ +project( + 'libjaylink', 'c', + version: '0.3.1', + license: ' GPL-3.0-or-later', + default_options: [ + 'c_std=gnu99', + 'warning_level=3', + 'werror=true', + ] +) + +project_description = 'Library to access J-Link devices' +project_url = 'https://gitlab.zapb.de/libjaylink/libjaylink.git' + +option_usb = get_option('usb') + +include_dirs = include_directories('libjaylink') + +libusb = dependency( + 'libusb-1.0', + version: '>=1.0.16', + required: false +) + +have_usb = libusb.found() and (option_usb.enabled() or option_usb.auto()) + +if have_usb + add_project_arguments('-DHAVE_LIBUSB', language: 'c') +endif + +version = meson.project_version() +version_array = version.split('.') +major_version = version_array[0].to_int() +minor_version = version_array[1].to_int() +version_micro = version_array[2].to_int() + +package_version = { + 'major': version_array[0], + 'minor': version_array[1], + 'micro': version_array[2], +} + +git = find_program('git', required: false) + +if git.found() + git_tag = run_command([git, 'describe', '--dirty'], check: false).stdout().strip() + + if git_tag != '' + package_version_string = git_tag + else + package_version_string = version + endif +else + package_version_string = version +endif + +# Libtool interface version of libjaylink. This is not the same as the package +# version. For information about the versioning system of libtool, see: +# http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning + +library_version = { + 'current': 2, + 'revision': 0, + 'age': 2, +} + +library_version_string = '@0@.@1@.@2@'.format( + library_version['current'] - library_version['age'], + library_version['age'], + library_version['revision']) + +subdir('libjaylink') + +summary({ + 'Package version': package_version_string, + 'Library version': library_version_string, + }, + section: 'Project details' +) + +summary({ + 'USB': have_usb, + 'TCP': true + }, + section: 'Enabled transports', + bool_yn: true +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..a3694cc --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,3 @@ +option('usb', type : 'feature', value : 'auto', + description : 'enable USB transport (requires libusb-1.0)' +) |