|
| 1 | +project( |
| 2 | + 'libserialport', |
| 3 | + 'c', |
| 4 | + version: '0.1.1', |
| 5 | + license: 'LGPL3+', |
| 6 | + meson_version: '>= 0.47.0', |
| 7 | +) |
| 8 | + |
| 9 | +libserialport_includes = include_directories(['.']) |
| 10 | + |
| 11 | +libserialport_headers = files('libserialport.h') |
| 12 | + |
| 13 | +libserialport_sources = files('serialport.c', 'timing.c') |
| 14 | + |
| 15 | +libserialport_cflags = [] |
| 16 | +libserialport_ldflags = [] |
| 17 | + |
| 18 | +if host_machine.system() == 'linux' |
| 19 | + libserialport_sources += files('linux.c', 'linux_termios.c') |
| 20 | + libserialport_cflags += '-DLIBSERIALPORT_ATBUILD' |
| 21 | +elif host_machine.system() == 'windows' |
| 22 | + libserialport_sources += files('windows.c') |
| 23 | + libserialport_cflags += '-DLIBSERIALPORT_MSBUILD' |
| 24 | + libserialport_ldflags += '-lsetupapi' |
| 25 | +elif host_machine.system() == 'darwin' |
| 26 | + libserialport_sources += files('macosx.c') |
| 27 | + libserialport_cflags += '-DLIBSERIALPORT_ATBUILD' |
| 28 | +elif host_machine.system() == 'freebsd' |
| 29 | + libserialport_sources += files('freebsd.c') |
| 30 | + libserialport_cflags += '-DLIBSERIALPORT_ATBUILD' |
| 31 | +endif |
| 32 | + |
| 33 | +libserialport_lib = library( |
| 34 | + 'libserialport', |
| 35 | + libserialport_sources, |
| 36 | + c_args: libserialport_cflags, |
| 37 | + link_args: libserialport_ldflags, |
| 38 | + include_directories: libserialport_includes, |
| 39 | + version: meson.project_version(), |
| 40 | + install: true, |
| 41 | +) |
| 42 | + |
| 43 | +install_headers(libserialport_headers) |
| 44 | + |
| 45 | +libserialport_dep = declare_dependency( |
| 46 | + include_directories: libserialport_includes, |
| 47 | + link_with: libserialport_lib, |
| 48 | +) |
0 commit comments