Skip to content

Commit ad7dcca

Browse files
author
Marc Jakobi
committed
Build .dll library on MSVC
1 parent 534bfed commit ad7dcca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Build {
100100
_ => config.define("LUA_USE_POSIX", None),
101101
};
102102
}
103-
_ if target.contains("windows") => {
103+
_ if target.contains("windows") || target.contains("msvc") => {
104104
// Defined in Lua >= 5.3
105105
config.define("LUA_USE_WINDOWS", None);
106106
}
@@ -151,6 +151,11 @@ impl Build {
151151
Lua53 => "lua5.3",
152152
Lua54 => "lua5.4",
153153
};
154+
let lib_name = if target.contains("msvc") {
155+
format!("{}.{}", lib_name, std::env::consts::DLL_EXTENSION)
156+
} else {
157+
lib_name.to_string()
158+
};
154159

155160
config
156161
.include(&source_dir)
@@ -213,7 +218,7 @@ impl Build {
213218
}
214219
}
215220

216-
config.out_dir(&lib_dir).compile(lib_name);
221+
config.out_dir(&lib_dir).compile(&lib_name);
217222

218223
for f in &["lauxlib.h", "lua.h", "luaconf.h", "lualib.h"] {
219224
fs::copy(source_dir.join(f), include_dir.join(f)).unwrap();

0 commit comments

Comments
 (0)