diff options
author | 박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com> | 2018-03-19 08:26:24 +0900 |
---|---|---|
committer | GitHub Enterprise <noreply-CODE@samsung.com> | 2018-03-19 08:26:24 +0900 |
commit | d579dbbc3f632c5cbb254ee6687a037116c62e96 (patch) | |
tree | eb44dbd026ef5ae01ffe5288447ddf2c89504302 | |
parent | 30d192850454f101025cfb957b45a63ae5b6f2d8 (diff) | |
download | nnfw-d579dbbc3f632c5cbb254ee6687a037116c62e96.tar.gz nnfw-d579dbbc3f632c5cbb254ee6687a037116c62e96.tar.bz2 nnfw-d579dbbc3f632c5cbb254ee6687a037116c62e96.zip |
Add basic configure & build tools (#11)
* Add basic configure & build tools
This commit introduces 'nncc' script which eases CMake configure and
build.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
* Fix a typo (NNCC_SCIPRT_RPATH -> NNCC_SCRIPT_RPATH)
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | nncc | 28 | ||||
-rw-r--r-- | scripts/build.configuration | 1 | ||||
-rw-r--r-- | scripts/command/build | 12 | ||||
-rw-r--r-- | scripts/command/configure | 10 |
5 files changed, 52 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build @@ -0,0 +1,28 @@ +#!/bin/bash + +NNCC_SCRIPT_RPATH="scripts" +NNCC_COMMAND_RPATH="${NNCC_SCRIPT_RPATH}/command" + +NNCC_PROJECT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NNCC_SCRIPT_PATH="${NNCC_PROJECT_PATH}/${NNCC_SCRIPT_RPATH}" + +# Get command from command-line +COMMAND=$1; shift + +if [[ -z "${COMMAND}" ]]; then + echo "USAGE: $0 [COMMAND] ..." + exit 255 +fi + +COMMAND_FILE="${NNCC_PROJECT_PATH}/${NNCC_COMMAND_RPATH}/${COMMAND}" + +if [[ ! -f "${COMMAND_FILE}" ]]; then + echo "ERROR: '${COMMAND}' is not supported" + # TODO Show available commands + exit 255 +fi + +export NNCC_PROJECT_PATH +export NNCC_SCRIPT_PATH + +source "${COMMAND_FILE}" "$@" diff --git a/scripts/build.configuration b/scripts/build.configuration new file mode 100644 index 000000000..d22c92dce --- /dev/null +++ b/scripts/build.configuration @@ -0,0 +1 @@ +BUILD_WORKSPACE_RPATH="build" diff --git a/scripts/command/build b/scripts/command/build new file mode 100644 index 000000000..cdbc3e543 --- /dev/null +++ b/scripts/command/build @@ -0,0 +1,12 @@ +#!/bin/bash + +source "${NNCC_SCRIPT_PATH}/build.configuration" + +BUILD_WORKSPACE_PATH="${NNCC_PROJECT_PATH}/${BUILD_WORKSPACE_RPATH}" + +if [[ ! -d "${BUILD_WORKSPACE_PATH}" ]]; then + echo "'${BUILD_WORKSPACE_RPATH}' does not exist. Please run 'configure' first" + exit 255 +fi +cd "${BUILD_WORKSPACE_PATH}" +make diff --git a/scripts/command/configure b/scripts/command/configure new file mode 100644 index 000000000..3af975849 --- /dev/null +++ b/scripts/command/configure @@ -0,0 +1,10 @@ +#!/bin/bash + +source "${NNCC_SCRIPT_PATH}/build.configuration" + +BUILD_WORKSPACE_PATH="${NNCC_PROJECT_PATH}/${BUILD_WORKSPACE_RPATH}" + +mkdir -p "${BUILD_WORKSPACE_PATH}" + +cd "${BUILD_WORKSPACE_PATH}" +cmake "${NNCC_PROJECT_PATH}" "$@" |