Autotools vs SCons configure/build system
OK, I have gotten SCons set up to do a lot of cool things, like build source and binary packages automatically. I've also restructured things a little bit, the runtime/ directory is gone now. data/ is moved to the root directory and everything like lists, settings etc. went into data. I also moved some things out of the root, like the project files and the win/ directory - now these reside in tools/anjuta/ and tools/win/ respectively. The .dll files from runtime went into tools/win/dll/.Now I've been trying to code the DATA_DIR variable into the game. It's not possible just to replace every string that needs it with DATA_DIR + ... because in a lot of places this is an attempt to concatenate two string literals, which the compiler doesn't like. So, I thought it would be better to just define a static global variable that would hold it. So now, in main.cpp, there is a line<pre>extern const string data_directory = DATA_DIR;</pre>and in all the files that use data_directory, I've got<pre>extern const string data_directory;</pre>This seems to be working OK now. Is there a better way to do this? I think the only way to make it better would be to have a global configuration class or something, that way this variable could be loaded from a file instead of hard-coded in.Next, I need to set up some way of handling the settings directory. Now, the game will run if executed after an install, it finds some splash graphics, but as soon as it tries to load other stuff (like, anything in lists/) it fails because I've moved that stuff out from under it...Stuff to do:* find the user's homedir (this code will not be portable, I think we'll have to probably start defining something that tells it whether we're compiling on Win32 or Linux if not already)* check to see if there's already a SETTINGS_DIR (defaults to ".vdrift")there* if not, create it and copy defaults from DATA_DIR/settings/* if so, read settings from it* logs should be saved to SETTINGS_DIR/logs* replays should be saved to SETTINGS_DIR/replays* screenshots should be saved to SETTINGS_DIR/shots or something like that
|