From 6afef7c5f1ae0b6473efe328cf81dbfc9066372c Mon Sep 17 00:00:00 2001 From: libo24 Date: Thu, 4 Feb 2016 21:34:30 +0800 Subject: [PATCH] compilation refactored. Removed custom FindOpenCV. Removed custom CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH --- .gitignore | 1 + CMakeLists.txt | 29 +-- cmake/DependencyUtilities.cmake | 13 + cmake/FindOpenCV.cmake | 298 ---------------------- cmake/LibraryConfig.cmake | 2 +- src/CMakeLists.txt | 1 + src/brisk/CMakeLists.txt | 6 +- src/brisk/thirdparty/agast/CMakeLists.txt | 6 +- src/calib/CMakeLists.txt | 14 +- src/camera_models/CMakeLists.txt | 9 +- src/chessboard/CMakeLists.txt | 8 +- src/dbow2/DUtilsCV/CMakeLists.txt | 7 +- src/dbow2/DVision/CMakeLists.txt | 10 +- src/examples/CMakeLists.txt | 10 +- src/features2d/CMakeLists.txt | 9 +- src/gpl/CMakeLists.txt | 6 +- src/infrastr_calib/CMakeLists.txt | 9 +- src/location_recognition/CMakeLists.txt | 4 +- src/npoint/CMakeLists.txt | 7 +- src/sparse_graph/CMakeLists.txt | 9 +- src/visual_odometry/CMakeLists.txt | 6 +- 21 files changed, 62 insertions(+), 402 deletions(-) delete mode 100644 cmake/FindOpenCV.cmake diff --git a/.gitignore b/.gitignore index 99068b16..74517daa 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ # Editors .*~ *~ +*.sw[a-z] # Build Folder build/* diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c681cf4..20221ad8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,30 +14,6 @@ INCLUDE(InstallSettings) # Libraries -LIST(APPEND CMAKE_LIBRARY_PATH ~/.linuxbrew/lib) -LIST(APPEND CMAKE_LIBRARY_PATH /opt/local/lib) -LIST(APPEND CMAKE_LIBRARY_PATH /opt/local/lib/ufsparse) # Mac OS X -LIST(APPEND CMAKE_LIBRARY_PATH /usr/lib) -LIST(APPEND CMAKE_LIBRARY_PATH /usr/lib/atlas) -LIST(APPEND CMAKE_LIBRARY_PATH /usr/lib/suitesparse) # Ubuntu -LIST(APPEND CMAKE_LIBRARY_PATH /usr/lib64/atlas) -LIST(APPEND CMAKE_LIBRARY_PATH /usr/local/homebrew/lib) # Mac OS X -LIST(APPEND CMAKE_LIBRARY_PATH /usr/local/lib) -LIST(APPEND CMAKE_LIBRARY_PATH /usr/local/lib/suitesparse) -# Headers -LIST(APPEND CMAKE_INCLUDE_PATH ~/.linuxbrew/include) -LIST(APPEND CMAKE_INCLUDE_PATH /opt/local/include) -LIST(APPEND CMAKE_INCLUDE_PATH /opt/local/include/ufsparse) # Mac OS X -LIST(APPEND CMAKE_INCLUDE_PATH /opt/local/var/macports/software/eigen3/opt/local/include/eigen3) # Mac OS X -LIST(APPEND CMAKE_INCLUDE_PATH /usr/include) -LIST(APPEND CMAKE_INCLUDE_PATH /usr/include/eigen3) # Ubuntu 10.04's default location. -LIST(APPEND CMAKE_INCLUDE_PATH /usr/include/suitesparse) # Ubuntu -LIST(APPEND CMAKE_INCLUDE_PATH /usr/local/homebrew/include) # Mac OS X -LIST(APPEND CMAKE_INCLUDE_PATH /usr/local/homebrew/include/eigen3) # Mac OS X -LIST(APPEND CMAKE_INCLUDE_PATH /usr/local/include) -LIST(APPEND CMAKE_INCLUDE_PATH /usr/local/include/eigen3) -LIST(APPEND CMAKE_INCLUDE_PATH /usr/local/include/suitesparse) - set(CAMODOCAL_INCLUDE_INSTALL_PATH "include") # Library finding include(LibraryConfig) @@ -119,7 +95,7 @@ configure_file(CamOdoCalPathConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/CamOdoCalPat include_directories( # External ${EIGEN3_INCLUDE_DIR} - ${OPENCV_INCLUDE_DIRS} + ${OpenCV_INCLUDE_DIRS} # All library includes are prefixed with the path to avoid conflicts ${CMAKE_CURRENT_SOURCE_DIR} @@ -146,7 +122,7 @@ if(CAMODOCAL_PLATFORM_UNIX) #set_linker_flags("-Wl,--no-undefined -ldl -lnsl -lm -pthread -lrt" CACHE) find_package(LibDL) find_package(Libnsl) - find_package(LibM) + # find_package(LibM) find_package(Threads) find_package(Librt) find_package(Libm) @@ -191,6 +167,7 @@ include_directories( include ) +message("GLOG_FOUND in main" ${GLOG_FOUND}) add_subdirectory(src) install(DIRECTORY "include/camodocal" DESTINATION ${CAMODOCAL_INCLUDE_INSTALL_PATH}) diff --git a/cmake/DependencyUtilities.cmake b/cmake/DependencyUtilities.cmake index 1a365f61..bc05b8a5 100644 --- a/cmake/DependencyUtilities.cmake +++ b/cmake/DependencyUtilities.cmake @@ -6,6 +6,13 @@ macro(camodocal_required_dependency _name) list(APPEND __required_dependencies ${_name}) set(__required_dependencies ${__required_dependencies} CACHE INTERNAL "list of all required dependencies") + string(TOUPPER ${_name} _name_upper) + if (DEFINED ${_name}_FOUND) + set(${_name_upper}_FOUND ${${_name}_FOUND}) + else (DEFINED ${_name}_FOUND) + set(${_name}_FOUND ${${_name_upper}_FOUND}) + endif (DEFINED ${_name}_FOUND) + endmacro(camodocal_required_dependency _name) macro(camodocal_optional_dependency _name) @@ -13,5 +20,11 @@ macro(camodocal_optional_dependency _name) list(APPEND __optional_dependencies ${_name}) set(__optional_dependencies ${__optional_dependencies} CACHE INTERNAL "list of all optional dependencies") + string(TOUPPER ${_name} _name_upper) + if (DEFINED ${_name}_FOUND) + set(${_name_upper}_FOUND ${${_name}_FOUND}) + else (DEFINED ${_name}_FOUND) + set(${_name}_FOUND ${${_name_upper}_FOUND}) + endif (DEFINED ${_name}_FOUND) endmacro(camodocal_optional_dependency _name) diff --git a/cmake/FindOpenCV.cmake b/cmake/FindOpenCV.cmake deleted file mode 100644 index 0dfad882..00000000 --- a/cmake/FindOpenCV.cmake +++ /dev/null @@ -1,298 +0,0 @@ - -# The following variables control the behaviour of this module: -# -# OPENCV_DIR: Specify a custom directory where suitesparse is located -# libraries and headers will be searched for in -# ${OPENCV_DIR}/include and ${OPENCV_DIR}/lib - -include(FindPackageHandleStandardArgs) -include(HandleLibraryTypes) - -# @TODO: Consider using standard find_package(OpenCV) because this will support a broader range of versions. - -set(OpenCV_IncludeSearchPaths - ${OPENCV_DIR}/include - $ENV{OpenCV_DIR}/include - /usr/include/ - /usr/include/opencv-2.3.1 - /usr/local/include/ - /opt/local/include/ - ~/.linuxbrew/include -) - -set(OpenCV_LibrarySearchPaths - ${OPENCV_DIR}/lib - /usr/lib/ - /usr/local/lib/ - /opt/local/lib/ - $ENV{OpenCV_DIR}/x64/vc10/lib - ~/.linuxbrew/lib -) - -find_path(OPENCV_INCLUDE_DIRS opencv2/opencv.hpp - PATHS ${OpenCV_IncludeSearchPaths} -) - -set(OPENCV_CMAKE_PATHS - ${OPENCV_DIR}/share/OpenCV/ - /usr/local/share/OpenCV/ - /usr/share/OpenCV/ - /opt/local/share/OpenCV/ - $ENV{OpenCV_DIR}/share/OpenCV/ - ~/.linuxbrew/share/OpenCV/ -) - - -find_file(OPENCV_CONFIG_CMAKE NAMES OpenCVConfig.cmake - PATHS - ${OPENCV_CMAKE_PATHS} -) - -if(EXISTS ${OPENCV_CONFIG_CMAKE}) - include(${OPENCV_CONFIG_CMAKE}) -endif() - -find_file(OPENCV_CONFIG_VERSION_CMAKE NAMES OpenCVConfig-version.cmake - PATHS - ${OPENCV_CMAKE_PATHS} -) - -if(EXISTS ${OPENCV_CONFIG_VERSION_CMAKE}) - include(${OPENCV_CONFIG_VERSION_CMAKE}) -endif() - -if(WIN32) - # this is the suffix of the library in windows - # @TODO may want to change this to work for more than opencv 2.4.1 - set(OPENCV_LIB_STRING 241) -endif() - -find_library(OPENCV_CALIB3D_LIBRARY - NAMES opencv_calib3d${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_CORE_LIBRARY - NAMES opencv_core${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_FEATURES2D_LIBRARY - NAMES opencv_features2d${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_FLANN_LIBRARY - NAMES opencv_flann${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_GPU_LIBRARY - NAMES opencv_gpu${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_HIGHGUI_LIBRARY - NAMES opencv_highgui${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_IMGPROC_LIBRARY - NAMES opencv_imgproc${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_ML_LIBRARY - NAMES opencv_ml${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_OBJDETECT_LIBRARY - NAMES opencv_objdetect${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_VIDEO_LIBRARY - NAMES opencv_video${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} -) - -find_library(OPENCV_IMGCODECS_LIBRARY - NAMES opencv_imgcodecs - PATHS ${OpenCV_LibrarySearchPaths} -) - - - -# Handle the REQUIRED argument and set the _FOUND variable -find_package_handle_standard_args(OpenCV "Could NOT find opencv_calib3d (OpenCV)" - OPENCV_CALIB3D_LIBRARY -) -find_package_handle_standard_args(OpenCV "Could NOT find opencv_highgui (OpenCV)" - OPENCV_HIGHGUI_LIBRARY -) -find_package_handle_standard_args(OpenCV "Could NOT find opencv_imgproc (OpenCV)" - OPENCV_IMGPROC_LIBRARY -) -find_package_handle_standard_args(OpenCV "Could NOT find opencv_ml (OpenCV)" - OPENCV_ML_LIBRARY -) - -message(STATUS "OPENCV_VERSION: ${OpenCV_VERSION} VERSION_LESS 3.0.0") -if(OpenCV_VERSION VERSION_LESS "3.0.0") - # OpenCV2 - message(STATUS "OPENCV_VERSION: ${OpenCV_VERSION} VERSION_LESS 3.0.0 IS_LESS") - find_library(OPENCV_NONFREE_LIBRARY - NAMES opencv_nonfree${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} - ) - - find_library(OPENCV_LEGACY_LIBRARY - NAMES opencv_legacy${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} - ) - - find_library(OPENCV_CONTRIB_LIBRARY - NAMES opencv_contrib${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} - ) - - # Handle the REQUIRED argument and set the _FOUND variable - find_package_handle_standard_args(OpenCV "Could NOT find opencv_gpu (OpenCV)" - OPENCV_GPU_LIBRARY - ) - find_package_handle_standard_args(OpenCV "Could NOT find opencv_nonfree (OpenCV)" - OPENCV_NONFREE_LIBRARY - ) - find_package_handle_standard_args(OpenCV "Could NOT find opencv_contrib (OpenCV)" - OPENCV_CONTRIB_LIBRARY - ) - find_package_handle_standard_args(OpenCV "Could NOT find opencv_legacy (OpenCV)" - OPENCV_LEGACY_LIBRARY - ) - - # Collect optimized and debug libraries - handle_library_types(OPENCV_LEGACY_LIBRARY) - handle_library_types(OPENCV_NONFREE_LIBRARY) - handle_library_types(OPENCV_CONTRIB_LIBRARY) - handle_library_types(OPENCV_GPU_LIBRARY) - - - if(OPENCV_LEGACY_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_LEGACY_LIBRARY}) - endif() - - if(OPENCV_NONFREE_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_NONFREE_LIBRARY}) - endif() - - if(OPENCV_CONTRIB_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_CONTRIB_LIBRARY}) - endif() - - if(OPENCV_GPU_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_GPU_LIBRARY}) - endif() - -else() - # OpenCV3 - message(STATUS "OPENCV_VERSION: ${OpenCV_VERSION} VERSION_LESS 3.0.0 NOT_LESS") - find_library(OPENCV_IMGCODECS_LIBRARY - NAMES opencv_imgcodecs${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} - ) - find_library(OPENCV_XFEATURES2D_LIBRARY - NAMES opencv_xfeatures2d${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} - ) - find_library(OPENCV_FEATURES2D_LIBRARY - NAMES opencv_features2d${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} - ) - find_library(OPENCV_CUDAFEATURES2D_LIBRARY - NAMES opencv_cudafeatures2d${OPENCV_LIB_STRING} - PATHS ${OpenCV_LibrarySearchPaths} - ) - - # Handle the REQUIRED argument and set the _FOUND variable - find_package_handle_standard_args(OpenCV "Could NOT find opencv_imgcodecs (OpenCV)" - OPENCV_IMGCODECS_LIBRARY - ) - find_package_handle_standard_args(OpenCV "Could NOT find opencv_xfeatures2d (OpenCV)" - OPENCV_XFEATURES2D_LIBRARY - ) - find_package_handle_standard_args(OpenCV "Could NOT find opencv_features2d (OpenCV)" - OPENCV_FEATURES2D_LIBRARY - ) - find_package_handle_standard_args(OpenCV "Could NOT find opencv_cudafeatures2d (OpenCV)" - OPENCV_CUDAFEATURES2D_LIBRARY - ) - - # Collect optimized and debug libraries - handle_library_types(OPENCV_IMGCODECS_LIBRARY ) - handle_library_types(OPENCV_XFEATURES2D_LIBRARY) - handle_library_types(OPENCV_FEATURES2D_LIBRARY ) - handle_library_types(OPENCV_CUDAFEATURES2D_LIBRARY ) - - if(OPENCV_IMGCODECS_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_IMGCODECS_LIBRARY}) - endif() - - if(OPENCV_XFEATURES2D_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_XFEATURES2D_LIBRARY}) - endif() - - if(OPENCV_FEATURES2D_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_FEATURES2D_LIBRARY}) - endif() - - if(OPENCV_CUDAFEATURES2D_LIBRARY) - list(APPEND OPENCV_VERSION_SPECIFIC_LIBRARIES ${OPENCV_CUDAFEATURES2D_LIBRARY}) - endif() - -endif() - -# Collect optimized and debug libraries -handle_library_types(OPENCV_CORE_LIBRARY) -handle_library_types(OPENCV_FEATURES2D_LIBRARY) -handle_library_types(OPENCV_FLANN_LIBRARY) -handle_library_types(OPENCV_HIGHGUI_LIBRARY) -handle_library_types(OPENCV_IMGPROC_LIBRARY) -handle_library_types(OPENCV_ML_LIBRARY) -handle_library_types(OPENCV_OBJDETECT_LIBRARY) -handle_library_types(OPENCV_VIDEO_LIBRARY) - -# This has to be last, because we use it a proxy -# for the final determination if OpenCV is present or not -find_package_handle_standard_args(OpenCV "Could NOT find opencv_core (OpenCV)" - OPENCV_INCLUDE_DIRS - OPENCV_CORE_LIBRARY -) - -# there seems to be some differences -# between versions of CMake for the OpenCV_FOUND variable -# The value set in OpenCVConfig.cmake may not match -# what is specified in CMake's find_package_handle_standard_args -if(OPENCV_FOUND AND NOT OpenCV_FOUND) - set(OpenCV_FOUND ${OPENCV_FOUND}) -elseif(OpenCV_FOUND AND NOT OPENCV_FOUND) - set(OPENCV_FOUND ${OpenCV_FOUND}) -endif() - -mark_as_advanced( - OPENCV_INCLUDE_DIRS - - OPENCV_CONTRIB_LIBRARY - OPENCV_CORE_LIBRARY - OPENCV_FEATURES2D_LIBRARY - OPENCV_FLANN_LIBRARY - OPENCV_GPU_LIBRARY - OPENCV_HIGHGUI_LIBRARY - OPENCV_IMGPROC_LIBRARY - OPENCV_LEGACY_LIBRARY - OPENCV_ML_LIBRARY - OPENCV_OBJDETECT_LIBRARY - OPENCV_VIDEO_LIBRARY - OPENCV_IMGCODECS_LIBRARY -) - diff --git a/cmake/LibraryConfig.cmake b/cmake/LibraryConfig.cmake index 31df64f2..2cef36ad 100644 --- a/cmake/LibraryConfig.cmake +++ b/cmake/LibraryConfig.cmake @@ -84,7 +84,7 @@ endif() ##### Boost ##### # Expand the next statement if newer boost versions than 1.40.0 are released -set(Boost_ADDITIONAL_VERSIONS "1.40" "1.40.0" "1.49" "1.49.0") +# set(Boost_ADDITIONAL_VERSIONS "1.40" "1.40.0" "1.49" "1.49.0") find_package(Boost 1.40 REQUIRED COMPONENTS filesystem program_options serialization system thread) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d57230dc..62112ac9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,6 +3,7 @@ add_subdirectory(ceres-solver) endif() add_subdirectory(brisk) add_subdirectory(calib) +message("GLOG in src" ${GLOG_FOUND}) add_subdirectory(camera_models) add_subdirectory(camera_systems) add_subdirectory(chessboard) diff --git a/src/brisk/CMakeLists.txt b/src/brisk/CMakeLists.txt index 9e0fe183..98a355e7 100644 --- a/src/brisk/CMakeLists.txt +++ b/src/brisk/CMakeLists.txt @@ -1,4 +1,4 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) #agast add_subdirectory(thirdparty/agast) include_directories(thirdparty/agast/include) @@ -11,7 +11,7 @@ include_directories(include) #build the brisk library dynamic and static versions camodocal_library(camodocal_brisk SHARED ${BRISK_SOURCE_FILES} ${BRISK_HEADER_FILES}) -camodocal_link_libraries(camodocal_brisk agast ${OPENCV_CORE_LIBRARY}) +camodocal_link_libraries(camodocal_brisk agast ${OpenCV_LIBS}) camodocal_install(camodocal_brisk) -endif() \ No newline at end of file +endif() diff --git a/src/brisk/thirdparty/agast/CMakeLists.txt b/src/brisk/thirdparty/agast/CMakeLists.txt index 7303d236..06c77fff 100644 --- a/src/brisk/thirdparty/agast/CMakeLists.txt +++ b/src/brisk/thirdparty/agast/CMakeLists.txt @@ -8,7 +8,5 @@ INCLUDE_DIRECTORIES(include/agast) #build the library dynamic and static versions camodocal_library(agast SHARED ${AGAST_SOURCE_FILES} ${AGAST_HEADER_FILES}) - camodocal_link_libraries(agast ${OPENCV_CORE_LIBRARY} - ${OPENCV_FEATURES2D_LIBRARY} - ${OPENCV_IMGPROC_LIBRARY}) - camodocal_install(agast) \ No newline at end of file + camodocal_link_libraries(agast ${OpenCV_LIBS}) + camodocal_install(agast) diff --git a/src/calib/CMakeLists.txt b/src/calib/CMakeLists.txt index cf0186ad..2f0c8541 100644 --- a/src/calib/CMakeLists.txt +++ b/src/calib/CMakeLists.txt @@ -26,7 +26,7 @@ set(SRCS PlanarHandEyeCalibration.cc ) -if(OPENCV_FOUND) +if(OpenCV_FOUND) list(APPEND SRCS CameraCalibration.cc @@ -41,9 +41,7 @@ list(APPEND SRCS set(CALIB_OPTIONAL_DEPENDENCIES - ${OPENCV_CORE_LIBRARY} - ${OPENCV_IMGPROC_LIBRARY} - ${OPENCV_CALIB3D_LIBRARY} + ${OpenCV_LIBS} camodocal_camera_models camodocal_camera_systems camodocal_gpl @@ -51,7 +49,7 @@ set(CALIB_OPTIONAL_DEPENDENCIES camodocal_sparse_graph camodocal_visual_odometry ) -endif(OPENCV_FOUND) +endif(OpenCV_FOUND) camodocal_library(camodocal_calib SHARED ${SRCS}) @@ -86,13 +84,13 @@ endif(VCHARGE_VIZ) camodocal_install(camodocal_calib) -if(OPENCV_FOUND) +if(OpenCV_FOUND) camodocal_test(CamOdoCalibration) camodocal_link_libraries(CamOdoCalibration_test ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} camodocal_calib ) -endif(OPENCV_FOUND) +endif(OpenCV_FOUND) camodocal_test(HandEyeCalibration) @@ -105,4 +103,4 @@ camodocal_test(PlanarHandEyeCalibration) camodocal_link_libraries(PlanarHandEyeCalibration_test ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} camodocal_calib -) \ No newline at end of file +) diff --git a/src/camera_models/CMakeLists.txt b/src/camera_models/CMakeLists.txt index e63c6a2a..fc1e7d6a 100644 --- a/src/camera_models/CMakeLists.txt +++ b/src/camera_models/CMakeLists.txt @@ -2,7 +2,8 @@ include_directories( ${CERES_INCLUDE_DIRECTORIES} ) -if(GLOG_FOUND AND OPENCV_FOUND) +message("CV "${OpenCV_FOUND} "CV2" ${OpenCV_CORE_FOUND} "G " ${GLOG_FOUND}) +if(GLOG_FOUND AND OpenCV_FOUND) camodocal_library(camodocal_camera_models SHARED Camera.cc CameraFactory.cc @@ -15,9 +16,7 @@ camodocal_library(camodocal_camera_models SHARED camodocal_link_libraries(camodocal_camera_models ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_IMGPROC_LIBRARY} - ${OPENCV_CALIB3D_LIBRARY} + ${OpenCV_LIBS} camodocal_gpl ceres ${GLOG_LIBRARIES} @@ -34,4 +33,4 @@ camodocal_link_libraries(EquidistantCamera_test camodocal_camera_models) camodocal_test(PinholeCamera) camodocal_link_libraries(PinholeCamera_test camodocal_camera_models) -endif(GLOG_FOUND AND OPENCV_FOUND) \ No newline at end of file +endif(GLOG_FOUND AND OpenCV_FOUND) diff --git a/src/chessboard/CMakeLists.txt b/src/chessboard/CMakeLists.txt index ebb14c4a..bede1feb 100644 --- a/src/chessboard/CMakeLists.txt +++ b/src/chessboard/CMakeLists.txt @@ -1,14 +1,12 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) camodocal_library(camodocal_chessboard SHARED Chessboard.cc ) camodocal_link_libraries(camodocal_chessboard ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_CALIB3D_LIBRARY} - ${OPENCV_IMGPROC_LIBRARY} + ${OpenCV_LIBS} ) camodocal_install(camodocal_chessboard) -endif(OPENCV_FOUND) +endif(OpenCV_FOUND) diff --git a/src/dbow2/DUtilsCV/CMakeLists.txt b/src/dbow2/DUtilsCV/CMakeLists.txt index ca69d03e..99031f9c 100644 --- a/src/dbow2/DUtilsCV/CMakeLists.txt +++ b/src/dbow2/DUtilsCV/CMakeLists.txt @@ -10,12 +10,7 @@ camodocal_library(camodocal_DUtilsCV SHARED camodocal_link_libraries(camodocal_DUtilsCV ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} - ${OPENCV_CALIB3D_LIBRARY} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_FEATURES2D_LIBRARY} - ${OPENCV_HIGHGUI_LIBRARY} - ${OPENCV_IMGPROC_LIBRARY} - ${OPENCV_VERSION_SPECIFIC_LIBRARIES} + ${OpenCV_LIBS} ) camodocal_install(camodocal_DUtilsCV) diff --git a/src/dbow2/DVision/CMakeLists.txt b/src/dbow2/DVision/CMakeLists.txt index 08d4bc92..aa332988 100644 --- a/src/dbow2/DVision/CMakeLists.txt +++ b/src/dbow2/DVision/CMakeLists.txt @@ -30,14 +30,8 @@ camodocal_library(camodocal_DVision SHARED camodocal_link_libraries(camodocal_DVision ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_FEATURES2D_LIBRARY} - ${OPENCV_FLANN_LIBRARY} - ${OPENCV_IMGPROC_LIBRARY} - ${OPENCV_LEGACY_LIBRARY} - ${OPENCV_NONFREE_LIBRARY} + ${OpenCV_LIBS} camodocal_DUtils - ${OPENCV_VERSION_SPECIFIC_LIBRARIES} ) -camodocal_install(camodocal_DVision) \ No newline at end of file +camodocal_install(camodocal_DVision) diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 4aea783a..8a303bfe 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -1,5 +1,5 @@ -if(CAMODOCAL_CALIB_FOUND AND OPENCV_FOUND) +if(CAMODOCAL_CALIB_FOUND AND OpenCV_FOUND) camodocal_executable(intrinsic_calib intrinsic_calib.cc @@ -10,8 +10,7 @@ camodocal_link_libraries(intrinsic_calib ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_HIGHGUI_LIBRARY} + ${OpenCV_LIBS} camodocal_calib camodocal_chessboard ) @@ -25,8 +24,7 @@ camodocal_link_libraries(stereo_calib ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_HIGHGUI_LIBRARY} + ${OpenCV_LIBS} camodocal_calib camodocal_chessboard ) @@ -43,7 +41,7 @@ camodocal_link_libraries(extrinsic_calib camodocal_calib ) -endif(CAMODOCAL_CALIB_FOUND AND OPENCV_FOUND) +endif(CAMODOCAL_CALIB_FOUND AND OpenCV_FOUND) include_directories( ../dbow2/DBoW2 diff --git a/src/features2d/CMakeLists.txt b/src/features2d/CMakeLists.txt index 5426c212..75143a32 100644 --- a/src/features2d/CMakeLists.txt +++ b/src/features2d/CMakeLists.txt @@ -1,4 +1,4 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) camodocal_library(camodocal_features2d SHARED ORBGPU.cc SurfGPU.cc @@ -7,10 +7,7 @@ camodocal_library(camodocal_features2d SHARED camodocal_link_libraries(camodocal_features2d ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_VERSION_SPECIFIC_LIBRARIES} - ${OPENCV_LIBRARIES} - ${OPENCV_FEATURES2D_LIBRARY} + ${OpenCV_LIBS} ${Boost_SYSTEM_LIBRARY_RELEASE} ${CUDA_CUDART_LIBRARY_OPTIONAL} ${Boost_LIBRARIES} @@ -18,4 +15,4 @@ camodocal_link_libraries(camodocal_features2d camodocal_install(camodocal_features2d) -endif(OPENCV_FOUND) \ No newline at end of file +endif(OpenCV_FOUND) diff --git a/src/gpl/CMakeLists.txt b/src/gpl/CMakeLists.txt index 8479442b..d06180e0 100644 --- a/src/gpl/CMakeLists.txt +++ b/src/gpl/CMakeLists.txt @@ -1,4 +1,4 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) include_directories( ${CERES_INCLUDE_DIRECTORIES} ) @@ -12,10 +12,10 @@ set_source_files(GPL_SRC_FILES camodocal_library(camodocal_gpl SHARED ${GPL_SRC_FILES}) camodocal_link_libraries(camodocal_gpl ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} - ${OPENCV_CORE_LIBRARY} + ${OpenCV_LIBS} ceres ${CERES_LIBRARIES} ) camodocal_install(camodocal_gpl) -endif(OPENCV_FOUND) +endif(OpenCV_FOUND) diff --git a/src/infrastr_calib/CMakeLists.txt b/src/infrastr_calib/CMakeLists.txt index 19e27a37..5d07751b 100644 --- a/src/infrastr_calib/CMakeLists.txt +++ b/src/infrastr_calib/CMakeLists.txt @@ -1,4 +1,4 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) include_directories( ${CERES_INCLUDE_DIRECTORIES} ../dbow2/DBoW2 @@ -17,10 +17,7 @@ camodocal_link_libraries(camodocal_infrastr_calib ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_IMGPROC_LIBRARY} - ${OPENCV_CALIB3D_LIBRARY} - ${OPENCV_VERSION_SPECIFIC_LIBRARIES} + ${OpenCV_LIBS} camodocal_camera_systems camodocal_features2d camodocal_gpl @@ -40,4 +37,4 @@ camodocal_link_libraries(camodocal_infrastr_calib camodocal_install(camodocal_infrastr_calib) endif(VCHARGE_VIZ) -endif(OPENCV_FOUND) +endif(OpenCV_FOUND) diff --git a/src/location_recognition/CMakeLists.txt b/src/location_recognition/CMakeLists.txt index 9bb03792..e7e9ab71 100644 --- a/src/location_recognition/CMakeLists.txt +++ b/src/location_recognition/CMakeLists.txt @@ -1,4 +1,4 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) include_directories( ../dbow2/DBoW2 ../dbow2/DUtils @@ -20,4 +20,4 @@ camodocal_link_libraries(camodocal_location_recognition ) camodocal_install(camodocal_location_recognition) -endif(OPENCV_FOUND) \ No newline at end of file +endif(OpenCV_FOUND) \ No newline at end of file diff --git a/src/npoint/CMakeLists.txt b/src/npoint/CMakeLists.txt index 7c7762f6..ee422b9d 100644 --- a/src/npoint/CMakeLists.txt +++ b/src/npoint/CMakeLists.txt @@ -1,4 +1,4 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) camodocal_library(camodocal_fivepoint SHARED five-point/five-point.cpp five-point/modelest.cpp @@ -6,9 +6,8 @@ camodocal_library(camodocal_fivepoint SHARED camodocal_link_libraries(camodocal_fivepoint ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_CALIB3D_LIBRARY} + ${OpenCV_LIBS} ) camodocal_install(camodocal_fivepoint) -endif(OPENCV_FOUND) +endif(OpenCV_FOUND) diff --git a/src/sparse_graph/CMakeLists.txt b/src/sparse_graph/CMakeLists.txt index 3ff72ac9..71335cf8 100644 --- a/src/sparse_graph/CMakeLists.txt +++ b/src/sparse_graph/CMakeLists.txt @@ -1,4 +1,4 @@ -if(OPENCV_FOUND) +if(OpenCV_FOUND) camodocal_library(camodocal_sparse_graph SHARED Odometry.cc Pose.cc @@ -11,11 +11,8 @@ camodocal_link_libraries(camodocal_sparse_graph ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} - ${OPENCV_CORE_LIBRARY} - ${OPENCV_FEATURES2D_LIBRARY} - ${OPENCV_HIGHGUI_LIBRARY} - ${OPENCV_VERSION_SPECIFIC_LIBRARIES} + ${OpenCV_LIBS} ) camodocal_install(camodocal_sparse_graph) -endif(OPENCV_FOUND) \ No newline at end of file +endif(OpenCV_FOUND) diff --git a/src/visual_odometry/CMakeLists.txt b/src/visual_odometry/CMakeLists.txt index ac608db0..62347503 100644 --- a/src/visual_odometry/CMakeLists.txt +++ b/src/visual_odometry/CMakeLists.txt @@ -14,11 +14,7 @@ camodocal_library(camodocal_visual_odometry SHARED camodocal_link_libraries(camodocal_visual_odometry ${CAMODOCAL_PLATFORM_UNIX_LIBRARIES} ${Boost_THREAD_LIBRARY} - ${OPENCV_FEATURES2D_LIBRARY} - ${OPENCV_FLANN_LIBRARY} - ${OPENCV_HIGHGUI_LIBRARY} - ${OPENCV_NONFREE_LIBRARY} - ${OPENCV_VERSION_SPECIFIC_LIBRARIES} + ${OpenCV_LIBS} camodocal_brisk camodocal_camera_models camodocal_features2d