SConscript_config 3.5 KB

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