Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build system cleanups #274

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Graphene
### A thin layer of types for graphic libraries

### A thin layer of types for graphic libraries

![Linux Build](https://github.com/ebassi/graphene/workflows/Ubuntu%20Build/badge.svg)
![MSVC Build](https://github.com/ebassi/graphene/workflows/MSVC%20Build/badge.svg)
![MSYS2 Build](https://github.com/ebassi/graphene/workflows/MSYS2%20Build/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/ebassi/graphene/badge.svg?branch=master)](https://coveralls.io/github/ebassi/graphene?branch=master)
[![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)

When creating graphic libraries you most likely end up dealing with points
Expand Down Expand Up @@ -67,10 +67,10 @@ First of all, clone the Git repository:

Then run:

$ meson _build # on Windows, it may be "meson.py"
$ cd _build
$ ninja test
# ninja install
$ meson setup _build
$ meson compile -C _build
$ meson test -C _build
$ meson install -C _build

It is possible, when building Graphene, to disable specific optimizations by
using configuration options:
Expand Down Expand Up @@ -120,12 +120,19 @@ Please note that on some MSYS2 installations the Meson binary may be called

## Documentation

### Contributing

You can follow the [contribution guide](./CONTRIBUTING.md) if you want to
participate in this project. Graphene also has a [code of
conduct](./CODE_OF_CONDUCT.md), so make sure to follow it when interacting
on the project's issue tracker.

### Release notes

The release notes are available on the Graphene
[wiki](https://github.com/ebassi/graphene/wiki/Release-Notes).

### Available types
### Reference

Graphene provides common types needed to handle 3D transformations:

Expand All @@ -139,7 +146,7 @@ Graphene provides common types needed to handle 3D transformations:
* [vectors](http://ebassi.github.io/graphene/docs/graphene-Vectors.html) (2, 3, or 4-sized)
* [matrices](http://ebassi.github.io/graphene/docs/graphene-Matrix.html)
* [planes](http://ebassi.github.io/graphene/docs/graphene-Plane.html)
* [axis aligned bounding boxes](http://ebassi.github.io/graphene/docs/graphene-Box.html)
* [3D axis aligned bounding boxes](http://ebassi.github.io/graphene/docs/graphene-Box.html)
* [spheres](http://ebassi.github.io/graphene/docs/graphene-Sphere.html)
* [frustums](http://ebassi.github.io/graphene/docs/graphene-Frustum.html)

Expand All @@ -161,4 +168,4 @@ Graphene is released under the terms of the MIT/X11 license.
See the [license file](./LICENSE.txt) for more details.

[mutest]: https://github.com/ebassi/mutest
[gobject-api]: https://developer.gnome.org/gobject/stable/
[gobject-api]: https://docs.gtk.org/gobject
4 changes: 2 additions & 2 deletions include/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ graphene_config_h = configure_file(
input: 'graphene-config.h.meson',
output: 'graphene-config.h',
configuration: graphene_conf,
install_dir: join_paths(graphene_libdir, graphene_api_path, 'include'),
install_dir: graphene_libdir / graphene_api_path / 'include',
)

# Version header
Expand All @@ -50,7 +50,7 @@ configure_file(
input: 'graphene-version.h.meson',
output: 'graphene-version.h',
configuration: version_conf,
install_dir: join_paths(graphene_includedir, graphene_api_path),
install_dir: graphene_includedir / graphene_api_path,
)

install_headers(
Expand Down
44 changes: 20 additions & 24 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
project('graphene', 'c',
version: '1.11.1',
license: 'MIT',
meson_version: '>= 1.0',
default_options: [
'buildtype=debugoptimized',
'c_std=c99',
'warning_level=1'
])
version: '1.11.1',
license: 'MIT',
meson_version: '>= 1.0',
default_options: [
'buildtype=debugoptimized',
'c_std=c99',
'warning_level=1'
],
)

cc = meson.get_compiler('c')
host_system = host_machine.system()
Expand Down Expand Up @@ -44,9 +45,9 @@ darwin_versions = [current + 1, '@0@.@1@'.format(current + 1, revision)]

# Paths
graphene_prefix = get_option('prefix')
graphene_libdir = join_paths(graphene_prefix, get_option('libdir'))
graphene_includedir = join_paths(graphene_prefix, get_option('includedir'))
graphene_datadir = join_paths(graphene_prefix, get_option('datadir'))
graphene_libdir = graphene_prefix / get_option('libdir')
graphene_includedir = graphene_prefix / get_option('includedir')
graphene_datadir = graphene_prefix / get_option('datadir')

graphene_api_path = '@0@-@1@'.format(meson.project_name(), graphene_api_version)

Expand Down Expand Up @@ -198,11 +199,9 @@ elif get_option('optimization') in ['2', '3', 's']
endif

extra_args = []
# Detect and set symbol visibility
if get_option('default_library') != 'static'
if host_system == 'windows'
conf.set('DLL_EXPORT', true)
endif
# Export DLL symbols on Windows when building a shared library
if get_option('default_library') != 'static' and host_system == 'windows'
conf.set('DLL_EXPORT', true)
endif

# Optional dependency on GObject
Expand All @@ -225,14 +224,11 @@ if get_option('gobject_types')
endif

# Optional dependency on GObject-Introspection; if GObject is disabled
# then we don't build introspection data either
gir = find_program('g-ir-scanner', required : get_option('introspection'))
build_gir = build_gobject and gir.found()
# Disable g-i when cross compiling by default because it rarely works unless
# special care has been taken, in which case the user can enable the option.
if meson.is_cross_build() and not get_option('introspection').enabled()
build_gir = false
endif
# then we don't build introspection data either.
#
# We only build introspection if we can run binaries on the host.
gir = find_program('g-ir-scanner', required: get_option('introspection'))
build_gir = get_option('introspection').allowed() and build_gobject and gir.found() and meson.can_run_host_binaries()

# Check for InitOnce on Windows
if host_system == 'windows'
Expand Down
3 changes: 2 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ graphene_dep_sources = []
# Introspection
if build_gir
python = python.find_installation('python3')
identfilter_py = join_paths(meson.current_source_dir(), 'identfilter.py')
identfilter_py = meson.current_source_dir() / 'identfilter.py'

gir_extra_args = [
'--identifier-filter-cmd=@0@ "@1@"'.format(python.full_path(), identfilter_py),
Expand All @@ -122,6 +122,7 @@ if build_gir
header: 'graphene-gobject.h',
install: true,
extra_args: gir_extra_args,
fatal_warnings: get_option('werror'),
)
graphene_dep_sources += graphene_gir
endif
Expand Down
Loading