Bugzilla – Bug 1088
Code in scratch directory assumes all modules are enabled
Last modified: 2011-04-17 23:09:09 EDT
Waf currently makes code in the scratch directory depend on the set of enabled modules. The code users place in scratch, however, can depend on any module even if only a few modules have been enabled. Also, there is no wscript file for the scratch directory to let waf know what modules scratch should depend on. Therefore, all modules will have to be enabled in waf when there is code in scratch. One problem with this solution is that there are currently files in the scratch directory in ns-3-dev, which means that all modules will always be enabled until the scratch directory is cleared. Is it possible to remove these files from ns-3-dev/scratch?
I'm not sure I agree with "all modules will have to be enabled in waf when there is code in scratch"; maybe we could do the also: 1- "scratch programs are only built if all modules are enabled" 2- or just "we always build scratch programs, let the user worry about whether or not the scratch programs are buildable". You outlined only one option of 3 possible.
One idea from Tom is to create (In reply to comment #1) > I'm not sure I agree with "all modules will have to be enabled in waf when > there is code in scratch"; maybe we could do the also: > > 1- "scratch programs are only built if all modules are enabled" > > 2- or just "we always build scratch programs, let the user worry about > whether or not the scratch programs are buildable". > > You outlined only one option of 3 possible. We could do 2 and use Tom's idea of having the files in ns-3-dev/scratch only depend on core. An example of such a script is hello-simulator.cc in examples/tutorial. Since every module has to depend on core, the scripts in ns-3-dev/scratch would always be able to be built.
*** Bug 1091 has been marked as a duplicate of this bug. ***
I am proposing to remove the existing scratch programs from Mercurial and then add the following very simple program (scratch-simulator.cc) to the scratch directory that only depends on core: #include "ns3/core-module.h" NS_LOG_COMPONENT_DEFINE ("ScratchSimulator"); using namespace ns3; int main (int argc, char *argv[]) { NS_LOG_UNCOND ("Scratch Simulator"); }
(In reply to comment #4) > I am proposing to remove the existing scratch programs from Mercurial and then > add the following very simple program (scratch-simulator.cc) to the scratch > directory that only depends on core: > > #include "ns3/core-module.h" > > NS_LOG_COMPONENT_DEFINE ("ScratchSimulator"); > > using namespace ns3; > > int > main (int argc, char *argv[]) > { > NS_LOG_UNCOND ("Scratch Simulator"); > } +1
Bug closed. ns-3-dev changeset: 7b2e9458bff1