add nativefiledialog and nanovdb (#410)
* add nfd * add nanovdb * fix nativefiledialog * fix objc again * add absent frameworkspull/411/head^2
parent
4db23ee526
commit
f874fe763a
2 changed files with 88 additions and 0 deletions
@ -0,0 +1,43 @@ |
||||
package("nanovdb") |
||||
|
||||
set_homepage("https://developer.nvidia.com/nanovdb") |
||||
set_description("Developed by NVIDIA, NanoVDB adds real-time rendering GPU support for OpenVDB.") |
||||
|
||||
add_urls("https://github.com/AcademySoftwareFoundation/openvdb.git") |
||||
add_versions("20201219", "9b79bb0dd66a442149083c8093deefcb03f881c3") |
||||
|
||||
add_deps("cmake") |
||||
add_deps("cuda", "optix", {system = true}) |
||||
add_deps("openvdb") |
||||
|
||||
on_load("windows", function (package) |
||||
package:add("defines", "_USE_MATH_DEFINES") |
||||
package:add("defines", "NOMINMAX") |
||||
end) |
||||
|
||||
on_install("macosx", "linux", "windows", function (package) |
||||
os.cd("nanovdb") |
||||
local configs = {"-DNANOVDB_BUILD_UNITTESTS=OFF", "-DNANOVDB_BUILD_EXAMPLES=OFF", "-DNANOVDB_BUILD_BENCHMARK=OFF", "-DOPENVDB_USE_STATIC_LIBS=ON", "-DBoost_USE_STATIC_LIBS=ON"} |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
local optix = package:dep("optix"):fetch() |
||||
table.insert(configs, "-DOptiX_ROOT=" .. path.directory(optix.sysincludedirs[1])) |
||||
if package:is_plat("windows") then |
||||
table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) |
||||
table.insert(configs, "-DCMAKE_CUDA_FLAGS_DEBUG=-Xcompiler /" .. package:config("vs_runtime")) |
||||
table.insert(configs, "-DCMAKE_CUDA_FLAGS_RELEASE=-Xcompiler /" .. package:config("vs_runtime")) |
||||
end |
||||
import("package.tools.cmake").install(package, configs) |
||||
os.mv(package:installdir("nanovdb"), package:installdir("include")) |
||||
package:addenv("PATH", "bin") |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
void test() { |
||||
nanovdb::GridBuilder<float> builder(0.0f); |
||||
auto acc = builder.getAccessor(); |
||||
acc.setValue(nanovdb::Coord(1, 2, 3), 1.0f); |
||||
} |
||||
]]}, {configs = {languages = "c++14"}, |
||||
includes = {"nanovdb/util/GridBuilder.h"}})) |
||||
end) |
@ -0,0 +1,45 @@ |
||||
package("nativefiledialog") |
||||
|
||||
set_homepage("https://github.com/mlabbe/nativefiledialog") |
||||
set_description("A tiny, neat C library that portably invokes native file open and save dialogs.") |
||||
set_license("zlib") |
||||
|
||||
add_urls("https://github.com/mlabbe/nativefiledialog/archive/refs/tags/release_$(version).tar.gz", {version = function (version) return version:gsub("%.", "") end}) |
||||
add_urls("https://github.com/mlabbe/nativefiledialog.git") |
||||
add_versions("1.1.6", "1bbaed79b9c499c8d2a54f40f89277e721c0894bf3048bb247d826b96db6bc08") |
||||
|
||||
if is_plat("windows") then |
||||
add_syslinks("shell32", "ole32") |
||||
elseif is_plat("macosx") then |
||||
add_frameworks("AppKit") |
||||
end |
||||
on_install("windows", "macosx", "linux", function (package) |
||||
os.cd("src") |
||||
io.writefile("xmake.lua", [[ |
||||
add_rules("mode.debug", "mode.release") |
||||
target("nfd") |
||||
set_kind("static") |
||||
set_values("objc.build.arc", false) |
||||
add_includedirs("include") |
||||
add_files("nfd_common.c") |
||||
if is_plat("windows") then |
||||
add_defines("_CRT_SECURE_NO_WARNINGS") |
||||
add_files("nfd_win.cpp") |
||||
elseif is_plat("macosx") then |
||||
add_files("nfd_cocoa.m") |
||||
elseif is_plat("linux") then |
||||
add_files("nfd_zenity.c") |
||||
end |
||||
add_headerfiles("include/nfd.h") |
||||
]]) |
||||
import("package.tools.xmake").install(package) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_csnippets({test = [[ |
||||
void test() { |
||||
nfdchar_t *outPath = NULL; |
||||
nfdresult_t result = NFD_OpenDialog( NULL, NULL, &outPath ); |
||||
} |
||||
]]}, {includes = "nfd.h"})) |
||||
end) |
Loading…
Reference in new issue