Skip to content

Commit

Permalink
Do not build at source directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jskang94 committed Jun 3, 2020
1 parent b01475b commit 9cdc01d
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 63 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ Examples/ROS/ORB_SLAM2/build/
Examples/Stereo/stereo_euroc
Examples/Stereo/stereo_kitti
KeyFrameTrajectory.txt
Thirdparty/DBoW2/build/
Thirdparty/DBoW2/lib/
Thirdparty/g2o/build/
Thirdparty/g2o/config.h
Thirdparty/g2o/lib/
Vocabulary/ORBvoc.txt
build/
*~
lib/

28 changes: 15 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,13 @@ endif()

find_package(Eigen3 3.1.0 REQUIRED)

include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
)

if (ORB_SLAM2_BUILD_WITH_PANGOLIN)
find_package(Pangolin REQUIRED)
add_definitions(-DORB_SLAM2_HAS_PANGOLIN)
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
add_subdirectory(Thirdparty/DBoW2)
add_subdirectory(Thirdparty/g2o)

add_library(${PROJECT_NAME} SHARED
src/System.cc
Expand All @@ -75,11 +69,19 @@ src/Viewer.cc
)

target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o.so
PUBLIC
ORB_SLAM2_FORKED_g2o
ORB_SLAM2_FORKED_DBoW2
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
)
target_include_directories(${PROJECT_NAME}
PUBLIC
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/Thirdparty
${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
)

# Build examples
Expand Down
9 changes: 3 additions & 6 deletions Thirdparty/DBoW2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ if(NOT OpenCV_FOUND)
endif()
endif()

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

include_directories(${OpenCV_INCLUDE_DIRS})
add_library(DBoW2 SHARED ${SRCS_DBOW2} ${SRCS_DUTILS})
target_link_libraries(DBoW2 ${OpenCV_LIBS})

add_library(ORB_SLAM2_FORKED_DBoW2 SHARED ${SRCS_DBOW2} ${SRCS_DUTILS})
target_include_directories(ORB_SLAM2_FORKED_DBoW2 PUBLIC ${OpenCV_INCLUDE_DIRS})
target_link_libraries(ORB_SLAM2_FORKED_DBoW2 PUBLIC ${OpenCV_LIBS})
11 changes: 1 addition & 10 deletions Thirdparty/g2o/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ if(MSVC90)
endif(MSVC90)

# Set the output directory for the build executables and libraries
IF(WIN32)
SET(g2o_LIBRARY_OUTPUT_DIRECTORY ${g2o_SOURCE_DIR}/bin CACHE PATH "Target for the libraries")
ELSE(WIN32)
SET(g2o_LIBRARY_OUTPUT_DIRECTORY ${g2o_SOURCE_DIR}/lib CACHE PATH "Target for the libraries")
ENDIF(WIN32)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${g2o_LIBRARY_OUTPUT_DIRECTORY})
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${g2o_LIBRARY_OUTPUT_DIRECTORY})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${g2o_RUNTIME_OUTPUT_DIRECTORY})

# Set search directory for looking for our custom CMake scripts to
# look for SuiteSparse, QGLViewer, and Eigen3.
Expand Down Expand Up @@ -76,7 +68,6 @@ ENDIF(EIGEN3_FOUND)

# Generate config.h
SET(G2O_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER}")
configure_file(config.h.in ${g2o_SOURCE_DIR}/config.h)

# Set up the top-level include directories
INCLUDE_DIRECTORIES(
Expand All @@ -86,7 +77,7 @@ ${g2o_SOURCE_DIR}/stuff
${G2O_EIGEN3_INCLUDE})

