runtime_lib.cmake 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. if (NOT DEFINED WAMR_ROOT_DIR)
  4. set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../)
  5. endif ()
  6. if (NOT DEFINED SHARED_DIR)
  7. set (SHARED_DIR ${WAMR_ROOT_DIR}/core/shared)
  8. endif ()
  9. if (NOT DEFINED IWASM_DIR)
  10. set (IWASM_DIR ${WAMR_ROOT_DIR}/core/iwasm)
  11. endif ()
  12. if (NOT DEFINED APP_MGR_DIR)
  13. set (APP_MGR_DIR ${WAMR_ROOT_DIR}/core/app-mgr)
  14. endif ()
  15. if (NOT DEFINED APP_FRAMEWORK_DIR)
  16. set (APP_FRAMEWORK_DIR ${WAMR_ROOT_DIR}/core/app-framework)
  17. endif ()
  18. if (NOT DEFINED DEPS_DIR)
  19. set (DEPS_DIR ${WAMR_ROOT_DIR}/core/deps)
  20. endif ()
  21. if (DEFINED EXTRA_SDK_INCLUDE_PATH)
  22. message(STATUS, "EXTRA_SDK_INCLUDE_PATH = ${EXTRA_SDK_INCLUDE_PATH} ")
  23. include_directories (
  24. ${EXTRA_SDK_INCLUDE_PATH}
  25. )
  26. endif ()
  27. # Set default options
  28. # Set WAMR_BUILD_TARGET, currently values supported:
  29. # "X86_64", "AMD_64", "X86_32", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA"
  30. if (NOT DEFINED WAMR_BUILD_TARGET)
  31. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  32. # Build as X86_64 by default in 64-bit platform
  33. set (WAMR_BUILD_TARGET "X86_64")
  34. else ()
  35. # Build as X86_32 by default in 32-bit platform
  36. set (WAMR_BUILD_TARGET "X86_32")
  37. endif ()
  38. endif ()
  39. ################ optional according to settings ################
  40. if (WAMR_BUILD_INTERP EQUAL 1 OR WAMR_BUILD_JIT EQUAL 1)
  41. include (${IWASM_DIR}/interpreter/iwasm_interp.cmake)
  42. endif ()
  43. if (WAMR_BUILD_AOT EQUAL 1)
  44. include (${IWASM_DIR}/aot/iwasm_aot.cmake)
  45. if (WAMR_BUILD_JIT EQUAL 1)
  46. include (${IWASM_DIR}/compilation/iwasm_compl.cmake)
  47. endif ()
  48. endif ()
  49. if (WAMR_BUILD_APP_FRAMEWORK EQUAL 1)
  50. include (${APP_FRAMEWORK_DIR}/app_framework.cmake)
  51. include (${SHARED_DIR}/coap/lib_coap.cmake)
  52. include (${APP_MGR_DIR}/app-manager/app_mgr.cmake)
  53. include (${APP_MGR_DIR}/app-mgr-shared/app_mgr_shared.cmake)
  54. endif ()
  55. if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1)
  56. include (${IWASM_DIR}/libraries/libc-builtin/libc_builtin.cmake)
  57. endif ()
  58. if (WAMR_BUILD_LIBC_WASI EQUAL 1)
  59. include (${IWASM_DIR}/libraries/libc-wasi/libc_wasi.cmake)
  60. endif ()
  61. ####################### Common sources #######################
  62. set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -ffunction-sections -fdata-sections \
  63. -Wall -Wno-unused-parameter -Wno-pedantic")
  64. # include the build config template file
  65. include (${CMAKE_CURRENT_LIST_DIR}/config_common.cmake)
  66. include_directories (${SHARED_DIR}/include
  67. ${IWASM_DIR}/include)
  68. file (GLOB header
  69. ${SHARED_DIR}/include/*.h
  70. ${IWASM_DIR}/include/*.h
  71. )
  72. LIST (APPEND RUNTIME_LIB_HEADER_LIST ${header})
  73. enable_language (ASM)
  74. include (${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake)
  75. include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake)
  76. include (${IWASM_DIR}/common/iwasm_common.cmake)
  77. include (${SHARED_DIR}/utils/shared_utils.cmake)
  78. set (source_all
  79. ${PLATFORM_SHARED_SOURCE}
  80. ${MEM_ALLOC_SHARED_SOURCE}
  81. ${UTILS_SHARED_SOURCE}
  82. ${LIBC_BUILTIN_SOURCE}
  83. ${LIBC_WASI_SOURCE}
  84. ${IWASM_COMMON_SOURCE}
  85. ${IWASM_INTERP_SOURCE}
  86. ${IWASM_AOT_SOURCE}
  87. ${IWASM_COMPL_SOURCE}
  88. ${WASM_APP_LIB_SOURCE_ALL}
  89. ${NATIVE_INTERFACE_SOURCE}
  90. ${APP_MGR_SOURCE}
  91. )
  92. set (WAMR_RUNTIME_LIB_SOURCE ${source_all})