Skip to content

Commit e8c9be6

Browse files
committed
Fix bindings name and updated profiles
1 parent cdfc45d commit e8c9be6

File tree

9 files changed

+33
-12
lines changed

9 files changed

+33
-12
lines changed
File renamed without changes.

examples/cross_build/wasm/profiles/wasm64

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ os=Emscripten
1212
emsdk/[*]
1313

1414
[conf]
15-
tools.build:cflags=['-sMEMORY64=1']
16-
tools.build:cxxflags=['-sMEMORY64=1']
17-
1815
# In this early stage of wasm64, ALLOW_MEMORY_GROWTH is not having effect. Also it may not be the most efficient solution.
1916
# wasm64 for now needs to declare INITIAL_MEMORY as the maximum memory
20-
tools.build:exelinkflags=[ '-sMEMORY64=1', '-sALLOW_MEMORY_GROWTH=1', '-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB' ]
21-
tools.build:sharedlinkflags=[ '-sMEMORY64=1', '-sALLOW_MEMORY_GROWTH=1', '-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB' ]
17+
tools.build:exelinkflags=['-sALLOW_MEMORY_GROWTH=1', '-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB']
18+
tools.build:sharedlinkflags=['-sALLOW_MEMORY_GROWTH=1', '-sMAXIMUM_MEMORY=16GB', '-sINITIAL_MEMORY=16GB']
2219

2320
# Uncomment the following line to use emcc and em++ system compilers instead of conan packaged ones
2421
# tools.build:compiler_executables={'c':'emcc', 'cpp':'em++'}

examples/cross_build/wasm/wasm64/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WASM 32 bit vs 64 bit projet comparison
1+
# WASM 32 bit vs 64 bit project comparison
22

33

44
This basic example aims to show the differences between cross compiling a project with `arch=wasm` (which stands for `wasm32` bits)
@@ -52,3 +52,19 @@ Failed after allocating 16352 MiB ~ 15 GiB
5252
The difference is notable, the 4 GB limitation does not exist more in a `64 bit` architecture.
5353
The dynamic memory limit could be easily increased by modifying the profile.
5454

55+
56+
## Binary inspection
57+
58+
Another way of determining if a WASM lib is 32 or 64 bit, `wasm-objdump` command can be used (must be downloaded first):
59+
60+
```sh
61+
$ wasm-objdump -d build/release-wasm/wasm-alloc.wasm | grep '\.load'
62+
```
63+
This should output `i32.load`.
64+
65+
But the following should show plenty of `i64.load`, indicating `64-bit` operations:
66+
67+
```sh
68+
$ wasm-objdump -d build/release-wasm64/wasm-alloc.wasm | grep '\.load'
69+
```
70+

examples/cross_build/wasm/wasm_game/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ find_package(raylib)
77
add_executable(wasm_game main.cpp)
88
target_link_libraries(wasm_game raylib)
99

10+
# Set the executable suffix to .html in order to generate a html page by
11+
# Emscripten (there is no way of setting this from a user toolchain or
12+
# conanfile as it is later overriden by the emscripten toolchain)
1013
set(CMAKE_EXECUTABLE_SUFFIX ".html")
11-
12-
set_target_properties(wasm_game PROPERTIES
13-
LINK_FLAGS "-sALLOW_MEMORY_GROWTH=1 -sUSE_GLFW=3 -sASYNCIFY --shell-file ${CMAKE_SOURCE_DIR}/shell.html"
14-
)

examples/cross_build/wasm/wasm_game/conanfile.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
from conan import ConanFile
2-
from conan.tools.cmake import CMake, cmake_layout
2+
from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain
33

44
class ConanApplication(ConanFile):
55
package_type = "application"
66
settings = "os", "compiler", "build_type", "arch"
7-
generators = "CMakeDeps", "CMakeToolchain"
87

98
def layout(self):
109
cmake_layout(self)
1110

1211
def requirements(self):
1312
self.requires("raylib/5.5")
1413

14+
def generate(self):
15+
deps = CMakeDeps(self)
16+
deps.generate()
17+
18+
tc = CMakeToolchain(self)
19+
tc.extra_exelinkflags.append(
20+
"-sALLOW_MEMORY_GROWTH=1 -sUSE_GLFW=3 -sASYNCIFY --shell-file=${CMAKE_SOURCE_DIR}/shell.html"
21+
)
22+
tc.generate()
23+
1524
def build(self):
1625
cmake = CMake(self)
1726
cmake.configure()

0 commit comments

Comments
 (0)