Closed nyanpasu64 closed 4 years ago
In my (relatively uninformed) opinion, -Werror is reasonable for people modifying/contributing to RtAudio, but causes problems for people including it in other projects
Hi, yes this is why we add -Werror
only for debug builds, the idea is to use it for RtAudio development. It seems clear that there might be a desire to compile RtAudio with debug information but without the full "I am developing RtAudio now" flags enabled. Is there a good way in CMake to separate RtAudio's debug build from the superproject's debug build? (CMake is a bit weird when it comes to subprojects imho. Seems to be very hard to make a CMakeLists.txt
that works to everyone's satisfaction.) I guess ideally you'd want your project to set up RtAudio for RelWithDebugInfo.
In this case I would say -Werror
did it's job since those functions are not supposed to be defined except when they are used. (Maybe they should be templated to avoid this problem, come to think of it.) Can you tell me what API you are compiling?
I think (not 100% sure) it's WASAPI only, on MinGW 64. Is it a good idea to enable other APIs too, or is WASAPI the best available API on anything newer than Windows XP?
I finally had some time to look into this. It seems that there is a difference between the automake build and the CMake build in debug mode, the former adds the flag "-Wno-error=unused-function", and the latter does not.
So, it could be fixed by adding that flag, but it might be nice to fix it and remove it instead.
CMake ends its first run with,
Compiling with support for: wasapi
Looking in wasapi part of RtAudio.cpp
, it seems that the wchar version of convertCharPointerToStdString
is used but no the char version. This can be fixed by making this function into a template.
This rule fires, regardless if RtAudio is being built by itself in debug mode, or if it's embedded in another CMake project being built in debug mode.
Arguably -Werror is a bad idea since it makes your code brittle to compiler changes: https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend/
In my (relatively uninformed) opinion, -Werror is reasonable for people modifying/contributing to RtAudio, but causes problems for people including it in other projects (my project), and people making debug builds of the unmodified source for symbols.
In my local copy of RtAudio, I commented out the CMakeLists rule to include -Werror:
https://github.com/thestk/rtaudio/blob/a1ddca0c452c05a5f5d0b36d5a5648296061d4e2/CMakeLists.txt#L70-L72