Skip to content

Instantly share code, notes, and snippets.

@ahundt
Created May 3, 2015 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahundt/9b2755a54107e936fa4f to your computer and use it in GitHub Desktop.
Save ahundt/9b2755a54107e936fa4f to your computer and use it in GitHub Desktop.
ExternalProject_Add script for camodocal library
# https://github.com/hengli/camodocal
include (ExternalProject)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/camodocal")
set (camodocal_URL "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/camodocal")
else ()
set (camodocal_URL "INSERT DOWNLOAD URL OR LOCAL PATH TO camodocal HERE")
message(STATUS "Add -DFRI_CLIENT_SDK_CPP_URL=/path/to/camodocal to your cmake command to build camodocal components")
endif ()
if(EXISTS ${camodocal_URL})
ExternalProject_Add (
camodocal
URL "${camodocal_URL}"
CMAKE_CACHE_ARGS
"-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
"-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}"
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}"
"-DINSTALL_COPYABLE=TRUE"
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
)
ExternalProject_Get_Property(camodocal install_dir)
set(camodocal_INCLUDE_DIRS
${install_dir}/include
)
set(camodocal_LIBNAMES
agast
camodocal_DBoW2
camodocal_DUtils
camodocal_DUtilsCV
camodocal_DVision
camodocal_brisk
camodocal_calib
camodocal_location_recognition
camodocal_pose_estimation
camodocal_pose_graph
camodocal_pugixml
camodocal_sparse_graph
camodocal_visual_odometry
camodocal_camera_models
camodocal_camera_systems
camodocal_chessboard
camodocal_features2d
camodocal_fivepoint
camodocal_gpl
camodocal_infrastr_calib
)
foreach(LIBNAME IN LISTS camodocal_LIBNAMES )
add_library(${LIBNAME} SHARED IMPORTED )
# TODO make this work for additional compilers, operating systems, and configurations
set_target_properties(${LIBNAME} PROPERTIES IMPORTED_LOCATION ${install_dir}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX} )
list(APPEND camodocal_LIBRARIES ${LIBNAME})
add_dependencies(${LIBNAME} camodocal)
endforeach()
add_library(ceres STATIC IMPORTED)
set_target_properties(ceres PROPERTIES IMPORTED_LOCATION ${install_dir}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ceres${CMAKE_STATIC_LIBRARY_SUFFIX})
list(APPEND camodocal_LIBRARIES ceres)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(camodocal DEFAULT_MSG camodocal_LIBRARIES camodocal_INCLUDE_DIRS)
endif(EXISTS ${camodocal_URL})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment