# build support status
##  host build
*  windows build (ok)
*  linux build   (ok)
*  macos build   (ok)
##  cross build
*  windows cross build arm-android (ok)
*  windows cross build arm-linux   (ok)
*  linux cross build arm-android   (ok)
*  linux cross build arm-linux     (ok)
*  macos cross build arm-android   (ok)
*  macos cross build arm-linux     (ok but experimental)
*  macos cross build ios           (ok)

# build env prepare
## package install
### windows host build
    ```
    1: installl Visual Studio (need support LLVM/clang-cl), eg 2019
    clang-cl 9 linker have crash issue, pls install 7/8/10
    2: install extension of VS: python/cmake/LLVM
    3: CUDA env(if enable CUDA), version detail: project_root_dir/README.md
    ```
### linux host build
    ```
    1: cmake, which version > 3.14.4
    2: gcc/g++, which version > 6
    3: install build-essential git git-lfs gfortran libgfortran-6-dev autoconf gnupg flex bison gperf curl 
    4: zlib1g-dev gcc-multilib g++-multilib lib32ncurses5-dev libxml2-utils xsltproc unzip libtool:
    5: librdmacm-dev rdmacm-utils python3-dev swig python3-numpy texinfo
    6: CUDA env(if enable CUDA), version detail: project_root_dir/README.md
    ```
### macos host build
    ```
    1: cmake, which version > 3.14.4
    2: install brew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    3: brew install python python3 swig coreutils
    4: install at least xcode command line tool: https://developer.apple.com/xcode/
    5: about cuda: we do not support CUDA on macos
    ```
### cross build for arm-android
    now we support windows/linux/macos cross build to arm-android
    ```
    1: install unix-like tools, eg MSYS if you are using windows(recommend)
    we also support CMD.exe or powershell on windows
    1: download NDK from https://developer.android.google.cn/ndk/downloads/
    for diff OS platform package, suggested NDK20 or NDK21
    2: export NDK_ROOT=NDK_DIR at bash-like env
    3: config NDK_ROOT to PATH env at windows control board if use CMD/powershell
    ```
### cross build for arm-linux
    now we support arm-linux on linux and windows fully, also experimental on MACOS
    ```
    1: download toolchains on https://releases.linaro.org/components/toolchain/gcc-linaro/
    or https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
    if use windows or linux
    2: download https://github.com/thinkski/osx-arm-linux-toolchains if use MACOS
    ```
### cross build for ios
    now we only support cross build to ios on MACOS
    ```
    1: install full xcode: https://developer.apple.com/xcode/
    ```
## third-party code prepare
### with bash env(linux/macos/unix-like tools on windows, eg: msys etc)
    ```
    ./third_party/prepare.sh
    ./third_party/install-mkl.sh
    ```
### windows shell env(eg: cmd, powershell etc)
    infact if you can use git command on windows, which means you always install
    bash.exe at the same dir of git.exe, find it, then you can prepare third-party
    code by command:
    ```
    bash.exe ./third_party/prepare.sh
    bash.exe ./third_party/install-mkl.sh
    ```
# how to build
## with bash env(linux/macos/unix-like tools on windows, eg: msys etc)
    ```
    1: host build just use scripts:scripts/cmake-build/host_build.sh
    2: cross build to arm-android: scripts/cmake-build/cross_build_android_arm_inference.sh
    3: cross build to arm-linux:   scripts/cmake-build/cross_build_linux_arm_inference.sh
    4: cross build to ios:         scripts/cmake-build/cross_build_ios_arm_inference.sh
    ```
## windows shell env(eg: cmd, powershell etc)
    ```
    1: we do not provide BAT for cmd/powershlel scripts, BUT u can refs for scripts/cmake-build/*.sh
    ```
## Visual Studio GUI(only for windows host)
    ```
    1: import megengine src to Visual Studio as a project
    2: right click CMakeLists.txt, choose config 'cmake config'
       choose clang_cl_x86 or clang_cl_x64
    3: config other CMAKE config, eg, CUDA ON OR OFF
    ```


# other arm-linux-like board support
it`s easy to support other customized arm-linux-like board, example:
1: HISI 3516/3519, infact u can just use toolchains from arm developer or linaro
then call scripts/cmake-build/cross_build_linux_arm_inference.sh to build a ELF
binary, or if you get HISI official toolschain, you just need modify CMAKE_CXX_COMPILER
and CMAKE_C_COMPILER in toolchains/arm-linux-gnueabi* to a real name

2: about Raspberry, just use scripts/cmake-build/cross_build_linux_arm_inference.sh
