new crafter.build structure

This commit is contained in:
Jorijn van der Graaf 2025-11-09 20:11:22 +01:00
commit e35b7302cb
22 changed files with 83 additions and 109 deletions

View file

@ -5,7 +5,7 @@
Crafter.CppDOM is a C++ library that exposes the browser DOM api's to C++ WebAssembly.
# How to use
Please view the samples folder, this is a snippit from the HelloElement sample:
Please view the examples folder, this is a snippit from the HelloElement example:
```cpp
import Crafter.CppDOM;
@ -18,31 +18,26 @@ int main(){
```
You can also view the wiki for more detailed information.
It is highly recommended to use this with [Crafter.WebBuild](https://github.com/Catcrafts/Crafter.WebBuild), but it is not strictly required if the same way of injecting the env is followed. The following instructions will be for Crafter.WebBuild.
It is highly recommended to use this with [Crafter.Build](https://forgejo.catcrafts.net/Catcrafts/Crafter.Build), but it is not strictly required if the same way of injecting the env is followed. The following instructions will be for Crafter.Build.
## Quickstart
create a ``project.json`` in an empty folder, open it in your preferred text editor.
Create a basic project file, that describes your web project.
```JSON
{
"name": "sample-project",
"name": "main",
"configurations": [
{
"name": "debug",
"standard": "c++26",
"source_files": ["main"],
"module_files": [],
"build_dir": "./build",
"output_dir": "./bin",
"optimization_level": "0",
"target": "wasm32-unknown-wasi",
"type": "executable",
"name": "executable",
"implementations": ["main"],
"target": "wasm32-wasi",
"debug" : true,
"dependencies": [
{
"path":"https://github.com/Catcrafts/Crafter.CppDOM.git",
"configuration":"debug"
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.CppDOM.git",
"configuration":"lib-debug"
}
]
],
}
]
}
@ -59,6 +54,6 @@ int main(){
}
```
Save and close, then run ``crafter-webbuild serve -c debug``. Now you can open the browser at ``http://localhost:8080/`` and ``Hello World!`` will appear in the browser.
Save and close, then run ``crafter-build build executable && caddy file-server --listen :8080 --root bin/executable``. if you have caddy installed, if not use your favorite static file server instead. Now you can open the browser at ``http://localhost:8080`` and ``Hello World!`` will appear in the browser.
This sample can also be viewed in the [HelloElement sample](https://github.com/Catcrafts/Crafter.CppDOM/tree/master/samples/HelloElement)
This sample can also be viewed in the [HelloElement example](https://forgejo.catcrafts.net/Catcrafts/Crafter.CppDOM/src/branch/master/examples)