-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63eb1ba
commit 12e08cf
Showing
8 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
target("lc-backend-cpu") | ||
_config_project({ | ||
project_kind = "shared" | ||
}) | ||
on_load(function(target) | ||
local function rela(p) | ||
return path.relative(path.absolute(p, os.scriptdir()), os.projectdir()) | ||
end | ||
target:add("defines", "LC_IR_EXPORT_DLL") | ||
target:add("deps", "lc-runtime", "lc-ir", "lc-ast", "lc-rust") | ||
target:set("features", "cpu") | ||
if is_plat("windows") then | ||
target:add("syslinks", "Ws2_32", "Advapi32", "Bcrypt", "Userenv") | ||
end | ||
local function add_rs_link(str) | ||
target:add("linkdirs", path.absolute(path.join("../../rust/target", str), os.scriptdir()), { | ||
public = true | ||
}) | ||
target:add("links", "luisa_compute_backend_impl.dll", { | ||
public = true | ||
}) | ||
end | ||
if is_mode("debug") then | ||
add_rs_link("debug") | ||
else | ||
add_rs_link("release") | ||
end | ||
end) | ||
before_build(function(target) | ||
local profile = nil | ||
if is_mode("debug") then | ||
profile = "debug" | ||
else | ||
profile = "release" | ||
end | ||
local lib_path = path.absolute(path.join("../../rust/target", profile), os.scriptdir()) | ||
os.setenv("EMBREE_DLL_OUT_DIR", lib_path) | ||
end) | ||
add_rules("build_cargo") | ||
add_files("../../rust/luisa_compute_backend_impl/Cargo.toml") | ||
|
||
after_build(function(target) | ||
local dlls = { | ||
"embree4", | ||
"libmmd", | ||
"tbb12", | ||
"tbbmalloc", | ||
"luisa_compute_backend_impl" | ||
} | ||
local function copy_dll(str) | ||
local lib_path = path.absolute(path.join("../../rust/target", str), os.scriptdir()) | ||
local bin_dir = target:targetdir() | ||
for i, v in ipairs(dlls) do | ||
if is_plat("windows") then | ||
os.cp(path.join(lib_path, v .. ".dll"), bin_dir) | ||
else | ||
os.cp(path.join(lib_path, "lib" .. v .. ".so"), bin_dir) | ||
end | ||
end | ||
end | ||
if is_mode("debug") then | ||
copy_dll("debug") | ||
else | ||
copy_dll("release") | ||
end | ||
end) | ||
add_files("**.cpp") | ||
add_files("../common/rust_device_common.cpp") | ||
target_end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters