mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-30 21:05:33 +08:00
311 lines
11 KiB
Diff
311 lines
11 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 9c1b150..367fbbc 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -218,24 +218,71 @@ include_directories(
|
||
|
# as system headers.
|
||
|
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
|
||
|
|
||
|
+
|
||
|
+set(THEIA_USE_EXTERNAL_CEREAL OFF CACHE BOOL "Use a system Cereal library")
|
||
|
+set(THEIA_USE_EXTERNAL_FLANN OFF CACHE BOOL "Use a system Flann library")
|
||
|
+
|
||
|
# build Third party libraries included in distro.
|
||
|
-add_subdirectory(libraries)
|
||
|
-include_directories(
|
||
|
- libraries
|
||
|
- libraries/spectra
|
||
|
- ${akaze_SOURCE_DIR}
|
||
|
- ${akaze_INCLUDE_DIR}
|
||
|
- ${cereal_SOURCE_DIR}
|
||
|
- ${cereal_SOURCE_DIR}/include
|
||
|
- ${flann_SOURCE_DIR}
|
||
|
- ${flann_SOURCE_DIR}/src/cpp
|
||
|
- ${gtest_SOURCE_DIR}/include
|
||
|
- ${gtest_SOURCE_DIR}
|
||
|
- ${optimo_SOURCE_DIR}
|
||
|
- ${statx_SOURCE_DIR}
|
||
|
- ${stlplus3_SOURCE_DIR}
|
||
|
- ${vlfeat_SOURCE_DIR}
|
||
|
- ${visual_sfm_SOURCE_DIR})
|
||
|
+if (BUILD_TESTING)
|
||
|
+ add_subdirectory(libraries/gtest)
|
||
|
+endif (BUILD_TESTING)
|
||
|
+
|
||
|
+# AKAZE feature extractor.
|
||
|
+add_subdirectory(libraries/akaze)
|
||
|
+
|
||
|
+include_directories(${akaze_SOURCE_DIR} ${akaze_INCLUDE_DIR})
|
||
|
+
|
||
|
+# Cereal for portable IO.
|
||
|
+if(NOT THEIA_USE_EXTERNAL_CEREAL)
|
||
|
+ add_subdirectory(libraries/cereal)
|
||
|
+
|
||
|
+ include_directories(${cereal_SOURCE_DIR} ${cereal_SOURCE_DIR}/include)
|
||
|
+ set(THEIA_INTERNAL_CEREAL_LIB ${THEIA_INTERNAL_LIB_PREFIX}/cereal ${THEIA_INTERNAL_LIB_PREFIX}/cereal/include)
|
||
|
+else()
|
||
|
+ find_package(cereal REQUIRED)
|
||
|
+
|
||
|
+ set(_THEIA_CEREAL_LIBRARIES cereal)
|
||
|
+endif()
|
||
|
+
|
||
|
+# Flann for fast approximate nearest neighbor searches.
|
||
|
+if(NOT THEIA_USE_EXTERNAL_FLANN)
|
||
|
+ add_subdirectory(libraries/flann)
|
||
|
+
|
||
|
+ include_directories(${flann_SOURCE_DIR} ${flann_SOURCE_DIR}/src/cpp)
|
||
|
+ set(_THEIA_FLANN_LIBRARIES flann_cpp)
|
||
|
+ set(THEIA_INTERNAL_FLANN_LIB ${THEIA_INTERNAL_LIB_PREFIX}/flann)
|
||
|
+else()
|
||
|
+ find_package(Flann REQUIRED)
|
||
|
+
|
||
|
+ include_directories(${FLANN_INCLUDE_DIR})
|
||
|
+ set(_THEIA_FLANN_LIBRARIES ${FLANN_LIBRARY})
|
||
|
+endif()
|
||
|
+
|
||
|
+# Add Optimo.
|
||
|
+add_subdirectory(libraries/optimo)
|
||
|
+include_directories(${optimo_SOURCE_DIR})
|
||
|
+
|
||
|
+# Add Spectra.
|
||
|
+include_directories(libraries/spectra)
|
||
|
+
|
||
|
+# Add Statx.
|
||
|
+add_subdirectory(libraries/statx)
|
||
|
+include_directories(${statx_SOURCE_DIR})
|
||
|
+
|
||
|
+# STLPlus for filepath tools.
|
||
|
+add_subdirectory(libraries/stlplus3)
|
||
|
+include_directories(${stlplus3_SOURCE_DIR})
|
||
|
+
|
||
|
+# Add VLFeat.
|
||
|
+add_subdirectory(libraries/vlfeat)
|
||
|
+include_directories(${vlfeat_SOURCE_DIR})
|
||
|
+
|
||
|
+# Add VisualSfM files.
|
||
|
+add_subdirectory(libraries/visual_sfm)
|
||
|
+include_directories(${visual_sfm_SOURCE_DIR})
|
||
|
+
|
||
|
+include_directories(libraries)
|
||
|
+
|
||
|
|
||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||
|
include(OptimizeTheiaCompilerFlags)
|
||
|
@@ -260,7 +307,19 @@ install(FILES ${THEIA_HDRS} DESTINATION include/theia)
|
||
|
file(GLOB_RECURSE THEIA_INTERNAL_HDRS ${CMAKE_SOURCE_DIR}/src/theia/*.h)
|
||
|
install(DIRECTORY src/theia/ DESTINATION include/theia FILES_MATCHING PATTERN "*.h")
|
||
|
|
||
|
-install(DIRECTORY libraries/ DESTINATION include/theia/libraries FILES_MATCHING PATTERN "*.h*")
|
||
|
+install(DIRECTORY libraries/akaze/ DESTINATION include/theia/libraries/akaze FILES_MATCHING PATTERN "*.h*")
|
||
|
+if(NOT THEIA_USE_EXTERNAL_CEREAL)
|
||
|
+ install(DIRECTORY libraries/cereal/ DESTINATION include/theia/libraries/cereal FILES_MATCHING PATTERN "*.h*")
|
||
|
+endif()
|
||
|
+if(NOT THEIA_USE_EXTERNAL_FLANN)
|
||
|
+ install(DIRECTORY libraries/flann/ DESTINATION include/theia/libraries/flann FILES_MATCHING PATTERN "*.h*")
|
||
|
+endif()
|
||
|
+install(DIRECTORY libraries/optimo/ DESTINATION include/theia/libraries/optimo FILES_MATCHING PATTERN "*.h*")
|
||
|
+install(DIRECTORY libraries/spectra/ DESTINATION include/theia/libraries/spectra FILES_MATCHING PATTERN "*.h*")
|
||
|
+install(DIRECTORY libraries/statx/ DESTINATION include/theia/libraries/statx FILES_MATCHING PATTERN "*.h*")
|
||
|
+install(DIRECTORY libraries/stlplus3/ DESTINATION include/theia/libraries/stlplus3 FILES_MATCHING PATTERN "*.h*")
|
||
|
+install(DIRECTORY libraries/visual_sfm/ DESTINATION include/theia/libraries/visual_sfm FILES_MATCHING PATTERN "*.h*")
|
||
|
+install(DIRECTORY libraries/vlfeat/ DESTINATION include/theia/libraries/vlfeat FILES_MATCHING PATTERN "*.h*")
|
||
|
|
||
|
# Add an uninstall target to remove all installed files.
|
||
|
configure_file("${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in"
|
||
|
@@ -320,8 +379,9 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake/TheiaConfigVersion.cmake.in"
|
||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/TheiaConfig.cmake"
|
||
|
"${CMAKE_CURRENT_BINARY_DIR}/TheiaConfigVersion.cmake"
|
||
|
"${CMAKE_SOURCE_DIR}/cmake/FindEigen.cmake"
|
||
|
- "${CMAKE_SOURCE_DIR}/cmake/FindGlog.cmake"
|
||
|
+ "${CMAKE_SOURCE_DIR}/cmake/FindFlann.cmake"
|
||
|
"${CMAKE_SOURCE_DIR}/cmake/FindGflags.cmake"
|
||
|
- "${CMAKE_SOURCE_DIR}/cmake/FindOpenImageIO.cmake"
|
||
|
+ "${CMAKE_SOURCE_DIR}/cmake/FindGlog.cmake"
|
||
|
+ "${CMAKE_SOURCE_DIR}/cmake/FindOpenImageIO.cmake"
|
||
|
"${CMAKE_SOURCE_DIR}/cmake/FindSuiteSparse.cmake"
|
||
|
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
|
||
|
diff --git a/cmake/FindFlann.cmake b/cmake/FindFlann.cmake
|
||
|
new file mode 100644
|
||
|
index 0000000..5d19ef7
|
||
|
--- /dev/null
|
||
|
+++ b/cmake/FindFlann.cmake
|
||
|
@@ -0,0 +1,63 @@
|
||
|
+###############################################################################
|
||
|
+# Find FLANN
|
||
|
+#
|
||
|
+# This sets the following variables:
|
||
|
+# FLANN_FOUND - True if FLANN was found.
|
||
|
+# FLANN_INCLUDE_DIRS - Directories containing the FLANN include files.
|
||
|
+# FLANN_LIBRARIES - Libraries needed to use FLANN.
|
||
|
+# FLANN_DEFINITIONS - Compiler flags for FLANN.
|
||
|
+# If FLANN_USE_STATIC is specified and then look for static libraries ONLY else
|
||
|
+# look for shared ones
|
||
|
+
|
||
|
+if(FLANN_USE_STATIC)
|
||
|
+ set(FLANN_RELEASE_NAME flann_cpp_s flann_cpp)
|
||
|
+ set(FLANN_DEBUG_NAME flann_cpp_s-gd flann_cpp-gd)
|
||
|
+else(FLANN_USE_STATIC)
|
||
|
+ set(FLANN_RELEASE_NAME flann_cpp)
|
||
|
+ set(FLANN_DEBUG_NAME flann_cpp-gd)
|
||
|
+endif(FLANN_USE_STATIC)
|
||
|
+
|
||
|
+find_package(PkgConfig QUIET)
|
||
|
+if (FLANN_FIND_VERSION)
|
||
|
+ pkg_check_modules(PC_FLANN flann>=${FLANN_FIND_VERSION})
|
||
|
+else(FLANN_FIND_VERSION)
|
||
|
+ pkg_check_modules(PC_FLANN flann)
|
||
|
+endif(FLANN_FIND_VERSION)
|
||
|
+
|
||
|
+set(FLANN_DEFINITIONS ${PC_FLANN_CFLAGS_OTHER})
|
||
|
+
|
||
|
+find_path(FLANN_INCLUDE_DIR flann/flann.hpp
|
||
|
+ HINTS ${PC_FLANN_INCLUDEDIR} ${PC_FLANN_INCLUDE_DIRS} "${FLANN_ROOT}" "$ENV{FLANN_ROOT}"
|
||
|
+ PATHS "$ENV{PROGRAMFILES}/Flann" "$ENV{PROGRAMW6432}/Flann"
|
||
|
+ PATH_SUFFIXES include)
|
||
|
+
|
||
|
+find_library(FLANN_LIBRARY
|
||
|
+ NAMES ${FLANN_RELEASE_NAME}
|
||
|
+ HINTS ${PC_FLANN_LIBDIR} ${PC_FLANN_LIBRARY_DIRS} "${FLANN_ROOT}" "$ENV{FLANN_ROOT}"
|
||
|
+ PATHS "$ENV{PROGRAMFILES}/Flann" "$ENV{PROGRAMW6432}/Flann"
|
||
|
+ PATH_SUFFIXES lib)
|
||
|
+
|
||
|
+find_library(FLANN_LIBRARY_DEBUG
|
||
|
+ NAMES ${FLANN_DEBUG_NAME} ${FLANN_RELEASE_NAME}
|
||
|
+ HINTS ${PC_FLANN_LIBDIR} ${PC_FLANN_LIBRARY_DIRS} "${FLANN_ROOT}" "$ENV{FLANN_ROOT}"
|
||
|
+ PATHS "$ENV{PROGRAMFILES}/Flann" "$ENV{PROGRAMW6432}/Flann"
|
||
|
+ PATH_SUFFIXES lib)
|
||
|
+
|
||
|
+if(NOT FLANN_LIBRARY_DEBUG)
|
||
|
+ set(FLANN_LIBRARY_DEBUG ${FLANN_LIBRARY})
|
||
|
+endif(NOT FLANN_LIBRARY_DEBUG)
|
||
|
+
|
||
|
+set(FLANN_INCLUDE_DIRS ${FLANN_INCLUDE_DIR})
|
||
|
+set(FLANN_LIBRARIES optimized ${FLANN_LIBRARY} debug ${FLANN_LIBRARY_DEBUG})
|
||
|
+
|
||
|
+include(FindPackageHandleStandardArgs)
|
||
|
+find_package_handle_standard_args(FLANN DEFAULT_MSG FLANN_LIBRARY FLANN_INCLUDE_DIR)
|
||
|
+
|
||
|
+mark_as_advanced(FLANN_LIBRARY FLANN_LIBRARY_DEBUG FLANN_INCLUDE_DIR)
|
||
|
+
|
||
|
+if(FLANN_FOUND)
|
||
|
+ message(STATUS "Flann found (include: ${FLANN_INCLUDE_DIRS}, lib: ${FLANN_LIBRARIES})")
|
||
|
+ if(FLANN_USE_STATIC)
|
||
|
+ add_definitions(-DFLANN_STATIC)
|
||
|
+ endif(FLANN_USE_STATIC)
|
||
|
+endif(FLANN_FOUND)
|
||
|
diff --git a/cmake/TheiaConfig.cmake.in b/cmake/TheiaConfig.cmake.in
|
||
|
index a3ea187..9195da1 100644
|
||
|
--- a/cmake/TheiaConfig.cmake.in
|
||
|
+++ b/cmake/TheiaConfig.cmake.in
|
||
|
@@ -207,22 +207,47 @@ endif (NOT TARGET theia AND NOT Theia_BINARY_DIR)
|
||
|
# Set the expected XX_LIBRARIES variable for FindPackage().
|
||
|
set(THEIA_LIBRARIES theia)
|
||
|
|
||
|
+set(THEIA_USE_EXTERNAL_CEREAL @THEIA_USE_EXTERNAL_CEREAL@)
|
||
|
+set(THEIA_USE_EXTERNAL_FLANN @THEIA_USE_EXTERNAL_FLANN@)
|
||
|
+
|
||
|
+# Cereal.
|
||
|
+if (THEIA_USE_EXTERNAL_CEREAL)
|
||
|
+ find_package(cereal QUIET)
|
||
|
+ if (TARGET cereal)
|
||
|
+ message(STATUS "Found required Theia dependency: Cereal")
|
||
|
+ else (TARGET cereal)
|
||
|
+ theia_report_not_found("Missing required Theia dependency: Cereal.")
|
||
|
+ endif (TARGET cereal)
|
||
|
+ list(APPEND THEIA_LIBRARIES cereal)
|
||
|
+endif (THEIA_USE_EXTERNAL_CEREAL)
|
||
|
+
|
||
|
+# Flann.
|
||
|
+if (THEIA_USE_EXTERNAL_FLANN)
|
||
|
+ find_package(Flann QUIET)
|
||
|
+ if (FLANN_FOUND)
|
||
|
+ message(STATUS "Found required Theia dependency: Flann")
|
||
|
+ else (FLANN_FOUND)
|
||
|
+ theia_report_not_found("Missing required Theia dependency: Flann.")
|
||
|
+ endif (FLANN_FOUND)
|
||
|
+ list(APPEND THEIA_INCLUDE_DIRS ${FLANN_INCLUDE_DIR})
|
||
|
+ list(APPEND THEIA_LIBRARIES ${FLANN_LIBRARY})
|
||
|
+endif (THEIA_USE_EXTERNAL_FLANN)
|
||
|
+
|
||
|
# Add the libraries included with the distribution.
|
||
|
set(THEIA_INTERNAL_LIB_PREFIX ${THEIA_INCLUDE_DIR}/theia/libraries)
|
||
|
set(THEIA_INTERNAL_LIBS_INCLUDES
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}/akaze
|
||
|
- ${THEIA_INTERNAL_LIB_PREFIX}/cereal
|
||
|
- ${THEIA_INTERNAL_LIB_PREFIX}/cereal/include
|
||
|
- ${THEIA_INTERNAL_LIB_PREFIX}/flann
|
||
|
+ @THEIA_INTERNAL_CEREAL_LIB@
|
||
|
+ @THEIA_INTERNAL_FLANN_LIB@
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}/gtest
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}/gtest/include
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}/optimo
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}/spectra
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}/statx
|
||
|
${THEIA_INTERNAL_LIB_PREFIX}/stlplus3
|
||
|
- ${THEIA_INTERNAL_LIB_PREFIX}/vlfeat
|
||
|
- ${THEIA_INTERNAL_LIB_PREFIX}/visual_sfm)
|
||
|
+ ${THEIA_INTERNAL_LIB_PREFIX}/visual_sfm
|
||
|
+ ${THEIA_INTERNAL_LIB_PREFIX}/vlfeat)
|
||
|
|
||
|
list(APPEND THEIA_INCLUDE_DIRS ${THEIA_INTERNAL_LIBS_INCLUDES})
|
||
|
|
||
|
diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt
|
||
|
deleted file mode 100644
|
||
|
index 84f3829..0000000
|
||
|
--- a/libraries/CMakeLists.txt
|
||
|
+++ /dev/null
|
||
|
@@ -1,27 +0,0 @@
|
||
|
-if (${BUILD_TESTING})
|
||
|
- add_subdirectory(gtest)
|
||
|
-endif (${BUILD_TESTING})
|
||
|
-
|
||
|
-# AKAZE feature extractor.
|
||
|
-add_subdirectory(akaze)
|
||
|
-
|
||
|
-# Cereal for portable IO.
|
||
|
-add_subdirectory(cereal)
|
||
|
-
|
||
|
-# Flann for fast approximate nearest neighbor searches.
|
||
|
-add_subdirectory(flann)
|
||
|
-
|
||
|
-# Add Optimo.
|
||
|
-add_subdirectory(optimo)
|
||
|
-
|
||
|
-# Add Statx.
|
||
|
-add_subdirectory(statx)
|
||
|
-
|
||
|
-# STLPlus for filepath tools.
|
||
|
-add_subdirectory(stlplus3)
|
||
|
-
|
||
|
-# Add VLFeat.
|
||
|
-add_subdirectory(vlfeat)
|
||
|
-
|
||
|
-# Add VisualSfM files.
|
||
|
-add_subdirectory(visual_sfm)
|
||
|
\ No newline at end of file
|
||
|
diff --git a/src/theia/CMakeLists.txt b/src/theia/CMakeLists.txt
|
||
|
index 65787eb..07c54a4 100644
|
||
|
--- a/src/theia/CMakeLists.txt
|
||
|
+++ b/src/theia/CMakeLists.txt
|
||
|
@@ -174,14 +174,15 @@ set(THEIA_LIBRARY_DEPENDENCIES
|
||
|
${CERES_LIBRARIES}
|
||
|
${GFLAGS_LIBRARIES}
|
||
|
${GLOG_LIBRARIES}
|
||
|
- ${SUITESPARSE_LIBRARIES}
|
||
|
${OPENIMAGEIO_LIBRARIES}
|
||
|
+ ${SUITESPARSE_LIBRARIES}
|
||
|
+ ${_THEIA_CEREAL_LIBRARIES}
|
||
|
+ ${_THEIA_FLANN_LIBRARIES}
|
||
|
akaze
|
||
|
- flann_cpp
|
||
|
statx
|
||
|
stlplus3
|
||
|
- vlfeat
|
||
|
- visual_sfm)
|
||
|
+ visual_sfm
|
||
|
+ vlfeat)
|
||
|
|
||
|
set(THEIA_LIBRARY_SOURCE
|
||
|
${THEIA_SRC}
|