Skip to content

Add meson build system for C++ #41

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add meson build system for C++ #41

wants to merge 2 commits into from

Conversation

bonimy
Copy link

@bonimy bonimy commented Jun 3, 2022

I'm writing a project using meson as the build system as sphgeom
happens to be a dependence. There were a few issues trying to build with
cmake and I found it easier to just add meson support.

'UnitVector3d.cc',
'utils.cc',
'Vector3d.cc']
sphgeom = static_library(

Choose a reason for hiding this comment

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

Why a static library, particularly? If you just use library() it becomes the choice of the builder (via -Ddefault_library=static, but it also accepts =both to build both at the same time).

The cmake build uses shared, not static, though cmake doesn't really have a good way to choose between the two.

Copy link
Author

Choose a reason for hiding this comment

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

We can do just library(). I would assume that I didn't know I had the option at that time.


subdir('src')

pkg_mod = import('pkgconfig')

Choose a reason for hiding this comment

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

In addition to creating a pkg-config file, you may also want to create a declare_dependency() that adds the incdir and the sphgeom library, as an interface, which then allows using this meson.build as a Meson subproject with automatic dependency fallback.

Copy link
Author

Choose a reason for hiding this comment

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

how would I do declare_dependency()? I guess I'm not following.

Comment on lines +1 to +5
incdir = include_directories('../include/')

install_headers(
'../include/lsst/sphgeom/Angle.h',
'../include/lsst/sphgeom/AngleInterval.h',

Choose a reason for hiding this comment

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

Personally, I would define this in subdir('include') so you don't need all these ../ everywhere. :)

Copy link
Author

Choose a reason for hiding this comment

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

I didn't know that was possible. No objections from me.

@bonimy bonimy force-pushed the meson branch 3 times, most recently from 2c4f45a to 8a2e1e1 Compare June 3, 2022 03:20
@bonimy
Copy link
Author

bonimy commented Aug 11, 2022

Just bumping to say that I've been in the process of moving states, but I'll hopefully finish this PR soon once things settle down.

@timj
Copy link
Member

timj commented Aug 16, 2024

I rebased this PR just in case there is still interest in it.

I'm writing a project using meson as the build system as sphgeom
happens to be a dependence. There were a few issues trying to build with
cmake and I found it easier to just add meson support.
@bonimy
Copy link
Author

bonimy commented Jun 16, 2025

Sorry for never getting back to this. I ended up switching career paths.

If someone wants to take over this branch to merge it, please do. I haven't worked with meson for so long that I don't think I'd remember how to finish this branch out.

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.

3 participants