mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 09:07:47 +00:00
[cmake] add a cmake build script to build OpenThread (#4969)
This commit adds a bash script to compile the platform that supports
cmake.
Usage examples:
./script/cmake-build cc1352
./script/cmake-build posix -DOT_MAC_FILTER=ON
This commit is contained in:
+22
-125
@@ -29,13 +29,20 @@
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
readonly OT_SRCDIR="$(pwd)"
|
||||
readonly OT_BUILDDIR="$OT_SRCDIR/build"
|
||||
readonly OT_BUILDDIR="$(pwd)/build"
|
||||
|
||||
readonly OT_COMMON_OPTIONS=(
|
||||
"-DOT_COMPILE_WARNING_AS_ERROR=ON"
|
||||
)
|
||||
|
||||
readonly OT_BASIC_CHECK_OPTIONS=(
|
||||
"-DOT_COMMISSIONER=ON"
|
||||
"-DOT_DHCP6_CLIENT=ON"
|
||||
"-DOT_DHCP6_SERVER=ON"
|
||||
"-DOT_DNS_CLIENT=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
)
|
||||
|
||||
reset_source()
|
||||
{
|
||||
rm -rf "$OT_BUILDDIR"
|
||||
@@ -43,160 +50,50 @@ reset_source()
|
||||
|
||||
build_cc1352()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=cc1352"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=examples/platforms/cc1352/arm-none-eabi.cmake"
|
||||
"-DOT_COMMISSIONER=on"
|
||||
"-DOT_DHCP6_CLIENT=on"
|
||||
"-DOT_DHCP6_SERVER=on"
|
||||
"-DOT_DNS_CLIENT=on"
|
||||
"-DOT_JOINER=on"
|
||||
"-DOT_SLAAC=on"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
reset_source
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja
|
||||
cd "$OT_SRCDIR"
|
||||
"$(dirname "$0")"/cmake-build cc1352 "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_cc2538()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=cc2538"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=examples/platforms/cc2538/arm-none-eabi.cmake"
|
||||
)
|
||||
|
||||
reset_source
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja
|
||||
cd "$OT_SRCDIR"
|
||||
"$(dirname "$0")"/cmake-build cc2538 "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_cc2650()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=cc2650"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=examples/platforms/cc2650/arm-none-eabi.cmake"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
reset_source
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja ot-cli-mtd ot-ncp-mtd
|
||||
cd "$OT_SRCDIR"
|
||||
"$(dirname "$0")"/cmake-build cc2650 "${OT_COMMON_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_cc2652()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=cc2652"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=examples/platforms/cc2652/arm-none-eabi.cmake"
|
||||
"-DOT_COMMISSIONER=on"
|
||||
"-DOT_DHCP6_CLIENT=on"
|
||||
"-DOT_DHCP6_SERVER=on"
|
||||
"-DOT_DNS_CLIENT=on"
|
||||
"-DOT_JOINER=on"
|
||||
"-DOT_SLAAC=on"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
reset_source
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja
|
||||
cd "$OT_SRCDIR"
|
||||
"$(dirname "$0")"/cmake-build cc2652 "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_kw41z()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=kw41z"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=examples/platforms/kw41z/arm-none-eabi.cmake"
|
||||
"-DOT_COMMISSIONER=on"
|
||||
"-DOT_DHCP6_CLIENT=on"
|
||||
"-DOT_DHCP6_SERVER=on"
|
||||
"-DOT_DNS_CLIENT=on"
|
||||
"-DOT_JOINER=on"
|
||||
"-DOT_SLAAC=on"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
reset_source
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja
|
||||
cd "$OT_SRCDIR"
|
||||
"$(dirname "$0")"/cmake-build kw41z "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_qpg6095()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=qpg6095"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=examples/platforms/qpg6095/arm-none-eabi.cmake"
|
||||
"-DOT_COMMISSIONER=on"
|
||||
"-DOT_DHCP6_CLIENT=on"
|
||||
"-DOT_DHCP6_SERVER=on"
|
||||
"-DOT_DNS_CLIENT=on"
|
||||
"-DOT_JOINER=on"
|
||||
"-DOT_SLAAC=on"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
reset_source
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja
|
||||
cd "$OT_SRCDIR"
|
||||
"$(dirname "$0")"/cmake-build qpg6095 "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_samr21()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=samr21"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=examples/platforms/samr21/arm-none-eabi.cmake"
|
||||
"-DOT_COMMISSIONER=on"
|
||||
"-DOT_DHCP6_CLIENT=on"
|
||||
"-DOT_DHCP6_SERVER=on"
|
||||
"-DOT_DNS_CLIENT=on"
|
||||
"-DOT_JOINER=on"
|
||||
"-DOT_SLAAC=on"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
reset_source
|
||||
wget http://ww1.microchip.com/downloads/en/DeviceDoc/asf-standalone-archive-3.45.0.85.zip || die
|
||||
unzip -qq asf-standalone-archive-3.45.0.85.zip || die
|
||||
mv xdk-asf-3.45.0 third_party/microchip/asf || die
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja
|
||||
cd "$OT_SRCDIR"
|
||||
|
||||
asfzip=asf-standalone-archive-3.45.0.85.zip
|
||||
wget http://ww1.microchip.com/downloads/en/DeviceDoc/${asfzip}
|
||||
unzip -qq ${asfzip}
|
||||
mv xdk-asf-3.45.0 third_party/microchip/asf
|
||||
|
||||
"$(dirname "$0")"/cmake-build samr21 "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
readonly OT_SRCDIR="$(pwd)"
|
||||
readonly OT_BUILDDIR="$OT_SRCDIR/build"
|
||||
readonly OT_BUILDDIR="$(pwd)/build"
|
||||
|
||||
reset_source()
|
||||
{
|
||||
@@ -42,46 +41,10 @@ build()
|
||||
local options=("$@")
|
||||
|
||||
options+=(
|
||||
"-DOT_COMPILE_WARNING_AS_ERROR=on"
|
||||
"-DOT_PLATFORM=posix"
|
||||
"-DOT_BORDER_AGENT=on"
|
||||
"-DOT_BORDER_ROUTER=on"
|
||||
"-DOT_CHANNEL_MANAGER=on"
|
||||
"-DOT_CHANNEL_MONITOR=on"
|
||||
"-DOT_CHILD_SUPERVISION=on"
|
||||
"-DOT_COAP=on"
|
||||
"-DOT_COAPS=on"
|
||||
"-DOT_COMMISSIONER=on"
|
||||
"-DOT_DHCP6_CLIENT=on"
|
||||
"-DOT_DHCP6_SERVER=on"
|
||||
"-DOT_DIAGNOSTIC=on"
|
||||
"-DOT_DNS_CLIENT=on"
|
||||
"-DOT_ECDSA=on"
|
||||
"-DOT_EXTERNAL_HEAP=on"
|
||||
"-DOT_IP6_FRAGM=on"
|
||||
"-DOT_JAM_DETECTION=on"
|
||||
"-DOT_JOINER=on"
|
||||
"-DOT_LEGACY=on"
|
||||
"-DOT_LINK_RAW=on"
|
||||
"-DOT_LOG_LEVEL_DYNAMIC=on"
|
||||
"-DOT_MAC_FILTER=on"
|
||||
"-DOT_MTD_NETDIAG=on"
|
||||
"-DOT_PLATFORM_NETIF=on"
|
||||
"-DOT_PLATFORM_UDP=on"
|
||||
"-DOT_REFERENCE_DEVICE=on"
|
||||
"-DOT_SERVICE=on"
|
||||
"-DOT_SETTINGS_RAM=on"
|
||||
"-DOT_SLAAC=on"
|
||||
"-DOT_SNTP_CLIENT=on"
|
||||
"-DOT_FULL_LOGS=on"
|
||||
"-DOT_FULL_LOGS=ON"
|
||||
)
|
||||
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" "$OT_SRCDIR"
|
||||
ninja
|
||||
|
||||
cd "$OT_SRCDIR"
|
||||
"$(dirname "$0")"/cmake-build posix "${options[@]}"
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -29,13 +29,7 @@
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
readonly OT_SRCDIR="$(pwd)"
|
||||
readonly OT_BUILDDIR="$OT_SRCDIR/build"
|
||||
|
||||
readonly OT_COMMON_OPTIONS=(
|
||||
"-DOT_COMPILE_WARNING_AS_ERROR=on"
|
||||
"-DOT_PLATFORM=simulation"
|
||||
)
|
||||
readonly OT_BUILDDIR="$(pwd)/build"
|
||||
|
||||
reset_source()
|
||||
{
|
||||
@@ -44,46 +38,10 @@ reset_source()
|
||||
|
||||
build_all_features()
|
||||
{
|
||||
local options=("${OT_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_BORDER_AGENT=on"
|
||||
"-DOT_BORDER_ROUTER=on"
|
||||
"-DOT_COAP=on"
|
||||
"-DOT_COAPS=on"
|
||||
"-DOT_COMMISSIONER=on"
|
||||
"-DOT_CHANNEL_MANAGER=on"
|
||||
"-DOT_CHANNEL_MONITOR=on"
|
||||
"-DOT_CHILD_SUPERVISION=on"
|
||||
"-DOT_DHCP6_CLIENT=on"
|
||||
"-DOT_DHCP6_SERVER=on"
|
||||
"-DOT_DIAGNOSTIC=on"
|
||||
"-DOT_DNS_CLIENT=on"
|
||||
"-DOT_ECDSA=on"
|
||||
"-DOT_IP6_FRAGM=on"
|
||||
"-DOT_JAM_DETECTION=on"
|
||||
"-DOT_JOINER=on"
|
||||
"-DOT_LINK_RAW=on"
|
||||
"-DOT_MAC_FILTER=on"
|
||||
"-DOT_MTD_NETDIAG=on"
|
||||
"-DOT_SERVICE=on"
|
||||
"-DOT_SLAAC=on"
|
||||
"-DOT_SNTP_CLIENT=on"
|
||||
)
|
||||
|
||||
reset_source
|
||||
|
||||
mkdir -p "$OT_BUILDDIR"
|
||||
cd "$OT_BUILDDIR"
|
||||
cmake -GNinja "${options[@]}" ..
|
||||
ninja
|
||||
cd "$OT_SRCDIR"
|
||||
|
||||
"$(dirname "$0")"/cmake-build simulation
|
||||
reset_source
|
||||
mkdir build && cd build
|
||||
cmake -GNinja "${options[@]}" -DOT_OTNS=on -DOT_SIMULATION_VIRTUAL_TIME=on ..
|
||||
ninja
|
||||
cd ..
|
||||
"$(dirname "$0")"/cmake-build simulation -DOT_OTNS=ON -DOT_SIMULATION_VIRTUAL_TIME=ON
|
||||
}
|
||||
|
||||
build_toranj()
|
||||
|
||||
Executable
+169
@@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# This script calls cmake and ninja to compile OpenThread for the given platform.
|
||||
#
|
||||
# Compile with default build options:
|
||||
#
|
||||
# script/cmake-build ${platform}
|
||||
#
|
||||
# Compile with the specified build option enabled:
|
||||
#
|
||||
# script/cmake-build ${platform} -D${option}=ON
|
||||
#
|
||||
# Compile with the specified build option disabled that already enabled by default:
|
||||
#
|
||||
# script/cmake-build ${platform} -D${option}=OFF
|
||||
#
|
||||
# Compile with the specified ninja build target:
|
||||
#
|
||||
# OT_CMAKE_NINJA_TARGET="ot-cli-ftd" script/cmake-build ${platform}
|
||||
#
|
||||
# Compile with the specified build directory:
|
||||
#
|
||||
# OT_CMAKE_BUILD_DIR="./build/temp" script/cmake-build ${platform}
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# script/cmake-build simulation
|
||||
#
|
||||
# script/cmake-build simulation -DOT_FULL_LOGS=ON -DOT_CHANNEL_MANAGER=OFF
|
||||
#
|
||||
# OT_CMAKE_NINJA_TARGET="ot-cli-mtd" OT_CMAKE_BUILD_DIR="./build/temp" script/cmake-build simulation -DOT_FULL_LOGS=ON -DOT_CHANNEL_MANAGER=OFF
|
||||
#
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET:-}
|
||||
|
||||
readonly OT_SRCDIR="$(pwd)"
|
||||
readonly OT_PLATFORMS=(cc1352 cc2538 cc2650 cc2652 kw41z qpg6095 samr21 simulation posix)
|
||||
readonly OT_POSIX_SIM_COMMON_OPTIONS=(
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_COAP=ON"
|
||||
"-DOT_COAP_OBSERVE=ON"
|
||||
"-DOT_COAPS=ON"
|
||||
"-DOT_COMMISSIONER=ON"
|
||||
"-DOT_CHANNEL_MANAGER=ON"
|
||||
"-DOT_CHANNEL_MONITOR=ON"
|
||||
"-DOT_CHILD_SUPERVISION=ON"
|
||||
"-DOT_DHCP6_CLIENT=ON"
|
||||
"-DOT_DHCP6_SERVER=ON"
|
||||
"-DOT_DIAGNOSTIC=ON"
|
||||
"-DOT_DNS_CLIENT=ON"
|
||||
"-DOT_ECDSA=ON"
|
||||
"-DOT_IP6_FRAGM=ON"
|
||||
"-DOT_JAM_DETECTION=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
"-DOT_LEGACY=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_MTD_NETDIAG=ON"
|
||||
"-DOT_REFERENCE_DEVICE=ON"
|
||||
"-DOT_SERVICE=ON"
|
||||
"-DOT_SNTP_CLIENT=ON"
|
||||
"-DOT_COVERAGE=ON"
|
||||
"-DOT_LOG_LEVEL_DYNAMIC=ON"
|
||||
"-DOT_COMPILE_WARNING_AS_ERROR=ON"
|
||||
)
|
||||
|
||||
die()
|
||||
{
|
||||
echo " ** ERROR: Openthread CMake doesn't support platform \"$1\""
|
||||
exit 1
|
||||
}
|
||||
|
||||
build()
|
||||
{
|
||||
local platform=$1
|
||||
local builddir="${OT_CMAKE_BUILD_DIR:-build/${platform}}"
|
||||
shift
|
||||
|
||||
mkdir -p "${builddir}"
|
||||
cd "${builddir}"
|
||||
|
||||
cmake -GNinja "$@" "${OT_SRCDIR}"
|
||||
|
||||
if [[ -n ${OT_CMAKE_NINJA_TARGET[*]} ]]; then
|
||||
ninja "${OT_CMAKE_NINJA_TARGET[@]}"
|
||||
else
|
||||
ninja
|
||||
fi
|
||||
|
||||
cd "${OT_SRCDIR}"
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
if [[ $# == 0 ]]; then
|
||||
echo "Please specify a platform: ${OT_PLATFORMS[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local platform="$1"
|
||||
shift
|
||||
local local_options=()
|
||||
local options=(
|
||||
"-DOT_PLATFORM=${platform}"
|
||||
"-DOT_SLAAC=ON"
|
||||
)
|
||||
|
||||
# Check if the platform supports cmake.
|
||||
echo "${OT_PLATFORMS[@]}" | grep -wq "${platform}" || die "${platform}"
|
||||
|
||||
case "${platform}" in
|
||||
posix)
|
||||
local_options+=(
|
||||
"-DOT_LOG_OUTPUT=PLATFORM_DEFINED"
|
||||
"-DOT_POSIX_MAX_POWER_TABLE=ON"
|
||||
)
|
||||
options+=("${OT_POSIX_SIM_COMMON_OPTIONS[@]}" "${local_options[@]}")
|
||||
;;
|
||||
simulation)
|
||||
local_options=("-DOT_LINK_RAW=ON")
|
||||
options+=("${OT_POSIX_SIM_COMMON_OPTIONS[@]}" "${local_options[@]}")
|
||||
;;
|
||||
cc2650)
|
||||
OT_CMAKE_NINJA_TARGET=("ot-cli-mtd" "ot-ncp-mtd")
|
||||
options+=("-DCMAKE_TOOLCHAIN_FILE=examples/platforms/${platform}/arm-none-eabi.cmake" "-DCMAKE_BUILD_TYPE=Release")
|
||||
;;
|
||||
cc1352 | cc2652 | samr21 | qpg6095)
|
||||
options+=("-DCMAKE_TOOLCHAIN_FILE=examples/platforms/${platform}/arm-none-eabi.cmake" "-DCMAKE_BUILD_TYPE=Release")
|
||||
;;
|
||||
*)
|
||||
options+=("-DCMAKE_TOOLCHAIN_FILE=examples/platforms/${platform}/arm-none-eabi.cmake")
|
||||
;;
|
||||
esac
|
||||
|
||||
options+=("$@")
|
||||
build "${platform}" "${options[@]}"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
+20
-108
@@ -34,28 +34,6 @@ set -euo pipefail
|
||||
|
||||
readonly OT_BUILDDIR="$(pwd)/build"
|
||||
readonly OT_SRCDIR="$(pwd)"
|
||||
readonly OT_TEST_COMMON_OPTIONS=(
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_CHANNEL_MANAGER=ON"
|
||||
"-DOT_CHANNEL_MONITOR=ON"
|
||||
"-DOT_CHILD_SUPERVISION=ON"
|
||||
"-DOT_COAP=ON"
|
||||
"-DOT_COAPS=ON"
|
||||
"-DOT_COMMISSIONER=ON"
|
||||
"-DOT_COVERAGE=ON"
|
||||
"-DOT_DHCP6_CLIENT=ON"
|
||||
"-DOT_DHCP6_SERVER=ON"
|
||||
"-DOT_DIAGNOSTIC=ON"
|
||||
"-DOT_IP6_FRAGM=ON"
|
||||
"-DOT_JAM_DETECTION=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
"-DOT_LOG_LEVEL_DYNAMIC=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_REFERENCE_DEVICE=ON"
|
||||
"-DOT_SERVICE=ON"
|
||||
"-DOT_SLAAC=ON"
|
||||
)
|
||||
|
||||
readonly COLOR_PASS='\033[0;32m'
|
||||
readonly COLOR_FAIL='\033[0;31m'
|
||||
@@ -70,17 +48,10 @@ readonly VIRTUAL_TIME="${VIRTUAL_TIME:-1}"
|
||||
build_simulation()
|
||||
{
|
||||
local version="$1"
|
||||
local options=("${OT_TEST_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=simulation"
|
||||
"-DOT_THREAD_VERSION=${version}"
|
||||
)
|
||||
local options=("-DOT_THREAD_VERSION=${version}")
|
||||
|
||||
if [[ ${version} == "1.2" ]]; then
|
||||
options+=(
|
||||
"-DOT_DUA=ON"
|
||||
)
|
||||
options+=("-DOT_DUA=ON")
|
||||
fi
|
||||
|
||||
if [[ ${VIRTUAL_TIME} == 1 ]]; then
|
||||
@@ -93,30 +64,16 @@ build_simulation()
|
||||
fi
|
||||
|
||||
if [[ ${version} == "1.2" ]]; then
|
||||
options+=(
|
||||
"-DOT_CSL_RECEIVER=ON"
|
||||
)
|
||||
options+=("-DOT_CSL_RECEIVER=ON")
|
||||
fi
|
||||
|
||||
local builddir="${OT_BUILDDIR}/cmake/openthread-simulation-${version}"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake -GNinja "${options[@]}" "${ot_extra_options[@]}" "${OT_SRCDIR}" \
|
||||
&& ninja)
|
||||
OT_CMAKE_BUILD_DIR="${OT_BUILDDIR}/cmake/openthread-simulation-${version}" "${OT_SRCDIR}"/script/cmake-build simulation "${options[@]}" "${ot_extra_options[@]}"
|
||||
|
||||
if [[ ${version} == "1.2" ]]; then
|
||||
|
||||
options+=(
|
||||
"-DOT_BACKBONE_ROUTER=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_SERVICE=ON"
|
||||
)
|
||||
options+=("-DOT_BACKBONE_ROUTER=ON")
|
||||
|
||||
local builddir="${OT_BUILDDIR}/cmake/openthread-simulation-${version}-bbr"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake -GNinja "${options[@]}" "${ot_extra_options[@]}" "${OT_SRCDIR}" \
|
||||
&& ninja)
|
||||
OT_CMAKE_BUILD_DIR="${OT_BUILDDIR}/cmake/openthread-simulation-${version}-bbr" "${OT_SRCDIR}"/script/cmake-build simulation "${options[@]}" "${ot_extra_options[@]}"
|
||||
|
||||
fi
|
||||
}
|
||||
@@ -124,44 +81,23 @@ build_simulation()
|
||||
build_posix()
|
||||
{
|
||||
local version="$1"
|
||||
local options=("${OT_TEST_COMMON_OPTIONS[@]}")
|
||||
|
||||
options+=(
|
||||
"-DOT_PLATFORM=posix"
|
||||
"-DOT_POSIX_MAX_POWER_TABLE=ON"
|
||||
"-DOT_READLINE=readline"
|
||||
"-DOT_THREAD_VERSION=${version}"
|
||||
)
|
||||
local options=("-DOT_THREAD_VERSION=${version}")
|
||||
|
||||
if [[ ${version} == "1.2" ]]; then
|
||||
options+=(
|
||||
"-DOT_DUA=ON"
|
||||
)
|
||||
options+=("-DOT_DUA=ON")
|
||||
fi
|
||||
|
||||
if [[ ${VIRTUAL_TIME} == 1 ]]; then
|
||||
options+=("-DOT_POSIX_VIRTUAL_TIME=ON")
|
||||
fi
|
||||
|
||||
local builddir="${OT_BUILDDIR}/cmake/openthread-posix-${version}"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake -GNinja "${options[@]}" "${ot_extra_options[@]}" "${OT_SRCDIR}" \
|
||||
&& ninja)
|
||||
OT_CMAKE_BUILD_DIR="${OT_BUILDDIR}/cmake/openthread-posix-${version}" "${OT_SRCDIR}"/script/cmake-build posix "${options[@]}" "${ot_extra_options[@]}"
|
||||
|
||||
if [[ ${version} == "1.2" ]]; then
|
||||
|
||||
options+=(
|
||||
"-DOT_BACKBONE_ROUTER=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_SERVICE=ON"
|
||||
)
|
||||
options+=("-DOT_BACKBONE_ROUTER=ON")
|
||||
|
||||
local builddir="${OT_BUILDDIR}/cmake/openthread-posix-${version}-bbr"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake -GNinja "${options[@]}" "${ot_extra_options[@]}" "${OT_SRCDIR}" \
|
||||
&& ninja)
|
||||
OT_CMAKE_BUILD_DIR="${OT_BUILDDIR}/cmake/openthread-posix-${version}-bbr" "${OT_SRCDIR}"/script/cmake-build posix "${options[@]}" "${ot_extra_options[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -335,7 +271,7 @@ EXAMPLES:
|
||||
THREAD_VERSION=1.2 VIRTUAL_TIME=0 $0 clean build cert_suite tests/scripts/thread-cert/v1_2_*
|
||||
|
||||
# Run a single expect test
|
||||
$0 clean build expect tests/scripts/expect/log-level.exp
|
||||
$0 clean build expect tests/scripts/expect/cli-log-level.exp
|
||||
|
||||
# Run all expect tests
|
||||
$0 clean build expect
|
||||
@@ -346,43 +282,19 @@ EXAMPLES:
|
||||
|
||||
do_package()
|
||||
{
|
||||
local options=("-DCMAKE_BUILD_TYPE=Release")
|
||||
local builddir="${OT_BUILDDIR}/cmake/openthread-sim"
|
||||
local options=(
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_CHILD_SUPERVISION=ON"
|
||||
"-DOT_COMMISSIONER=ON"
|
||||
"-DOT_COMPILE_WARNING_AS_ERROR=ON"
|
||||
"-DOT_DIAGNOSTIC=ON"
|
||||
"-DOT_IP6_FRAGM=ON"
|
||||
"-DOT_JAM_DETECTION=ON"
|
||||
"-DOT_JOINER=ON"
|
||||
"-DOT_LOG_LEVEL_DYNAMIC=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_SERVICE=ON"
|
||||
"-DOT_SLAAC=ON"
|
||||
)
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake -GNinja -DOT_PLATFORM="simulation" "${options[@]}" "${ot_extra_options[@]}" "${OT_SRCDIR}" \
|
||||
&& ninja package \
|
||||
&& ls "${builddir}"/openthread-simulation-*.deb)
|
||||
|
||||
OT_CMAKE_NINJA_TARGET="package" OT_CMAKE_BUILD_DIR="${builddir}" "${OT_SRCDIR}"/script/cmake-build simulation "${options[@]}" "${ot_extra_options[@]}"
|
||||
ls "${builddir}"/openthread-simulation-*.deb
|
||||
|
||||
builddir="${OT_BUILDDIR}/cmake/openthread-host"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake -GNinja -DOT_PLATFORM="posix" "${options[@]}" "${ot_extra_options[@]}" "${OT_SRCDIR}" \
|
||||
&& ninja package \
|
||||
&& ls "${builddir}"/openthread-standalone-*.deb)
|
||||
OT_CMAKE_NINJA_TARGET="package" OT_CMAKE_BUILD_DIR="${builddir}" "${OT_SRCDIR}"/script/cmake-build posix "${options[@]}" "${ot_extra_options[@]}"
|
||||
ls "${builddir}"/openthread-standalone-*.deb
|
||||
|
||||
builddir="${OT_BUILDDIR}/cmake/openthread-daemon"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake -GNinja -DOT_PLATFORM="posix" \
|
||||
-DOT_DAEMON=1 -DOT_PLATFORM_NETIF=1 -DOT_PLATFORM_UDP=1 "${options[@]}" "${ot_extra_options[@]}" "${OT_SRCDIR}" \
|
||||
&& ninja package \
|
||||
&& ls "${builddir}"/openthread-daemon-*.deb)
|
||||
OT_CMAKE_NINJA_TARGET="package" OT_CMAKE_BUILD_DIR="${builddir}" "${OT_SRCDIR}"/script/cmake-build posix "${options[@]}" "${ot_extra_options[@]}" "-DOT_DAEMON=ON -DOT_PLATFORM_NETIF=ON -DOT_PLATFORM_UDP=ON"
|
||||
ls "${builddir}"/openthread-daemon-*.deb
|
||||
}
|
||||
|
||||
envsetup()
|
||||
|
||||
Reference in New Issue
Block a user