It needs to be one file Be.so because modules reference classes from different files, so they need to be compiled together.
https://pybind11.readthedocs.io/en/stable/advanced/misc.html#partitioning-code-over-multiple-extension-modules
Build system done! Builds using jam -j$(nproc)
should run in parallel, yielding a significant speed boost. Also, failed builds should be able to continue where they left off instead of restarting.
Looks like youâve made progress with BeMatched. I canât quite play it because when I click on a cardâŚ
terminate called after throwing an instance of 'pybind11::error_already_set'
what(): AttributeError: 'Be.Button.BButton' object has no attribute 'IsEnabled'
At:
/boot/home/Desktop/haiku/BeMatched/main.py(188): ok
/boot/home/Desktop/haiku/BeMatched/main.py(133): MessageReceived
Sorry, forgot to push Haiku-PyAPI again.
How about having a âmake installâ for the build system,
that copies the Be folder to the python vendor-packages?
And what about having an option for which python version to build for?
An install target should be easy enough. Choosing the python version is probably a bit harder but some kind of config file like Haiku has should work.
It could go in /system/lib/python3.9/vendor-packages/.
and i dont think it should be too hard to choose the python version,
we just need to change the -I paths for the build command.
Ah, sorry, I meant the hard part would be letting the user tell jam
which python version it should compile for. A config file is one way of doing that.
Can it be given as an argument, or a target?
For example:
build-3.9
build-3.10
build-3.11
install-3.9
install-3.10
install-3.11
Ah, how ugly! Youâre hurting my eyes! Just kidding
There is a way of passing arguments for the build script. It looks like jam install -spython-version=3.11
and would have to be specified every time you build or install unless we specify a default.
BeMatched runs now, thanks to the changes youâve pushed.
For those curious, hereâs a schreenshot:
Interesting topic, thanks for working on this!
Nice job, thank you all very much for working on this!
Looking at that self.events
thing in the original code example, maybe it might be possible for the bindings to support responding to BMessages using a Python function decorator, so roughly like this:
@BMessageHandlerFunction(self.START_MSG)
def start(self, msg):
...
That would eliminate the overhead for manually managing that event map and overriding MessageReceived()
in every program.
Just an idea from someone who isnât a Python expert by any stretch of the imagination.
Not really,
jam build should be aliased to build-3.10.
And -spython-version=3.11
? Youâre calling my codes ugly?
What! me? never.
Build-3.10 works fine enough but doesnât scale very nicely. Imagine in some dystopian future⌠jam build-$python_version-$arch-$debug_or_release
and us having to write code for every possible combination!
well, maybe -spy=3.11
Having decorators isnât really possible, but now made self.events be there already, and removed the need for overriding MessageReceived.
@BiPolar added python3.11 as an in between IIRC, so it shouldnât be used a lot, python3.10 is âat this momentâ still the default in Haiku, and python3.12 is in the works (kudos to @BiPolar there)
Itâs just an example.
Just thought Iâd shed some info here, np (you guys probably are still aware of this, but others maybe not)
@ZardShard can you help me with the Jamfile?
I am having trouble with the install rules.