Skip to content

Commit 4d2b956

Browse files
committed
Renamed and fixed profiles
1 parent 98d7b4f commit 4d2b956

File tree

20 files changed

+39
-17
lines changed

20 files changed

+39
-17
lines changed

examples/cross_build/wasm/bindings/README.md renamed to examples/cross_build/emscripten/bindings/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# WASM project with bindings and conan dependency
22

3-
43
## Build and run
54

65
To compile the project:
@@ -12,7 +11,21 @@ $ conan build . -pr:h ../profiles/wasm32 --build=missing
1211
To open a WASM webpage locally, most of the browsers will complain due to security reasons as WASM must be loaded asynchronous
1312

1413
The easiest way of opening the generated webpage (should be in `build/release-wasm/wasm_example.html`) is by running a local server.
15-
This can be done via `emrun` command (needs to be downloaded):
14+
This can be done via `emrun` command:
15+
16+
`emrun` is packaged with `emskd` recipe so it should be available by activating build environment:
17+
18+
**POSIX**
19+
```sh
20+
$ source build/release-wasm/generators/conanbuild.sh
21+
```
22+
23+
**Windows**
24+
```sh
25+
$ build\release-wasm\generators\conanbuild.bat
26+
```
27+
28+
By this time, `emrun`, `node`, and other JS/WASM tools should be available in the path:
1629

1730
```sh
1831
$ emrun --browser <browser_name> build/release-wasm/wasm_example.html

examples/cross_build/wasm/bindings/conanfile.py renamed to examples/cross_build/emscripten/bindings/conanfile.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import os
2-
31
from conan import ConanFile
42
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
5-
from conan.tools.files import copy
63

74

85
class WasmExampleRecipe(ConanFile):
@@ -22,15 +19,16 @@ def generate(self):
2219
deps.generate()
2320
tc = CMakeToolchain(self)
2421

22+
# HEAPxx values need to be exported explicitly since Emscripten 4.0.7
23+
# https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#407---041525
2524
tc.extra_exelinkflags.append(
2625
"-sEXPORTED_FUNCTIONS=['_malloc','_free'] \
27-
-sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','getValue','setValue'] \
26+
-sEXPORTED_RUNTIME_METHODS=['ccall','cwrap','getValue','setValue','HEAPF32'] \
2827
-sENVIRONMENT=web \
2928
-sALLOW_MEMORY_GROWTH=1 \
3029
-sNO_EXIT_RUNTIME=1 \
3130
--shell-file ${CMAKE_SOURCE_DIR}/shell.html"
3231
)
33-
3432
tc.generate()
3533

3634
def build(self):
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
include(default)
2+
3+
[settings]
4+
arch=asm.js
5+
build_type=Release
6+
os=Emscripten
7+
8+
[tool_requires]
9+
emsdk/[*]
10+
11+
[conf]
12+
# Verbosity
13+
tools.build:verbosity=verbose
14+
tools.compilation:verbosity=verbose
15+
16+
# Distinguish between arch
17+
tools.cmake.cmake_layout:build_folder_vars=['settings.build_type', 'settings.arch']

examples/cross_build/wasm/profiles/wasm32 renamed to examples/cross_build/emscripten/profiles/wasm32

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1+
include(default)
2+
13
[settings]
24
arch=wasm
35
build_type=Release
4-
compiler=apple-clang
5-
compiler.cppstd=gnu17
6-
compiler.cstd=gnu11
7-
compiler.libcxx=libc++
8-
compiler.version=17
96
os=Emscripten
107

118
[tool_requires]

examples/cross_build/wasm/profiles/wasm64 renamed to examples/cross_build/emscripten/profiles/wasm64

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1+
include(default)
2+
13
[settings]
24
arch=wasm64
35
build_type=Release
4-
compiler=apple-clang
5-
compiler.cppstd=gnu17
6-
compiler.cstd=gnu11
7-
compiler.libcxx=libc++
8-
compiler.version=17
96
os=Emscripten
107

118
[tool_requires]

0 commit comments

Comments
 (0)