recastnavigation编译为动态库使用

RecastNavigation是一个导航寻路工具集,使用邻接的凸多边形集合描述一个3D场景,A*寻路算法使3D场景的可达性得到保证。

RecastNavigation编译流程

  1. 安装SDL环境

    1
    2
    3
    4
    yum install SDL2_gfx-devel.x86_64
    yum install SDL2_image-devel.x86_64
    yum install SDL2_ttf-devel.x86_64
    yum install SDL2.x86_64
  2. 安装opengl环境

    1
    2
    3
    yum install mesa*
    yum install freeglut*
    yum install *GLEW*
  3. 下载编译代码

    1
    2
    3
    4
    5
    6
    7
    8
    git clone git@github.com:recastnavigation/recastnavigation.git
    cd recastnavigation
    mkdir build
    cd build
    cmake -DBUILD_RECAST_DEMO=OFF ..
    make
    # g++版本7.3.1, 低版本可能会有问题
    # 编译后的库文件在recastnavigation/build/Detour/和recastnavigation/build/Recast目录下
  4. 使用

    recastnavigation/build/Detourrecastnavigation/build/Recast 目录下的libDetour.alibRecast.a 文件复制到你的项目中, 然后引用头文件Recast/IncludeDetour/Include即可, 具体示例可参考RecastDemo