Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / infra / packaging / preset / 20230413_windows
1 #!/bin/bash
2
3 PRESET="20230413"
4
5 function preset_configure()
6 {
7   REQUIRED_UNITS=()
8   # Common Libraries
9   REQUIRED_UNITS+=("angkor" "cwrap" "pepper-str" "pepper-strcast" "pp")
10   REQUIRED_UNITS+=("oops" "pepper-assert" "pepper-csv2vec" "foder" "crew")
11   REQUIRED_UNITS+=("souschef")
12   REQUIRED_UNITS+=("safemain")
13   REQUIRED_UNITS+=("arser")
14   REQUIRED_UNITS+=("vconone")
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-tflite280" "mio-circle05" "mio-tflite2121" "mio-circle06")
21   # Data I/O
22   REQUIRED_UNITS+=("dio-hdf5")
23   # Compute
24   REQUIRED_UNITS+=("luci-compute")
25   # Circle compiler library (.circle -> .circle)
26   REQUIRED_UNITS+=("luci")
27   # Python interface for circle schema
28   REQUIRED_UNITS+=("pics")
29   # Tools
30   REQUIRED_UNITS+=("tflite2circle" "circle2circle" "tflchef")
31   REQUIRED_UNITS+=("circle-tensordump" "circledump")
32   REQUIRED_UNITS+=("tf2tfliteV2" "luci-interpreter")
33   REQUIRED_UNITS+=("luci-eval-driver")
34   REQUIRED_UNITS+=("record-minmax" "circle-quantizer" "rawdata2hdf5" "circle-mpqsolver")
35   REQUIRED_UNITS+=("circle-eval-diff" "circle-interpreter")
36   REQUIRED_UNITS+=("circle-partitioner" "circle-operator")
37   REQUIRED_UNITS+=("one-cmds")
38   REQUIRED_UNITS+=("bcq-tools")
39   REQUIRED_UNITS+=("dalgona")
40   REQUIRED_UNITS+=("visq")
41
42   # Dependent modules needed for build
43   REQUIRED_UNITS+=("circlechef")
44   REQUIRED_UNITS+=("circle-verify")
45
46   NPROC=$(cat /proc/cpuinfo | grep -c processor)
47
48   # TODO Use "nncc configure" and "nncc build"
49   cmake \
50     -G "MSYS Makefiles" \
51     -DUSE_PROTOBUF_LEGACY_IMPORT=ON \
52     -DCMAKE_EXE_LINKER_FLAGS="-Wl,--allow-multiple-definition" \
53     -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--allow-multiple-definition" \
54     -DENABLE_TEST=OFF \
55     -DDOWNLOAD_GTEST=OFF \
56     -DBUILD_GTEST=OFF \
57     -DCMAKE_C_COMPILER=gcc \
58     -DCMAKE_CXX_COMPILER=g++ \
59     -DCMAKE_INSTALL_PREFIX="${NNCC_INSTALL_PREFIX}" \
60     -DCMAKE_BUILD_TYPE=release \
61     -DBUILD_WHITELIST=$(join_by ";" "${REQUIRED_UNITS[@]}") \
62     -DEXTERNALS_BUILD_THREADS=$((NPROC/2)) \
63     ${EXTRA_OPTIONS[@]} \
64     "${NNAS_PROJECT_PATH}/infra/nncc"
65 }
66
67 function preset_install()
68 {
69   # Install libraries to bin/ for Windows release
70   mv ${NNCC_INSTALL_PREFIX}/lib/*.dll ${NNCC_INSTALL_PREFIX}/bin
71   rm -rf ${NNCC_INSTALL_PREFIX}/lib
72
73   # Install tf2nnpkg
74   install -T -m 755 -D "${SCRIPT_PATH}/res/tf2nnpkg.${PRESET}" "${NNAS_INSTALL_PREFIX}/bin/tf2nnpkg"
75
76   # Though you have to install tensorflow to run 'tf2tfliteV2',
77   # tensorflow can't be installed in mingw. First, You can install tensorflow 
78   # from Window native CMD(run as administrator) with python virtual environment.
79   # And, you must copy it to "${NNAS_INSTALL_PREFIX}/bin/venv"
80 }