]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/ports/suitesparse/build_fixes.patch
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / tools / vcpkg / ports / suitesparse / build_fixes.patch
CommitLineData
1e59de90
TL
1diff --git a/CMakeLists.txt b/CMakeLists.txt
2index 9602cce..dafb434 100644
3--- a/CMakeLists.txt
4+++ b/CMakeLists.txt
5@@ -5,14 +5,6 @@
6 # Updated by jesnault (jerome.esnault@inria.fr) 2014-01-21
7 # -----------------------------------------------------------------
8
9-option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
10-include(cmake/HunterGate.cmake)
11-
12-HunterGate(
13- URL "https://github.com/ruslo/hunter/archive/v0.23.214.tar.gz"
14- SHA1 "e14bc153a7f16d6a5eeec845fb0283c8fad8c358"
15-)
16-
17 PROJECT(SuiteSparseProject)
18
19 cmake_minimum_required(VERSION 3.1)
20@@ -47,29 +39,9 @@ else()
21 message(STATUS "Using user defined CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
22 endif()
23
24-# Fix GKlib path:
25-IF(NOT WIN32)
26- SET(GKLIB_PATH "${${PROJECT_NAME}_SOURCE_DIR}/SuiteSparse/metis-5.1.0/GKlib" CACHE INTERNAL "Path to GKlib (for METIS)" FORCE)
27-ENDIF()
28-
29-# allow creating DLLs in Windows without touching the source code:
30-IF(NOT ${CMAKE_VERSION} VERSION_LESS "3.4.0" AND WIN32)
31- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
32-ENDIF()
33-
34 ## get CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBDIR
35 include(GNUInstallDirs)
36
37-if(CMAKE_SIZEOF_VOID_P MATCHES "8")
38- set(SUITESPARSE_LIB_POSTFIX "64")
39-else()
40- set(SUITESPARSE_LIB_POSTFIX "")
41-endif()
42-
43-## get POSTFIX for lib install dir
44-set(LIB_POSTFIX "${SUITESPARSE_LIB_POSTFIX}" CACHE STRING "suffix for 32/64 inst dir placement")
45-mark_as_advanced(LIB_POSTFIX)
46-
47 # We want libraries to be named "libXXX" and "libXXXd" in all compilers:
48 # ------------------------------------------------------------------------
49 set(CMAKE_DEBUG_POSTFIX "d")
50@@ -77,59 +49,6 @@ IF(MSVC)
51 set(SP_LIB_PREFIX "lib") # Libs are: "libXXX"
52 ENDIF(MSVC)
53
54-## check if we can build metis
55-SET(BUILD_METIS_DEFAULT ON)
56-if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/SuiteSparse/metis-5.1.0/CMakeLists.txt")
57- SET(BUILD_METIS_DEFAULT OFF)
58-endif()
59-
60-SET(WITH_CUDA OFF CACHE BOOL "Build with CUDA support")
61-
62-SET(BUILD_METIS ${BUILD_METIS_DEFAULT} CACHE BOOL "Build METIS for partitioning?")
63-SET(METIS_DIR ${${PROJECT_NAME}_SOURCE_DIR}/SuiteSparse/metis-5.1.0 CACHE PATH "Source directory of METIS")
64-
65-if(BUILD_METIS)
66- ## prepare the installation :
67- ## using metis target here is not possible because this target is added in another branch of the CMake structure
68- ## TRICK: need to dynamically modify the metis CMakeLists.txt file before it going to parsed...
69- ## (very ugly/poor for a metis project get from SCM (git/svn/cvs) but it's works ;) and it doesn't matter if metis was get from .zip)
70- if(EXISTS "${METIS_DIR}/libmetis/CMakeLists.txt")
71- file(READ "${METIS_DIR}/libmetis/CMakeLists.txt" contentFile)
72- string(REGEX MATCH "EXPORT SuiteSparseTargets" alreadyModified ${contentFile}) ## use a string pattern to check if we have to do the modif
73- if(NOT alreadyModified)
74- file(APPEND "${METIS_DIR}/libmetis/CMakeLists.txt"
75- "
76- set_target_properties(metis PROPERTIES PUBLIC_HEADER \"../include/metis.h\")
77- install(TARGETS metis ## this line is also the string pattern to check if the modification had already done
78- EXPORT SuiteSparseTargets
79- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
80- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
81- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
82- PUBLIC_HEADER DESTINATION include
83- )
84- "
85- )
86- endif()
87- endif()
88- add_subdirectory(SuiteSparse/metis-5.1.0) ## important part for building metis from its src files
89-endif(BUILD_METIS)
90-
91-
92-## For EXPORT only :
93-## Previous version of cmake (>2.8.12) doesn't auto take into account external lib (here I mean blas and lapack) we need to link to for our current target we want to export.
94-## Or at least we need to investigate how to do with previous version.
95-## This may cause some trouble in case you want to build in static mode and then use it into another custom project.
96-## You will need to manually link your target into your custom project to the correct dependencies link interfaces.
97-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" GREATER 2.8.11) ## (policies introduced both in 2.8.12)
98- set(EXPORT_USE_INTERFACE_LINK_LIBRARIES ON CACHE BOOL "")
99- mark_as_advanced(EXPORT_USE_INTERFACE_LINK_LIBRARIES)
100- if(EXPORT_USE_INTERFACE_LINK_LIBRARIES)
101- cmake_policy(SET CMP0023 NEW) ## just for respecting the new target_link_libraries(...) signature procedure
102- cmake_policy(SET CMP0022 NEW) ## use INTERFACE_LINK_LIBRARIES property for in-build targets and ignore old properties (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?
103- ## Here, next version of cmake 2.8.12 auto take into account the link interface dependencies (see generated cmake/SuiteSparse-config*.cmake into your install dir)
104- endif()
105-endif()
106-
107 ## install_suitesparse_project(targetName headersList)
108 ## factorise the way we will install all projects (part of the suitesparse project)
109 ## <targetName> is the target of the current project you build
110@@ -176,16 +95,16 @@ macro(declare_suitesparse_library targetName srcsList headersList)
111 set(dsl_TARGET_PUBLIC_LINK "")
112 endif()
113 if(WITH_CUDA)
114- find_package(CUDA)
115+ find_package(CUDA REQUIRED)
116 endif()
117- IF(${CUDA_FOUND})
118+ IF(CUDA_FOUND)
119 INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS})
120 INCLUDE_DIRECTORIES(${SuiteSparse_GPUQREngine_INCLUDE})
121 INCLUDE_DIRECTORIES(${SuiteSparse_GPURuntime_INCLUDE})
122 CUDA_ADD_LIBRARY(${targetName} ${srcsList} ${headersList})
123- ELSE(${CUDA_FOUND})
124+ ELSE()
125 ADD_LIBRARY(${targetName} ${srcsList} ${headersList})
126- ENDIF(${CUDA_FOUND})
127+ ENDIF()
128 SET_TARGET_PROPERTIES(${targetName} PROPERTIES
129 OUTPUT_NAME ${SP_LIB_PREFIX}${targetName}
130 )
131@@ -211,44 +130,30 @@ MACRO(REMOVE_MATCHING_FILES_FROM_LIST match_expr lst_files)
132 ENDMACRO(REMOVE_MATCHING_FILES_FROM_LIST)
133
134 if(WITH_CUDA)
135- FIND_PACKAGE(cuda)
136- IF(${CUDA_FOUND})
137+ FIND_PACKAGE(CUDA REQUIRED)
138+ IF(CUDA_FOUND)
139 ADD_DEFINITIONS(-DGPU_BLAS)
140- ENDIF(${CUDA_FOUND})
141+ ENDIF()
142 endif()
143
144-hunter_add_package(LAPACK) # only in effect if HUNTER_ENABLED is set
145-# prefer LAPACK config file
146-find_package(LAPACK CONFIG)
147-if (LAPACK_FOUND AND TARGET blas AND TARGET lapack)
148- message(STATUS "found lapack and blas config file. Linking targets lapack and blas")
149- message(STATUS "- LAPACK_CONFIG: ${LAPACK_CONFIG}")
150- set(SuiteSparse_LINKER_LAPACK_BLAS_LIBS lapack blas)
151- # for suitesparse-config file set method used to find LAPACK (and BLAS)
152- set(SuiteSparse_LAPACK_used_CONFIG YES)
153-else()
154- # missing config file or targets, try BLAS and LAPACK
155- find_package(BLAS)
156- find_package(LAPACK)
157- if (BLAS_FOUND AND LAPACK_FOUND)
158+ find_package(BLAS REQUIRED)
159+ find_package(LAPACK REQUIRED)
160 message(STATUS "found lapack and blas config file. Linking targets lapack and blas")
161 message(STATUS "- LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}")
162 message(STATUS "- BLAS_LIBRARIES: ${BLAS_LIBRARIES}")
163 set(SuiteSparse_LINKER_LAPACK_BLAS_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
164 # for suitesparse-config file set method used to find LAPACK (and BLAS)
165 set(SuiteSparse_LAPACK_used_CONFIG NO)
166- else () # LAPACK is not found
167- message(FATAL_ERROR "lapack not found")
168- endif()
169-endif()
170
171-IF(BUILD_METIS)
172+IF(USE_VCPKG_METIS)
173+ find_package(metis REQUIRED)
174 set(SuiteSparse_LINKER_METIS_LIBS "metis")
175- ## namespaced library target for config
176- set(SuiteSparse_EXPORTED_METIS_LIBS "SuiteSparse::metis")
177+ set(SuiteSparse_EXPORTED_METIS_LIBS "metis")
178+ set(SuiteSparse_FIND_DEPENDENCY_METIS "find_dependency(metis REQUIRED)")
179 else()
180 set(SuiteSparse_LINKER_METIS_LIBS "")
181 set(SuiteSparse_EXPORTED_METIS_LIBS "")
182+ set(SuiteSparse_FIND_PACKAGE_METIS "")
183 ENDIF()
184
185 add_subdirectory(SuiteSparse)
186@@ -287,7 +192,7 @@ endmacro()
187 # get SuiteSparse version
188 get_SuiteSparse_Version()
189
190-set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/suitesparse-${SuiteSparse_VERSION})
191+set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/suitesparse)
192 ## create targets file
193 export(EXPORT SuiteSparseTargets
194 FILE "${CMAKE_CURRENT_BINARY_DIR}/suitesparse/suitesparse-targets.cmake"
195@@ -301,7 +206,7 @@ configure_file(cmake/SuiteSparse-config-install.cmake.in
196 ## do the EXPORT for allowing other project to easily use suitesparse with cmake
197 install(EXPORT SuiteSparseTargets
198 FILE
199- SuiteSparse-targets.cmake
200+ suitesparse-targets.cmake
201 NAMESPACE
202 SuiteSparse::
203 DESTINATION
204diff --git a/SuiteSparse/CMakeLists.txt b/SuiteSparse/CMakeLists.txt
205index c6e2834..6fdfb01 100644
206--- a/SuiteSparse/CMakeLists.txt
207+++ b/SuiteSparse/CMakeLists.txt
208@@ -1,23 +1,5 @@
209 PROJECT(SuiteSparse)
210
211-# Set optimized building:
212-IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug")
213- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
214- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
215- # only optimize for native processer when NOT cross compiling
216- if(NOT CMAKE_CROSSCOMPILING)
217- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=native")
218- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=native")
219- endif(NOT CMAKE_CROSSCOMPILING)
220-ENDIF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_BUILD_TYPE MATCHES "Debug")
221-
222-# Global flags:
223-IF (BUILD_METIS)
224- INCLUDE_DIRECTORIES("${METIS_SOURCE_DIR}/include")
225-ELSE (BUILD_METIS)
226- ADD_DEFINITIONS(-DNPARTITION)
227-ENDIF ( BUILD_METIS)
228-
229 # Disable COMPLEX numbers: disable it by default, since it causes problems in some platforms.
230 SET(HAVE_COMPLEX OFF CACHE BOOL "Enables building SuiteSparse with complex numbers (disabled by default to avoid problems in some platforms)")
231 IF (NOT HAVE_COMPLEX)
232@@ -38,12 +20,12 @@ if(WITH_CUDA)
233 set(SUBPROJECTS_TO_ADD
234 ${SUBPROJECTS_TO_ADD}
235 SuiteSparse_GPURuntime
236- GPUQREngine
237+ GPUQREngine
238 )
239 endif()
240
241 set(SUBPROJECTS_TO_ADD
242- ${SUBPROJECTS_TO_ADD}
243+ ${SUBPROJECTS_TO_ADD}
244 SuiteSparse_config
245 AMD
246 BTF
247diff --git a/cmake/SuiteSparse-config-install.cmake.in b/cmake/SuiteSparse-config-install.cmake.in
248index 1e587d1..fd8f3a7 100644
249--- a/cmake/SuiteSparse-config-install.cmake.in
250+++ b/cmake/SuiteSparse-config-install.cmake.in
251@@ -2,20 +2,14 @@
252 get_filename_component(_SuiteSparse_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
253 get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_SELF_DIR}" PATH)
254 get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH)
255-get_filename_component(_SuiteSparse_PREFIX "${_SuiteSparse_PREFIX}" PATH)
256
257 include(CMakeFindDependencyMacro)
258-if (@SuiteSparse_LAPACK_used_CONFIG@) # SuiteSparse_LAPACK_used_CONFIG
259- # use config file which provides LAPACK (and BLAS) for us
260- find_dependency(LAPACK CONFIG)
261-else()
262- # try to find BLAS and LAPACK with modules
263 find_dependency(BLAS)
264 find_dependency(LAPACK)
265-endif ()
266+ @SuiteSparse_FIND_DEPENDENCY_METIS@
267
268 # Load targets from the install tree.
269-include(${_SuiteSparse_SELF_DIR}/SuiteSparse-targets.cmake)
270+include(${_SuiteSparse_SELF_DIR}/suitesparse-targets.cmake)
271
272 # Report SuiteSparse header search locations.
273 set(SuiteSparse_INCLUDE_DIRS ${_SuiteSparse_PREFIX}/include)
274@@ -39,3 +33,7 @@ set(SuiteSparse_LIBRARIES
275
276 unset(_SuiteSparse_PREFIX)
277 unset(_SuiteSparse_SELF_DIR)
278+set(SUITESPARSE_FOUND TRUE)
279+set(SuiteSparse_FOUND TRUE)
280+set(SUITESPARSE_LIBRARIES ${SuiteSparse_LIBRARIES})
281+set(SUITESPARSE_INCLUDE_DIRS ${SuiteSparse_INCLUDE_DIRS})