-
Notifications
You must be signed in to change notification settings - Fork 230
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
ability to compile libsoundio source with MSVC #49
Comments
Your arguments are convincing. Let's see how much effort it will be to get libsoundio to compile with MSVC. |
#50 pull request is one way to do it: leveraging on the STL implementation of the Another way might have been to maintain a compatibility layer for
|
Even if one were not so keen on MSVC - wouldn't it be 'better' to use fewer gcc extensions? You're part way there with cmake already. The array indexed initialisation seems to me unnecessary though. I guess it can be hidden in a macro and used as documentation. Does clang support it? |
@jmansion what GCC extensions am I using?
It's part of the C99 standard. Yes, clang supports it, and I agree that while the feature is helpful to avoid programmer mistakes, the feature is unnecessary. As discussed in the PR, we're removing array indexed initialization to allow building with MSVC. |
I have the libraries and some of the executables building. sio_list_devices has built but only found dummy devices, CMake has wasapi selected. And bizarre: So far:
Possibly the last of these relates to most MSVC using __uuidof and the gcc-ised headers make up for this with explicit support somewhere? No idea about gcc on Windows for building COM stuff, I'm afraid. Given that __uuidof looks like a macro, there is some hope I guess. Ah, when I looked up the array init, it was marked as a gcc extension. The code that is using it is C++, are you sure its legal? I wouldn't know about C99. :-( I use gcc for C++ on Linux in dayjob, and use VC++ generally on Windows. I find MS' attitude to C(( indefensible, but at least they are making an effort now. |
That's attribute(x) |
@jmansion are you aware of #50 ? @hotgloupi has fixed many of these issues already. It's not quite done yet, but after that pull request we expect to be able to build with MSVC. |
You found a bug in sio_list_devices. Fixed: aef8d16 |
I guess not - I came via the 1.0.3 release. I should move to master I guess. It wasn't my intention to get embroiled in dev - I had been trying rtaudio today and found the performance with wasapi wasn't as good as ASIO, and I was hoping I could kick the tyres and see whether it was any better. My understanding is that exclusive mode with input and output to the same device should be possible to have sample perfect and similar performance (in terms of over/underrun). Has to be said that rtaudio with ASIO seems fine with my Asus STX card though. |
Once 1.1.0 is released (with MSVC compile support), may I invite you to come back and kick the tyres once more by posting in this thread? Alternately you can download one of the prebuilt Windows builds from http://libsound.io/. I tested them with MSVC. |
Thanks to @hotgloupi's work in #50 which I just merged, libsoundio source code can be compiled with MSVC. However it does not work out of the box, since the cmake configuration isn't quite set up for an MSVC build. So the remaining work to be done on this issue is edit the cmake configuration so that MSVC build can be performed on Windows. However, at this point it is quite possible for someone to directly embed libsoundio in their msvc project. |
i managed to at least compile the dummy interface.
|
ps. i forgot: i also added a |
@kritzikratzi I'm not sure you need to include "list.h", do you remember what was the error ? Also, with this setup, one cannot choose to compile using gcc or clang in C++ mode, which could be a valuable thing to allow. @andrewrk It could be a good idea to setup some automated build on Travis and appveyor, I can provide some help if needed |
@hotgloupi about the gcc/clang problem: the only thing that needs to be taken care of is libm (either adding it for clang/gcc only, or removing it for msvc. not sure whats easier). the list.h problem came from here these two lines: |
My point was: Allowing compilation in C++ with clang/gcc is kind of a good idea, as it highlight dangerous cast or other type checks warnings (as C++ has stricter rules). About the list.h thing, I understand now that you were only compiling the dummy backend. If any other backend is enabled, I guess it will somehow include list.h. That's why I didn't see the problem while playing with MSVC. |
I've considered this. The problem is that testing libsoundio is really only effective when testing on various hardware with different sound cards. Setting up a Travis/appveyor build would be misleading - looking like tests were passing when really things could be horribly broken for many hardware configurations. |
@andrewrk about the travis builds: it's still a good baseline to know it works on various compilers. for manual testing i'm happy to help whenever i have time. (i usually have a mbp and lenovo with win8 plus external soundcard nearby). feel free to send emails before releases. |
Fair point.
I plan to release 1.1.0 soon - now is a good time. |
@andrewrk The only point of automated builds is to see if it builds on all compiler/os selected. |
Any idea when the release will be made? |
@jmansion if not released by Feb 1, I invite you to remind me by posting in this thread again. |
I'm going to do my own tests here with a virtual machine, but @michaelmaltese what's the status of this issue last you checked? Did you ever get all the way to a working MSVC build? |
I can confirm that it builds with MSVC, though you do need to turn off warnings-as-errors (it gives quite a few warnings). |
Just thought I'd poke this thread for status. It seemed like MSVS was originally targeted for 1.1.0, but now maybe 1.1.1? I agree that MSVS support is cool for just quick and dirty getting going and kicking the tires. I actually use MinGW for windows almost exclusively for my own projects, but its sometimes challenging to get foreign projects going for the first time with gnu/msys on windows, so its nice to just try things out in msvs before putting in the effort to unify the gnu on windows builds. I'm really sold on the "vs portaudio" wiki page which rang true for me - thanks for putting together this project! |
Well I modified the CMakeList.txt then had to rearrange a couple windows header includes, and got it building(under c++) for my project. |
Okay. Since some mods were required, I guess that's why this issue isn't fully closed yet. |
All of the changes are in wasapi.c/wasapi.h/CMakeLists.txt, though i was working from 1.1.0 I might try again with git master here soon and see if anything is different. |
I left the issue open because I haven't personally tested this with MSVC yet. Will do soon... |
If anyone has clear instructions on how to build with either VS 2015 or VS 2017 I'd gladly take them... |
Does anybody know if it is possible to even use libsoundio in a project with MSVC currently or is it only possible with MinGW? Since there is no .lib or .def library files generated for Windows use, I can't see how this can be used in a MSVC project. However, if a .def file was generated as part of the build procedure, I think it should be possible. If anybody has a solution to this, please let me know. Edit: It turns out that a .dll.a file can be used in the same way as a .lib file, so the prebuild library can be used directly in a MSVC project. |
@hotgloupi says
The text was updated successfully, but these errors were encountered: