Why is there no MSVC support? - Printable Version +- Colobot Forum - International Colobot Community (https://colobot.info/forum) +-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76) +--- Forum: Colobot: Gold Edition Development (https://colobot.info/forum/forumdisplay.php?fid=62) +---- Forum: Game Engine & General Talk (https://colobot.info/forum/forumdisplay.php?fid=63) +---- Thread: Why is there no MSVC support? (/showthread.php?tid=595) |
Why is there no MSVC support? - Simbax - 04-19-2015 I have seen some people struggling with compiling Colobot using Visual Studio, but when I run cmake I get an error: "Your C++ compiler doesn't seem to support C++11. Supported compilers at this time are GCC 4.6+ and clang." Does that mean that Colobot uses C++11 features which are only available in GCC and clang, but not in other compilers (like MSVC)? I wanted to try to build the project using Visual Studio Community 2013, but I don't want to waste time struggling because of the compiler itself not supporting some necessary features for building. I have found a table with supported C++11 features in MSVC, it may be useful: https://msdn.microsoft.com/en-us/library/hh567368.aspx RE: Why is there no MSVC support? - krzys_h - 04-19-2015 It might be just that it doesn't know how to enable C++11 features in the compiler, or maybe the compiler doesn't support everything that's needed. I guess @piotrdz would know better. Take a look at this fragment of code: https://github.com/colobot/colobot/blob/dev/CMakeLists.txt#L117-L135 RE: Why is there no MSVC support? - Simbax - 04-19-2015 Accroding to this http://stackoverflow.com/questions/19372151/what-is-vs2012-cl-exe-equivalent-to-gcc-std-c11 MSVC doesn't need any flag for C++11 support. What is important though is what actual C++11 features are used in Colobot. RE: Why is there no MSVC support? - tomangelo - 04-19-2015 I've found this: http://cpprocks.com/c1114-compiler-and-library-shootout/ I don't know which features are needed from C++11 standard, but it seems MSVC still lack from supporting them. Maybe we could rewrite some parts of code, but: 1) if we'll have separate versions of code to gcc/clang and separate to msvc, some parts of code will be doubled, some issues could appear only to owners of specific compiler, what could make it more difficult to debug. And there will be need of copying same code two times. 2) if we'll rewrite current code to more universal - well, I don't know, it may be harder to develop, or have worst optimalisation. RE: Why is there no MSVC support? - krzys_h - 04-19-2015 Then, @Simbax could try adding this before the final else(): Code: elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") RE: Why is there no MSVC support? - piotrdz - 04-25-2015 Initially we focused on porting to Linux, so support for GCC and Clang was first priority. Then, adding Windows support was easier using MinGW and MXE, as GCC was already supported. The problem with MSVC was until recently poor support for C++11, especially two features we use: range-based for loops and initializer lists. With latest updates to MSVC 2013, it seems all we need is supported, so we can finally add it as supported. The remaining problem is getting it to compile with all necessary libraries. I could give it a try sometime later and see if it really works. PS. Yeah, I'm back RE: Why is there no MSVC support? - tomangelo - 04-25-2015 Ok, so who's gonna try with MSVC 2013? PS. Welcome again RE: Why is there no MSVC support? - Simbax - 04-25-2015 Well, Colobot uses not implemented features. I managed to install all necessary dependencies except po4a (it took me about 3 hours and I encountered some problems, but I think I can make a proper package) and CMake successfully generated VS2013 project files. I opened a solution and tried to build it. Even music is converted without problems, but some parts of code give errors. In app.h: Code: #include <unistd.h> In the same file: Code: usleep(20000); // should still give plenty of fps usleep function doesn't exist on Windows. There is an ugly workaround: Code: // Ugly fix for MSVC I'm leaving here rest of the errors. I'm too tired to try to fix them and not sure if you would even let me to push these changes to the repository. Code: 1>D:\Projects\colobot\gold\repo\src\object/level/parserexceptions.h(35): error C3646: 'noexcept' : unknown override specifier In CBOT there are some of these errors: Code: 1>d:\projects\colobot\gold\repo\src\cbot\CBot.h(75): fatal error C1017: invalid integer constant expression Also, there are a lot of warnings. I'm not sure if they should be there. Full logs are in attachments. I included only logs from building main Colobot source code and CBOT. RE: Why is there no MSVC support? - piotrdz - 04-26-2015 Well, you're right, we still have some dependencies to Unix utilities. We should not be using unistd.h and getopt.h directly, but provide the necessary functions via SystemUtils interface. The noexcept error could be fixed by providing an empty noexcept macro and the two remaining errors can be fixed with some rewriting of code. Some warnings are also worth to look at. I have some time today, so I should be able to fix it. Still, such problems are pretty embarrassing for Microsoft, as C++11 standard is now almost 4 years old, yet their compiler still doesn't fully support it. Update: I almost forgot just how much pain it is to compile something under Windows. But I finally got it to compile I will commit my fixes tomorrow as I'm too tired today. RE: Why is there no MSVC support? - tomangelo - 04-26-2015 So 0.1.5 will have support for MSVC 2010 or 2013? RE: Why is there no MSVC support? - piotrdz - 04-27-2015 (04-26-2015, 11:22 PM)tomangelo Wrote: So 0.1.5 will have support for MSVC 2010 or 2013? Indeed it will as I've just committed my changes. I compiled the project successfully using MSVC 2013 with update 4, and I think this is the only version which works. I can also provide a link to download archive with necessary libraries. What still doesn't work is generation of translations in data submodule, as for this you need some minimum Unix environment (perl, bash, sed, etc.). RE: Why is there no MSVC support? - Simbax - 05-05-2015 So, here's my pack with all necessary dependencies to compile Colobot: Gold Edition using Microsoft Visual Studio 2013. Content:
Instructions:
https://dl.dropboxusercontent.com/u/16682532/Colobot/colobot-dependencies-msvc2013.zip RE: Why is there no MSVC support? - tomaszkax86 - 05-05-2015 Thanks Simbax, I'll try this when I'm back at home. RE: Why is there no MSVC support? - piotrdz - 05-05-2015 For the record, here is my own package with necessary libraries: http://www.speedyshare.com/ApU57/colobot-msvc-libs.zip The package contains basically the same as Simbax's one, but I changed SDL_image to use libpng in one version. It should also work according to instructions above. RE: Why is there no MSVC support? - tomaszkax86 - 05-06-2015 Finally, I can compile Colobot on Windows without messing with MinGW. And test new things. Thank you guys. |