-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor the build system -- use exported cmake targets instead of ma… #35
Open
feixh
wants to merge
2
commits into
ucla-vision:devel
Choose a base branch
from
feixh:build
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.5) | |
|
||
project(estimator) | ||
|
||
# # overwrite binary output directory | ||
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) | ||
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) | ||
|
||
# if set, use inverse-depth parametrization | ||
# add_definitions(-DUSE_INVDEPTH) | ||
|
||
|
@@ -28,54 +24,19 @@ add_definitions(-DUSE_ONLINE_CAMERA_CALIB) | |
# rid of accumulated numeric error | ||
#add_definitions(-DENFORCE_SO3_FREQ=50) | ||
|
||
include_directories( | ||
${PROJECT_SOURCE_DIR} | ||
${CMAKE_SOURCE_DIR}/common) | ||
|
||
link_directories( | ||
${CMAKE_SOURCE_DIR}/lib) | ||
|
||
list(APPEND deps | ||
opencv_highgui | ||
opencv_features2d | ||
opencv_core | ||
opencv_video | ||
opencv_imgproc | ||
opencv_imgcodecs | ||
opencv_xfeatures2d | ||
glog | ||
GLEW | ||
pangolin | ||
pthread | ||
jsoncpp | ||
DBoW2 | ||
libpnp | ||
common | ||
ceres | ||
cxsparse | ||
cholmod | ||
lapack | ||
blas | ||
) | ||
if (IS_LINUX) | ||
list(APPEND deps GL) | ||
endif (IS_LINUX) | ||
|
||
if (USE_GPERFTOOLS) | ||
list(APPEND deps profiler) | ||
endif (USE_GPERFTOOLS) | ||
|
||
add_library(xapp STATIC | ||
|
||
add_library(xapp SHARED | ||
estimator_process.cpp | ||
loader.cpp | ||
geometry.cpp | ||
metrics.cpp | ||
publisher.cpp | ||
graphwriter.cpp | ||
viewer.cpp) | ||
target_link_libraries(xapp ${deps}) | ||
target_link_libraries(xapp PUBLIC common) | ||
|
||
|
||
add_library(xest STATIC | ||
add_library(xest SHARED | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular reason for building a shared library instead of a static library? |
||
factory.cpp | ||
estimator.cpp | ||
princedormand.cpp | ||
|
@@ -97,25 +58,24 @@ add_library(xest STATIC | |
mapper.cpp | ||
camera_manager.cpp | ||
imu.cpp) | ||
target_link_libraries(xest PUBLIC common) | ||
if (IS_MAC) | ||
target_link_libraries(xest INTERFACE ${deps} "-Wl, -framework OpenGL") | ||
elseif (IS_LINUX) | ||
target_link_libraries(xest INTERFACE ${deps}) | ||
target_compile_options(xest "-Wl, -framework OpenGL") | ||
endif() | ||
|
||
set(libxivo xest xapp) | ||
|
||
if (BUILD_G2O) | ||
add_library(xopt STATIC | ||
add_library(xopt SHARED | ||
optimizer.cpp | ||
optimizer_adapters.cpp | ||
) | ||
target_link_libraries(xopt xest ${deps}) | ||
target_link_libraries(xopt xest) | ||
list(APPEND libxivo xopt) | ||
endif(BUILD_G2O) | ||
|
||
add_executable(vio app/vio.cpp) | ||
target_link_libraries(vio ${libxivo} gflags::gflags) | ||
target_link_libraries(vio ${libxivo}) | ||
|
||
################################################################################ | ||
# TOOLING | ||
|
@@ -129,39 +89,39 @@ target_link_libraries(vio ${libxivo} gflags::gflags) | |
add_executable(unitTests_NumericalAlgorithms | ||
test/unittest_givens.cpp | ||
test/unittest_helpers.cpp) | ||
target_link_libraries(unitTests_NumericalAlgorithms xest ${deps} gtest gtest_main) | ||
target_link_libraries(unitTests_NumericalAlgorithms xest) | ||
add_test(NAME NumericalAlgorithms COMMAND unitTests_NumericalAlgorithms) | ||
|
||
add_executable(unitTests_Jacobians | ||
test/unittest_jacobians_instate.cpp | ||
test/unittest_jacobians_oos.cpp | ||
test/unittest_helpers.cpp) | ||
target_link_libraries(unitTests_Jacobians ${libxivo} ${deps} gtest gtest_main) | ||
target_link_libraries(unitTests_Jacobians ${libxivo}) | ||
add_test(NAME Jacobians COMMAND unitTests_Jacobians) | ||
|
||
add_executable(unitTests_Rodrigues | ||
test/unittest_rodrigues.cpp) | ||
target_link_libraries(unitTests_Rodrigues xest ${deps} gtest gtest_main) | ||
target_link_libraries(unitTests_Rodrigues xest) | ||
add_test(NAME Rodrigues COMMAND unitTests_Rodrigues) | ||
|
||
add_executable(unitTests_pinhole | ||
test/unittest_camera_pinhole.cpp) | ||
target_link_libraries(unitTests_pinhole xest ${deps} gtest gtest_main) | ||
target_link_libraries(unitTests_pinhole xest) | ||
add_test(NAME CamerasPinhole COMMAND unitTests_pinhole) | ||
|
||
add_executable(unitTests_radtan | ||
test/unittest_camera_radtan.cpp) | ||
target_link_libraries(unitTests_radtan xest ${deps} gtest gtest_main) | ||
target_link_libraries(unitTests_radtan xest) | ||
add_test(NAME CamerasRadtan COMMAND unitTests_radtan) | ||
|
||
add_executable(unitTests_equi | ||
test/unittest_camera_equi.cpp) | ||
target_link_libraries(unitTests_equi xest ${deps} gtest gtest_main) | ||
target_link_libraries(unitTests_equi xest) | ||
add_test(NAME CamerasEqui COMMAND unitTests_equi) | ||
|
||
add_executable(unitTests_atan | ||
test/unittest_camera_atan.cpp) | ||
target_link_libraries(unitTests_atan xest ${deps} gtest gtest_main) | ||
target_link_libraries(unitTests_atan xest) | ||
add_test(NAME CamerasAtan COMMAND unitTests_atan) | ||
|
||
if (BUILD_G2O) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add the following above this block so that CMake doesn't accidentally link to a version that was installed onto the OS or exported from another project: