Skip to content

Commit

Permalink
PocPlot initial github commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Stafford committed Sep 9, 2020
1 parent c628d72 commit d6d6ed0
Show file tree
Hide file tree
Showing 29 changed files with 6,808 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*.o
*.so
*.gir
*.typelib
build*/

# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

*.log
*.sqlite
61 changes: 59 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,59 @@
# pocplot
Simple GTK3/GObject Graph Plotting
# PocPlot

A simple GTK3/GObject graph plotting library.

This project was born from the need for making some nice looking plots in
another project I was working on. Many years ago I had used the plotting
facilities from GtkExtra but this module was never ported to GTK3. Having
looked into porting the GtkExtra modules from GTK2 I decided it was too complex
a task, given my requirements, so I started looking around for something else.
I found Goat Plot but this had issues with recent GTK3. However it was almost
what I wanted. Ultimately after a false start at fixing the issues there I
decided to sketch out some ideas and write my own.

PocPlot is the result of that effort. I've been using this with no problems
other than occasional bug-fixes for about ten months at the time of writing
(September 2020).

## Installation

PocPlot uses the
[Meson build system](https://mesonbuild.com/Getting-meson.html).
Refer to the Meson manual for standard configuration options.

Meson supports multiple build system backends. To build with
[Ninja](https://ninja-build.org/) do the following:

``` sh
$ meson [options] --buildtype=release builddir
$ ninja -C builddir install
```

The following build options are supported (defaults in bold text):
* -Ddocs=true/**false** - build and install the documentation.
* -Dintrospection=**true**/false - enable GObject introspection.
* -Dvapi=true/**false** - use `vapigen` to build Vala support.

A catalogue file, `poc-catalog.xml` is installed for use with Glade.

Note that the meson/ninja installer does not require an explicit `sudo`,
instead it will prompt for a password during install.

## Dependencies

PocPlot depends only on recent gtk3 and glib.

## Documentation

Documentation is built during installation and is accessible using Devhelp.
Usage should be fairly straightforward.

## Why PocPlot?

The name PocPlot is an hommage to GoatPlot (poc is Irish for a he-goat).
Being short, `poc` is also a convenient GObject namespace.

## Licence

PocPlot is licensed under the GNU Lesser General Public License version 2.1.
Please refer to LICENSE for full details.
27 changes: 27 additions & 0 deletions docs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')

glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')

poc_ignore = [
'pocbag.c',
'pocbag.h',
'mathextra.h',
'mathextra.h.in',
]

gnome.gtkdoc('poc',
dependencies : [declare_dependency(link_with : lib), gtkdep],
ignore_headers : poc_ignore,
gobject_typesfile : ['poc.types'],
main_xml : meson.project_name() + '-docs.xml',
src_dir : [meson.source_root(), meson.build_root()],
mkdb_args: [
'--default-includes=poc.h',
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(glib_docpath),
],
install : true
)
92 changes: 92 additions & 0 deletions docs/poc-docs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0"?>
<book xmlns="http://docbook.org/ns/docbook" version="5.0"
xmlns:xi="http://www.w3.org/2003/XInclude"
id="index">
<info>
<title>PocPlot Reference Manual</title>
<releaseinfo>
This document is for the PocPlot library.
</releaseinfo>
<copyright>
<year>2020</year>
<holder>Brian Stafford</holder>
</copyright>
</info>

<part>
<title>PocPlot Overview</title>

<xi:include href="overview.xml"><xi:fallback /></xi:include>

<chapter>
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
</part>

<part>
<title>PocPlot Objects and Types</title>

<chapter id="Plot">
<title>PocPlot Plot Objects</title>
<xi:include href="xml/pocplot.xml" />
<xi:include href="xml/pocdataset.xml" />
<xi:include href="xml/pocdatasetspline.xml" />
<xi:include href="xml/pocaxis.xml" />
</chapter>

<chapter id="Legend">
<title>PocPlot Additional Objects</title>
<xi:include href="xml/poclegend.xml" />
<xi:include href="xml/pocsample.xml" />
</chapter>

<chapter id="Types">
<title>PocPlot Types</title>
<xi:include href="xml/poctypes.xml" />
</chapter>

<chapter id="Other">
<title>PocPlot Internals</title>
<xi:include href="xml/pocspline.xml" />
</chapter>
</part>

<part>
<title>Symbols</title>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback/></xi:include>
</index>
<index id="api-index-deprecated">
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback/></xi:include>
</index>
</part>

<part>
<title>License</title>
<para>
PocPlot is free software; you can redistribute it and/or modify it under
the terms of the <citetitle>GNU Lesser General Public License</citetitle>
as published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
</para>

<para>
PocPlot is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the <citetitle>GNU Lesser General
Public License</citetitle> for more details.
</para>

<para>
You should have received a copy of the <citetitle>GNU Lesser General
Public License</citetitle> along with PocPlot; if not, see <ulink
type="http"
url="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</ulink>.
</para>
</part>

<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>
11 changes: 11 additions & 0 deletions docs/poc.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
poc_axis_get_type
poc_axis_mode_get_type
poc_dataset_get_type
poc_dataset_spline_get_type
poc_double_array_get_type
poc_legend_get_type
poc_line_style_get_type
poc_plot_get_type
poc_point_array_get_type
poc_point_get_type
poc_sample_get_type
29 changes: 29 additions & 0 deletions mathextra.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* This file is part of PocPlot.
*
* PocPlot is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* PocPlot is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with PocPlot; if not, see
* <https://www.gnu.org/licenses/>.
*
* Copyright 2020 Brian Stafford
*/
#ifndef _mathextra_h
#define _mathextra_h

#mesondefine HAVE_EXP10

#ifndef HAVE_EXP10
# define exp10(x) exp ((x) * M_LN10)
# define exp10f(x) expf ((x) * (float) M_LN10)
#endif

#endif
112 changes: 112 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
project('poc', 'c', version : '0.1.0', default_options: ['c_std=c11'])
pkg = import('pkgconfig')
gnome = import('gnome')

pocsource = [
'poc.h',
'pocaxis.c',
'pocaxis.h',
'pocbag.c',
'pocbag.h',
'pocdataset.c',
'pocdataset.h',
'pocdatasetspline.c',
'pocdatasetspline.h',
'poclegend.c',
'poclegend.h',
'pocplot.c',
'pocplot.h',
'pocsample.c',
'pocsample.h',
'pocspline.c',
'pocspline.h',
'poctypes.c',
'poctypes.h',
]

cflags = [
'-D__poc_compile__=1',
'-DGSEAL_ENABLE',
'-DG_DISABLE_DEPRECATED',
'-DG_DISABLE_SINGLE_INCLUDES',
'-DGDK_DISABLE_DEPRECATED',
'-DGTK_DISABLE_DEPRECATED',
'-DGDK_DISABLE_SINGLE_INCLUDES',
'-DGTK_DISABLE_SINGLE_INCLUDES',
'-DGTK_MULTIDEVICE_SAFE=1',
]

cflags_warnings = [
'-Wstrict-prototypes',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Walloc-zero',
'-Wduplicated-branches',
'-Wpointer-arith',
'-Wcast-align',
'-Wwrite-strings',
'-Wdeclaration-after-statement',
'-Wshadow',
'-Wredundant-decls',
'-Wpacked',
'-Wbad-function-cast',
]

cc = meson.get_compiler('c')
if get_option('warning_level') == '3'
cflags += cflags_warnings
endif
add_project_arguments(cc.get_supported_arguments(cflags), language: 'c')

mdep = cc.find_library('m', required: false)
gtkdep = dependency('gtk+-3.0')

mapfile = 'pocplot.map'
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)

lib = library('poc', pocsource,
link_args : vflag,
link_depends : mapfile,
dependencies : [gtkdep, mdep],
soversion : meson.project_version(),
install : true)

host_os = host_machine.system()
os_win32 = host_os.contains('mingw') or host_os.contains('windows')

if get_option('introspection')
gir = gnome.generate_gir(lib,
sources : pocsource,
nsversion : '0.1',
namespace : 'Poc',
identifier_prefix: 'Poc',
symbol_prefix: 'poc',
includes: ['GLib-2.0', 'GObject-2.0', 'Gtk-3.0'],
install: true
)

if get_option('vapi')
vapi = gnome.generate_vapi('poc-0.1',
sources: gir[0],
packages: [ 'gtk+-3.0' ],
install: true,
metadata_dirs: [ meson.current_source_dir() ],
)
endif
endif

if get_option('docs')
subdir ('docs')
endif

mathextra = configuration_data()
mathextra.set('HAVE_EXP10', cc.has_function('exp10', prefix : '#include <math.h>'))
configure_file(input : 'mathextra.h.in',
output : 'mathextra.h',
configuration : mathextra)

install_headers(['poc.h', 'pocplot.h', 'pocdataset.h', 'pocaxis.h', 'pocsample.h',
'pocdatasetspline.h', 'poclegend.h', 'pocspline.h', 'poctypes.h'])
pkg.generate(lib)

install_data(['poc-catalog.xml'], install_dir: 'share/glade/catalogs')
3 changes: 3 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
option('docs', type: 'boolean', value: 'false')
option('introspection', type: 'boolean', value: 'true')
option('vapi', type: 'boolean', value: 'false')
Loading

0 comments on commit d6d6ed0

Please sign in to comment.