Skip to content

Commit

Permalink
qt-build-utils: treat .obj files as object files
Browse files Browse the repository at this point in the history
  • Loading branch information
jnbooth authored and LeonMatthesKDAB committed Jan 21, 2025
1 parent ab544c7 commit 6c94838
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/qt-build-utils/src/parse_cflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ fn extract_lib_from_filename<'a>(target: &str, filename: &'a str) -> Option<&'a
}
}

/// Tests whether a file is an object file to be linked.
fn is_object_file(path: &std::path::Path) -> bool {
let Some(ext_os) = path.extension() else {
return false;
};
let Some(ext) = ext_os.to_str() else {
return false;
};
ext == "o" || ext == "obj"
}

/// Split link_args produced by pkg-config --cflags and / or --libs into separate flags.
///
/// Backslash in link_args is used to preserve literal meaning of following byte. Different words are
Expand Down Expand Up @@ -172,7 +183,7 @@ pub(crate) fn parse_libs_cflags(name: &str, link_args: &[u8], _builder: &mut cc:
(path.parent(), path.file_name(), &target)
{
let file_name = file_name.to_string_lossy();
if file_name.ends_with(".o") {
if is_object_file(path) {
#[cfg(feature = "link_qt_object_files")]
{
let path_string = path.to_string_lossy().to_string();
Expand Down

0 comments on commit 6c94838

Please sign in to comment.