Skip to content

Commit

Permalink
Merge pull request #2 from SloCompTech/develop
Browse files Browse the repository at this point in the history
Improved meson script
  • Loading branch information
SloCompTech authored Jul 16, 2018
2 parents c06336a + 20bfde5 commit 6009a3e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
10 changes: 8 additions & 2 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
SimpleTest = executable('SimpleTest','SimpleTest.cpp',
link_with: mylib)
# Build simple executable
SimpleTest = executable(
'SimpleTest',
'SimpleTest.cpp',
link_with: libbyteconvert
)

# Specify test for library
test('SimpleTest',SimpleTest)
18 changes: 13 additions & 5 deletions libbyteconvert/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
mylib = shared_library('byteconvert', 'ByteConvert.cpp',
version : meson.project_version(),
soversion : '0',
install: true)
install_headers('ByteConvert.hpp', subdir : 'ByteConvert')
# Install headers
install_headers('ByteConvert.hpp', subdir : 'ByteConvert')

# List sources
src = ['ByteConvert.cpp']

# Link & build libraries
libbyteconvert = library(
meson.project_name(),
src,
version : meson.project_version(),
install: true
)
34 changes: 21 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
project('libbyteconvert','cpp',
version:'0.1.4',
default_options : [
'c_std=c11',
'cpp_std=c++11'])
# Project info
project('byteconvert', 'cpp', version:'1.0.0', license: 'MIT', default_options : ['cpp_std=c++11'])

# Import modules
pkg = import('pkgconfig')

subdir('libbyteconvert')
subdir('libbyteconvert') # Run meson script in libbyteconvert dir
subdir('examples') # Run meson script in examples dir

pkg.generate(libraries : mylib,
version : meson.project_version(),
name : 'libbyteconvert',
filebase : 'byteconvert',
description : 'A conversion library.',
url: 'https://github.com/SloCompTech/ByteConvert_cpp')
# Package info
pkg.generate(
name : 'lib' + meson.project_name(),
description : 'Library for converting variables to bytes.',
version : meson.project_version(),
filebase : meson.project_name(),
url: 'https://github.com/SloCompTech/ByteConvert_cpp',
libraries : libbyteconvert
)

subdir('examples')
# Declare as dependency so it can be used elsewhere
libbyteconvert_inc = include_directories('libbyteconvert')
libbyteconvert_dep = declare_dependency(
link_with: libbyteconvert,
include_directories: libbyteconvert_inc
)

0 comments on commit 6009a3e

Please sign in to comment.