dtaralla / rrise

A Rust binding for Wwise
Other
13 stars 4 forks source link

Hardcoded paths in Windows target #2

Closed targrub closed 2 years ago

targrub commented 2 years ago

When I build my project, the linking step is unable to find the Ak dlls. It appears to be looking for them in a subdirectory of the SDK that ends in "x64_vc140". I looked at the code in, e.g., rrise/build/windows.rs, where I found this string.

I may be able to hack in a new version to correspond with the directory Wwise installed under the SDK, like

    let mut path = wwise_sdk.join("x64_vc170");
    if !path.is_dir() {
        path = wwise_sdk.join("x64_vc160");
        if !path.is_dir() {
            path = wwise_sdk.join("x64_vc150");
            if !path.is_dir() {
                path = wwise_sdk.join("x64_vc140");
            }
        }
    }

but obviously this is not a robust solution. For the time being I'm going to make a fork for myself containing this hack, and will investigate a better solution after I have it working.

The example code also has this hardcoding in it, and will also need a better solution.

In case it makes a difference, I'm using Wwise 2021.1.10.7883.

targrub commented 2 years ago

Sorry, I think I should have filed this against bevy-rrise. But rrise looks to have this issue, so I'll leave it open.

dtaralla commented 2 years ago

Hey ! Thanks for your interest.

So first thing: This crate (and bevy-rrise) don't officially support Wwise 2021.1.10 (I tested up to 2021.1.7). I've tested tonight with Wwise 2021.1.9 and it links properly too (statically with .libs and dynamically with DLLs at runtime), so this is because you use 2021.1.10. Your fix should be enough though for your tests👍I can't integrate it though because it might break this crate for people using VS2019. Indeed, would they install Wwise 2021.1.10 and the VS2022 Wwise SDK while using VS2019 to compile this crate... problem.

With the addition of the support of MSVC 17.0 (ie VS2022) by Wwise in .10, the vc170 variant needs to be added if you plan to use MSVC 17 libs from Wwise SDK. Something else you could try is installing the VS2019 SDK of Wwise too, and see if it fixes your issues.

This code is not pretty indeed, but I couldn't find a quick reliable way to fetch MSVC install details (like cl.exe path, msvc version,...). I use the same kind of code to find the DLL path in the bevy-rrise examples... We could make the selected vcXX folder overridable with some param though in the meantime... But personally, I'd want to update this code only if I have a nice solution that automatically selects the vcXX folder according to the visual studio version rust will be using to compile this crate.

EDIT: Looking into the cc::windows_registry thing. Maybe there is something we can use there.

dtaralla commented 2 years ago

I've added a fix_msvc_detection branch with a potential fix. Tried here with Wwise 2021.1.10 (with VS2022 platform ticked at install) + VS2022 and it worked. MSVC version and path/lib detection is also much better, based on the cc crate.

More info here: https://github.com/dtaralla/rrise/compare/main...fix_msvc_detection

Let me know if it works for you and I'll update the crate after more extensive testing this weekend :)

targrub commented 2 years ago

There's also a new major version of Wwise, 2022.1.0, out.

dtaralla commented 2 years ago

That's out of scope - it's still a beta.

targrub commented 2 years ago

That would make sense. But how can one tell it's a beta release?

dtaralla commented 2 years ago

I'm working with Wwise professionally and this release is not ready yet; search a bit on their blog and you'll see. They allow you to install it already for testing, but it's still a beta. It won't be released for production before "fall this year". It's going to disrupt a lot of game integration concepts with their new soundbank management, and I'll take some time later this year to see if I can integrate it in rrise too.