-
February 15th, 2010, 12:28 AM
#1
First Steps to multiple Builds of same codebase
Hi,
Looking for some advice,
I come from a more makefile / header definition build oriented background.
Currently, I'm setting up multiple builds of my gui, and right now I'm sort of seeing that my approach of using build variables defined in headers - ie
Code:
#define BUILD_TYPE BUILD_TEST_VERSION
etc etc
#elif (BUILD_TYPE==BUILD_TEST_VERSION)
#define ENABLE_TAB_BYTE 30
#define ENABLE_DT_RESTRICTIONS 1
#define ENABLE_GTIN_RESTRICTIONS 1
Might not be the way to go. These variables control whether certain tabs on a tabcontrol are set, and other assorted restrictions. I also need to generate setup files for these individual builds.
What I'm looking for is some advice on how to do this, easily. As soon as I start googling this type of issue, I get buried, fairly quickly, without finding analogous ways of achieving it "easily".
All I really want to do is change a couple of header defs, iterate through, and make executables and then automate setup builds, based on these executables.
Thoughts on simple ways to achieve this?
-
February 15th, 2010, 01:23 AM
#2
Re: First Steps to multiple Builds of same codebase
C++ compiler command line allows to set precompiler constants. This can be used to build different configurations. For example, in VC++ _DEBUG is defined only in Debug configuration.
You may write your code with different #ifdef statements, customizing its behavior. Use precompiler definitions to create different configurations both for batch build and inside of IDE. There is no need to change source code before build.
#ifdef BUILD_TEST_VERSION // defined in the command line or in the Project Properties
// ...
#endif
-
February 15th, 2010, 08:42 AM
#3
Re: First Steps to multiple Builds of same codebase
I do this in one of my programs. I have a free or 'LITE_VERSION' and a normal version. Anything in my code that shouldn't be in the free version has #ifndef LITE_VERSION surrounding it. I then create separate configurations: Debug, Release, Lite Debug, Lite Release (similar to what Alex just described). The Lite Debug & Lite Release configurations have 'LITE_VERSION' in Configuration Properties -> C++ -> Preprocessor -> Preprocessor definitions.
I was unable to configure the setup project like this though. I instead had to create multiple setup projects: InstallMyApp, InstallMyAppLite. I would have liked to have had just one setup project 'InstallMyApp', then select the configuration (Release or Lite Release) as I do in the C++ project, but I couldn't get that to work. For instance there's no way to tell the setup project 'if I'm building the Lite Release configuration don't include these specific files'.
-
February 15th, 2010, 08:46 AM
#4
Re: First Steps to multiple Builds of same codebase
Originally Posted by Martin O
For instance there's no way to tell the setup project 'if I'm building the Lite Release configuration don't include these specific files'.
...however, if your installer doesn't include a lot of extra files & just includes the .exe file & that's it, then a single setup project with multiple configurations might work.
-
February 15th, 2010, 10:27 PM
#5
Re: First Steps to multiple Builds of same codebase
Thanks very much for that info. That really helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|