| 12345678910111213141516171819202122232425262728293031323334353637 |
- project('invercargill-sql', ['vala', 'c'], version: '0.1')
- # Required dependencies
- glib_dep = dependency('glib-2.0')
- gobject_dep = dependency('gobject-2.0')
- invercargill_dep = dependency('invercargill-1')
- sqlite_dep = dependency('sqlite3')
- libpq_dep = dependency('libpq')
- # libpq: Vala's libpq.vapi emits "#include <postgresql/libpq-fe.h>" in the
- # generated C, but distros disagree on the header location (Debian keeps
- # them under /usr/include/postgresql, Fedora-style layouts install them
- # flat in /usr/include). Probe with the C compiler and, when the flat
- # layout is found, create a compat include dir with a postgresql/ symlink
- # tree in the build directory.
- cc = meson.get_compiler('c')
- libpq_compat_args = []
- if not cc.has_header('postgresql/libpq-fe.h', dependencies: libpq_dep)
- if not cc.has_header('libpq-fe.h', dependencies: libpq_dep)
- error('libpq headers not found; install libpq-devel/postgresql-devel')
- endif
- pg_includedir = run_command(
- find_program('pkg-config'), '--variable=includedir', 'libpq',
- check: true,
- ).stdout().strip()
- pg_compat = meson.current_build_dir() / 'pg-compat/postgresql'
- run_command('mkdir', '-p', pg_compat, check: true)
- foreach h : ['libpq-fe.h', 'libpq-events.h']
- run_command('ln', '-sfn', pg_includedir / h, pg_compat / h, check: true)
- endforeach
- run_command('ln', '-sfn', pg_includedir / 'libpq', pg_compat / 'libpq', check: true)
- libpq_compat_args = ['-I' + meson.current_build_dir() / 'pg-compat']
- endif
- # Subdirectories
- subdir('src')
- subdir('examples')
|