Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson build-system support #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

soerengrunewald
Copy link

Although the Makefile works perfectly fine as it is right now, it is somewhat dated. Also it makes cross-compiling and packaging a bit tedious.

So this will allow to build the library and some of the examples with meson.

[Why]
Although the Makefile works perfectly fine as it is right now. It is
somewhat dated. Also it makes cross-compiling and packaging a bit
tedious.

Signed-off-by: Soeren Grunewald <soeren.grunewald@desy.de>
@@ -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. :))


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.

Comment on lines +6 to +21
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

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.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants