Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
oir committed Nov 26, 2023
1 parent 7aefdc6 commit 660e3a6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2021 Ozan Irsoy
Copyright 2023 Ozan Irsoy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
project('meanwhile', 'cpp', default_options : ['cpp_std=c++20', 'warning_level=3', 'cpp_compiler=g++-11'])
project('meanwhile', 'cpp', default_options : ['cpp_std=c++20', 'warning_level=3'])

incdir = include_directories(['./', './extern/'])

threads = dependency('threads')
threads = dependency('threads')

deps = [threads]
deps = [threads]

sources = [
'demo.cpp',
Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
build-backend = 'mesonpy'
requires = ['meson-python']

[tool.meson-python.args]
install = ['--tags=runtime,python-runtime']

[project]
name = 'mewpy'
name = 'barkeep'
version = '0.0.1'
description = 'Our first Python project, using meson-python!'
description = ''
readme = 'README.md'
requires-python = '>=3.9'
license = {file = 'LICENSE'}
authors = [
{name = 'Bowsette Koopa', email = '[email protected]'},
{name = 'Ozan Irsoy'},
]
13 changes: 12 additions & 1 deletion python/meanwhile-py.cpp → python/barkeep.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <meanwhile/meanwhile.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

namespace py = pybind11;
using namespace mew;
Expand Down Expand Up @@ -101,7 +102,15 @@ void bind_template_progress_bar(py::module& m, char const* name) {
py::is_operator());
}

PYBIND11_MODULE(mewpy, m) {
void some_func(std::optional<std::string> msg) {
if (msg) {
std::cout << *msg << std::endl;
} else {
std::cout << "No message" << std::endl;
}
}

PYBIND11_MODULE(barkeep, m) {
m.doc() = "Python bindings for meanwhile";

py::enum_<AnimationStyle>(m, "AnimationStyle")
Expand Down Expand Up @@ -228,4 +237,6 @@ PYBIND11_MODULE(mewpy, m) {
[](AsyncDisplay& self, const AsyncDisplay& other) {
return Composite(self.clone(), other.clone());
});

m.def("some_func", &some_func, "msg"_a = py::none());
}
4 changes: 2 additions & 2 deletions python/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ if py.found()
pybind11 = subproject('pybind11').get_variable('pybind11_dep')

sources = [
'meanwhile-py.cpp',
'barkeep.cpp',
]

py.install_sources(
subdir: '../meanwhile',
pure: false,
)

tgt = py.extension_module('mewpy',
tgt = py.extension_module('barkeep',
sources : sources,
include_directories : incdir,
dependencies : deps + [pybind11],
Expand Down

0 comments on commit 660e3a6

Please sign in to comment.