Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / infra / packaging / preset / 20200508
1 #!/bin/bash
2
3 # NOTE purpose of this file is static analysis only
4 #      new official preset will be added when new programs are ready
5
6 PRESET="20200508"
7
8 function preset_configure()
9 {
10   REQUIRED_UNITS=()
11   # Common Libraries
12   REQUIRED_UNITS+=("angkor" "cwrap" "pepper-str" "pepper-strcast" "pp" "stdex")
13   REQUIRED_UNITS+=("oops" "pepper-assert" "foder")
14   REQUIRED_UNITS+=("safemain")
15   # Hermes Logging Framework
16   REQUIRED_UNITS+=("hermes" "hermes-std")
17   # loco IR and related utilities
18   REQUIRED_UNITS+=("loco" "locop" "locomotiv" "logo-core" "logo")
19   # Flatbuffer I/O
20   REQUIRED_UNITS+=("mio-tflite" "mio-circle")
21   # Circle compiler library (.circle -> .circle)
22   REQUIRED_UNITS+=("luci")
23   # Tools
24   REQUIRED_UNITS+=("tflite2circle" "circle2circle" "tflchef" "circlechef")
25   REQUIRED_UNITS+=("tf2tfliteV2" "luci-interpreter" "circle-verify")
26   REQUIRED_UNITS+=("record-minmax")
27
28   # TODO Use "nncc configure" and "nncc build"
29   cmake \
30     -DCMAKE_INSTALL_PREFIX="${NNCC_INSTALL_PREFIX}" \
31     -DCMAKE_BUILD_TYPE=release \
32     -DBUILD_WHITELIST=$(join_by ";" "${REQUIRED_UNITS[@]}") \
33     ${EXTRA_OPTIONS[@]} \
34     "${NNAS_PROJECT_PATH}/infra/nncc"
35 }
36
37 function preset_install()
38 {
39   install -t "${NNPKG_INSTALL_PREFIX}/bin" -D \
40     "${NNAS_PROJECT_PATH}/tools/nnpackage_tool/model2nnpkg/model2nnpkg.sh"
41
42   # Install tf2nnpkg
43   install -T -m 755 -D "${SCRIPT_PATH}/res/tf2nnpkg.${PRESET}" "${NNAS_INSTALL_PREFIX}/bin/tf2nnpkg"
44
45   # Create python virtual enviornment
46   python3 -m venv "${NNAS_INSTALL_PREFIX}/bin/venv"
47
48   # Install tensorflow
49   source "${NNAS_INSTALL_PREFIX}/bin/venv/bin/activate"
50   python -m pip --default-timeout=1000 --trusted-host pypi.org --trusted-host files.pythonhost.org \
51     install -U pip setuptools
52   python -m pip --default-timeout=1000 --trusted-host pypi.org --trusted-host files.pythonhost.org \
53     install tensorflow==2.2.0
54 }