# Include the subdirectories
ADD_LIBRARY(g2o ${G2O_LIB_TYPE}
ADD_LIBRARY(ORB_SLAM2_FORKED_g2o ${G2O_LIB_TYPE}
#types
g2o/types/types_sba.h
g2o/types/types_six_dof_expmap.h
Expand Down
4 changes: 2 additions & 2 deletions Thirdparty/g2o/config.h.in → Thirdparty/g2o/config.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef G2O_CONFIG_H
#define G2O_CONFIG_H

#cmakedefine G2O_OPENMP 1
#cmakedefine G2O_SHARED_LIBS 1
/* #undef G2O_OPENMP */
/* #undef G2O_SHARED_LIBS */

// give a warning if Eigen defaults to row-major matrices.
// We internally assume column-major matrices throughout the code.
Expand Down
5 changes: 3 additions & 2 deletions include/Converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
#include<opencv2/core/core.hpp>

#include<Eigen/Dense>
#include"Thirdparty/g2o/g2o/types/types_six_dof_expmap.h"
#include"Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h"

#include"g2o/g2o/types/types_six_dof_expmap.h"
#include"g2o/g2o/types/types_seven_dof_expmap.h"

namespace ORB_SLAM2
{
Expand Down
5 changes: 3 additions & 2 deletions include/Frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@

#include<vector>

#include "DBoW2/DBoW2/BowVector.h"
#include "DBoW2/DBoW2/FeatureVector.h"

#include "MapPoint.h"
#include "Thirdparty/DBoW2/DBoW2/BowVector.h"
#include "Thirdparty/DBoW2/DBoW2/FeatureVector.h"
#include "ORBVocabulary.h"
#include "KeyFrame.h"
#include "ORBextractor.h"
Expand Down
5 changes: 3 additions & 2 deletions include/KeyFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
#ifndef KEYFRAME_H
#define KEYFRAME_H

#include "DBoW2/DBoW2/BowVector.h"
#include "DBoW2/DBoW2/FeatureVector.h"

#include "MapPoint.h"
#include "Thirdparty/DBoW2/DBoW2/BowVector.h"
#include "Thirdparty/DBoW2/DBoW2/FeatureVector.h"
#include "ORBVocabulary.h"
#include "ORBextractor.h"
#include "Frame.h"
Expand Down
3 changes: 2 additions & 1 deletion include/LoopClosing.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

#include <thread>
#include <mutex>
#include "Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h"

#include "g2o/g2o/types/types_seven_dof_expmap.h"

namespace ORB_SLAM2
{
Expand Down
4 changes: 2 additions & 2 deletions include/ORBVocabulary.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef ORBVOCABULARY_H
#define ORBVOCABULARY_H

#include"Thirdparty/DBoW2/DBoW2/FORB.h"
#include"Thirdparty/DBoW2/DBoW2/TemplatedVocabulary.h"
#include"DBoW2/DBoW2/FORB.h"
#include"DBoW2/DBoW2/TemplatedVocabulary.h"

namespace ORB_SLAM2
{
Expand Down
2 changes: 1 addition & 1 deletion include/Optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "LoopClosing.h"
#include "Frame.h"

#include "Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h"
#include "g2o/g2o/types/types_seven_dof_expmap.h"

namespace ORB_SLAM2
{
Expand Down
4 changes: 2 additions & 2 deletions src/Initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

#include "Initializer.h"

#include "Thirdparty/DBoW2/DUtils/Random.h"

#include "Optimizer.h"
#include "ORBmatcher.h"

#include "DBoW2/DUtils/Random.h"

#include<thread>

namespace ORB_SLAM2
Expand Down
4 changes: 2 additions & 2 deletions src/KeyFrameDatabase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
*/

#include "KeyFrameDatabase.h"

#include "KeyFrame.h"
#include "Thirdparty/DBoW2/DBoW2/BowVector.h"

#include "DBoW2/DBoW2/BowVector.h"

#include<mutex>

Expand Down
2 changes: 1 addition & 1 deletion src/ORBmatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include<opencv2/core/core.hpp>
#include<opencv2/features2d/features2d.hpp>

#include "Thirdparty/DBoW2/DBoW2/FeatureVector.h"
#include "DBoW2/DBoW2/FeatureVector.h"

#include<stdint-gcc.h>

Expand Down
16 changes: 8 additions & 8 deletions src/Optimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

#include "Optimizer.h"

#include "Thirdparty/g2o/g2o/core/block_solver.h"
#include "Thirdparty/g2o/g2o/core/optimization_algorithm_levenberg.h"
#include "Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h"
#include "Thirdparty/g2o/g2o/types/types_six_dof_expmap.h"
#include "Thirdparty/g2o/g2o/core/robust_kernel_impl.h"
#include "Thirdparty/g2o/g2o/solvers/linear_solver_dense.h"
#include "Thirdparty/g2o/g2o/types/types_seven_dof_expmap.h"

#include<Eigen/StdVector>

#include "g2o/g2o/core/block_solver.h"
#include "g2o/g2o/core/optimization_algorithm_levenberg.h"
#include "g2o/g2o/solvers/linear_solver_eigen.h"
#include "g2o/g2o/types/types_six_dof_expmap.h"
#include "g2o/g2o/core/robust_kernel_impl.h"
#include "g2o/g2o/solvers/linear_solver_dense.h"
#include "g2o/g2o/types/types_seven_dof_expmap.h"

#include "Converter.h"

#include<mutex>
Expand Down
3 changes: 2 additions & 1 deletion src/PnPsolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@
#include <vector>
#include <cmath>
#include <opencv2/core/core.hpp>
#include "Thirdparty/DBoW2/DUtils/Random.h"
#include <algorithm>

#include "DBoW2/DUtils/Random.h"

using namespace std;

namespace ORB_SLAM2
Expand Down
2 changes: 1 addition & 1 deletion src/Sim3Solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "KeyFrame.h"
#include "ORBmatcher.h"

#include "Thirdparty/DBoW2/DUtils/Random.h"
#include "DBoW2/DUtils/Random.h"

namespace ORB_SLAM2
{
Expand Down

0 comments on commit 9cdc01d

Please sign in to comment.