Skip to content

Commit

Permalink
catkin support
Browse files Browse the repository at this point in the history
  • Loading branch information
JzHuai0108 committed Nov 24, 2015
1 parent 610316e commit 7aacbed
Show file tree
Hide file tree
Showing 92 changed files with 5,219 additions and 5,241 deletions.
90 changes: 58 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
SET(PROJECT_NAME ORBSLAM_DWO)
SET(TRACE TRUE)
SET(MONO_SLAM TRUE)
SET(USE_ROS TRUE)

SET(PROJECT_NAME orbslam_dwo)
PROJECT(${PROJECT_NAME})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
cmake_minimum_required(VERSION 2.6)
#include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
#rosbuild_init()
SET(TRACE TRUE)
SET(MONO_SLAM FALSE)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${PROJECT_SOURCE_DIR}/cmake_modules/")

IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF()

MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
Expand All @@ -26,15 +27,19 @@ IF(TRACE)
ENDIF()
IF(MONO_SLAM)
ADD_DEFINITIONS(-DMONO)
ELSE()
ADD_DEFINITIONS(-DSLAM_OUTPUT_VISO2)
ENDIF()
IF(USE_ROS)
add_definitions(-DSLAM_USE_ROS)
ENDIF()

IF(CMAKE_BUILD_TYPE MATCHES Debug)
ADD_DEFINITIONS(-DSLAM_DEBUG_OUTPUT)
ENDIF()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Cholmod REQUIRED)
FIND_PACKAGE(SuiteSparse REQUIRED)
Expand All @@ -46,14 +51,36 @@ find_package(Boost 1.45.0 COMPONENTS system thread REQUIRED)
SET(vikit_common_INCLUDE_DIRS $ENV{HOME}/SVO/rpg_vikit/vikit_common/include)
SET(vikit_common_LIBRARIES $ENV{HOME}/SVO/rpg_vikit/vikit_common/lib/libvikit_common.so)


SET(g2o_INCLUDE_DIR $ENV{HOME}/ScaViSLAM/svslocal/include) # g2o, sophus, maybe opencv

IF(USE_ROS)
FIND_PACKAGE(OpenCV REQUIRED) # do not put findOpencv.cmake in cmake_module_path which causes an error
FIND_PACKAGE(catkin REQUIRED COMPONENTS roscpp roslib cmake_modules tf cv_bridge)
SET(g2o_LIBRARY_DIR $ENV{HOME}/ScaViSLAM/External/g2o/lib) # do not put local opencv and g2o libs together as it confuses catkin
catkin_package(
DEPENDS Eigen OpenCV Cholmod SuiteSparse Boost
CATKIN_DEPENDS roscpp roslib tf cv_bridge
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
)
ELSE()
set(OpenCV_LIBS opencv_core opencv_features2d opencv_flann opencv_gpu
opencv_nonfree opencv_highgui opencv_imgproc opencv_calib3d opencv_video)
SET(g2o_LIBRARY_DIR $ENV{HOME}/ScaViSLAM/svslocal/lib)
link_directories(${g2o_LIBRARY_DIR})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build)
ENDIF()

include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${EIGEN3_INCLUDE_DIR}
${CHOLMOD_INCLUDE_DIR}
${CSPARSE_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
$ENV{HOME}/ScaViSLAM/svslocal/include
${g2o_INCLUDE_DIR}
${vikit_common_INCLUDE_DIRS}
)

Expand All @@ -70,14 +97,12 @@ src/MapPoint.cc
src/KeyFrame.cc
src/FeatureGrid.cpp
src/Map.cc
#src/MapPublisher.cc
src/Optimizer.cc
src/PnPsolver.cc
src/Frame.cc
src/KeyFrameDatabase.cc
src/Sim3Solver.cc
src/Initializer.cc
src/timegrabber.cpp
src/stereoSFM.cpp
src/MotionModel.cpp
src/utils.cpp
Expand All @@ -91,46 +116,47 @@ viso2/p_match.h
viso2/triangle.cpp
viso2/viso.cpp
viso2/viso_stereo.cpp
viso2/ptsetreg.cpp
viso2/five-point.cpp
g2o_types/global.h
g2o_types/maths_utils.cpp
g2o_types/eigen_utils.h
g2o_types/eigen_utils.cpp
g2o_types/anchored_points.cpp
g2o_types/IMU_constraint.cpp
g2o_types/timegrabber.cpp
)

IF(USE_ROS)
LIST(APPEND SOURCEFILES src/MapPublisher.cc)
ENDIF()

