-
Notifications
You must be signed in to change notification settings - Fork 811
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
PhysX Emscripten WebAssembly build target #238
base: 4.1
Are you sure you want to change the base?
Conversation
* Created new 'emscripten' platform, using the linux build as a template * emscripten build does not support snippets/samples(although this support should be possible to add) * running a standard generate_projects.sh, selecting emscripten, and `make` in a build configuration directory builds a wasm/js file for loading in the browser. * a new module has been added PhysxWebBindings which only exists in the emscripten platform. This includes(for now) a single cpp file describing th embind bindings. * This build has only been tested on mac and WSL. This is not expected to work in windows.
This is great! I made some notes along the way:
Either way, I now have an I do have a few questions about the future, maybe you have some ideas:
|
Thanks for taking a look at this @ashconnell!
|
|
signed? |
* Fix an error generated by -Wmisleading-indentation Signed-off-by: Squareys <[email protected]> * Allow building emscripten target on win32 Signed-off-by: Squareys <[email protected]> * Add -Wno-alloca and Wno-anon-enum-enum-conversion to clang flags Signed-off-by: Squareys <[email protected]> * Avoid casting const ref to non-const ref Signed-off-by: Squareys <[email protected]> * Add -Wno-dtor-name for emscripten target Signed-off-by: Squareys <[email protected]> * Also add compile definitions to PhysXWebBindings target Signed-off-by: Squareys <[email protected]> * Add -fPIC to avoid linker error Specifically: wasm-ld: warning: unexpected existing value for R_WASM_TABLE_INDEX_REL_SLEB Signed-off-by: Squareys <[email protected]> * Avoid duplicate symbols caused by transitively linking libs multiple times Signed-off-by: Squareys <[email protected]>
@jtoy @ashconnell All signed :) |
Has anyone been successful with linking this into their emscripten project recently and has any pointers in doing so with the modern releases of emscripten? |
@yosmo78 it works fine but currently uses an older version of emscripten with embind. The instructions here should get you up and running: https://github.com/ashconnell/physx-js |
Thanks @ashconnell , your build scripts were really helpful to learning on what to do Does anyone know what the .bc files are? I want to statically link in PhysX with my code in emscripten so I can access it in c++ and have it compile down into the generated wasm of emscripten. Are the .bc file equivalent to .a files? Do I just include the headers of PhysX to access the functions inside my c++ code? Sorry for the questions, I am a new to this wasm stuff. But having physX would help reduce dev time of implementing everything myself. Thank! |
|
||
|
||
# We need to output .bc files instead of .a files for our emscripten build | ||
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".bc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not required anymore since 2.0.x emscripten
|
||
SET(PHYSX_PLATFORM_LINKED_LIBS dl) | ||
|
||
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".bc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, can be removed
What's the status of this PR? |
support should be possible to add)
make
in a build configuration directory builds a wasm/js file forloading in the browser.
emscripten platform. This includes(for now) a single cpp file describing
th embind bindings.
to work in windows.
The bindings include what is used today by Amazon Sumerian, it is expected that other consumers will pull this down and augment the bindings as desired, although I suppose it would be possible to bind everything.