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 for C++ #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
9 changes: 9 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project('sphgeom', 'cpp')

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.

pkg_mod.generate(
sphgeom,
description : 'C++ spherical geometry primitives for LSST Data Management'
)
69 changes: 69 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
incdir = include_directories('../include/')

install_headers(
'../include/lsst/sphgeom/Angle.h',
'../include/lsst/sphgeom/AngleInterval.h',
Comment on lines +1 to +5

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. :)

'../include/lsst/sphgeom/BigInteger.h',
'../include/lsst/sphgeom/Box3d.h',
'../include/lsst/sphgeom/Box.h',
'../include/lsst/sphgeom/Chunker.h',
'../include/lsst/sphgeom/Circle.h',
'../include/lsst/sphgeom/codec.h',
'../include/lsst/sphgeom/CompoundRegion.h',
'../include/lsst/sphgeom/constants.h',
'../include/lsst/sphgeom/ConvexPolygon.h',
'../include/lsst/sphgeom/curve.h',
'../include/lsst/sphgeom/Ellipse.h',
'../include/lsst/sphgeom/HtmPixelization.h',
'../include/lsst/sphgeom/Interval1d.h',
'../include/lsst/sphgeom/Interval.h',
'../include/lsst/sphgeom/LonLat.h',
'../include/lsst/sphgeom/Matrix3d.h',
'../include/lsst/sphgeom/Mq3cPixelization.h',
'../include/lsst/sphgeom/NormalizedAngle.h',
'../include/lsst/sphgeom/NormalizedAngleInterval.h',
'../include/lsst/sphgeom/orientation.h',
'../include/lsst/sphgeom/Pixelization.h',
'../include/lsst/sphgeom/python.h',
'../include/lsst/sphgeom/Q3cPixelization.h',
'../include/lsst/sphgeom/RangeSet.h',
'../include/lsst/sphgeom/Region.h',
'../include/lsst/sphgeom/Relationship.h',
'../include/lsst/sphgeom/UnitVector3d.h',
'../include/lsst/sphgeom/utils.h',
'../include/lsst/sphgeom/Vector3d.h',
subdir : 'lsst/sphgeom'
)
sphgeom_sources = [
'Angle.cc',
'AngleInterval.cc',
'BigInteger.cc',
'Box3d.cc',
'Box.cc',
'Chunker.cc',
'Circle.cc',
'CompoundRegion.cc',
'ConvexPolygon.cc',
'Ellipse.cc',
'HtmPixelization.cc',
'Interval1d.cc',
'LonLat.cc',
'Matrix3d.cc',
'Mq3cPixelization.cc',
'NormalizedAngle.cc',
'NormalizedAngleInterval.cc',
'orientation.cc',
'Q3cPixelization.cc',
'RangeSet.cc',
'Region.cc',
'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.

'sphgeom',
sphgeom_sources,
include_directories : incdir,
install: true)
dep_sphgeom = declare_dependency(
include_directories : incdir,
link_with : sphgeom)
Loading