Skip to content

Commit 6f1a53f

Browse files
committed
Added meson build framework
1 parent 22e1e09 commit 6f1a53f

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@
3131
*.out
3232
*.app
3333

34+
# Ninja
35+
/build*

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,31 @@ Have you ever wanted to transmit `int`,`short`,`long`,`double` or any other nume
88
## What you need to consider, when you are using this library
99
When you are using this library, you need to consider variable byte size, because if you are using different platforms, then there may be some errors, because int on platform 1 has 4 bytes and int on platform 2 may has 2 bytes.
1010

11+
## What you need to install this project ?
12+
You need [python3](https://www.python.org/), [ninja](https://ninja-build.org/) and [meson](http://mesonbuild.com).
13+
14+
```
15+
$ sudo apt-get install python3 python3-pip ninja-build
16+
```
17+
1118
## How to install
1219
```
1320
$ cd <library_directory>
21+
$ mkdir build
22+
$ meson build && cd build
23+
$ ninja
24+
$ sudo ninja install
1425
```
1526

27+
If you have problems, that library can't be found run `sudo ldconfig /usr/local/lib/x86_64-linux-gnu/` if you haven't changed prefix, else mofidy path.
28+
29+
## How to include library to your c or c++ project ?
30+
It's simple. At the top of your source file include library:
31+
``` c++
32+
#include<ByteConvert/ByteConvert.hpp>
33+
```
1634

35+
And when you compile add flag `-lbyteconvert`, example `g++ -std=c++11 MyProject.cpp -lbyteconvert -o MyProject`.
1736
## Examples
1837
Convert numeric variable for eg. `int`,`short`,`float`,`double` to array of bytes.
1938
``` c++

examples/SimpleTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <iostream>
22
#include <cstdlib>
3+
#include <ByteConvert/ByteConvert.hpp>
34

45
using namespace std;
56

libbyteconvert/meson.build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pkg = import('pkgconfig')
2+
mylib = shared_library('byteconvert', 'ByteConvert.cpp', version : '0.1.1', soversion : '0',install: true)
3+
install_headers('ByteConvert.hpp', subdir : 'ByteConvert')
4+
pkg.generate(libraries : mylib,
5+
version : '0.1.1',
6+
name : 'libbyteconvert',
7+
filebase : 'libbyteconvert',
8+
description : 'A conversion library.')

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project('libbyteconvert','cpp',version:'0.1.1',default_options : ['c_std=c11', 'cpp_std=c++11'])
2+
subdir('libbyteconvert')

0 commit comments

Comments
 (0)