mindsystem Posted October 30, 2011 Report Share Posted October 30, 2011 I've just started using the Code::Blocks IDE on my netbook, as it seems to run best while also leaving screen space for the actual code, and I was wondering if anyone here uses C::B for working on 0AD and would know how to set up the code as a project within it. Philip`, on IRC, mentioned the possibility of using premake to output a Code::Blocks importable makefile, but I haven't been able to find much on the subject.Alternatively, if there's another resource-light IDE out there that would be a better fit/easier implementation of the codebase that I simply haven't checked out, suggestions are welcome.[Note: I absolutely refuse to use Eclipse. Takes forever to load anything.] Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted October 30, 2011 Report Share Posted October 30, 2011 I've just started using the Code::Blocks IDE on my netbook, as it seems to run best while also leaving screen space for the actual code, and I was wondering if anyone here uses C::B for working on 0AD and would know how to set up the code as a project within it. Philip`, on IRC, mentioned the possibility of using premake to output a Code::Blocks importable makefile, but I haven't been able to find much on the subject.Alternatively, if there's another resource-light IDE out there that would be a better fit/easier implementation of the codebase that I simply haven't checked out, suggestions are welcome.[Note: I absolutely refuse to use Eclipse. Takes forever to load anything.]Premake4 supports Code::Blocks in theory, but I doubt anyone has tested that with our build system. Basically you want to run premake4 with the "codeblocks" option to generate the workspace (see build\workspaces\update-workspaces.* for an example of how premake is invoked). I don't know what OS you're using, but in Windows I suspect you'll need to use the MSVC toolchain (not GCC which is what Premake seems to be configuring by default, I think our source makes the assumption you will only use MSVC for Windows and GCC for other OSes). I've tested opening the workspace in Code::Blocks and it looks properly structured, but the build options are configured for GCC - maybe it will work in Linux. Quote Link to comment Share on other sites More sharing options...
quantumstate Posted October 30, 2011 Report Share Posted October 30, 2011 (edited) I had a quick look and you can easily generate a project using premake4.You could add a line to update-workspaces.sh (around line 69):premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die "Premake codeblocks failed"(If you are using windows you could add an equivalent line to update-workspaces.bat)Edit: I just tried building and it didn't work correctly. It threw quite a lot of errors when linking. Edited October 30, 2011 by quantumstate Quote Link to comment Share on other sites More sharing options...
Yves Posted October 30, 2011 Report Share Posted October 30, 2011 I had a quick look and you can easily generate a project using premake4.[...]That could work, but we had to make some changes to premake to get the other environments working and it's likely that there will be some gliches for Code::Blocks too.If you test it, please tell us if it works. Quote Link to comment Share on other sites More sharing options...
mindsystem Posted October 31, 2011 Author Report Share Posted October 31, 2011 (edited) I had a quick look and you can easily generate a project using premake4.You could add a line to update-workspaces.sh (around line 69):premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die "Premake codeblocks failed"(If you are using windows you could add an equivalent line to update-workspaces.bat)Edit: I just tried building and it didn't work correctly. It threw quite a lot of errors when linking.I did that and it worked perfectly for me. Granted, the project hierarchy is a bit iffy, but other than that, it works.EDIT: When I say "perfectly", I mean it imports "perfectly" and doesn't give any errors. Compiling is another issue altogether. See the attached text file.error.txt Edited October 31, 2011 by mindsystem Quote Link to comment Share on other sites More sharing options...
mindsystem Posted October 31, 2011 Author Report Share Posted October 31, 2011 (edited) I seem to have figured out what the issue is, seemingly fixed by adding "/usr/lib" under "Compiler" after [Right-click pyrogenesis] > "Build options..." > "Search directories".See the image below:http://db.tt/aBS1eXjMIf someone running Linux can confirm this, things should be all well and good.Edit: Turns out it only worked because I accidentally compiled most of it via terminal, so when I tried to recompile via Code::Blocks, it gave me the same errors again. Edited October 31, 2011 by mindsystem Quote Link to comment Share on other sites More sharing options...
Yves Posted November 7, 2011 Report Share Posted November 7, 2011 Good news: I was able to successfully build using the Code::Blocks IDE. Some manual tweaks were required, but it looks like it won't be hard to integrate them into the premake scripts.From what I see until now, Code::Blocks looks promising and I'm going to give it a try. Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted November 7, 2011 Report Share Posted November 7, 2011 Excellent I assume you mean Linux/GCC? Quote Link to comment Share on other sites More sharing options...
Yves Posted November 7, 2011 Report Share Posted November 7, 2011 I assume you mean Linux/GCC?Yes, I didn't check it on Windows yet.I guess this will be more difficult and for me it does not have priority because most Windows developers use Visual Studio anyway. Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted November 7, 2011 Report Share Posted November 7, 2011 Yes, I didn't check it on Windows yet.I guess this will be more difficult and for me it does not have priority because most Windows developers use Visual Studio anyway.Yeah I wouldn't worry about it, the odds are that even if someone wants to use Code::Blocks as their IDE in Windows, they'd still need MSVC installed to compile, and getting all the options correct looks like a pain (I do think it's possible). Quote Link to comment Share on other sites More sharing options...
Yves Posted November 8, 2011 Report Share Posted November 8, 2011 You could also use MinGW.If we tried to support it we would have to decide if the options in Code::Blocks should be for MinGW (GCC) or Visual Studio compiler. I don't think there's a way to support both. Maybe I'll do some tests on Windows, but I won't finish it if It's too much work and if there's no one who actually uses it. Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted November 9, 2011 Report Share Posted November 9, 2011 I doubt MinGW would work since our Windows-specific code almost certainly assumes it's being compiled with MSVC. I'm not aware of any benefits of compiling with GCC instead of MSVC, so it doesn't seem worth spending any effort making the game compatible with GCC on Windows. Quote Link to comment Share on other sites More sharing options...
Yves Posted November 11, 2011 Report Share Posted November 11, 2011 If someone would like to test it or has any feedback, here's a patch for Code::Blocks support on Linux.As yet I've only done some quick tests.premake_codeblocks.patch Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted November 12, 2011 Report Share Posted November 12, 2011 If someone would like to test it or has any feedback, here's a patch for Code::Blocks support on Linux.As yet I've only done some quick tests.Works great on Ubuntu w/ Code::Blocks 10.05. I tried building both release and debug config, and tested the debugger feature, with no problems.I went ahead and tested on OS X Lion too, as a possible Xcode alternative. It gives the following error when building the engine project:/Users/Ben/0ad/source/ps/XML/RelaxNG.cpp|26|error: libxml/relaxng.h: No such file or directoryWhich is strange, somehow it's not finding libxml2 includes? "locate relaxng.h" shows:/Developer/SDKs/MacOSX10.6.sdk/usr/include/libxml2/libxml/relaxng.h/Developer/SDKs/MacOSX10.7.sdk/usr/include/libxml2/libxml/relaxng.h/Users/Ben/0ad/libraries/libxml2/include/libxml/relaxng.h/usr/include/libxml2/libxml/relaxng.h/usr/share/doc/libxml2-2.7.3/html/html/libxml-relaxng.htmlThis is probably a separate issue, I think you could commit your patch Quote Link to comment Share on other sites More sharing options...
Yves Posted November 12, 2011 Report Share Posted November 12, 2011 ...I went ahead and tested on OS X Lion too, as a possible Xcode alternative. It gives the following error when building the engine project:/Users/Ben/0ad/source/ps/XML/RelaxNG.cpp|26|error: libxml/relaxng.h: No such file or directoryWhich is strange, somehow it's not finding libxml2 includes?...It's a bit weird. It does not find pkg-config because /opt/local/bin is not in the PATH of the shell used to execute commands inside C::B.There are some setting for the environment under Settings>Environment... but they don't seem to have any effect on that.It finally worked after starting C::B from the terminal. Somehow it got the right PATH that way.The question is how I could solve this with premake. I don't think I should use a full path to pkg-config because it could be installed elsewhere.The only other solution I see would be executing pkg-config from premake and inserting the output directly. That's how I had to do it for Xcode.EDIT: Committed - http://trac.wildfiregames.com/changeset/10521 Quote Link to comment Share on other sites More sharing options...
Pedro Falcão Posted November 29, 2011 Report Share Posted November 29, 2011 (edited) I generally use Eclipse IDE with Java, C and C++ and the plugin Subclipse to work with SVN (I had to reinstall my windows because of problems with TortoiseSVN, so i'll never use it again). Eclipse has a very friendly (and configurable) interface, detects semantic and sintax errors within the code in real time, supports both windows, linux and Mac and is totally free. http://www.eclipse.o...nents/indigosr1 Edited November 29, 2011 by Pedro Falcão Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted November 30, 2011 Report Share Posted November 30, 2011 It finally worked after starting C::B from the terminal. Somehow it got the right PATH that way.Confirmed that this works, but then it won't run the app bundle, it thinks it has never been built Also Code::Blocks seems really buggy on OS X, not only the UI, but it freezes occasionally, crashes when closing, the settings don't save, etc. So I think it's not worth spending too much effort on, probably much more important to get Xcode working properly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.