1#!/bin/bash 2# 3# Copyright (c) 2020, The OpenThread Authors. 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 3. Neither the name of the copyright holder nor the 14# names of its contributors may be used to endorse or promote products 15# derived from this software without specific prior written permission. 16# 17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27# POSSIBILITY OF SUCH DAMAGE. 28# 29 30set -euxo pipefail 31 32OT_BUILDDIR="$(pwd)/build" 33readonly OT_BUILDDIR 34 35reset_source() 36{ 37 rm -rf "$OT_BUILDDIR" 38} 39 40build_all_features() 41{ 42 # Build Thread 1.1 with full features 43 reset_source 44 "$(dirname "$0")"/cmake-build simulation -DOT_THREAD_VERSION=1.1 45 46 # Build Thread 1.1 cli-radio 47 reset_source 48 "$(dirname "$0")"/cmake-build simulation \ 49 -DOT_THREAD_VERSION=1.1 \ 50 -DOT_DIAGNOSTIC=ON \ 51 -DOT_APP_CLI=ON \ 52 -DOT_APP_NCP=OFF \ 53 -DOT_APP_RCP=OFF \ 54 -DOT_FTD=OFF \ 55 -DOT_MTD=OFF 56 57 # Thread 1.3 options 58 local options=( 59 "-DOT_BACKBONE_ROUTER=ON" 60 "-DOT_BORDER_ROUTING=ON" 61 "-DOT_NAT64_BORDER_ROUTING=ON" 62 "-DOT_NAT64_TRANSLATOR=ON" 63 "-DOT_CSL_RECEIVER=ON" 64 "-DOT_MLR=ON" 65 "-DOT_OTNS=ON" 66 "-DOT_SIMULATION_VIRTUAL_TIME=ON" 67 "-DOT_THREAD_VERSION=1.3" 68 ) 69 70 # Build Thread 1.3 with full features 71 reset_source 72 "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON 73 74 # Build Thread 1.3 Backbone Router without DUA ND Proxying 75 reset_source 76 "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_BACKBONE_ROUTER_DUA_NDPROXYING=OFF 77 78 # Build Thread 1.3 Backbone Router without Multicast Routing 79 reset_source 80 "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=OFF 81 82 # Build with Vendor Extension 83 reset_source 84 "$(dirname "$0")"/cmake-build simulation \ 85 -DOT_THREAD_VERSION=1.1 \ 86 -DOT_VENDOR_EXTENSION=../../src/core/common/extension_example.cpp 87 88 # Build Thread 1.3 with no additional features 89 reset_source 90 "$(dirname "$0")"/cmake-build simulation -DOT_THREAD_VERSION=1.3 91 92 # Build Thread 1.3 with full features and OT_ASSERT=OFF 93 reset_source 94 "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_ASSERT=OFF 95 96 # Build with RAM settings 97 reset_source 98 "$(dirname "$0")"/cmake-build simulation -DOT_SETTINGS_RAM=ON 99 100 # Build with Vendor CLI commands 101 reset_source 102 "$(dirname "$0")"/cmake-build simulation \ 103 -DOT_CLI_VENDOR_EXTENSION=../../src/cli/cli_extension_example.cmake 104} 105 106build_toranj() 107{ 108 reset_source 109 top_builddir="$OT_BUILDDIR" ./tests/toranj/build.sh cmake 110} 111 112main() 113{ 114 build_all_features 115 build_toranj 116} 117 118main "$@" 119