diff --git a/examples/meson.build b/examples/meson.build index e5f46e7..66c32f1 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -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) \ No newline at end of file diff --git a/libbyteconvert/meson.build b/libbyteconvert/meson.build index edd1ecb..1293fb9 100644 --- a/libbyteconvert/meson.build +++ b/libbyteconvert/meson.build @@ -1,5 +1,13 @@ -mylib = shared_library('byteconvert', 'ByteConvert.cpp', - version : meson.project_version(), - soversion : '0', - install: true) -install_headers('ByteConvert.hpp', subdir : 'ByteConvert') \ No newline at end of file +# 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 +) \ No newline at end of file diff --git a/meson.build b/meson.build index f0e149f..07a4253 100644 --- a/meson.build +++ b/meson.build @@ -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') \ No newline at end of file +# 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 +) \ No newline at end of file