LIST(APPEND LINK_LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
cholmod
csparse
cxsparse
${Boost_LIBRARIES}
#$ENV{HOME}/ScaViSLAM/svslocal/lib/libviso2.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_core.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_solver_cholmod.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_solver_dense.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_stuff.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_solver_csparse.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_csparse_extension.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_types_sba.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_types_sim3.so
$ENV{HOME}/ScaViSLAM/svslocal/lib/libg2o_types_slam3d.so

${g2o_LIBRARY_DIR}/libg2o_core.so
${g2o_LIBRARY_DIR}/libg2o_solver_cholmod.so
${g2o_LIBRARY_DIR}/libg2o_solver_dense.so
${g2o_LIBRARY_DIR}/libg2o_stuff.so
${g2o_LIBRARY_DIR}/libg2o_solver_csparse.so
${g2o_LIBRARY_DIR}/libg2o_csparse_extension.so
${g2o_LIBRARY_DIR}/libg2o_types_sba.so
${g2o_LIBRARY_DIR}/libg2o_types_sim3.so
${g2o_LIBRARY_DIR}/libg2o_types_slam3d.so
${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so
#${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_core.so
#${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_solver_cholmod.so
#${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_solver_dense.so
#${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_stuff.so
#${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_types_sba.so
#${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_types_sim3.so
#${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_types_slam3d.so
${vikit_common_LIBRARIES} #for logging and timing
)

IF(USE_ROS)
INCLUDE_DIRECTORIES(${catkin_INCLUDE_DIRS})
LIST(APPEND LINK_LIBS ${catkin_LIBRARIES})
ENDIF()

ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCEFILES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LINK_LIBS})


add_executable(test_orbslam src/main.cc)
TARGET_LINK_LIBRARIES(test_orbslam ${PROJECT_NAME})
13 changes: 11 additions & 2 deletions Thirdparty/DBoW2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 2.8)
project(DBoW2)

SET(CMAKE_BUILD_TYPE Release) # Release, RelWithDebInfo
SET(CMAKE_VERBOSE_MAKEFILE OFF)
SET(USE_ROS true) # Set False if you want to build this package without Catkin
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")

