summaryrefslogtreecommitdiffstats
path: root/meson.build
blob: ad10f25709514afa453aacd817d5d2e48c610bcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
project(
    'djinterop',
    'cpp', 'c',
    version: '0.14.2',
    license: 'LGPL-3.0',
    default_options: ['cpp_std=c++17', 'default_library=shared'])

cpp_compiler = meson.get_compiler('cpp')

if cpp_compiler.get_id() == 'msvc'
    # Ask MSVC to populate the __cplusplus macro properly.
    add_global_arguments('/Zc:__cplusplus', language: 'cpp')
endif

# Set hidden visibility arguments for everything the project, if available.
default_library_type = get_option('default_library')
if default_library_type != 'static'
    if cpp_compiler.has_argument('-fvisibility=hidden')
        add_global_arguments('-fvisibility=hidden', language: ['c', 'cpp'])
    endif
else
	add_global_arguments('-DDJINTEROP_STATIC', language: 'cpp')
endif


# libdl is "special", not like other dependencies
dl_dep = cpp_compiler.find_library('dl', required: false)

thread_dep = dependency('threads')
zlib_dep = dependency('zlib', version: '>=1.2.8', fallback: ['zlib', 'zlib_dep'])

# We may either use a system-wide installation of SQLite, or our embedded one.
if get_option('system_sqlite')
    sqlite3_dep = dependency('sqlite3', version: '>=3.11.0')
else
    message('Using embedded SQLite')
    sqlite3_dep = declare_dependency(
        include_directories: 'ext/sqlite-amalgamation',
        sources: 'ext/sqlite-amalgamation/sqlite3.c',
        compile_args: ['-DSQLITE_OMIT_LOAD_EXTENSION'],
        version: '3.33.0')
endif
sqlite_modern_cpp_dep = declare_dependency(
    dependencies: [sqlite3_dep],
    include_directories: 'ext/sqlite_modern_cpp')

inc = include_directories('include')

subdir('include')
subdir('src')
subdir('testdata')
subdir('test')
subdir('example')

# TODO - add Doxygen support

pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : djinterop_lib,
                 version : meson.project_version(),
                 name : 'lib' + meson.project_name(),
                 filebase : meson.project_name(),
                 description : 'Provides access to database formats used ' +
                    'to store information about DJ record libraries')