Skip to content

Commit

Permalink
Build via Meson
Browse files Browse the repository at this point in the history
  • Loading branch information
lcallarec committed Mar 23, 2020
1 parent 5afddb9 commit 274b484
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
example
test
export.png
export.png
build
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,16 @@ var filename = "chart_export.png";
chart.to_png(filename);
```

## Deps

| dependency |
|----------------|
| libcairo2-dev |
| libgee-0.8-dev |
| libgtk-3-dev |

## Example

Example source code available [here](examples/live-chart.vala)

Compile and run with (you need to have cario-dev installed)
Compile and run with :

```bash
$ make
meson build
ninja -C build
./build/examples/example
```

## Dependencies
Expand Down
2 changes: 2 additions & 0 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
executable('example', 'live-chart.vala', dependencies: deps + [livechart_dep])

19 changes: 19 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
project('live-chart', ['vala', 'c'])

cc = meson.get_compiler('c')
libm = cc.find_library('m', required: true)

gtk = dependency('gtk+-3.0', version: '>= 3.22')
gee = dependency('gee-0.8')

vala_args = ['--target-glib=2.50']

deps = [
gtk,
gee,
libm
]

subdir('src')
subdir('tests')
subdir('examples')
26 changes: 26 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

sources = files(
'area.vala',
'axis.vala',
'background.vala',
'bar.vala',
'bounds.vala',
'chart.vala',
'config.vala',
'drawable_serie.vala',
'drawable.vala',
'grid.vala',
'legend.vala',
'line_area.vala',
'line.vala',
'point.vala',
'points.vala',
'serie.vala',
'smooth_line_area.vala',
'smooth_line.vala',
'value.vala',
'values.vala'
)

livechart_static_lib = static_library('livechart', [sources], dependencies: deps, vala_args: vala_args)
livechart_dep = declare_dependency(include_directories: include_directories('.'), link_with: livechart_static_lib)
14 changes: 14 additions & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

test_sources = files(
'area.vala',
'axis.vala',
'bounds.vala',
'chart.vala',
'config.vala',
'points.vala',
'runner.vala',
'values.vala'
)

test('livechart-test', executable('livechart-test',test_sources, dependencies: deps + [livechart_dep]))

0 comments on commit 274b484

Please sign in to comment.