Skip to content

Commit

Permalink
Revert "Revert "Add wasm-micro-runtime submodule and get building wit…
Browse files Browse the repository at this point in the history
…h CMake." (iree-org#5312)"

This reverts commit fd64070.
  • Loading branch information
ScottTodd committed Dec 22, 2021
1 parent d1620f0 commit 6ed6586
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@
[submodule "third_party/musl"]
path = third_party/musl
url = https://github.com/powderluv/musl.git
[submodule "third_party/wasm-micro-runtime"]
path = third_party/wasm-micro-runtime
url = https://github.com/bytecodealliance/wasm-micro-runtime.git
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ add_subdirectory(build_tools/third_party/cuda EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/libyaml EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/stblib EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/vulkan_memory_allocator EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/wasm-micro-runtime EXCLUDE_FROM_ALL)

iree_set_googletest_cmake_options()
add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL)
Expand Down
1 change: 1 addition & 0 deletions SUBMODULE_VERSIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ f435ae9dee673e83504618b77e1be8cddda73e74 third_party/tensorflow
058e89011fceca912d43638ebb6b85992147fcfe third_party/tracy
9e62d027636cd7210f60d934f56107ed6e1579b8 third_party/vulkan_headers
5c8b3ba955f0dbb30d18afc420f3a38adc779231 third_party/vulkan_memory_allocator
54e82ec439552018d0f26c60b0fd6cc9e36b42a8 third_party/wasm-micro-runtime
c8e0b39f6f6f1edded5c4adf7d46aa4d2a95befe third_party/webgpu-headers
59 changes: 59 additions & 0 deletions build_tools/third_party/wasm-micro-runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file modeled after the instructions at
# https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/build_wamr.md

set(WAMR_SOURCE_DIR "${IREE_SOURCE_DIR}/third_party/wasm-micro-runtime")

# Runtime build target -> platform in wasm-micro-runtime/core/shared/platform/
if(ANDROID)
set(WAMR_BUILD_PLATFORM "android")
elseif(APPLE)
set(WAMR_BUILD_PLATFORM "darwin")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(WAMR_BUILD_PLATFORM "linux")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(WAMR_BUILD_PLATFORM "windows")
# Enable MASM (Microsoft Macro Assembler) for compiling .asm files.
enable_language(ASM_MASM)
endif()

# Pick the features we want. Most default to disabled.
set(WAMR_BUILD_INTERP 1)

include(${WAMR_SOURCE_DIR}/build-scripts/runtime_lib.cmake)

# WAMR unconditionally adds a global compiler flag for 64 bit targets, which
# is not handled or needed by MSVC.
# TODO(scotttodd): Omit the flag upstream rather than work around it here.
if(MSVC)
string(REGEX REPLACE " -fPIC" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
endif()

set(_WAMR_LIBRARY_NAME "wasm_micro_runtime_vmlib")
add_library(${_WAMR_LIBRARY_NAME} STATIC "")
target_sources(${_WAMR_LIBRARY_NAME}
PRIVATE
${WAMR_RUNTIME_LIB_SOURCE})
target_include_directories(${_WAMR_LIBRARY_NAME} SYSTEM
PUBLIC
"$<BUILD_INTERFACE:${WAMR_SOURCE_DIR}/core/iwasm/include/>")

# Suppress all warnings for this third party code.
if(MSVC)
target_compile_options(${_WAMR_LIBRARY_NAME} PRIVATE "/W0")
else()
target_compile_options(${_WAMR_LIBRARY_NAME} PRIVATE "-w")
endif()
1 change: 1 addition & 0 deletions third_party/wasm-micro-runtime
Submodule wasm-micro-runtime added at 54e82e

0 comments on commit 6ed6586

Please sign in to comment.