为什么选择非模版类
因为模版类安装报错。。 找不到解决办法。。你们是怎么安装那么顺利的。。
Sophus安装
git clone https://github.com/strasdat/Sophus.git
cd Sophus/
git checkout a621ff
mkdir build
cd build
cmake ..
make
sudo make install
外部项目CMakeLists编写
-workspace
-CMakeLists.txt
-bin
-build
-include
-src
main.cpp
CMakeLists.txt文件编写
cmake_minimum_required(VERSION 3.0)
project(workspace)
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(Sophus_DIR "/home/usrname/Sophus/build")
find_package(Sophus REQUIRED)
AUX_SOURCE_DIRECTORY(src DIR_SRCS)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(TEST_VIO ${DIR_SRCS})
set(Sophus_LIBRARIES "/usr/local/lib/libSophus.so")
include_directories(${workspace_vioslam}/include)
include_directories(${Sophus_INCLUDE_DIRS})
include_directories("/usr/include/eigen3")
add_executable(run ${TEST_VIO})
target_link_libraries(run ${Sophus_LIBRARIES})
编好CMakeLists.txt之后
编译:
//从workspace根目录下
cd build
cmake ..
make
运行:
//从workspace根目录下
cd bin
./run