mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
[ceres] Portfile fix
This commit is contained in:
parent
83e3a296dc
commit
4857f86a3b
@ -1,4 +1,4 @@
|
||||
Source: ceres
|
||||
Version: 1.12.0-1
|
||||
Version: 1.12.0-2
|
||||
Build-Depends:suitesparse, eigen3, clapack, gflags, glog
|
||||
Description: non-linear optimization package
|
247
ports/ceres/fix-find-packages.patch
Normal file
247
ports/ceres/fix-find-packages.patch
Normal file
@ -0,0 +1,247 @@
|
||||
--- a/cmake/FindSuiteSparse.cmake Mon Dec 05 18:42:48 2016
|
||||
+++ b/cmake/FindSuiteSparse.cmake Fri Jul 07 01:50:54 2017
|
||||
@@ -179,8 +179,6 @@
|
||||
/opt/local/include/ufsparse # Mac OS X
|
||||
/usr/local/homebrew/include # Mac OS X
|
||||
/usr/local/include
|
||||
- /usr/local/include/suitesparse
|
||||
- /usr/include/suitesparse # Ubuntu
|
||||
/usr/include)
|
||||
list(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
|
||||
${SUITESPARSE_LIBRARY_DIR_HINTS}
|
||||
@@ -188,9 +186,10 @@
|
||||
/opt/local/lib/ufsparse # Mac OS X
|
||||
/usr/local/homebrew/lib # Mac OS X
|
||||
/usr/local/lib
|
||||
- /usr/local/lib/suitesparse
|
||||
- /usr/lib/suitesparse # Ubuntu
|
||||
/usr/lib)
|
||||
+# Additional suffixes to try appending to each search path.
|
||||
+list(APPEND SUITESPARSE_CHECK_PATH_SUFFIXES
|
||||
+ suitesparse) # Windows/Ubuntu
|
||||
|
||||
# Given the number of components of SuiteSparse, and to ensure that the
|
||||
# automatic failure message generated by FindPackageHandleStandardArgs()
|
||||
@@ -218,7 +217,8 @@
|
||||
set(AMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS AMD_FOUND)
|
||||
find_library(AMD_LIBRARY NAMES amd
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${AMD_LIBRARY})
|
||||
message(STATUS "Found AMD library: ${AMD_LIBRARY}")
|
||||
else (EXISTS ${AMD_LIBRARY})
|
||||
@@ -229,7 +229,8 @@
|
||||
mark_as_advanced(AMD_LIBRARY)
|
||||
|
||||
find_path(AMD_INCLUDE_DIR NAMES amd.h
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${AMD_INCLUDE_DIR})
|
||||
message(STATUS "Found AMD header in: ${AMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${AMD_INCLUDE_DIR})
|
||||
@@ -243,7 +244,8 @@
|
||||
set(CAMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CAMD_FOUND)
|
||||
find_library(CAMD_LIBRARY NAMES camd
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${CAMD_LIBRARY})
|
||||
message(STATUS "Found CAMD library: ${CAMD_LIBRARY}")
|
||||
else (EXISTS ${CAMD_LIBRARY})
|
||||
@@ -254,7 +256,8 @@
|
||||
mark_as_advanced(CAMD_LIBRARY)
|
||||
|
||||
find_path(CAMD_INCLUDE_DIR NAMES camd.h
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
message(STATUS "Found CAMD header in: ${CAMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
@@ -268,7 +271,8 @@
|
||||
set(COLAMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS COLAMD_FOUND)
|
||||
find_library(COLAMD_LIBRARY NAMES colamd
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${COLAMD_LIBRARY})
|
||||
message(STATUS "Found COLAMD library: ${COLAMD_LIBRARY}")
|
||||
else (EXISTS ${COLAMD_LIBRARY})
|
||||
@@ -279,7 +283,8 @@
|
||||
mark_as_advanced(COLAMD_LIBRARY)
|
||||
|
||||
find_path(COLAMD_INCLUDE_DIR NAMES colamd.h
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
message(STATUS "Found COLAMD header in: ${COLAMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
@@ -293,7 +298,8 @@
|
||||
set(CCOLAMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CCOLAMD_FOUND)
|
||||
find_library(CCOLAMD_LIBRARY NAMES ccolamd
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${CCOLAMD_LIBRARY})
|
||||
message(STATUS "Found CCOLAMD library: ${CCOLAMD_LIBRARY}")
|
||||
else (EXISTS ${CCOLAMD_LIBRARY})
|
||||
@@ -304,7 +310,8 @@
|
||||
mark_as_advanced(CCOLAMD_LIBRARY)
|
||||
|
||||
find_path(CCOLAMD_INCLUDE_DIR NAMES ccolamd.h
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
message(STATUS "Found CCOLAMD header in: ${CCOLAMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
@@ -318,7 +325,8 @@
|
||||
set(CHOLMOD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CHOLMOD_FOUND)
|
||||
find_library(CHOLMOD_LIBRARY NAMES cholmod
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${CHOLMOD_LIBRARY})
|
||||
message(STATUS "Found CHOLMOD library: ${CHOLMOD_LIBRARY}")
|
||||
else (EXISTS ${CHOLMOD_LIBRARY})
|
||||
@@ -329,7 +337,8 @@
|
||||
mark_as_advanced(CHOLMOD_LIBRARY)
|
||||
|
||||
find_path(CHOLMOD_INCLUDE_DIR NAMES cholmod.h
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
message(STATUS "Found CHOLMOD header in: ${CHOLMOD_INCLUDE_DIR}")
|
||||
else (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
@@ -343,7 +352,8 @@
|
||||
set(SUITESPARSEQR_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSEQR_FOUND)
|
||||
find_library(SUITESPARSEQR_LIBRARY NAMES spqr
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
message(STATUS "Found SuiteSparseQR library: ${SUITESPARSEQR_LIBRARY}")
|
||||
else (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
@@ -354,7 +364,8 @@
|
||||
mark_as_advanced(SUITESPARSEQR_LIBRARY)
|
||||
|
||||
find_path(SUITESPARSEQR_INCLUDE_DIR NAMES SuiteSparseQR.hpp
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
message(STATUS "Found SuiteSparseQR header in: ${SUITESPARSEQR_INCLUDE_DIR}")
|
||||
else (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
@@ -370,7 +381,8 @@
|
||||
# support for it, this will do no harm if it wasn't.
|
||||
set(TBB_FOUND TRUE)
|
||||
find_library(TBB_LIBRARIES NAMES tbb
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${TBB_LIBRARIES})
|
||||
message(STATUS "Found Intel Thread Building Blocks (TBB) library: "
|
||||
"${TBB_LIBRARIES}, assuming SuiteSparseQR was compiled with TBB.")
|
||||
@@ -383,7 +395,8 @@
|
||||
|
||||
if (TBB_FOUND)
|
||||
find_library(TBB_MALLOC_LIB NAMES tbbmalloc
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${TBB_MALLOC_LIB})
|
||||
message(STATUS "Found Intel Thread Building Blocks (TBB) Malloc library: "
|
||||
"${TBB_MALLOC_LIB}")
|
||||
@@ -413,7 +426,8 @@
|
||||
# If SuiteSparse version is >= 4 then SuiteSparse_config is required.
|
||||
# For SuiteSparse 3, UFconfig.h is required.
|
||||
find_library(SUITESPARSE_CONFIG_LIBRARY NAMES suitesparseconfig
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${SUITESPARSE_CONFIG_LIBRARY})
|
||||
message(STATUS "Found SuiteSparse_config library: "
|
||||
"${SUITESPARSE_CONFIG_LIBRARY}")
|
||||
@@ -421,7 +435,8 @@
|
||||
mark_as_advanced(SUITESPARSE_CONFIG_LIBRARY)
|
||||
|
||||
find_path(SUITESPARSE_CONFIG_INCLUDE_DIR NAMES SuiteSparse_config.h
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
message(STATUS "Found SuiteSparse_config header in: "
|
||||
"${SUITESPARSE_CONFIG_INCLUDE_DIR}")
|
||||
@@ -439,7 +454,8 @@
|
||||
# does not have librt).
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
|
||||
find_library(LIBRT_LIBRARY NAMES rt
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (LIBRT_LIBRARY)
|
||||
message(STATUS "Adding librt: ${LIBRT_LIBRARY} to "
|
||||
"SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
|
||||
@@ -458,7 +474,8 @@
|
||||
# UFconfig header which should be present in < v4 installs.
|
||||
set(SUITESPARSE_CONFIG_FOUND FALSE)
|
||||
find_path(UFCONFIG_INCLUDE_DIR NAMES UFconfig.h
|
||||
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${UFCONFIG_INCLUDE_DIR})
|
||||
message(STATUS "Found UFconfig header in: ${UFCONFIG_INCLUDE_DIR}")
|
||||
set(UFCONFIG_FOUND TRUE)
|
||||
@@ -549,7 +566,8 @@
|
||||
|
||||
# METIS (Optional dependency).
|
||||
find_library(METIS_LIBRARY NAMES metis
|
||||
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (EXISTS ${METIS_LIBRARY})
|
||||
message(STATUS "Found METIS library: ${METIS_LIBRARY}.")
|
||||
set(METIS_FOUND TRUE)
|
||||
--- a/cmake/FindCXSparse.cmake Mon Dec 05 18:42:48 2016
|
||||
+++ b/cmake/FindCXSparse.cmake Fri Jul 07 01:50:04 2017
|
||||
@@ -135,12 +135,16 @@
|
||||
/usr/local/homebrew/lib # Mac OS X.
|
||||
/opt/local/lib
|
||||
/usr/lib)
|
||||
+# Additional suffixes to try appending to each search path.
|
||||
+list(APPEND CXSPARSE_CHECK_PATH_SUFFIXES
|
||||
+ suitesparse) # Linux/Windows
|
||||
|
||||
# Search supplied hint directories first if supplied.
|
||||
find_path(CXSPARSE_INCLUDE_DIR
|
||||
NAMES cs.h
|
||||
- PATHS ${CXSPARSE_INCLUDE_DIR_HINTS}
|
||||
- ${CXSPARSE_CHECK_INCLUDE_DIRS})
|
||||
+ HINTS ${CXSPARSE_INCLUDE_DIR_HINTS}
|
||||
+ PATHS ${CXSPARSE_CHECK_INCLUDE_DIRS}
|
||||
+ PATH_SUFFIXES ${CXSPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (NOT CXSPARSE_INCLUDE_DIR OR
|
||||
NOT EXISTS ${CXSPARSE_INCLUDE_DIR})
|
||||
cxsparse_report_not_found(
|
||||
@@ -150,8 +154,9 @@
|
||||
NOT EXISTS ${CXSPARSE_INCLUDE_DIR})
|
||||
|
||||
find_library(CXSPARSE_LIBRARY NAMES cxsparse
|
||||
- PATHS ${CXSPARSE_LIBRARY_DIR_HINTS}
|
||||
- ${CXSPARSE_CHECK_LIBRARY_DIRS})
|
||||
+ HINTS ${CXSPARSE_LIBRARY_DIR_HINTS}
|
||||
+ PATHS ${CXSPARSE_CHECK_LIBRARY_DIRS}
|
||||
+ PATH_SUFFIXES ${CXSPARSE_CHECK_PATH_SUFFIXES})
|
||||
if (NOT CXSPARSE_LIBRARY OR
|
||||
NOT EXISTS ${CXSPARSE_LIBRARY})
|
||||
cxsparse_report_not_found(
|
@ -27,6 +27,15 @@ vcpkg_from_github(
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix-find-packages.patch
|
||||
)
|
||||
|
||||
# Ninja crash compiler with error:
|
||||
# "fatal error C1001: An internal error has occurred in the compiler. (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 255)"
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
@ -36,22 +45,8 @@ vcpkg_configure_cmake(
|
||||
-DCXSPARSE=ON
|
||||
-DEIGENSPARSE=ON
|
||||
-DSUITESPARSE=ON
|
||||
-DBLAS_LIBRARIES=${CURRENT_INSTALLED_DIR}/lib/openblas.lib
|
||||
-DCXSPARSE_INCLUDE_DIR=${SUITESPARSE_INCLUDE_DIR}
|
||||
-DCXSPARSE_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/libcxsparse.lib
|
||||
-DEIGEN_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/eigen3
|
||||
-DGFLAGS_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include
|
||||
-DGFLAGS_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/gflags.lib
|
||||
-DGLOG_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include
|
||||
-DGLOG_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/glog.lib
|
||||
-DLAPACK_LIBRARIES=${CURRENT_INSTALLED_DIR}/lib/lapack.lib
|
||||
-DMETIS_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/metis.lib
|
||||
-DSUITESPARSE_INCLUDE_DIR_HINTS=${CURRENT_INSTALLED_DIR}/include/suitesparse
|
||||
OPTIONS_RELEASE
|
||||
-DSUITESPARSE_LIBRARY_DIR_HINTS=${CURRENT_INSTALLED_DIR}/lib
|
||||
OPTIONS_DEBUG
|
||||
-DSUITESPARSEQR_LIBRARY=${CURRENT_INSTALLED_DIR}/debug/lib/libspqrd.lib
|
||||
-DSUITESPARSE_LIBRARY_DIR_HINTS=${CURRENT_INSTALLED_DIR}/debug/lib
|
||||
-DGFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION=OFF # TheiaSfm doesn't work well with this
|
||||
-DGLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION=OFF # TheiaSfm doesn't work well with this
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
@ -60,12 +55,15 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH "CMake")
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
#clean
|
||||
# Changes target search path
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake CERES_TARGETS)
|
||||
string(REPLACE "get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../"
|
||||
"get_filename_component(CURRENT_ROOT_INSTALL_DIR\n \${CERES_CURRENT_CONFIG_DIR}/../../" CERES_TARGETS "${CERES_TARGETS}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/ceres/CeresConfig.cmake "${CERES_TARGETS}")
|
||||
|
||||
# Clean
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/share/ceres/FindEigen.cmake)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/share/ceres/FindGflags.cmake)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/share/ceres/FindGlog.cmake)
|
||||
|
||||
# Handle copyright of suitesparse and metis
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/ceres)
|
||||
|
Loading…
x
Reference in New Issue
Block a user