Skip to content

fix: build lib into separate lib directory #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl Build {
let out_dir = self.out_dir.as_ref().ok_or("OUT_DIR is not set")?;
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut source_dir = manifest_dir.join(version.source_dir());
let lib_dir = out_dir.join("lib");
let include_dir = out_dir.join("include");

if !include_dir.exists() {
Expand Down Expand Up @@ -218,7 +219,7 @@ impl Build {
.flag("-w") // Suppress all warnings
.flag_if_supported("-fno-common") // Compile common globals like normal definitions
.add_files_by_ext(&source_dir, "c")?
.out_dir(out_dir)
.out_dir(&lib_dir)
.try_compile(version.lib_name())?;

for f in &["lauxlib.h", "lua.h", "luaconf.h", "lualib.h"] {
Expand All @@ -230,7 +231,7 @@ impl Build {

Ok(Artifacts {
include_dir,
lib_dir: out_dir.clone(),
lib_dir,
libs: vec![version.lib_name().to_string()],
})
}
Expand Down