Open szabolcsdombi opened 1 year ago
Hi there (:
I would like to submit PyGLM as a Pyodide package.
That would be great! Thank you for the help!
I can make a PR with the changes. I first wanted to know if these changes would be welcome.
Thanks a lot for the work you've done already. The changes would indeed be welcome, however, since it's been a while since I've last worked on this project, I would like to take this opportunity myself to get in touch with PyGLM again - if that's alright with you (: Since PyGLM is built to a single, enormous Object file (which is an issue in itself), there shouldn't be any issues when turning everything static (besides PyInit_glm).
I added the static keyword to any applicable symbol. With the changes in #225, the following symbols remain from the table you've provided:
_ZNKSt3__24hashIN3glm3matILi2ELi2EdLNS1_9qualifierE0EEEEclERKS4_
_ZN13PyGLMTypeInfo4initEiP7_object
_ZNKSt3__24hashIN3glm3vecILi3EdLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3vecILi4EdLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3matILi3ELi2EdLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3matILi4ELi2EdLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3matILi3ELi4EfLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3matILi4ELi3EfLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3matILi4ELi4EfLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3matILi4ELi4EiLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3matILi4ELi4EjLNS1_9qualifierE0EEEEclERKS4_
_ZNKSt3__24hashIN3glm3quaIdLNS1_9qualifierE0EEEEclERKS4_
PyInit_glm
_ZN21PyGLMSingleTypeHolderC2EP7_object
_ZN21PyGLMSingleTypeHolder20getMostImportantTypeEiSt16initializer_listINS_5DTypeEE
_ZN21PyGLMSingleTypeHolder7asInt64Ev
_ZN21PyGLMSingleTypeHolder6asBoolEv
_ZN21PyGLMSingleTypeHolder8asDoubleEv
_ZN21PyGLMSingleTypeHolder8asUint64Ev
_ZN21PyGLMSingleTypeHolder7asInt32Ev
_ZN21PyGLMSingleTypeHolder8asUint32Ev
_ZN21PyGLMSingleTypeHolder7asInt16Ev
_ZN21PyGLMSingleTypeHolder8asUint16Ev
_ZN21PyGLMSingleTypeHolder6asInt8Ev
_ZN21PyGLMSingleTypeHolder7asUint8Ev
_ZN21PyGLMSingleTypeHolder7asFloatEv
The remaining ones are mostly member functions of structs. I don't think they will cause any collisions.
Since PyGLM is built to a single, enormous Object file (which is an issue in itself), there shouldn't be any issues when turning everything static (besides PyInit_glm).
When we compile for the web the entire project including all libraries and the cpython core itself will end up as "a single, enormous Object file"
I also learned this on a single file projects see
Oops, didn't mean to close this
The remaining entries and the entries from glm::
will not cause any issues I think.
I checked and there is no way to hide them, not even with __attribute__((hidden))
_I guess this would be the opposite of EMSCRIPTEN_KEEPALIVE
._
I just built from the updated master. You can try PyGLM in the browser:
https://pyodide.org/en/stable/console.html
import micropip; await micropip.install('https://f003.backblazeb2.com/file/zengl-data/build/PyGLM-2.7.1-cp311-cp311-emscripten_3_1_45_wasm32.whl'); import glm
I can prepare the meta.yml
when this source is also available on PyPI as an sdist.
No rush with a release, I will test some existing projects with this code in the meantime.
Hello!
I would like to submit PyGLM as a Pyodide package. This would mean to add a simple meta.yml pointing to the sdist on PyPI.
Previously the sdist was broken, thanks for the recent version it is fixed now.
There is still some changes that would be great to make before submitting. When compiling for the web it is important to have all the internal functions / globals declared as static.
I tried to do this for glm but it seems not to be possible. I have tweaked the setup.hpp to declare functions as either
static
orstatic inline
. It did not work due to operators cannot be declared static and there is no other define I could change. Luckyily glm is behind a namespace, so name collision with other libraries are unlikely, (unless they also provide glm).Here is the rest of the symbols that are not static:
It would be really nice to mark these symbols static. Except
PyInit_glm
. Or at least simple ones likectypes_float
. Such a name might be also present in other libraries.PS: sorry I could not demagle the names.
I have generated this list with the followind Dockerfile added in the root:
I can make a PR with the changes. I first wanted to know if these changes would be welcome.