preparation.cmake 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. ################ WASI-SDK ################
  4. find_path(WASI_SDK_HOME
  5. NAMES wasi-sdk
  6. PATHS /opt/
  7. REQUIRED
  8. )
  9. if (NOT WASI_SDK_HOME)
  10. message(FATAL_ERROR
  11. "can not find wasi-sdk. "
  12. "please download it from "
  13. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz "
  14. "and install it under /opt/wasi-sdk"
  15. )
  16. else()
  17. message(STATUS
  18. "Detecting wasi-sdk info: ${WASI_SDK_HOME}/wasi-sdk"
  19. )
  20. endif()
  21. #
  22. # check clang version
  23. execute_process(COMMAND
  24. ${WASI_SDK_HOME}/wasi-sdk/bin/clang --version
  25. OUTPUT_VARIABLE clang_full_version_string
  26. )
  27. string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
  28. CLANG_VERSION_STRING ${clang_full_version_string}
  29. )
  30. message(STATUS "Detecting clang versoin: ${CLANG_VERSION_STRING}")
  31. if(CLANG_VERSION_STRING VERSION_LESS 11.0)
  32. message(FATAL_ERROR
  33. "please install latest wai-sdk to get a clang-11 at least"
  34. )
  35. endif()
  36. ################ EMCC ################
  37. if(NOT DEFINED ENV{EMSDK})
  38. message(FATAL_ERROR
  39. "can not find emsdk. "
  40. "please refer to https://emscripten.org/docs/getting_started/downloads.html "
  41. "and install it, "
  42. "or active emsdk by 'source ./emsdk_env.sh'"
  43. )
  44. endif()
  45. message(STATUS "Detecting EMSDK info: $ENV{EMSDK}")
  46. ### check if the emsdk is 2.0.12
  47. ### upstream/.emsdk_version should be releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit
  48. file(STRINGS "$ENV{EMSDK}/upstream/.emsdk_version" EMSDK_VERSION)
  49. if(NOT (${EMSDK_VERSION} STREQUAL "releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit"))
  50. message(FATAL_ERROR "please install emsdk 2.0.12")
  51. endif()
  52. ################ BINARYEN ################
  53. find_program(WASM_OPT
  54. NAMES wasm-opt
  55. PATHS /opt/binaryen-version_101/bin /opt/binaryen/bin
  56. )
  57. if (NOT WASM_OPT)
  58. message(FATAL_ERROR
  59. "can not find wasm-opt. "
  60. "please download it from "
  61. "https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz "
  62. "and install it under /opt"
  63. )
  64. else()
  65. message(STATUS
  66. "Detecting EMSDK info: $ENV{EMSDK}"
  67. )
  68. endif()