Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 43
Registered: ‎02-11-2014
My Device: Q10, Z10, Z30, Passport, Classic
My Carrier: None
Accepted Solution

Debug vs. Release builds on Simulator

I'm writing a BB10 native Cascades/C++ app using the Momentics 2.0 IDE on Mac OSX.


I'd like to have a "Debug" version that includes extra code to check for internal inconsistencies and extra testing features (which will make the app run slow), and a "Release" version without all the extra code (so it will run faster and be smaller, and not let users do things they are not meant to do).


I think I can use the QT_NO_DEBUG macro to enable/disable the extra code.  Am I on the right track here?  Is that the "BB10 Way"?


I choose "Run Release" instead of "Run" in the IDE, clean, and build, but I don't see -DQT_NO_DEBUG in the commands in the Console window as it's building.  When it runs on the simulator, I get no qDebug() output in the Console window, so something must be different.  I added a SystemDialog to tell me if QT_NO_DEBUG is enabled or not, and it's always disabled.  I have not yet tried on a real device.  I need this to work on the simulator as well as a real device.


Looking around the Momentics 2.0 IDE, I see references to "Device-Debug", "Device-Release", "Device-Profile", "Simulator-Debug" but _NOT_ "Simulator-Release".  Why not?


(I get this list by right-clicking my project in the Project Explorer tab, Build Configurations/Manage...  which brings up a "Manage Configurations" dialog with these configurations listed.)


I've created a new configuration called "Simulator-Release" by copying "Simulator-Debug", and made it the active configuration, but I don't see how to edit it to add -DQT_NO_DEBUG and change optimization levels, etc.


When I right-click my project in the Project Explorer, Run As/Run Configurations...  I get a dialog that lets me select a target (Named like: MyApp run_release sim_10_2_1_3175), where I can change the Build Configuration to my new Simulator-Release, but then the field for "Binary:" turns blank and doesn't let me edit it.


I also see references to a folder like "x86/o-g" (which I think is where it puts the debug build), and also a folder called "x86/o" (which is where I would guess it would put a release build.)  Am I guessing correctly here?  Why have the references to "x86/o" without a configuration to build into there?


I would hope this kind of thing would be somewhat easy, maybe even built-in when I originally created the project, but I've been googling and trying things for half the day with no luck.


Can you point me to some step-by-step examples of how to do what I'm trying to do?  I've used a lot of IDEs and other build systems in my day, but I'm fairly new to Momentics/Eclipse.


Thanks for any input,

Ed Federmeyer


Posts: 43
Registered: ‎02-11-2014
My Device: Q10, Z10, Z30, Passport, Classic
My Carrier: None

Re: Debug vs. Release builds on Simulator

Just a follow-up:


After some googling, I found some answers that suggest editing the file:



That's kind of icky though- editing an application file like that.


I found that I could add these lines to my project's Makefile to get the same effect:


x86-Simulator-Release/Makefile: $(QMAKE_TARGET).pro

    @mkdir -p x86-Simulator-Release

    cd x86-Simulator-Release && $(QMAKE) -spec blackberry-x86-qcc ../$(QMAKE_TARGET).pro  CONFIG+=debug_and_release CONFIG+=simulator CONFIG+=Simulator-Release


Simulator-Release: x86-Simulator-Release/Makefile translate FORCE

    $(MAKE) -C ./x86-Simulator-Release -f Makefile debug


clean: FORCE

    rm -rf arm arm-p x86 x86-Simulator-Release

    rm -f $(I18N_DIR)/*.qm


Then in my project's .pro file, I add this snippet:


Simulator-Release {




Of course, you could add all kinds of targets this way to build different versions from the same code base.


The biggest drawback is that I get these warnings from overriding the "clean" target:


Makefile:15: warning: overriding recipe for target `clean'

mk/cs-base.mk:44: warning: ignoring old recipe for target `clean'


I hate warnings in my build.  Hate 'em!!!


Is there anyway the Momentics development team can setup the "clean" target so that we can override it (or add to it) cleanly from our own Makefile?


I had to base the new config on the debug config and put it into a different folder than x86/o because the currently generated Makefile.release has some problems (adding -mthumb to the CFLAGS and CXXFLAGS for an x86 target for one!)  Is there any way they could cleanup the Makefile.release generation so it's usable on x86?


I'm not sure of the proper process to request these kinds of updates.





Posts: 43
Registered: ‎02-11-2014
My Device: Q10, Z10, Z30, Passport, Classic
My Carrier: None

Re: Debug vs. Release builds on Simulator

One more follow up!


Duh!  I suddenly realised!


Instead of including mk/cs-base.mk in my project's Makefile, I can COPY cs-base.mk to a local version in my project's folder (cs-base-custom.mk for example), include THAT, and put my additional targets in there, with no need to override the "clean" target, which means no more makefile warnings!


Happy, happy day!  Smiley Very Happy