Skip to content

Commit

Permalink
Add example build files based on Tizen OS
Browse files Browse the repository at this point in the history
  • Loading branch information
wootak-jung committed Aug 21, 2021
1 parent f66f408 commit df18cdb
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/build_overrides/tizen.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

declare_args() {
# Root directory for tizen.
tizen_root = "//config/tizen/chip-gn/platform"
}
22 changes: 22 additions & 0 deletions examples/lighting-app/linux/with_tizen.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# add this gni as import in your build args to use tizen in the example
# 'import("//with_tizen.gni")'

import("//build_overrides/chip.gni")

import("${chip_root}/config/tizen/chip-gn/args.gni")

current_os = "tizen"
74 changes: 74 additions & 0 deletions scripts/examples/gn_tizen_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash

#
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -e

# Build script for GN examples GitHub workflow.

source "$(dirname "$0")/../../scripts/activate.sh"

if [ -z "$TIZEN_HOME" ]; then
echo "TIZEN_HOME not set!"
exit 1
fi

GN_ARGS=()

EXAMPLE_DIR=$1
shift
OUTPUT_DIR=$1
shift

NINJA_ARGS=()
for arg; do
case $arg in
-v)
NINJA_ARGS+=(-v)
;;
*=*)
GN_ARGS+=("$arg")
;;
*import*)
GN_ARGS+=("$arg")
;;
*)
echo >&2 "invalid argument: $arg"
echo >&2 "You can use -v for ninja args, and '=' or 'import' for gn args"
exit 2
;;
esac
done

set -x
env

PKG_CONFIG_SYSROOT_DIR=$TIZEN_HOME \
PKG_CONFIG_LIBDIR=$TIZEN_HOME/usr/lib/pkgconfig \
PKG_CONFIG_PATH=$TIZEN_HOME/usr/lib/pkgconfig \
gn gen --check --fail-on-unused-args --root="$EXAMPLE_DIR" "$OUTPUT_DIR" --args=''$GN_ARGS'
target_os="tizen"
target_cpu="arm" arm_arch="armv7-a"
import("//build_overrides/build.gni")
target_cflags=[ "--sysroot='$TIZEN_HOME'" ]
target_ldflags=[ "--sysroot='$TIZEN_HOME'" ]
custom_toolchain="${build_root}/toolchain/custom"
target_cc="'$TIZEN_HOME'/bin/arm-linux-gnueabi-gcc"
target_cxx="'$TIZEN_HOME'/bin/arm-linux-gnueabi-g++"
target_ar="'$TIZEN_HOME'/bin/arm-linux-gnueabi-ar"'

ninja -C "$OUTPUT_DIR" "${NINJA_ARGS[@]}"

0 comments on commit df18cdb

Please sign in to comment.