From 660e3a6fb7c0b911f9a2cf569820e3f680527aae Mon Sep 17 00:00:00 2001 From: oir Date: Sat, 25 Nov 2023 20:40:47 -0500 Subject: [PATCH] . --- LICENSE | 2 +- meson.build | 6 +++--- pyproject.toml | 9 ++++++--- python/{meanwhile-py.cpp => barkeep.cpp} | 13 ++++++++++++- python/meson.build | 4 ++-- 5 files changed, 24 insertions(+), 10 deletions(-) rename python/{meanwhile-py.cpp => barkeep.cpp} (96%) diff --git a/LICENSE b/LICENSE index 853956a..01f33bc 100644 --- a/LICENSE +++ b/LICENSE @@ -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. diff --git a/meson.build b/meson.build index b07a34a..a021c3f 100644 --- a/meson.build +++ b/meson.build @@ -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', diff --git a/pyproject.toml b/pyproject.toml index c382777..8a3bfe2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = 'bowsette@example.com'}, + {name = 'Ozan Irsoy'}, ] \ No newline at end of file diff --git a/python/meanwhile-py.cpp b/python/barkeep.cpp similarity index 96% rename from python/meanwhile-py.cpp rename to python/barkeep.cpp index a752d67..41e7346 100644 --- a/python/meanwhile-py.cpp +++ b/python/barkeep.cpp @@ -1,5 +1,6 @@ #include #include +#include namespace py = pybind11; using namespace mew; @@ -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 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_(m, "AnimationStyle") @@ -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()); } \ No newline at end of file diff --git a/python/meson.build b/python/meson.build index 7b809f5..007fcb8 100644 --- a/python/meson.build +++ b/python/meson.build @@ -5,7 +5,7 @@ if py.found() pybind11 = subproject('pybind11').get_variable('pybind11_dep') sources = [ - 'meanwhile-py.cpp', + 'barkeep.cpp', ] py.install_sources( @@ -13,7 +13,7 @@ if py.found() pure: false, ) - tgt = py.extension_module('mewpy', + tgt = py.extension_module('barkeep', sources : sources, include_directories : incdir, dependencies : deps + [pybind11],