Skip to content
Open
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
8 changes: 8 additions & 0 deletions examples/common-cxx/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
libexample_commoncxx = static_library('common', 'scpi-def.cpp',
include_directories : [ inc, include_directories('.') ],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since meson 0.50 (you specified an 0.60 minimum requirement), the arguments to include_directories: [...] can be a string, and it is automatically converted as though the include_directories() function was used. The function is still useful for e.g. defining the inc variable in one directory and using it in another. :)

That being said, implicit_include_directories: true is the default and means that executables/libraries already, implicitly, have '.' as an include directory. So this is redundant.

(You still need it down below for declare_dependency. :))

)

libexample_commoncxx_dep = declare_dependency(
include_directories : [ inc, include_directories('.') ],
link_with : libexample_commoncxx,
)
8 changes: 8 additions & 0 deletions examples/common/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
libexample_common = static_library('common', 'scpi-def.c',
include_directories : [ inc, include_directories('.') ],
)

libexample_common_dep = declare_dependency(
include_directories : [ inc, include_directories('.') ],
link_with : libexample_common,
)
13 changes: 13 additions & 0 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
subdir('common')
subdir('common-cxx')

subdir('test-interactive')
subdir('test-interactive-cxx')
subdir('test-parser')

subdir('test-tcp')
subdir('test-tcp-srq')

##subdir('test-CVI_w_GUI')
##subdir('test-LwIP-netconn')
subdir('test-vxi11')
1 change: 1 addition & 0 deletions examples/test-interactive-cxx/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
executable('test-interactive', 'main.cpp', dependencies: [ libscpi_static_dep, libexample_commoncxx_dep ])
1 change: 1 addition & 0 deletions examples/test-interactive/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
executable('test-interactive', 'main.c', dependencies: [ libscpi_static_dep, libexample_common_dep ])
1 change: 1 addition & 0 deletions examples/test-parser/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
executable('test-parser', 'main.c', dependencies: [ libscpi_static_dep, libexample_common_dep ])
1 change: 1 addition & 0 deletions examples/test-tcp-srq/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
executable('test-tcp-srq', 'main.c', dependencies: [ libscpi_static_dep, libexample_common_dep ])
1 change: 1 addition & 0 deletions examples/test-tcp/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
executable('test-tcp', 'main.c', dependencies: [ libscpi_static_dep, libexample_common_dep ])
13 changes: 13 additions & 0 deletions examples/test-vxi11/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
vxi11_dep = dependency('vxi11', required: false)
tirpc_dep = dependency('libtirpc', required: false)

if vxi11_dep.found() and tirpc_dep.found()
executable('test-vxi11',
[ 'main.c', 'vxi11_xdr.c' ],
dependencies: [
libscpi_static_dep,
libexample_common_dep,
tirpc_dep, vxi11_dep,
]
)
endif
18 changes: 18 additions & 0 deletions libscpi/inc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
inc = include_directories('.')

headers = files([
'scpi/cc.h',
'scpi/config.h',
'scpi/constants.h',
'scpi/error.h',
'scpi/expression.h',
'scpi/ieee488.h',
'scpi/minimal.h',
'scpi/parser.h',
'scpi/scpi.h',
'scpi/types.h',
'scpi/units.h',
'scpi/utils.h',
])

install_headers(headers, subdir: 'scpi')
3 changes: 3 additions & 0 deletions libscpi/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
subdir('inc')
subdir('src')
subdir('test')
37 changes: 37 additions & 0 deletions libscpi/src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 'scpi.g'
sources = files([
'error.c',
'expression.c',
'fifo.c',
'ieee488.c',
'lexer.c',
'minimal.c',
'parser.c',
'units.c',
'utils.c',
])

inc_private = include_directories( '.' )

libscpi = both_libraries('scpi',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of both_libraries, I would generally recommend using library() but setting the meson project option default_options: ['default_library=both'].

This allows end users to decide which ones they need, if they really want to. Unless there's a technical reason why the software requires that all users have both of them.

sources,
soversion: meson.project_version(),
include_directories: [ inc, inc_private ],
install: true,
)

libscpi_dynamic_dep = declare_dependency(
include_directories: inc,
link_with: libscpi.get_shared_lib(),
)

libscpi_static_dep = declare_dependency(
include_directories: inc,
link_with: libscpi.get_static_lib(),
)

pkg = import('pkgconfig')
pkg.generate(libscpi,
name: 'libscpi',
description : 'SCPI parser library',
)
21 changes: 21 additions & 0 deletions libscpi/test/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

cunit_dep = dependency('cunit', required: false)
if cunit_dep.found()
deps = [ libscpi_static_dep, cunit_dep ]

test('fifo',
executable('fifo', 'test_fifo.c', dependencies: deps)
)

test('lexer_parser',
executable('lexer_parser', 'test_lexer_parser.c', dependencies: deps)
)

test('parser',
executable('parser', 'test_parser.c', dependencies: deps)
)

test('scpi_utils',
executable('scpi_utils', 'test_scpi_utils.c', dependencies: deps)
)
endif
Comment on lines +6 to +21

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably do all this with a foreach loop, too.

20 changes: 20 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
project('scpi-parser', [ 'c', 'cpp' ],
version : '2.2',
license : 'BSD',
meson_version : '>= 0.60',
default_options : [
'warning_level=3',
'buildtype=debugoptimized',
]
)


c_args = []
cpp_args = []

cc = meson.get_compiler('c')

install_data(files(['LICENSE', 'README.md']))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current Makefile doesn't install README.md anywhere... I wonder how generally useful this is?

The LICENSE file, since meson 1.1.0, can be handled via https://mesonbuild.com/Reference-manual_functions.html#project_license_files


subdir('libscpi')
subdir('examples')