Expand All @@ -23,8 +26,14 @@ set(HDRS_DUTILS
set(SRCS_DUTILS
DUtils/Random.cpp
DUtils/Timestamp.cpp)

find_package(OpenCV REQUIRED)
IF(USE_ROS)
find_package(OpenCV REQUIRED)
ELSE()
set(OpenCV_INCLUDE_DIRS $ENV{HOME}/ScaViSLAM/svslocal/include)
set(OpenCV_LIBS opencv_core opencv_features2d opencv_flann opencv_gpu
opencv_nonfree opencv_highgui opencv_imgproc opencv_calib3d)
link_directories($ENV{HOME}/ScaViSLAM/svslocal/lib)
ENDIF()

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

Expand Down
62 changes: 30 additions & 32 deletions Thirdparty/DBoW2/build/CMakeCache.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is the CMakeCache file.
# For build in directory: /home/jianzhuhuai0108/ORB_SLAM/Thirdparty/DBoW2/build
# For build in directory: /home/jhuai/catkin_ws/src/orbslam_dwo/Thirdparty/DBoW2/build
# It was generated by CMake: /usr/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
Expand All @@ -19,12 +19,12 @@ CMAKE_AR:FILEPATH=/usr/bin/ar

//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_BUILD_TYPE:STRING=

//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON

//CXX compiler.
//CXX compiler
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++

//Flags used by the compiler during all build types.
Expand All @@ -33,18 +33,17 @@ CMAKE_CXX_FLAGS:STRING=
//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g

//Flags used by the compiler during release minsize builds.
//Flags used by the compiler during release builds for minimum
// size.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
//Flags used by the compiler during release builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

//Flags used by the compiler during Release with Debug Info builds.
//Flags used by the compiler during release builds with debug info.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG

//C compiler.
//C compiler
CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc

//Flags used by the compiler during all build types.
Expand All @@ -53,19 +52,18 @@ CMAKE_C_FLAGS:STRING=
//Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=-g

//Flags used by the compiler during release minsize builds.
//Flags used by the compiler during release builds for minimum
// size.
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
//Flags used by the compiler during release builds.
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

//Flags used by the compiler during Release with Debug Info builds.
//Flags used by the compiler during release builds with debug info.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG

//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=' '
CMAKE_EXE_LINKER_FLAGS:STRING=

//Flags used by the linker during debug builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
Expand All @@ -92,7 +90,7 @@ CMAKE_LINKER:FILEPATH=/usr/bin/ld
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make

//Flags used by the linker during the creation of modules.
CMAKE_MODULE_LINKER_FLAGS:STRING=' '
CMAKE_MODULE_LINKER_FLAGS:STRING=

//Flags used by the linker during debug builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
Expand Down Expand Up @@ -122,7 +120,7 @@ CMAKE_PROJECT_NAME:STATIC=DBoW2
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib

//Flags used by the linker during the creation of dll's.
CMAKE_SHARED_LINKER_FLAGS:STRING=' '
CMAKE_SHARED_LINKER_FLAGS:STRING=

//Flags used by the linker during debug builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
Expand Down Expand Up @@ -171,24 +169,24 @@ CMAKE_USE_RELATIVE_PATHS:BOOL=OFF
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE

//Value Computed by CMake
DBoW2_BINARY_DIR:STATIC=/home/jianzhuhuai0108/ORB_SLAM/Thirdparty/DBoW2/build
DBoW2_BINARY_DIR:STATIC=/home/jhuai/catkin_ws/src/orbslam_dwo/Thirdparty/DBoW2/build

//Dependencies for the target
DBoW2_LIB_DEPENDS:STATIC=general;opencv_videostab;general;opencv_video;general;opencv_ts;general;opencv_superres;general;opencv_stitching;general;opencv_photo;general;opencv_ocl;general;opencv_objdetect;general;opencv_nonfree;general;opencv_ml;general;opencv_legacy;general;opencv_imgproc;general;opencv_highgui;general;opencv_gpu;general;opencv_flann;general;opencv_features2d;general;opencv_core;general;opencv_contrib;general;opencv_calib3d;
DBoW2_LIB_DEPENDS:STATIC=general;opencv_videostab;general;opencv_video;general;opencv_ts;general;opencv_superres;general;opencv_stitching;general;opencv_photo;general;opencv_ocl;general;opencv_objdetect;general;opencv_ml;general;opencv_legacy;general;opencv_imgproc;general;opencv_highgui;general;opencv_gpu;general;opencv_flann;general;opencv_features2d;general;opencv_core;general;opencv_contrib;general;opencv_calib3d;

//Value Computed by CMake
DBoW2_SOURCE_DIR:STATIC=/home/jianzhuhuai0108/ORB_SLAM/Thirdparty/DBoW2
DBoW2_SOURCE_DIR:STATIC=/home/jhuai/catkin_ws/src/orbslam_dwo/Thirdparty/DBoW2

//Path where debug 3rdpaty OpenCV dependencies are located
OpenCV_3RDPARTY_LIB_DIR_DBG:PATH=

//Path where release 3rdpaty OpenCV dependencies are located
OpenCV_3RDPARTY_LIB_DIR_OPT:PATH=

OpenCV_CONFIG_PATH:FILEPATH=/usr/local/share/OpenCV
OpenCV_CONFIG_PATH:FILEPATH=/usr/share/OpenCV

//The directory containing a CMake configuration file for OpenCV.
OpenCV_DIR:PATH=/usr/local/share/OpenCV
OpenCV_DIR:PATH=/usr/share/OpenCV

//Path where debug OpenCV libraries are located
OpenCV_LIB_DIR_DBG:PATH=
Expand All @@ -203,18 +201,14 @@ OpenCV_LIB_DIR_OPT:PATH=

//ADVANCED property for variable: CMAKE_AR
CMAKE_AR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_BUILD_TOOL
CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1
//What is the target build tool cmake is generating for.
CMAKE_BUILD_TOOL:INTERNAL=/usr/bin/make
//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=/home/jianzhuhuai0108/ORB_SLAM/Thirdparty/DBoW2/build
CMAKE_CACHEFILE_DIR:INTERNAL=/home/jhuai/catkin_ws/src/orbslam_dwo/Thirdparty/DBoW2/build
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=8
CMAKE_CACHE_MINOR_VERSION:INTERNAL=2
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=12
CMAKE_CACHE_PATCH_VERSION:INTERNAL=2
//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
//Path to CMake executable.
Expand Down Expand Up @@ -261,13 +255,17 @@ CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Start directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=/home/jianzhuhuai0108/ORB_SLAM/Thirdparty/DBoW2
CMAKE_HOME_DIRECTORY:INTERNAL=/home/jhuai/catkin_ws/src/orbslam_dwo/Thirdparty/DBoW2
//Install .so files without execute permission.
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
//ADVANCED property for variable: CMAKE_LINKER
Expand Down Expand Up @@ -295,7 +293,7 @@ CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_RANLIB
CMAKE_RANLIB-ADVANCED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=/usr/share/cmake-2.8
CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.2
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
Expand Down
Loading

0 comments on commit 7aacbed

Please sign in to comment.