enable x86 suitesparse & ceres-solver (#3154)

* enable x86 suitesparse

* enable x86 ceres-solver
pull/3146/head^2
Hoildkv 1 year ago committed by GitHub
parent 724b6f8a5d
commit d3d3f4bb54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/c/ceres-solver/xmake.lua
  2. 11
      packages/s/suitesparse/port/xmake.lua
  3. 29
      packages/s/suitesparse/xmake.lua

@ -20,7 +20,7 @@ package("ceres-solver")
end
end)
on_install("windows|x64", "linux", "macosx", function (package)
on_install("windows|x64", "windows|x86", "linux", "macosx", function (package)
local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOCUMENTATION=OFF", "-DBUILD_EXAMPLES=OFF", "-DBUILD_BENCHMARKS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))

@ -5,10 +5,11 @@ set_languages("cxx14")
add_rules("mode.debug", "mode.release")
-- initialize options
option("with_cuda", {default = false, showmenu = true, description = "Build with CUDA support."})
option("with_blas", {default = "mkl", showmenu = true, description = "Choose BLAS vendor.", values={"mkl", "openblas"}})
option("complex", {default = false, showmenu = true, description = "Build with complex number support."})
option("graphblas", {default = false, showmenu = true, description = "Build GraphBLAS module."})
option("with_cuda", {default = false, showmenu = true, description = "Build with CUDA support."})
option("with_blas", {default = "mkl", showmenu = true, description = "Choose BLAS vendor.", values={"mkl", "openblas"}})
option("complex", {default = false, showmenu = true, description = "Build with complex number support."})
option("graphblas", {default = false, showmenu = true, description = "Build GraphBLAS module."})
option("graphblas_static", {default = false, showmenu = true, description = "Build static GraphBLAS module."})
-- set dependencies
add_requires("metis")
@ -161,6 +162,7 @@ target("SPQR")
target_end()
if has_config("graphblas") then
if has_config("graphblas_static") then
target("GraphBLAS")
set_kind("static")
add_files("GraphBLAS/Source/*.c", "GraphBLAS/Source/Generated/*.c")
@ -175,6 +177,7 @@ target("GraphBLAS")
add_headerfiles("GraphBLAS/Include/*.h")
target_end()
end
end
if has_config("with_cuda") then
target("SuiteSparse_GPURuntime")

@ -16,7 +16,8 @@ package("suitesparse")
add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"})
add_configs("blas", {description = "Set BLAS vendor.", default = "openblas", type = "string", values = {"mkl", "openblas", "apple"}})
add_configs("blas_static", {description = "Use static BLAS library.", default = true, type = "boolean"})
add_configs("graphblas", {description = "Enable static GraphBLAS module.", default = false, type = "boolean"})
add_configs("graphblas", {description = "Enable GraphBLAS module.", default = not is_arch("x86"), type = "boolean"})
add_configs("graphblas_static", {description = "Enable static GraphBLAS module.", default = false, type = "boolean"})
add_deps("metis")
if not is_plat("windows") then
@ -32,11 +33,6 @@ package("suitesparse")
if package:config("openmp") then
package:add("deps", "openmp")
end
if package:config("cuda") then
package:add("deps", "cuda", {system = true, configs = {utils = {"cublas"}}})
package:add("links", "GPUQREngine")
package:add("links", "SuiteSparse_GPURuntime")
end
if package:config("blas") == "apple" then
package:add("frameworks", "Accelerate")
else
@ -46,31 +42,43 @@ package("suitesparse")
local suffix = ""
if package:is_plat("windows") and not package:config("shared") then
suffix = "_static"
if package:config("graphblas") then
package:add("links", "graphblas" .. (package:config("graphblas_static") and "_static" or ""))
end
end
for _, lib in ipairs({"lagraphx", "lagraph", "graphblas", "spex", "spqr", "rbio", "ParU", "umfpack", "ldl", "klu", "klu_cholmod", "cxsparse", "cholmod", "colamd", "ccolamd", "camd", "btf", "amd", "suitesparse_mongoose", "suitesparseconfig"}) do
package:add("links", lib .. suffix)
end
else
if package:config("cuda") then
package:add("deps", "cuda", {system = true, configs = {utils = {"cublas"}}})
package:add("links", "GPUQREngine")
package:add("links", "SuiteSparse_GPURuntime")
end
for _, lib in ipairs({"SPQR", "UMFPACK", "LDL", "KLU", "CXSparse", "CHOLMOD", "COLAMD", "CCOLAMD", "CAMD", "BTF", "AMD", "suitesparseconfig"}) do
package:add("links", lib)
end
end
end)
on_install("windows|x64", "macosx", "linux", function (package)
on_install("windows|x64", "windows|x86", "macosx", "linux", function (package)
if package:version():ge("7.4.0") then
local configs = {"-DSUITESPARSE_DEMOS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DGRAPHBLAS_BUILD_STATIC_LIBS=" .. (package:config("graphblas") and "ON" or "OFF"))
table.insert(configs, "-DGRAPHBLAS_BUILD_STATIC_LIBS=" .. (package:config("graphblas_static") and "ON" or "OFF"))
table.insert(configs, "-DSUITESPARSE_USE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
table.insert(configs, "-DSUITESPARSE_USE_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
local bla_vendor = {mkl = "Intel10_64lp", openblas = "OpenBLAS", apple = "Apple"}
table.insert(configs, "-DBLA_VENDOR=" .. bla_vendor[package:config("blas")])
table.insert(configs, "-DBLA_STATIC=" .. (package:config("blas_static") and "ON" or "OFF"))
if package:is_plat("windows") then
table.insert(configs, "-DSUITESPARSE_ENABLE_PROJECTS=suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr;graphblas;lagraph") -- remove spex since it does not support windows
if package:config("graphblas") then
table.insert(configs, "-DSUITESPARSE_ENABLE_PROJECTS=suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr;graphblas;lagraph") -- remove spex since it does not support windows
else
table.insert(configs, "-DSUITESPARSE_ENABLE_PROJECTS=suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr")
end
local vs_sdkver = import("core.tool.toolchain").load("msvc"):config("vs_sdkver")
if vs_sdkver then
local build_ver = string.match(vs_sdkver, "%d+%.%d+%.(%d+)%.?%d*")
@ -78,6 +86,8 @@ package("suitesparse")
table.insert(configs, "-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=" .. vs_sdkver)
table.insert(configs, "-DCMAKE_SYSTEM_VERSION=" .. vs_sdkver)
end
elseif not package:config("graphblas") then
table.insert(configs, "-DSUITESPARSE_ENABLE_PROJECTS=suitesparse_config;mongoose;amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack;paru;rbio;spqr;spex")
end
import("package.tools.cmake").install(package, configs)
else
@ -86,6 +96,7 @@ package("suitesparse")
configs.with_blas = package:config("blas")
configs.with_cuda = package:config("cuda")
configs.graphblas = package:config("graphblas")
configs.graphblas_static = package:config("graphblas_static")
import("package.tools.xmake").install(package, configs)
end
end)

Loading…
Cancel
Save