Skip to content

Commit 6009a3e

Browse files
authored
Merge pull request #2 from SloCompTech/develop
Improved meson script
2 parents c06336a + 20bfde5 commit 6009a3e

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

examples/meson.build

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
SimpleTest = executable('SimpleTest','SimpleTest.cpp',
2-
link_with: mylib)
1+
# Build simple executable
2+
SimpleTest = executable(
3+
'SimpleTest',
4+
'SimpleTest.cpp',
5+
link_with: libbyteconvert
6+
)
7+
8+
# Specify test for library
39
test('SimpleTest',SimpleTest)

libbyteconvert/meson.build

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
mylib = shared_library('byteconvert', 'ByteConvert.cpp',
2-
version : meson.project_version(),
3-
soversion : '0',
4-
install: true)
5-
install_headers('ByteConvert.hpp', subdir : 'ByteConvert')
1+
# Install headers
2+
install_headers('ByteConvert.hpp', subdir : 'ByteConvert')
3+
4+
# List sources
5+
src = ['ByteConvert.cpp']
6+
7+
# Link & build libraries
8+
libbyteconvert = library(
9+
meson.project_name(),
10+
src,
11+
version : meson.project_version(),
12+
install: true
13+
)

meson.build

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
project('libbyteconvert','cpp',
2-
version:'0.1.4',
3-
default_options : [
4-
'c_std=c11',
5-
'cpp_std=c++11'])
1+
# Project info
2+
project('byteconvert', 'cpp', version:'1.0.0', license: 'MIT', default_options : ['cpp_std=c++11'])
3+
4+
# Import modules
65
pkg = import('pkgconfig')
76

8-
subdir('libbyteconvert')
7+
subdir('libbyteconvert') # Run meson script in libbyteconvert dir
8+
subdir('examples') # Run meson script in examples dir
99

10-
pkg.generate(libraries : mylib,
11-
version : meson.project_version(),
12-
name : 'libbyteconvert',
13-
filebase : 'byteconvert',
14-
description : 'A conversion library.',
15-
url: 'https://github.com/SloCompTech/ByteConvert_cpp')
10+
# Package info
11+
pkg.generate(
12+
name : 'lib' + meson.project_name(),
13+
description : 'Library for converting variables to bytes.',
14+
version : meson.project_version(),
15+
filebase : meson.project_name(),
16+
url: 'https://github.com/SloCompTech/ByteConvert_cpp',
17+
libraries : libbyteconvert
18+
)
1619

17-
subdir('examples')
20+
# Declare as dependency so it can be used elsewhere
21+
libbyteconvert_inc = include_directories('libbyteconvert')
22+
libbyteconvert_dep = declare_dependency(
23+
link_with: libbyteconvert,
24+
include_directories: libbyteconvert_inc
25+
)

0 commit comments

Comments
 (0)