SConscript_config 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #
  2. # Copyright (c) 2021, RT-Thread Development Team
  3. #
  4. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. #
  6. import os
  7. import re
  8. from building import *
  9. Import('rtconfig')
  10. src = []
  11. objs = []
  12. cwd = GetCurrentDir()
  13. IWASM_INC_DIR = os.path.join(cwd, '..', 'core', 'iwasm', 'include')
  14. CPPPATH = [IWASM_INC_DIR]
  15. if rtconfig.BUILD == 'debug':
  16. CPPDEFINES = ['BH_DEBUG=1']
  17. else:
  18. CPPDEFINES = ['BH_DEBUG=0']
  19. if rtconfig.ARCH == 'arm':
  20. if re.match('^cortex-m.*', rtconfig.CPU):
  21. print('[WAMR] using thumbv4t')
  22. CPPDEFINES += ['BUILD_TARGET_THUMB']
  23. CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_THUMB']
  24. elif re.match('^cortex-a.*', rtconfig.CPU):
  25. print('[WAMR] using armv7')
  26. CPPDEFINES += ['BUILD_TARGET_ARM']
  27. CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV7']
  28. elif re.match('^cortex-r.*', rtconfig.CPU):
  29. print('[WAMR] using armv7')
  30. CPPDEFINES += ['BUILD_TARGET_ARM']
  31. CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV7']
  32. elif rtconfig.CPU == 'armv6':
  33. print('[WAMR] using armv6')
  34. CPPDEFINES += ['BUILD_TARGET_ARM']
  35. CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV6']
  36. elif re.match('^arm9*', rtconfig.CPU):
  37. print('[WAMR] using armv4')
  38. CPPDEFINES += ['BUILD_TARGET_ARM']
  39. CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV4']
  40. elif rtconfig.ARCH == 'ia32':
  41. CPPDEFINES += ['BUILD_TARGET_X86_32', 'RTT_WAMR_BUILD_TARGET_X86_32']
  42. else:
  43. print("[WAMR] unknown arch", rtconfig.ARCH)
  44. if GetDepend(['WAMR_BUILD_INTERP']):
  45. CPPDEFINES += ['WASM_ENABLE_INTERP=1']
  46. if GetDepend(['WAMR_BUILD_FAST_INTERP']):
  47. CPPDEFINES += ['WASM_ENABLE_FAST_INTERP=1']
  48. print("[WAMR] fast interpreter was enabled")
  49. else:
  50. CPPDEFINES += ['WASM_ENABLE_FAST_INTERP=0']
  51. print("[WAMR] fast interpreter was disabled")
  52. else:
  53. CPPDEFINES += ['WASM_ENABLE_INTERP=0']
  54. CPPDEFINES += ['WASM_ENABLE_JIT=0']
  55. if GetDepend(['WAMR_BUILD_MULTI_MODULE']):
  56. CPPDEFINES += ['WASM_ENABLE_MULTI_MODULE=1']
  57. else:
  58. CPPDEFINES += ['WASM_ENABLE_MULTI_MODULE=0']
  59. if GetDepend(['WAMR_BUILD_SPEC_TEST']):
  60. CPPDEFINES += ['WASM_ENABLE_SPEC_TEST=1']
  61. print("[WAMR] spec test compatible mode was enabled")
  62. if GetDepend(['WAMR_BUILD_BULK_MEMORY']):
  63. CPPDEFINES += ['WASM_ENABLE_BULK_MEMORY=1']
  64. print("[WAMR] Bulk memory feature was enabled")
  65. else:
  66. CPPDEFINES += ['WASM_ENABLE_BULK_MEMORY=0']
  67. if GetDepend(['WAMR_BUILD_SHARED_MEMORY']):
  68. CPPDEFINES += ['WASM_ENABLE_SHARED_MEMORY=1']
  69. print("[WAMR] Shared memory enabled")
  70. else:
  71. CPPDEFINES += ['WASM_ENABLE_SHARED_MEMORY=0']
  72. if GetDepend(['WAMR_BUILD_MINI_LOADER']):
  73. CPPDEFINES += ['WASM_ENABLE_MINI_LOADER=1']
  74. print("[WAMR] mini loader enabled")
  75. else:
  76. CPPDEFINES += ['WASM_ENABLE_MINI_LOADER=0']
  77. if GetDepend(['WAMR_DISABLE_HW_BOUND_CHECK']):
  78. CPPDEFINES += ['WASM_DISABLE_HW_BOUND_CHECK=1']
  79. print("[WAMR] Hardware boundary check disabled")
  80. if GetDepend(['WAMR_BUILD_SIMD']):
  81. CPPDEFINES += ['WASM_ENABLE_SIMD=1']
  82. print('[WAMR] SIMD enabled')
  83. if GetDepend(['WAMR_BUILD_MEMORY_PROFILING']):
  84. CPPDEFINES += ['WASM_ENABLE_MEMORY_PROFILING=1']
  85. print('[WAMR] Memory profiling enabled')
  86. if GetDepend(['WAMR_BUILD_CUSTOM_NAME_SECTION']):
  87. CPPDEFINES += ['WASM_ENABLE_CUSTOM_NAME_SECTION=1']
  88. print('[WAMR] Custom name section enabled')
  89. if GetDepend(['WAMR_BUILD_TAIL_CALL']):
  90. CPPDEFINES += ['WASM_ENABLE_TAIL_CALL=1']
  91. print('[WAMR] Tail call enabledd')
  92. LIBS = ['m']
  93. group = DefineGroup('wamr', src, depend = ['PKG_USING_WAMR'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
  94. Return('group')