CMakeLists.txt 1.0 KB

12345678910111213141516171819202122232425
  1. # Copyright (C) 2022 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. cmake_minimum_required(VERSION 3.14)
  4. project(file)
  5. ################ wasm application ###############
  6. add_subdirectory(src)
  7. # Use ExternalProject to avoid incorporating WAMR library compilation flags into the
  8. # compilation of the wasm application, which could lead to compatibility
  9. # issues due to different targets.
  10. # Like: clang: error: unsupported option '-arch' for target 'wasm32-wasi'
  11. list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../cmake)
  12. find_package(WASISDK REQUIRED)
  13. include(ExternalProject)
  14. ExternalProject_Add(wasm-app
  15. SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasm-app"
  16. CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-app -B build
  17. -DWASI_SDK_PREFIX=${WASISDK_HOME}
  18. -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN}
  19. BUILD_COMMAND ${CMAKE_COMMAND} --build build
  20. INSTALL_COMMAND ${CMAKE_COMMAND} --install build --prefix ${CMAKE_CURRENT_BINARY_DIR}
  21. )