preparation.cmake 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. #######################################
  4. include(ExternalProject)
  5. file(REAL_PATH ../../.. WAMR_ROOT
  6. BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
  7. )
  8. find_path(WASI_SDK_PARENT
  9. name wasi-sdk
  10. PATHS ${WAMR_ROOT}/test-tools/
  11. NO_DEFAULT_PATH
  12. NO_CMAKE_FIND_ROOT_PATH
  13. )
  14. if(NOT WASI_SDK_PARENT)
  15. message(FATAL_ERROR
  16. "can not find 'wasi-sdk' under ${WAMR_ROOT}/test-tools, "
  17. "please run ${WAMR_ROOT}/test-tools/build-wasi-sdk/build_wasi_sdk.py "
  18. "to build wasi-sdk and try again"
  19. )
  20. endif()
  21. set(WASI_SDK_HOME ${WASI_SDK_PARENT}/wasi-sdk)
  22. message(CHECK_START "Detecting WASI-SDK at ${WASI_SDK_HOME}")
  23. if(EXISTS "${WASI_SDK_HOME}/share/cmake/wasi-sdk.cmake")
  24. message(CHECK_PASS "found")
  25. else()
  26. message(CHECK_FAIL "not found")
  27. endif()
  28. ################ BINARYEN ################
  29. find_program(WASM_OPT
  30. NAMES wasm-opt
  31. PATHS /opt/binaryen-version_101/bin /opt/binaryen/bin
  32. NO_DEFAULT_PATH
  33. NO_CMAKE_FIND_ROOT_PATH
  34. )
  35. if(NOT WASM_OPT)
  36. message(FATAL_ERROR
  37. "can not find wasm-opt. "
  38. "please download it from "
  39. "https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz "
  40. "and install it under /opt"
  41. )
  42. endif()