I am talking about the development of an audio program, but since it is related to Cargo, I would like to ask a question here.
More specifically, I'm having trouble with the path variables that I pass to Cargo before building the cpal crate.
I am trying to develop an audio program with an ASIO host using cpal.
ASIO is written in C and I have to download the source code from the developer (Steinberg) and build the header files using bind-gen.
The problem is to tell the path where the ASIO SDK is located to build.rs in cpal. Currently cpal gets this path via the system's environment variable.
I doubt that using environment variables is the right thing to do, but the main problem is that this approach makes it very difficult to use different versions of the SDK in different binary crates in my machine.
If possible, I would like to be able to specify the path from the binary crate that is using cpal (which is a library crate). Are there any best practices?
Currently I just make cpal/asio-sys/.cargo/config.toml and write like
[env] CPAL_ASIO_DIR = "C:\\asio"
but this means that you have to rewrite it every time you clone from Git, which is a hassle.
Note that CPAL_ASIO_DIR is the name of the environment variable specified by cpal, but I override it with the Cargo environment variable.
If there is any other way to do this, please let me know.
By the way, precompiled binaries should not be distributed because of ASIO licence issues. As I recall. I thought about precompiling it myself, but I thought it would be best if the cpal side handled it if possible, so I wanted to ask for help from the community.