Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cmake/vcpkg/wamr/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO bytecodealliance/wasm-micro-runtime
REF 8c18e3f68b16c4bcaf05996b2636f6ed2b4cf629 # WAMR-2.4.4
SHA512 2378ab44e6ea3cd9bfede86a413c5d5503b8cd0d072bbee7099bd149897a58d74b57c06214f6b163242f5ac8bcdbb81a59632016ebd4c12a717786e1c387c9e3
PATCHES remove-fetchcontent.patch
)

vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME iwasm CONFIG_PATH lib/cmake/iwasm)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
19 changes: 19 additions & 0 deletions cmake/vcpkg/wamr/remove-fetchcontent.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/core/iwasm/libraries/simde/simde.cmake b/core/iwasm/libraries/simde/simde.cmake
--- a/core/iwasm/libraries/simde/simde.cmake
+++ b/core/iwasm/libraries/simde/simde.cmake
@@ -15,14 +15,5 @@ add_definitions (-DWASM_ENABLE_SIMDE=1)

include_directories(${LIB_SIMDE_DIR} ${LIB_SIMDE_DIR}/simde)

-include(FetchContent)
-
-FetchContent_Declare(
- simde
- GIT_REPOSITORY https://github.com/simd-everywhere/simde
- GIT_TAG v0.8.2
-)
-
-message("-- Fetching simde ..")
-FetchContent_MakeAvailable(simde)
+find_path(simde_SOURCE_DIR simde/wasm/simd128.h)
include_directories("${simde_SOURCE_DIR}")
18 changes: 18 additions & 0 deletions cmake/vcpkg/wamr/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "wamr",
"version-semver": "2.4.4",
"description": "WebAssembly Micro Runtime (WAMR)",
"homepage": "https://github.com/bytecodealliance/wasm-micro-runtime",
"license": "Apache-2.0",
"dependencies": [
"simde",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
8 changes: 5 additions & 3 deletions doc/BuildingHalideWithCMake.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ building the core pieces of Halide.
| [flatbuffers] | `~=23.5.26` | `WITH_SERIALIZATION=ON` | |
| [wabt] | `==1.0.39` | `Halide_WASM_BACKEND=wabt` | Does not have a stable API; exact version required. |
| [V8] | trunk | `Halide_WASM_BACKEND=V8` | Difficult to build. See [WebAssembly.md] |
| [WAMR] | `>=2.4.3` | `Halide_WASM_BACKEND=WAMR` | Built natively as static library from source. |
| [Python] | `>=3.10` | `WITH_PYTHON_BINDINGS=ON` | |
| [pybind11] | `~=2.11.1` | `WITH_PYTHON_BINDINGS=ON` | |

Expand Down Expand Up @@ -454,9 +455,9 @@ apply when `WITH_TESTS=ON`:

The following option selects the execution engine for in-process WASM testing:

| Option | Default | Description |
| --------------------- | ------- | ---------------------------------------------------------------------------------------- |
| `Halide_WASM_BACKEND` | `wabt` | Select the backend for WASM testing. Can be `wabt`, `V8` or a false value such as `OFF`. |
| Option | Default | Description |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------ |
| `Halide_WASM_BACKEND` | `wabt` | Select the backend for WASM testing. Can be `wabt`, `V8`, `WAMR` or a false value such as `OFF`. |

## Installing

Expand Down Expand Up @@ -614,5 +615,6 @@ On this test system (an M3 MacBook Pro), the build is three times faster, with a
[venv]: https://docs.python.org/3/tutorial/venv.html
[vs-cmake-docs]: https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio
[wabt]: https://github.com/WebAssembly/wabt
[wamr]: https://github.com/bytecodealliance/wasm-micro-runtime
[webassembly.md]: ./WebAssembly.md
[winget]: https://learn.microsoft.com/en-us/windows/package-manager/winget/
11 changes: 9 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ target_compile_definitions(Halide PUBLIC

set(Halide_WASM_BACKEND "wabt"
CACHE STRING "Which backend to use for Halide's WASM testing.")
set_property(CACHE Halide_WASM_BACKEND PROPERTY STRINGS "wabt;V8;OFF")
set_property(CACHE Halide_WASM_BACKEND PROPERTY STRINGS "wabt;V8;WAMR;OFF")

if (MSVC AND Halide_WASM_BACKEND STREQUAL "wabt")
message(WARNING "wabt is not yet supported on Windows")
Expand All @@ -591,13 +591,20 @@ if (Halide_WASM_BACKEND STREQUAL "wabt")
find_package(wabt REQUIRED)
_Halide_pkgdep(wabt)

target_link_libraries(Halide PRIVATE wabt::wabt)
target_compile_definitions(Halide PRIVATE WITH_WABT)
target_link_libraries(Halide PRIVATE wabt::wabt)
elseif (Halide_WASM_BACKEND STREQUAL "V8")
find_package(V8 REQUIRED)
_Halide_pkgdep(V8)

target_compile_definitions(Halide PRIVATE WITH_V8)
target_link_libraries(Halide PRIVATE V8::V8)
elseif (Halide_WASM_BACKEND STREQUAL "WAMR")
find_package(iwasm REQUIRED)
_Halide_pkgdep(iwasm)

target_compile_definitions(Halide PRIVATE WITH_WAMR)
target_link_libraries(Halide PRIVATE iwasm::vmlib)
elseif (Halide_WASM_BACKEND)
message(FATAL_ERROR "Unknown Halide_WASM_BACKEND `${Halide_WASM_BACKEND}`")
endif ()
Expand Down
Loading
Loading