Skip to content

Commit

Permalink
clean up -- remove more hard-coded paths
Browse files Browse the repository at this point in the history
  • Loading branch information
feixh committed Feb 20, 2022
1 parent fe15519 commit 2e1c2d6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 63 deletions.
95 changes: 42 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.5)
project(feh)

# vision lab visual-inertial navigation system
project(vl_vins)

# Set operating system variables
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
Expand Down Expand Up @@ -43,101 +45,91 @@ add_definitions(-DGOOGLE_STRIP_LOG=1)
# add_definitions(-DEIGEN_DEFAULT_TO_ROW_MAJOR)
add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_ZERO)

list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/thirdparty)
set(THIRD_PARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty")
list(APPEND CMAKE_PREFIX_PATH ${THIRD_PARTY_DIR})

# Find and add OpenCV to libraries
find_package(OpenCV REQUIRED)
find_package(OpenCV REQUIRED PATHS ${THIRD_PARTY_DIR}/opencv/install)
find_package(Python3 REQUIRED Interpreter Development)
find_package(Pangolin REQUIRED)
find_package(jsoncpp REQUIRED)

# Google stuff
find_package(gflags REQUIRED)
find_package(GTest REQUIRED NAMES GTest gtest googletest GoogleTest)
find_package(glog REQUIRED)
find_package(Ceres REQUIRED)
# Find and add DBoW2

# DBoW2
find_package(DBoW2 REQUIRED)
# Create an interface target for DBoW2 (since DBoW2 does not export headers & libraries as a target)
# Create an interface target for DBoW2 (since DBoW2 does not export headers & libraries as a target).
# We will add the DBoW2 target to our dependency list in a bit.
add_library(DBoW2 INTERFACE)
target_include_directories(DBoW2 INTERFACE ${DBoW2_INCLUDE_DIR})
target_link_libraries(DBoW2 INTERFACE ${DBoW2_LIBS})

# The dependency PNP does not properly export a target for easy integration,
# so we create an interface target here, and will add the interface target to
# the dependency list in a bit.
add_library(pnp INTERFACE)
target_include_directories(pnp INTERFACE ${THIRD_PARTY_DIR}/pnp)
target_link_libraries(pnp INTERFACE ${THIRD_PARTY_DIR}/pnp/build/liblibpnp.a)

# TODO (xiaohfei): this is not working since gperftools does not properly generate cmake config files.
# Need to manually add gperftools if needed.
if (USE_GPERFTOOLS)
find_package(gperftools REQUIRED)
endif()

# The dependency PNP does have proper installation target, need to manually specify paths.
add_library(pnp INTERFACE)
target_include_directories(pnp INTERFACE ${CMAKE_SOURCE_DIR}/thirdparty/pnp)
target_link_libraries(pnp INTERFACE ${CMAKE_SOURCE_DIR}/thirdparty/pnp/build/liblibpnp.a)

list(APPEND DEPS
# opencv
# OpenCV
opencv_highgui
opencv_features2d
opencv_core
opencv_video
opencv_imgproc
opencv_imgcodecs
opencv_xfeatures2d
# google stuff

# Google stuff
glog::glog
GTest::gtest
GTest::gtest_main
GTest::gmock
GTest::gmock_main
gflags_static
# graphics
GLEW
pangolin
# solver

# Ceres::ceres should carry over all its own dependencies, so we don't need
# to add the following dependencies: cxsparse, cholmod, lapack, and blas.
# But if needed, you can add them back.
Ceres::ceres
pnp
cxsparse
cholmod
lapack
blas
# utils
jsoncpp_lib

# Use jsoncpp_static if you are building modules of xivo as static libraryies
# jsoncpp_static
jsoncpp_lib

# Target "pangolin" exported by Pangolin should carry over its own dependencies, i.e.,
# GLEW and GL (in Linux). If needed, you can manually add them.
pangolin

# Loop closure dependencies.
pnp
DBoW2
# system
pthread
)
if (IS_LINUX)
list(APPEND DEPS GL)
endif (IS_LINUX)

link_libraries(${DEPS})

# Manually add link directories (ideally we dont have to use this)
link_directories(
/usr/local/lib
/usr/lib/x86_64-linux-gnu
)

include_directories(
${CMAKE_SOURCE_DIR}/common
${CMAKE_SOURCE_DIR}/src
# Manually add include dirs, ideally we don't need this
# ${JSONCPP_INCLUDE_DIRS}
# ${OpenCV_INCLUDE_DIRS}
# ${Python3_INCLUDE_DIRS}
/usr/include/suitesparse
/usr/include
)



enable_testing()
# add_subdirectory(thirdparty/abseil-cpp)
if (BUILD_G2O)
link_directories(${CMAKE_SOURCE_DIR}/thirdparty/g2o/release/lib)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/g2o/release/include)
list(APPEND deps
link_directories(${THIRD_PARTY_DIR}/g2o/release/lib)
include_directories(${THIRD_PARTY_DIR}/g2o/release/include)
link_libraries(
g2o_core
g2o_solver_dense
g2o_solver_cholmod
Expand All @@ -146,12 +138,9 @@ if (BUILD_G2O)
g2o_types_slam3d
g2o_types_sba
g2o_stuff
cholmod
cxsparse
)
)
endif(BUILD_G2O)

# feh
add_subdirectory(common)
add_subdirectory(src)

Expand All @@ -166,10 +155,10 @@ add_subdirectory(src)
# If you see an error saying "Python.h: No such file or directory", you probably
# need to "sudo apt-get install python3-dev" assuming you are binding to python3.
set(PYBIND11_CPP_STANDARD -std=c++17)
add_subdirectory(thirdparty/pybind11)
add_subdirectory(${THIRD_PARTY_DIR}/pybind11)
pybind11_add_module(pyxivo MODULE pybind11/pyxivo.cpp)
set(libxivo common xest xapp)
set(pybind_deps common xest xapp)
if (BUILD_G2O)
list(APPEND libxivo xopt)
list(APPEND pybind_deps xopt)
endif(BUILD_G2O)
target_link_libraries(pyxivo PRIVATE ${libxivo})
target_link_libraries(pyxivo PRIVATE ${pybind_deps})
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ if [ $USE_GPERFTOOLS = true ]; then
fi

CPU_COUNT=4
# OPENCV_INSTALL_DIR=/media/data3/stsuei/DevelopmentEnvironments/xivo_gcc9/share/OpenCV
OPENCV_INSTALL_DIR=$PWD/thirdparty/opencv/install/share/OpenCV
OPENCV_INSTALL_DIR=/media/data3/stsuei/DevelopmentEnvironments/xivo_gcc9/share/OpenCV

# build dependencies
PROJECT_DIR=$(pwd)
Expand Down
4 changes: 0 additions & 4 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
cmake_minimum_required(VERSION 3.5)
project(common)

# # uncomment to overwrite target destinations
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

add_library(common STATIC utils.cpp)

# option(BUILD_COMMON_TESTS True)
Expand Down
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.5)

project(estimator)

# # overwrite binary output directory
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)

# if set, use inverse-depth parametrization
# add_definitions(-DUSE_INVDEPTH)

Expand Down

0 comments on commit 2e1c2d6

Please sign in to comment.