docs/source_compile/windows_compile_windows.rst
.. role:: raw-html-m2r(raw) :format: html
本文介绍在 Windows 操作系统环境下,如何将 Paddle Lite 源代码编译生成 Windows 平台的预测库。
..
说明:
下载Paddle Lite官方发布的预编译包 <../quick_start/release_lib.html>_\ ,可满足一部分场景的需求。如果官方发布的编译包未覆盖你的场景,或者需要修改Paddle Lite源代码,则可参考本文构建。在该场景下 Paddle Lite 已验证的软硬件配置如下表所示:
.. list-table:: :header-rows: 1
推荐环境 ^^^^^^^^^^^^
环境配置步骤 ^^^^^^^^^^^^^^^^
#. CMake 需要 3.15 版本, 可在官网\ 下载 <https://cmake.org/download/>_ Windows 版本,并添加到环境变量中。
#. Python 需要 2.7 及以上版本, 可在官网\ 下载 <https://www.python.org/downloads/windows/>\ 。
#. Git 可以在官网\ 下载 <https://gitforwindows.org/>\ ,并添加到环境变量中。
#. Visual Studio 请在官网\ 下载 <https://visualstudio.microsoft.com/zh-hans/downloads/>_\ 所需版本。
编译步骤 ^^^^^^^^^^^^
1、 下载代码
.. include:: include/download_code.rst
2、 编译 Paddle Lite Windows 预测库
.. code-block:: dos
lite\tools\build_windows.bat
..
说明: 编译过程中,如出现源码编译耗时过长,通常是第三方库下载过慢或失败导致。请在完成 Paddle Lite 源码下载后,删除本地仓库根目录下的 third-party 目录,编译脚本会自动下载存储于国内 CDN 的第三方依赖文件压缩包,节省从 GitHub repo 同步第三方库的时间。
编译参数说明 ^^^^^^^^^^^^^^^^
build_windows.bat 编译参数详细说明如下。
.. list-table:: :header-rows: 1
预测库说明 <./library.html>_\ 。Ninja <https://ninja-build.org/>_ 构建系统(默认使用 vs2015 的 MSBuild 构建方案,添加上此编译选项使用 Ninja 编译构建)编译脚本使用示例 ^^^^^^^^^^^^^^^^^^^^
编译 Windows 平台不带日志 32 位的预测库
.. code-block:: dos
lite\tools\build_windows.bat without_log build_x86
编译结果位于 build.lite.x86\inference_lite_lib
详细内容如下:
1、 cxx\ 文件夹:包含 c++ 的库文件与相应的头文件
include : 头文件
lib : 库文件
静态库文件:
libpaddle_api_full_bundled.lib :full_api 静态库libpaddle_api_light_bundled.lib :light_api 静态库2、 third_party 文件夹:依赖的第三方预测库 mklml
3、 demo\cxx\ 文件夹:C++ 示例 demo
mobilenetv1_full :使用 full_api 执行 mobilenet_v1 预测的 C++ demomobilenetv1_light :使用 light_api 执行 mobilenet_v1 预测的 C++ demo4、 demo\python\ : Python 示例 demo
mobilenetv1_full_api.py\ :使用 full_api 执行 mobilenet_v1 预测的 Python demomobilenetv1_light_api.py\ :使用 full_api 执行 mobilenet_v1 预测的 Python demo5、 python\ 文件夹:包含 Python 的库文件和对应的 .whl 包
install\ 文件夹:编译成功的 .whl 包位于\ install\dist\*.whllib\ 文件夹:.whl 包依赖的库文件