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