Generating different builds (HD/SD/phone/tablet/etc.)

I would like to have different builds depending on the target device, specifically SD (LDPI), HD, tablet, and phone builds, so then I’ll have:

Awesome Game SD
Awesome Game HD
Awesome Game Tablet SD

Is there an obvious way to do this? I’m thinking of the C/C++ type thing such as:
[blockcode]
#ifdef HD_BUILD
do stuff
#elif TABLET_BUILD
do stuff
#endif
[/blockcode]
[import]uid: 44812 topic_id: 14102 reply_id: 314102[/import]

use if and else statements:

[lua]if system.getInfo(“model”) ~= “iPad” then

–do code that isnt ipad

else

– ipad specific code

end[/lua] [import]uid: 24641 topic_id: 14102 reply_id: 51911[/import]

That doesn’t catch all tablets (in the Android space I can’t check for every potential model string) and I’m doubtful that will modify how the contents of my distribution. For example, if I want a distribution that is SD and not HD, how do I ensure that the HD assets aren’t picked up in the build?
[import]uid: 44812 topic_id: 14102 reply_id: 51915[/import]

Why would you do that, in Config.lua make it zoomStretch instead of letterbox. Then it will be HD on all devices.

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 14102 reply_id: 51938[/import]

I want to keep asset sizes down, i.e. if I have an SD one then I can have a much smaller distribution.

Additionally I would like to know what I’m on so I can control my layout based on the device’s physical dimensions instead of logical ones.
[import]uid: 44812 topic_id: 14102 reply_id: 51943[/import]

I solved a similar problem with a make file. My main development directory contained all the assets, and I can “make iOS” or “make droid” to copy all the pertinent assets and code to another directory for building. That coupled with git branches for each build type, and a “manifest” file that contained a list of what files to copy for each type. This way only the assets for a given build type are included in that build. It also lets me keep a bunch of stuff in the main development directory that I don’t want included in the builds, or would choke Corona, like Pixlemator files, notes, etc.

Looks like this

.PHONY: all iOS droid  
  
all: iOS droid  
  
iOS:  
 git checkout ios  
 rm -rf ../DropDropsIOS  
 mkdir ../DropDropsIOS  
 tar cf - `cat Manifest-iOS` | (cd ../DropDropsIOS; tar xvf -)  
  
droid:  
 git checkout droid  
 rm -rf ../DropDropsDroid  
 mkdir ../DropDropsDroid  
 tar cf - `cat Manifest-droid` | (cd ../DropDropsDroid; tar xvf -)  

Just gotta remember to make changes in the main directory, not the build ones. Lost a bunch of changes by forgetting that one. Oops.

–Woof! [import]uid: 24607 topic_id: 14102 reply_id: 52316[/import]

Somewhat of a brute force approach, but that’s what I was afraid of =| Make is probably more overkill than I need, it sounds like I could just do a batch file that copies files into subdirectories and goes from there.

Is the build process automatable from the command line or is it always run through the simulator? A cursory glance of the docs hasn’t shown me how it picks up the assets it’s going to store in the distributions.

Thanks for the suggestion!
[import]uid: 44812 topic_id: 14102 reply_id: 52353[/import]