Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / infra / packaging / preset / 20200731_windows
1 #!/bin/bash
2
3 function preset_configure()
4 {
5   REQUIRED_UNITS=()
6   # Common Libraries
7   REQUIRED_UNITS+=("angkor" "cwrap" "pepper-str" "pepper-strcast" "pp" "stdex")
8   REQUIRED_UNITS+=("oops" "pepper-assert" "foder")
9   REQUIRED_UNITS+=("souschef")
10   REQUIRED_UNITS+=("safemain")
11   REQUIRED_UNITS+=("arser")
12   REQUIRED_UNITS+=("vconone")
13   # Hermes Logging Framework
14   REQUIRED_UNITS+=("hermes" "hermes-std")
15   # loco IR and related utilities
16   REQUIRED_UNITS+=("loco" "locop" "locomotiv" "logo-core" "logo")
17   # Flatbuffer I/O
18   REQUIRED_UNITS+=("mio-tflite" "mio-circle")
19   # Circle compiler library (.circle -> .circle)
20   REQUIRED_UNITS+=("luci")
21   # Tools
22   REQUIRED_UNITS+=("tflite2circle" "circle2circle" "tflchef" "circlechef")
23   REQUIRED_UNITS+=("tf2tfliteV2" "luci-interpreter" "circle-verify")
24   REQUIRED_UNITS+=("record-minmax" "circle-quantizer")
25   REQUIRED_UNITS+=("one-cmds")
26
27   NPROC=$(cat /proc/cpuinfo | grep -c processor)
28
29   # TODO Use "nncc configure" and "nncc build"
30   cmake \
31     -G "MSYS Makefiles" \
32     -DTF2NNPKG_FOR_WINDOWS=ON \
33     -DUSE_PROTOBUF_LEGACY_IMPORT=ON \
34     -DCMAKE_EXE_LINKER_FLAGS="-Wl,--allow-multiple-definition" \
35     -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--allow-multiple-definition" \
36     -DENABLE_TEST=OFF \
37     -DDOWNLOAD_GTEST=OFF \
38     -DBUILD_GTEST=OFF \
39     -DCMAKE_C_COMPILER=gcc \
40     -DCMAKE_CXX_COMPILER=g++ \
41     -DCMAKE_INSTALL_PREFIX="${NNCC_INSTALL_PREFIX}" \
42     -DCMAKE_BUILD_TYPE=release \
43     -DBUILD_WHITELIST=$(join_by ";" "${REQUIRED_UNITS[@]}") \
44     -DEXTERNALS_BUILD_THREADS=$((NPROC/2)) \
45     ${EXTRA_OPTIONS[@]} \
46     "${NNAS_PROJECT_PATH}/infra/nncc"
47 }
48
49 function preset_install()
50 {
51   # Install libraries to bin/ for Windows release
52   mv ${NNCC_INSTALL_PREFIX}/lib/*.dll ${NNCC_INSTALL_PREFIX}/bin
53   rm -rf ${NNCC_INSTALL_PREFIX}/lib
54
55   install -t "${NNPKG_INSTALL_PREFIX}/bin" -D \
56     "${NNAS_PROJECT_PATH}/tools/nnpackage_tool/model2nnpkg/model2nnpkg.sh"
57
58   # Install tf2nnpkg
59   install -T -m 755 -D "${SCRIPT_PATH}/res/tf2nnpkg.20200630" "${NNAS_INSTALL_PREFIX}/bin/tf2nnpkg"
60
61   # Though you have to install tensorflow to run 'tf2tfliteV2',
62   # tensorflow can't be installed in mingw. First, You can install tensorflow 
63   # from Window native CMD(run as administrator) with python virtual environment.
64   # And, you must copy it to "${NNAS_INSTALL_PREFIX}/bin/venv"
65 }