diff --git a/packages/b/bullet3/xmake.lua b/packages/b/bullet3/xmake.lua index ad6eec5d1..289154729 100644 --- a/packages/b/bullet3/xmake.lua +++ b/packages/b/bullet3/xmake.lua @@ -14,14 +14,14 @@ package("bullet3") add_configs("extras", { description = "Build the extras", default = false, type = "boolean"}) add_deps("cmake") + if is_plat("windows") then + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) + end add_links("Bullet2FileLoader", "Bullet3Collision", "Bullet3Common", "Bullet3Dynamics", "Bullet3Geometry", "Bullet3OpenCL_clew", "BulletDynamics", "BulletCollision", "BulletInverseDynamics", "BulletSoftBody", "LinearMath") add_includedirs("include", "include/bullet") on_install("macosx", "linux", "windows", function (package) - if package:is_plat("windows") and package:config("shared") then - raise("shared library is not available on windows.") - end local configs = {"-DBUILD_CPU_DEMOS=OFF", "-DBUILD_OPENGL3_DEMOS=OFF", "-DBUILD_BULLET2_DEMOS=OFF", "-DBUILD_UNIT_TESTS=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")) diff --git a/packages/l/libargon2/xmake.lua b/packages/l/libargon2/xmake.lua new file mode 100644 index 000000000..43a8dfb72 --- /dev/null +++ b/packages/l/libargon2/xmake.lua @@ -0,0 +1,40 @@ +package("libargon2") + + set_homepage("https://github.com/P-H-C/phc-winner-argon2") + set_description("The password hash Argon2, winner of PHC") + + add_urls("https://github.com/P-H-C/phc-winner-argon2/archive/refs/tags/$(version).zip", + "https://github.com/P-H-C/phc-winner-argon2.git") + add_versions("20190702", "506a80b90ac3ca8407636f3b26b7fed87a55f2f1275cde850cd6698903c4f008") + + if is_plat("linux") then + add_syslinks("pthread") + end + on_install("windows", "macosx", "linux", "mingw", function (package) + if not package:config("shared") then + io.replace("include/argon2.h", "__declspec(dllexport)", "", {plain = true}) + end + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + target("argon2") + set_kind("$(kind)") + add_files("src/core.c", "src/argon2.c", "src/thread.c", "src/encoding.c", "src/blake2/blake2b.c", "src/opt.c") + add_includedirs("include", "src") + add_headerfiles("include/argon2.h") + if not is_plat("windows") then + add_defines("A2_VISCTL") + add_cflags("-march=native") + end + if is_plat("linux") then + add_syslinks("pthread") + end + ]]) + import("package.tools.xmake").install(package) + if package:config("shared") then + io.replace(path.join(package:installdir("include"), "argon2.h"), "__declspec(dllexport)", "__declspec(dllimport)", {plain = true}) + end + end) + + on_test(function (package) + assert(package:has_cfuncs("argon2_error_message", {includes = "argon2.h"})) + end) diff --git a/packages/l/libiconv/xmake.lua b/packages/l/libiconv/xmake.lua index 6815aca23..42b85f9e9 100644 --- a/packages/l/libiconv/xmake.lua +++ b/packages/l/libiconv/xmake.lua @@ -35,7 +35,7 @@ package("libiconv") }) end) - on_install("macosx", "linux", "android", function (package) + on_install("macosx", "linux", "android", "mingw@msys", function (package) local configs = {"--disable-dependency-tracking", "--enable-extra-encodings"} if not package:is_plat("macosx") then table.insert(configs, "--enable-relocatable") diff --git a/packages/l/libsndfile/xmake.lua b/packages/l/libsndfile/xmake.lua index 934e34a74..6a9c11a95 100644 --- a/packages/l/libsndfile/xmake.lua +++ b/packages/l/libsndfile/xmake.lua @@ -4,13 +4,19 @@ package("libsndfile") set_description("A C library for reading and writing sound files containing sampled audio data.") set_license("LGPL-2.1") - set_urls("https://github.com/libsndfile/libsndfile/archive/v$(version).tar.gz", + add_urls("https://github.com/libsndfile/libsndfile/archive/$(version).tar.gz", "https://github.com/libsndfile/libsndfile.git") - - add_versions("1.0.30", "5942b963d1db3ed8ab1ffb85708322aa9637df76d9fe84e1dfe49a97a90e8f47") + add_versions("v1.0.30", "5942b963d1db3ed8ab1ffb85708322aa9637df76d9fe84e1dfe49a97a90e8f47") + add_versions("1.0.31", "a8cfb1c09ea6e90eff4ca87322d4168cdbe5035cb48717b40bf77e751cc02163") add_deps("cmake", "libflac", "libopus", "libvorbis", "libogg") + on_load("windows", "linux", "macosx", "iphoneos", "mingw", "android", function (package) + if package:config("shared") then + package:add("deps", "python 3.x", {kind = "binary"}) + end + end) + on_install("windows", "linux", "macosx", "iphoneos", "mingw", "android", function (package) local configs = {} table.insert(configs, "-DBUILD_PROGRAMS=OFF") @@ -27,18 +33,6 @@ package("libsndfile") cmake:write("add_definitions(-DFLAC__NO_DLL)\n") cmake:close() end - - -- it seems libsndfile expects CMAKE_MSVC_RUNTIME_LIBRARY - local vs_runtime = package:config("vs_runtime") - if vs_runtime == "MT" then - table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded") - elseif vs_runtime == "MTd" then - table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug") - elseif vs_runtime == "MD" then - table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL") - elseif vs_runtime == "MDd" then - table.insert(configs, "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL") - end end import("package.tools.cmake").install(package, configs) end) diff --git a/packages/o/openblas/xmake.lua b/packages/o/openblas/xmake.lua index c94f2d479..16a2a427c 100644 --- a/packages/o/openblas/xmake.lua +++ b/packages/o/openblas/xmake.lua @@ -10,10 +10,12 @@ package("openblas") add_versions("0.3.13", "85cacd71dec9bc1e1168a8463fd0aa29a31f449b4583ed3a1c689a56df8eae29") add_versions("0.3.15", "afc029572a84820596fe81f1faeb909ada5bab27d091285fdd80bc2a8231f4a6") add_versions("0.3.17", "85b650e6519371b80c1fc10cbaa74af671df9215a53c5d11c64e758396f030ef") + add_versions("0.3.18", "767757039c354b6625c497a856c362546c1b1e7400278ffb40e3b9bf731f3b27") elseif is_arch("x86") then add_urls("https://github.com/xianyi/OpenBLAS/releases/download/v$(version)/OpenBLAS-$(version)-x86.zip") add_versions("0.3.15", "bcde933737b477813eaac290de5cb8756d3b42199e8ef5f44b23ae5f06fe0834") add_versions("0.3.17", "8258a9a22075280fb02b65447ea77d9439a0097711e220fc4ae8f92927f32273") + add_versions("0.3.18", "c24ecd6e5f561de3861bf714b35e0957a27ee0e03ab4d2867d08377892daf66e") end add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true}) @@ -23,6 +25,7 @@ package("openblas") add_versions("0.3.13", "79197543b17cc314b7e43f7a33148c308b0807cd6381ee77f77e15acf3e6459e") add_versions("0.3.15", "30a99dec977594b387a17f49904523e6bc8dd88bd247266e83485803759e4bbe") add_versions("0.3.17", "df2934fa33d04fd84d839ca698280df55c690c86a5a1133b3f7266fce1de279f") + add_versions("0.3.18", "1632c1e8cca62d8bed064b37747e331a1796fc46f688626337362bf0d16aeadb") add_configs("with_fortran", {description="Compile with fortran enabled.", default = is_plat("linux"), type = "boolean"}) end diff --git a/packages/s/suitesparse/patches/5.10.1/msvc.patch b/packages/s/suitesparse/patches/5.10.1/msvc.patch new file mode 100644 index 000000000..fb93fb1ee --- /dev/null +++ b/packages/s/suitesparse/patches/5.10.1/msvc.patch @@ -0,0 +1,52 @@ +diff --git a/GPUQREngine/Include/GPUQREngine_BucketList.hpp b/GPUQREngine/Include/GPUQREngine_BucketList.hpp +index f37e3ecf..6f141a99 100644 +--- a/GPUQREngine/Include/GPUQREngine_BucketList.hpp ++++ b/GPUQREngine/Include/GPUQREngine_BucketList.hpp +@@ -62,7 +62,7 @@ public: + int VThead; // Index of the first available entry in VTlist + + // Constructors +- void *operator new(long unsigned int, BucketList* p) ++ void *operator new(size_t, BucketList* p) + { + return p; + } +diff --git a/GPUQREngine/Include/GPUQREngine_Front.hpp b/GPUQREngine/Include/GPUQREngine_Front.hpp +index 02d4208b..8517b2c2 100644 +--- a/GPUQREngine/Include/GPUQREngine_Front.hpp ++++ b/GPUQREngine/Include/GPUQREngine_Front.hpp +@@ -47,7 +47,7 @@ public: + /* Debug Fields */ + bool printMe; + +- void* operator new(long unsigned int reqMem, Front* ptr){ return ptr; } ++ void* operator new(size_t reqMem, Front* ptr){ return ptr; } + + Front( + Int fids_arg, // the front identifier +diff --git a/GPUQREngine/Include/GPUQREngine_LLBundle.hpp b/GPUQREngine/Include/GPUQREngine_LLBundle.hpp +index 93bd3212..fc347143 100644 +--- a/GPUQREngine/Include/GPUQREngine_LLBundle.hpp ++++ b/GPUQREngine/Include/GPUQREngine_LLBundle.hpp +@@ -68,7 +68,7 @@ public: + + TaskType CurrentTask; + +- void *operator new(long unsigned int, LLBundle* p){ return p; } ++ void *operator new(size_t, LLBundle* p){ return p; } + LLBundle(BucketList *buckets, Int panelSize, Int nativeBucket); + + // empty LLBundle constructor (currently used, kept for possible future use +diff --git a/GPUQREngine/Include/GPUQREngine_Scheduler.hpp b/GPUQREngine/Include/GPUQREngine_Scheduler.hpp +index aa3781d5..069b01a5 100644 +--- a/GPUQREngine/Include/GPUQREngine_Scheduler.hpp ++++ b/GPUQREngine/Include/GPUQREngine_Scheduler.hpp +@@ -90,7 +90,7 @@ public: + cudaStream_t memoryStreamD2H; + + /* Scheduler.cpp */ +- void *operator new(long unsigned int, Scheduler* p){ return p; } ++ void *operator new(size_t, Scheduler* p){ return p; } + Scheduler(Front *fronts, Int numFronts, size_t gpuMemorySize); + ~Scheduler(); + diff --git a/packages/s/suitesparse/port/xmake.lua b/packages/s/suitesparse/port/xmake.lua new file mode 100644 index 000000000..91fa29c3b --- /dev/null +++ b/packages/s/suitesparse/port/xmake.lua @@ -0,0 +1,189 @@ +set_project("SuiteSparse") +set_xmakever("2.5.6") +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."}) + +-- set dependencies +add_requires("metis") +add_requires(get_config("with_blas")) +if has_config("with_cuda") then + add_requires("cuda", {system = true, configs = {utils = {"cublas"}}}) + add_defines("GPU_BLAS") +end +if not has_config("complex") then + add_defines("NCOMPLEX") +end + +-- export config files for cmake +add_rules("utils.install.cmake_importfiles") + +-- export symbols for windows +if is_plat("windows") and is_kind("shared") then + add_rules("utils.symbols.export_all") +end + +-- rule for compiling source files with multiple definitions +rule("c.def_gen") + set_extensions(".c") + on_buildcmd_file(function (target, batchcmds, sourcefile, opt) + local prod_defs = {"none"} + + -- get defines from sourcefile + local fileconfig = target:fileconfig(sourcefile) + if fileconfig then + prod_defs = fileconfig.prod_defs + end + + local objectfile + for _, res in ipairs(prod_defs) do + local rootdir = path.join(target:autogendir(), "rules", "def_gen") + local filename = table.concat(table.join({path.basename(sourcefile)}, res), "_") .. ".c" + local sourcefile_cx = target:autogenfile(sourcefile, {rootdir = rootdir, filename = filename}) + + -- add objectfile + objectfile = target:objectfile(sourcefile_cx) + table.insert(target:objectfiles(), objectfile) + + -- add commands + if res ~= "none" then + batchcmds:show_progress(opt.progress, "${color.build.object}compiling.%s %s with define %s", get_config("mode"), sourcefile, res) + batchcmds:compile(sourcefile, objectfile, {configs = {defines = res}}) + else + batchcmds:show_progress(opt.progress, "${color.build.object}compiling.%s %s with no defines", get_config("mode"), sourcefile) + batchcmds:compile(sourcefile, objectfile) + end + end + + -- add deps + batchcmds:add_depfiles(sourcefile) + batchcmds:set_depmtime(os.mtime(objectfile)) + batchcmds:set_depcache(target:dependfile(objectfile)) + end) +rule_end() + +add_rules("c.def_gen", {override = true}) + +target("SuiteSparse_config") + set_kind("$(kind)") + add_files("SuiteSparse_config/SuiteSparse_config.c") + add_headerfiles("SuiteSparse_config/SuiteSparse_config.h") + add_includedirs("SuiteSparse_config", {public = true}) +target_end() + +for _, libname in ipairs({"AMD", "BTF", "CAMD", "CCOLAMD", "COLAMD"}) do +target(libname) + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_files(libname .. "/Source/*.c", {prod_defs = {"none", "DLONG"}}) + add_includedirs(libname .. "/Include", {public = true}) + add_headerfiles(libname .. "/Include/*.h") +target_end() +end + +target("CHOLMOD") + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_deps("AMD", "CAMD", "COLAMD", "CCOLAMD") + for _, module in ipairs({"Core", "Check", "Cholesky", "MatrixOps", "Partition", "Modify", "Supernodal"}) do + add_files("CHOLMOD/" .. module .. "/cholmod*.c", {prod_defs = {"none", "DLONG"}}) + end + add_includedirs("CHOLMOD/Include", {public = true}) + add_headerfiles("CHOLMOD/Include/*.h") + add_packages("metis") + add_packages(get_config("with_blas")) + if has_config("with_cuda") then + add_files("CHOLMOD/GPU/cholmod*.cu") + add_files("CHOLMOD/GPU/cholmod*.c", {prod_defs = {"none", "DLONG"}}) + add_packages("cuda", {public = true}) + end +target_end() + +target("CXSparse") + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_files("CXSparse/Source/*.c|cs_convert.c", {prod_defs = {"none", "CS_LONG"}}) + add_includedirs("CXSparse/Include", {public = true}) + add_headerfiles("CXSparse/Include/*.h") +target_end() + +target("KLU") + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_deps("AMD", "COLAMD", "BTF") + add_files("KLU/Source/*.c", {prod_defs = {"none", "DLONG"}}) + add_includedirs("KLU/Include", {public = true}) + add_headerfiles("KLU/Include/*.h") +target_end() + +target("LDL") + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_files("LDL/Source/*.c", {prod_defs = {"none", "LDL_LONG"}}) + add_includedirs("LDL/Include", {public = true}) + add_headerfiles("LDL/Include/*.h") +target_end() + +target("UMFPACK") + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_deps("AMD", "CHOLMOD") + add_files("UMFPACK/Source/umfpack_timer.c", "UMFPACK/Source/umfpack_tictoc.c") + local doubledefs = {"umf_analyze.c", "umf_apply_order.c", "umf_cholmod.c", "umf_colamd.c", "umf_free.c", "umf_fsize.c", "umf_is_permutation.c", "umf_malloc.c", "umf_realloc.c", "umf_report_perm.c", "umf_singletons.c"} + for _, file in ipairs(doubledefs) do + add_files("UMFPACK/Source/" .. file, {prod_defs = {"DINT", "DLONG"}}) + end + add_files("UMFPACK/Source/*.c|umfpack_timer.c|umfpack_tictoc.c|" .. table.concat(doubledefs, "|"), {prod_defs = {"DINT", "DLONG", "ZINT", "ZLONG"}}) + add_includedirs("UMFPACK/Include", {public = true}) + add_headerfiles("UMFPACK/Include/*.h") + add_packages(get_config("with_blas"), "metis") +target_end() + +target("SPQR") + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_deps("CHOLMOD") + add_files("SPQR/Source/*.cpp") + add_includedirs("SPQR/Include", {public = true}) + add_headerfiles("SPQR/Include/*.h", "SPQR/Include/*.hpp") + add_packages(get_config("with_blas"), "metis") + if has_config("with_cuda") then + add_deps("GPUQREngine") + add_packages("cuda") + add_files("SPQR/SPQRGPU/*.cpp") + end +target_end() + +if has_config("graphblas") then +target("GraphBLAS") + set_kind("$(kind)") + add_files("GraphBLAS/Source/*.c", "GraphBLAS/Source/Generated/*.c") + add_includedirs("GraphBLAS/Include", "GraphBLAS/Source", "GraphBLAS/Source/Template", "GraphBLAS/Source/Generated") + add_headerfiles("GraphBLAS/Include/*.h") +target_end() +end + +if has_config("with_cuda") then +target("SuiteSparse_GPURuntime") + set_kind("$(kind)") + add_deps("SuiteSparse_config") + add_packages("cuda") + add_files("SuiteSparse_GPURuntime/Source/*.cpp") + add_includedirs("SuiteSparse_GPURuntime/Include", {public = true}) + add_headerfiles("SuiteSparse_GPURuntime/Include/*.hpp") +target_end() + +target("GPUQREngine") + set_kind("$(kind)") + add_deps("SuiteSparse_config", "SuiteSparse_GPURuntime") + add_files("GPUQREngine/Source/**.cpp", "GPUQREngine/Source/*.cu") + add_includedirs("GPUQREngine/Include", {public = true}) + add_headerfiles("GPUQREngine/Include/(**.hpp)", "GPUQREngine/Include/(**.cu)") +target_end() +end diff --git a/packages/s/suitesparse/xmake.lua b/packages/s/suitesparse/xmake.lua new file mode 100644 index 000000000..fd26d37d8 --- /dev/null +++ b/packages/s/suitesparse/xmake.lua @@ -0,0 +1,46 @@ +package("suitesparse") + + set_homepage("https://people.engr.tamu.edu/davis/suitesparse.html") + set_description("SuiteSparse is a suite of sparse matrix algorithms") + + add_urls("https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/$(version).tar.gz", + "https://github.com/DrTimothyAldenDavis/SuiteSparse.git") + add_versions("v5.10.1", "acb4d1045f48a237e70294b950153e48dce5b5f9ca8190e86c2b8c54ce00a7ee") + + add_patches("v5.10.1", path.join(os.scriptdir(), "patches", "5.10.1", "msvc.patch"), "8ac61e9acfaa864a2528a14d3a7e6e86f6e6877de2fe93fdc87876737af5bf31") + + 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"}}) + add_configs("graphblas", {description = "Enable GraphBLAS module.", default = false, type = "boolean"}) + + add_deps("metis") + if is_plat("linux") then + add_syslinks("m", "rt") + end + on_load("windows", "macosx", "linux", function (package) + 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("graphblas") then + package:add("links", "GraphBLAS") + end + package:add("deps", package:config("blas")) + for _, lib in ipairs({"SPQR", "UMFPACK", "LDL", "KLU", "CXSparse", "CHOLMOD", "COLAMD", "CCOLAMD", "CAMD", "BTF", "AMD", "SuiteSparse_config"}) do + package:add("links", lib) + end + end) + + on_install("windows", "macosx", "linux", function (package) + os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") + local configs = {} + configs.with_blas = package:config("blas") + configs.with_cuda = package:config("cuda") + configs.graphblas = package:config("graphblas") + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("SuiteSparse_start", {includes = "SuiteSparse_config.h"})) + end)