btaggart {l Wrote}:smcameron {l Wrote}:Wasn't planning on it, as... well, wasn't aware of anything driving such a requirement. I know that's kind of how cmake works, but... I'm not using cmake. So, why would I want to do that? I am not seeing what that would enable or what problem that would avoid. Not that I'm against it, but I'm not going to do it without some good reason.
To be honest, this response took me by surprise. I've been a professional software engineer for 20 years now and I've never worked on a project set up this way.
Not that it's relevant, esp. seeing as how this is only a hobby and not a professional project, but I've been a professional software engineer for 28 years, and I've seen plenty of projects set up this way. One example off the top of my head:
fio. it would not be hard to find others, as this is more or less the old-school way of using make.
It would be easier for people to contribute if they know what's going on in the code, and having source files broken down into logical groups helps with that.
The entire project is...
- {l Code}: {l Select All Code}
$ find . -name '*.[ch]' -print | wc
158 158 2853
$ find . -name '*.[ch]' -print | xargs wc | tail
52 216 1383 ./vec4.c
781 2155 17581 ./snis_marshal.c
6 20 72 ./placeholder-part-points.h
232 733 5815 ./snis_text_window.c
25 106 1294 ./snis_event_callback.h
6 20 70 ./placeholder-system-points.h
85 228 1114 ./string-utils.c
26 95 808 ./snis_gauge.h
6 8 110 ./starbase-comms.h
75069 388161 2886969 total
only 158 C source files and ~75k lines of code. So as these things go, this project is fairly small, and relatively speaking, it's not really hard to find anything. There is likely nothing you cannot find with a single grep (even what little token pasting is done is augmented with comments to enable grepping). Contrast with the asset importing library "assimp" (
http://assimp.sourceforge.net/ ) which last I checked was around 300k lines of code, and all it does is import 3D assets (incidentally, this is why I wrote my own asset importing code -- 2700 lines of it, roughly -- I can understand and debug 2700 lines a hell of a lot easier than the 300k of assimp.) And, have you ever watched someone work with a C++ codebase with visual studio? Almost invariably, they *have no idea* where anything is defined, unless they are the ones that wrote the bit of code they are looking at, and even then, it's iffy. They use the IDE to navigate the code. What file any particular piece of code is in does not matter for purposes of making the code easier to understand, and this only gets more true as the codebase grows (e.g. if your code base is multiple millions of LOC, you better have good tools, because you're not going to learn your way fluently around it any time soon.) Now, I don't use visual studio. I use vim and gcc and make. The more files there are, the more files there are to search through. There are a few reasons to break things up into separate files. That a file is merely large is not one of those reasons. Breaking a large file up into smaller ones only *for the sake of making the files smaller* makes things *harder* to find, not easier. The two largest C files in SNIS are snis_client.c and snis_server.c and they are both roughly 13k lines each -- not really all that big. The next biggest file is 3k lines.
And I have and do separate functionality out into separate files to form modules -- and if you take the time to look, you'll see that I am fairly diligent about defining reasonable interfaces and not polluting the global namespace unnecessarily and things like that. Is it perfect? No. But it doesn't need to be perfect. But in any case, you are talking about moving things around into different directories, rather than busting up files, and more specifically, you're talking about separating the build artifacts from the source files specifically by means of directories (they are already separated by naming conventions, mostly.)
Also, building into the source directory makes it really hard to package up the game for distribution, if you (or I) ever wanted to do that.
With that, I concede you may have a point. This has nothing to do with how hard or easy the code is to understand though. And as a counterpoint, there is already some packaging of snis going on around the net,
https://aur.archlinux.org/packages/snis-git/ and moving things around would presumably break them (though possibly make it easier for them in the long run.)
Also, building into the source directory means that a mistake in the makefile could overwrite your source.
As could a mistake with the "rm" command, or any number of other shell commands. We have git and
stacked git I don't think that overwriting the source accidentally via the specific vector of a Makefile mistake is a concern worth worrying about. git reflog will correct most such mistakes.
Moving files around may also introduce discontinuities in the git history -- "git log --follow..." is supposed to mitigate that, but, I am not super confident that it works perfectly.
Obviously, this is your project and you'll run it as you see fit, and all these reasons are mostly conveniences. I'm looking forward to getting my Artemis group to give this a try.
So, the point about packaging seems like it could be a legitimate one, but there are tons of other bits of software out there that build in a similar manner (the typical "./configure", "make", "make install" steps) that don't seem to have any trouble getting packaged up despite dropping build artifacts right next to source files.
And, while making a game is a goal for me, it is really a secondary goal -- the primary goal of this thing is for me to have a project to have fun tinkering with. Moving files around to different directories, potentially making the git history ugly... it's a little hard for me to get very excited about it.