-
Notifications
You must be signed in to change notification settings - Fork 583
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
Add version header #110
Comments
The real question is why do you need the version at compile time in the first place? |
I need it to find opus package with CMake and retrieve its version. Find module uses If Opus will ever have CMake support, all information could be retrieved from installed CMake package module on any platform. But CMake support is still missing. |
There's someone working on CMake support. That being said, the idea is that getting the version from the header should not be needed. Instead, it's best to query actual features. For example, if you want to know if you can disable phase inversion, you can use #ifdef OPUS_SET_PHASE_INVERSION_DISABLED rather than attempt to see in what version that got added. Note that in some cases, the header version may differ from the run-time version (especially with dynamic libraries), so the run-time version is available through an API call. |
I'm not sure we will see CMake support soon. As i see development is stopped.
It is better, indeed. But Also, our test results differs depending on
We tried. Vcpkg build of Opus retrieves "unknown" version. I guess it is because Vcpkg downloads sources from Opus repo as There is fallback in |
In release tarballs, the version is set without any script, so it shouldn't be a problem. When cloning, the version scripts should work. If someone makes a tar.gz of the current master without any of the version info, then there's nothing we can do about it. |
So, if we dowload |
But idea about download tarball is good... It has |
About version header - if you add it, many CMake developers will thank you. You can make it standalone, do not include in any other public header. No harm to anything IMHO. Why? Because even if CMake project is megred, it doesn't mean every maintrainer will use CMake build to create Opus packages. So cmake package script will not be installed. |
You don't understand, the contents of the git repo does not include the version number anywhere. The version is always extracted from the git tags (and commits), which is the only way it can be accurate. Otherwise it's guaranteed to be messed up, out of sync, ... (we've been there). |
I understand. That's why Vcpkg build failed: no
Ok, it looks reasonable. And still no problem with version header. Keep template |
OK, back to the start. It seems like I don't actually understand your problem. What is it that a header version would solve? Especially considering that Opus 1.0 through 1.3 will never have one. |
I need this find_package(Opus 1.3) in my CMake project to work on any platfrom. API version is important when configuring project, right? On Unix-like systems i can run PkgConfig and retrive all the information i want. On Windows i can find include directory and library path with CMake commands, but not API version. PkgConfig doesn't works properly here. So what i can do? Some projects define version information in headers: #define ZLIB_VERSION "1.2.11"
#define ZLIB_VERNUM 0x12b0
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 11
#define ZLIB_VER_SUBREVISION 0 Then i can parse it and set my Everything works, |
OK, I think I get the problem. Now, the issue I see with your solution is how you handle older versions. You won't ever be able to see query version numbers 1.0 through 1.3 that way. The first you'd be able to query is 1.4 and it's likely more than a year away (could be multiple years). Maybe there's another way -- ideally one that would work for existing versions. |
I think this is common way. According to find modules bundled with CMake.
In my case |
The only way to detect installed Opus version without
pkg-config
(Windows platform) is parsing some version header and reading values from defines, e.gOPUS_VERSION_MAJOR
,OPUS_VERSION_MAJOR
etc.So, can
opus_version.h
public header be added tolibopus
?The text was updated successfully, but these errors were encountered: