James Kuszmaul | 28cc825 | 2021-01-17 11:32:21 -0800 | [diff] [blame] | 1 | # Project definition |
| 2 | project('rawrtcc', 'c', |
| 3 | version: '0.1.3', |
| 4 | default_options: ['c_std=c99'], |
| 5 | meson_version: '>=0.46.0') |
| 6 | |
| 7 | # Set compiler warning flags |
| 8 | compiler = meson.get_compiler('c') |
| 9 | compiler_args = compiler.get_supported_arguments([ |
| 10 | '-Wall', |
| 11 | '-Wmissing-declarations', |
| 12 | '-Wmissing-prototypes', |
| 13 | '-Wstrict-prototypes', |
| 14 | '-Wbad-function-cast', |
| 15 | '-Wsign-compare', |
| 16 | '-Wnested-externs', |
| 17 | '-Wshadow', |
| 18 | '-Waggregate-return', |
| 19 | '-Wcast-align', |
| 20 | '-Wextra', |
| 21 | '-Wold-style-definition', |
| 22 | '-Wdeclaration-after-statement', |
| 23 | '-Wuninitialized', |
| 24 | '-Wshorten-64-to-32', |
| 25 | '-pedantic', |
| 26 | ]) |
| 27 | add_project_arguments(compiler_args, language: 'c') |
| 28 | |
| 29 | # Configuration |
| 30 | configuration = configuration_data() |
| 31 | |
| 32 | # Dependency: re |
| 33 | # Note: We need to force using our own fork until re has accepted all our patches |
| 34 | re_dep = dependency('librawrre', |
| 35 | version: '>=0.6.0', |
| 36 | fallback: ['re', 're_dep'], |
| 37 | required: true) |
| 38 | |
| 39 | # Dependencies list |
| 40 | dependencies = [ |
| 41 | re_dep, |
| 42 | ] |
| 43 | |
| 44 | # Version |
| 45 | version = meson.project_version() |
| 46 | version_array = version.split('.') |
| 47 | configuration.set_quoted('RAWRTCC_VERSION', version) |
| 48 | configuration.set('RAWRTCC_VERSION_MAJOR', version_array[0]) |
| 49 | configuration.set('RAWRTCC_VERSION_MINOR', version_array[1]) |
| 50 | configuration.set('RAWRTCC_VERSION_PATCH', version_array[2]) |
| 51 | |
| 52 | # Set debug level |
| 53 | configuration.set('RAWRTC_DEBUG_LEVEL', get_option('debug_level')) |
| 54 | |
| 55 | # Includes |
| 56 | include_dir = include_directories('include') |
| 57 | subdir('include') |
| 58 | |
| 59 | # Sources |
| 60 | subdir('src') |
| 61 | |
| 62 | # Build library |
| 63 | rawrtcc = library(meson.project_name(), sources, |
| 64 | dependencies: dependencies, |
| 65 | include_directories: include_dir, |
| 66 | install: true, |
| 67 | version: version) |
| 68 | |
| 69 | # Declare dependency |
| 70 | rawrtcc_dep = declare_dependency( |
| 71 | include_directories: include_dir, |
| 72 | link_with: rawrtcc) |
| 73 | |
| 74 | # Generate pkg-config file |
| 75 | pkg = import('pkgconfig') |
| 76 | pkg.generate(rawrtcc, |
| 77 | name: meson.project_name(), |
| 78 | description: 'Common code used in RAWRTC projects.', |
| 79 | url: 'https://github.com/rawrtc/rawrtc-common') |