lv2 / pugl

A minimal portable API for embeddable GUIs
https://gitlab.com/lv2/pugl/
ISC License
181 stars 35 forks source link

How to use cpp bindings? #92

Closed apoorv569 closed 2 years ago

apoorv569 commented 2 years ago

I have a project that also uses meson build system, I have added a wrap file that pulls in the pugl repo and in my meson.build file I have this,

pugl_subproject = subproject('pugl',
                             default_options: [
                               'examples=disabled',
                               'tests=disabled',
                               'strict=false',
                               'cairo=disabled',
                               'opengl=enabled',
                               'vulkan=disabled',
                               'stub=false',
                               'docs=disabled',
                             ])
pugl = pugl_subproject.get_variable('pugl_dep')
# pugl_inc = pugl_subproject.get_variable('includes')
# gl_dep = pugl_subproject.get_variable('opengl_dep')
# pl_src = pugl_subproject.get_variable('platform_sources')
# cmn_src = pugl_subproject.get_variable('common_sources')
# gl_src = pugl_subproject.get_variable('sources')

executable(meson.project_name(),
           sources: [src],
           dependencies: [pugl])

by default I only get .h header files which are C. How can I use the cpp bindings instead?

drobilla commented 2 years ago

https://github.com/lv2/pugl/blob/c3bc53d45d26363da38ede93eaeb9aa6145643e3/bindings/cpp/meson.build#L6

eli-schwartz commented 2 years ago

@apoorv569,

TBH you should probably be using a [provide] section in the wrap file, and mapping each declare_dependency to its pkg-config name.

@drobilla,

This could actually be made slightly more ergonomic with

if meson.version().version_compare('>=0.54.0')
    meson.override_dependency('puglpp-@0@'.format(major_version), puglpp_dep)
endif
drobilla commented 2 years ago

@eli-schwartz Noted, thanks.

I'm still not entirely sure about the best approach for including C++ bindings with C projects like this - at the very least, sharing the version number is problematic, but I need yet another project like a hole in the head. Needs to be figured out before a stable release...

mfisher31 commented 2 years ago

Just put .hpp along side the .h ones :)

mfisher31 commented 2 years ago

then they share the same dep

drobilla commented 2 years ago

"at the very least, sharing the version number is problematic"

drobilla commented 2 years ago

71fa733

mfisher31 commented 2 years ago

Yeah, I was just messing around. Knew you wouldn't go for that 😇