Comments (2)
I've been thinking about this problem for a while and what I've come up with is implemented in another project called libclangjs, here. Libclangjs adds JavaScript / WASM bindings to llvm's libclang (similar to how OCJS adds JavaScript / WASM bindings to OCCT - but much simpler). There is a fairly minimal test and some docs that explain how it works. In summary:
- The bindings and relevant headers are published as a CMake package, that can be added via CMake's
find_package
call to your custom CMake project (which builds an "executable", i.e. the.js
and.wasm
files, you want to use in your JS project). - This CMake package is published via NPM. That might be a bit unusual, but I think it's an easy way of publishing that package, which should integrate nicely with commonly used JS development tools. This should also work nicely with a monorepo layout, where the "custom build" of OCJS is just another package that can be installed by other packages inside that repo.
- C/C++ code can then be written "like usual" in any other CMake-based project.
I believe this is much cleaner and lightweight than the current solution of adding c++ code to a yaml file and starting a huge Docker container for each compilation. If you have any thoughts / opinions on this, please let me know.
PS: This ignores the fact that the custom build yaml-files also specify which bindings should be included. This would be a separate issue under this proposal.
from opencascade.js.
I've been thinking about this problem for a while and what I've come up with is implemented in another project called libclangjs, here. Libclangjs adds JavaScript / WASM bindings to llvm's libclang (similar to how OCJS adds JavaScript / WASM bindings to OCCT - but much simpler). There is a fairly minimal test and some docs that explain how it works. In summary:
* The bindings and relevant headers are published as a CMake package, that can be added via CMake's [`find_package`](https://github.com/donalffons/libclangjs/blob/5af1087a3dd29f05b03ca38360d7a07d17c73277/tests/test-cmake/CMakeLists.txt#L7) call to your custom CMake project (which builds an "executable", i.e. the `.js` and `.wasm` files, you want to use in your JS project). * This CMake package is published via NPM. That might be a bit unusual, but I think it's an easy way of publishing that package, which should integrate nicely with commonly used JS development tools. This should also work nicely with a monorepo layout, where the "custom build" of OCJS is just another package that can be installed by other packages inside that repo. * C/C++ code can then be written "like usual" in any other CMake-based project.
I believe this is much cleaner and lightweight than the current solution of adding c++ code to a yaml file and starting a huge Docker container for each compilation. If you have any thoughts / opinions on this, please let me know.
PS: This ignores the fact that the custom build yaml-files also specify which bindings should be included. This would be a separate issue under this proposal.
It looks great ! If there are any examples, I would be happy to test.
from opencascade.js.
Related Issues (20)
- Nuxt3 template
- Build emcc crashes HOT 4
- How to iterate over NCollection_List?
- MultiThreaded build on the browser gives errors related to node environment HOT 2
- CI costs too much time when building ocjs HOT 5
- How to import brep file with opencascade.js? HOT 1
- null function or function signature mismatch when building shell from solid HOT 2
- How to access data from .write() HOT 2
- Custom Build: XCAFDoc_DocumentTool.ShapeTool is not a function
- Is It possible to export a image to SVG?
- can i modify or replace a shape for an assembly ? (Adding new shape replacing the old opencascade shape)
- How to config opencascade.js in next.js? HOT 1
- How to build only a few specific modules of occ
- Cannot bind the library with Vite HOT 1
- Noob question : about .step export
- Update opencascade to 7.8.0 HOT 2
- Few errors during custom build
- Project Maintenance Status? HOT 1
- Custom build no-exceptions.yml failed. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencascade.js.