diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/magma | |
Diffstat (limited to 'vcpkg/ports/magma')
| -rw-r--r-- | vcpkg/ports/magma/clang-cuda.patch | 23 | ||||
| -rw-r--r-- | vcpkg/ports/magma/disable-openmp-msvc.patch | 15 | ||||
| -rw-r--r-- | vcpkg/ports/magma/fix-cmake4.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/magma/no-tests.patch | 40 | ||||
| -rw-r--r-- | vcpkg/ports/magma/portfile.cmake | 57 | ||||
| -rw-r--r-- | vcpkg/ports/magma/vcpkg.json | 16 |
6 files changed, 164 insertions, 0 deletions
diff --git a/vcpkg/ports/magma/clang-cuda.patch b/vcpkg/ports/magma/clang-cuda.patch new file mode 100644 index 0000000..2ff14ce --- /dev/null +++ b/vcpkg/ports/magma/clang-cuda.patch @@ -0,0 +1,23 @@ +diff --git a/control/magma_internal.h b/control/magma_internal.h +index 7af16a5..0133e44 100644 +--- a/control/magma_internal.h ++++ b/control/magma_internal.h +@@ -33,7 +33,7 @@ + // functions where Microsoft fails to provide C99 standard + // (only with Microsoft, not with nvcc on Windows) + // in both magma_internal.h and testings.h +- #ifndef __NVCC__ ++ #if !defined(__NVCC__) && !defined(__clang__) + + #include <float.h> + #define copysign(x,y) _copysign(x,y) +@@ -43,6 +43,9 @@ + // note _snprintf has slightly different semantics than snprintf + #define snprintf _snprintf + ++ #elif !defined(__NVCC__) ++ // make sure this actually uses the C version and not the C++ overloads ++ #define copysign(x,y) copysign((double)x,(double)y) + #endif + + #else diff --git a/vcpkg/ports/magma/disable-openmp-msvc.patch b/vcpkg/ports/magma/disable-openmp-msvc.patch new file mode 100644 index 0000000..b143995 --- /dev/null +++ b/vcpkg/ports/magma/disable-openmp-msvc.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 828911d05f..a4f5b35ef3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,6 +103,10 @@ endif() + + # ---------------------------------------- + # locate OpenMP ++if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ++ set(CMAKE_DISBLE_FIND_PACKAGE_OpenMP ON) ++ # MSVC OpenMP is not enough to compile ++endif() + find_package( OpenMP ) + if (OPENMP_FOUND) + message( STATUS "Found OpenMP" ) diff --git a/vcpkg/ports/magma/fix-cmake4.patch b/vcpkg/ports/magma/fix-cmake4.patch new file mode 100644 index 0000000..8c7e2e4 --- /dev/null +++ b/vcpkg/ports/magma/fix-cmake4.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index fc61af7..a3c9606 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -654,7 +654,7 @@ endif()
+
+
+ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SPARSE_TEST_DIR}" )
+-cmake_policy( SET CMP0037 OLD)
++cmake_policy( SET CMP0037 NEW)
+ foreach( TEST ${sparse_testing_all} )
+ string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} )
+ string( REGEX REPLACE "${SPARSE_TEST_DIR}/" "" EXE ${EXE} )
diff --git a/vcpkg/ports/magma/no-tests.patch b/vcpkg/ports/magma/no-tests.patch new file mode 100644 index 0000000..0807181 --- /dev/null +++ b/vcpkg/ports/magma/no-tests.patch @@ -0,0 +1,40 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a3c9606..a783c57 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -569,6 +569,7 @@ target_link_libraries( lapacktest
+
+ # ----------------------------------------
+ # compile tester library
++if(FALSE)
+ add_library( tester ${libtest_all} )
+ target_link_libraries( tester
+ magma
+@@ -576,8 +577,7 @@ target_link_libraries( tester
+ ${blas_fix}
+ ${LAPACK_LIBRARIES}
+ )
+-
+-
++endif()
+ # ----------------------------------------
+ # compile MAGMA sparse library
+
+@@ -619,7 +619,7 @@ add_custom_target( sparse-lib DEPENDS magma_sparse )
+
+ # ----------------------------------------
+ # compile each tester
+-
++if(FALSE)
+ # save testers to testing/
+ # save tester lib files to testing_lib/ to avoid cluttering lib/
+ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY testing )
+@@ -664,7 +664,7 @@ foreach( TEST ${sparse_testing_all} )
+ list( APPEND sparse-testing ${EXE} )
+ endforeach()
+ add_custom_target( sparse-testing DEPENDS ${sparse-testing} )
+-
++endif()
+
+ # ----------------------------------------
+ # what to install
diff --git a/vcpkg/ports/magma/portfile.cmake b/vcpkg/ports/magma/portfile.cmake new file mode 100644 index 0000000..80d6742 --- /dev/null +++ b/vcpkg/ports/magma/portfile.cmake @@ -0,0 +1,57 @@ + +set(opts "") +if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(opts + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS:BOOL=ON + -DCMAKE_CUDA_SEPARABLE_COMPILATION:BOOL=OFF + ) +endif() + +vcpkg_download_distfile( + dist_file + URLS https://icl.utk.edu/projectsfiles/magma/downloads/magma-${VERSION}.tar.gz + FILENAME magma-${VERSION}.tar.gz + SHA512 233beb3d2809c12a27a9b7a6a0eb0bec0ade91fa6bf1a63e1ca4d491491ed5a8729996ac8fbf68ab8d678acab6ed56b7728689358a7b76b20b101227a9851c16 +) + +vcpkg_extract_source_archive( + src_path + ARCHIVE "${dist_file}" + PATCHES + disable-openmp-msvc.patch + no-tests.patch + clang-cuda.patch + fix-cmake4.patch +) + +vcpkg_find_cuda(OUT_CUDA_TOOLKIT_ROOT cuda_toolkit_root) + +vcpkg_cmake_configure( + SOURCE_PATH "${src_path}" + OPTIONS + -DMAGMA_ENABLE_CUDA=ON + -DMAGMA_ENABLE_HIP=OFF # HIP is backend and seems additive?! + -DUSE_FORTRAN=OFF + "-DCMAKE_CUDA_COMPILER:FILEPATH=${NVCC}" + "-DCUDAToolkit_ROOT=${cuda_toolkit_root}" + ${opts} +) +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() + +file(READ "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/magma.pc" contents) +string(REGEX REPLACE "Cflags: [^\n]+" "Cflags: -I\${includedir}" contents "${contents}") +file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/magma.pc" "${contents}") + +if(NOT VCPKG_BUILD_TYPE) + file(READ "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/magma.pc" contents) + string(REGEX REPLACE "Cflags: [^\n]+" "Cflags: -I\${includedir}" contents "${contents}") + file(WRITE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/magma.pc" "${contents}") +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +vcpkg_install_copyright(FILE_LIST "${src_path}/COPYRIGHT") diff --git a/vcpkg/ports/magma/vcpkg.json b/vcpkg/ports/magma/vcpkg.json new file mode 100644 index 0000000..40d241c --- /dev/null +++ b/vcpkg/ports/magma/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "magma", + "version": "2.9.0", + "description": "Matrix Algebra on GPU and Multi-core Architectures (MAGMA) is a collection of next-generation linear algebra libraries for heterogeneous computing", + "homepage": "https://icl.utk.edu/magma/", + "license": "BSD-3-Clause", + "dependencies": [ + "blas", + "cuda", + "lapack", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |