mrpt + Aria 的 vs2013项目配置

本文档详细介绍了如何配置mrpt slam项目的过程,包括编辑CMakeList.txt文件以添加依赖,使用cmake-gui生成项目并进行编译,以及设置项目属性等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 编辑mrpt的CMakeList.txt文件,查找需要的mrpt_package和添加依赖

#-----------------------------------------------------------------------------------------------
# CMake file for the MRPT example:  rbpf-slam
#
#  Run with "ccmake ." at the root directory, or use it as a template for 
#   starting your own programs
#-----------------------------------------------------------------------------------------------
SET(sampleName rbpf-slam)
SET(PRJ_NAME "EXAMPLE_${sampleName}")

# ---------------------------------------
# Declare a new CMake Project:
# ---------------------------------------
PROJECT(${PRJ_NAME})

# These commands are needed by modern versions of CMake:
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
if(COMMAND cmake_policy)
    cmake_policy(SET CMP0003 NEW)  # Required by CMake 2.7+
	if(POLICY CMP0043)
		cmake_policy(SET CMP0043 OLD) #  Ignore COMPILE_DEFINITIONS_<Config> properties.
	endif()
endif(COMMAND cmake_policy)

# ---------------------------------------------------------------------------
# Set the output directory of each example to its corresponding subdirectory
#  in the binary tree:
# ---------------------------------------------------------------------------
SET(EXECUTABLE_OUTPUT_PATH ".")

# --------------------------------------------------------------------------
#   The list of "libs" which can be included can be found in:
#     http://www.mrpt.org/Libraries
#
#   The dependencies of a library are automatically added, so you only 
#    need to specify the top-most libraries your code depend on.
# --------------------------------------------------------------------------
FIND_PACKAGE(MRPT REQUIRED slam;gui;obs;hwdrivers)  #在这里添加mrpt package

# ---------------------------------------------
# TARGET:
# ---------------------------------------------
# Define the executable target:
ADD_EXECUTABLE(${sampleName} rbpf-slam.cpp  
							${MRPT_VERSION_RC_FILE}) 

SET_TARGET_PROPERTIES(
	${sampleName} 
	PROPERTIES 
	PROJECT_LABEL "(EXAMPLE) ${sampleName}")

# Add special defines needed by this example, if any:
SET(MY_DEFS )
IF(MY_DEFS) # If not empty
	ADD_DEFINITIONS("-D${MY_DEFS}")
ENDIF(MY_DEFS)

# Add the required libraries for linking:
TARGET_LINK_LIBRARIES(${sampleName} 
	${MRPT_LINKER_LIBS}  # This is filled by FIND_PACKAGE(MRPT ...)
	""  # Optional extra libs...
	)

# Set optimized building:
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug")
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
ENDIF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug")


# -------------------------------------------------------------------------
# This part can be removed if you are compiling this program outside of 
#  the MRPT tree:
# -------------------------------------------------------------------------
IF(${CMAKE_PROJECT_NAME} STREQUAL "MRPT") # Fails if build outside of MRPT project.
	DeclareAppDependencies(${sampleName} mrpt-slam;mrpt-gui;mrpt-obs;mrpt-hwdrivers) # Dependencies 这里添加依赖
ENDIF(${CMAKE_PROJECT_NAME} STREQUAL "MRPT")
# -------------------------------------------------------------------------

2. 使用cmake-gui,编译器选择vc2013 64bit,生成项目,用vs2013打开,配置管理器为x64。


3. 项目属性中,vc++目录(若有其他需求,还需要添加其他目录)

添加包含目录 C:\Program Files\MobileRobots\Aria\ArNetworking\include;C:\Program Files\MobileRobots\Aria\include;

添加库目录 C:\Program Files\MobileRobots\Aria\lib64;

链接器-输入-附加依赖项

添加  AriaDebugVC12.lib;ArNetworkingDebugVC12.lib;


4. 将C:\Program Files\MobileRobots\Aria\bin64下的AriaDebugVC12.dll和ArNetworkingDebugVC12.dll拷贝到项目目录下,再拷贝到x64\debug目录下。


5. F7,即可生成通过。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值