ug4
Developing with the Netbeans IDE

The page is an install guide for the usage of Netbeans for ug. Currently tested with Netbeans 7.2 on Mac OS.


Download Netbeans

  • Go to http://netbeans.org/downloads/, download the "C/C++" package or the "All" package if you want to use NetBeans for other purposes as well.
  • Open the downloaded file (e.g. netbeans-7.2-ml-macosx.dmg), install.
  • Start Netbeans.
  • Select View -> Show Versioning Labels (for SVN info)
  • Netbeans -> Properties -> Miscellaneous -> Versioning: At "Format", enter {folder} {revision} {status}.

You can either checkout ug4 with NetBeans or do it manually. It is also possible to use the version you checked out previously, e.g., with Eclipse. If you have checked out ug already skip this paragraph and go directly to Create the ug4 project in Netbeans.

To use NetBeans for checkout, choose Team -> Subversion -> Checkout. In the following dialogs you must specify the SVN repository, your username etc. TODO: link me to the corresponding docu... After the checkout NetBeans will ask you whether to create a new project. Just follow Create the ug4 project in Netbeans.


Create the ug4 project in Netbeans

  • In Netbeans's Menu, choose File -> New Project ...-> C/C++ , C/C++ Project with Existing Sources, click Next.
  • As folder, specify your ug4 root (where the CMakeLists.txt is). Select "Custom Make Mode". Next.
    • If you already have a makefile (like when you already used cmake) specify it.
    • If not, select "Using the makefile generated by the configure script".
      set configure arguments to -DDIM=2 -DCPU=1 -DDEBUG=ON
      select run configure script in subfolder, and set "build_debug"
    Next.
  • add -j8 to make if you want to compile parallel (and you have enough RAM). Next
  • Source Files: Next
  • Code Assistance: Next
  • Project Name: Choose one. finish

ug4 will be built automatically for the first time. You can select Run -> Build Project to build it manually or use the "hammer" symbol.
If you use build flags, you must tell Netbeans to recognize them. Specially, if you do not use UG_PARALLEL, all Parallel Code will not be highlighted but regarded as dead code. So, add it to the Environment:

  1. Click right on folder ug4 -> Choose Properties
  2. Under Code Assistance -> Subfolder C++ Compiler
  3. Under Preprocessor Definitions:
  4. Fill in UG_PARALLEL

You might also want to add that for C Code Assistance.


Create other configurations

Unfortunately, Netbeans can not create other cmake configurations automatically. So you have to create your folder ug4/release_build yourself and execute cmake there. Then

  • In Netbeans menu, select Window -> Files. Then, right click on your project -> Properies. (also available in File -> Project Properties)
  • Select Build -> Make
  • Click on "Manage Configurations…", Duplicate & rename to e.g. Release
  • Set Working Directory to ug4/release_build
Note
Netbeans has a nice code assistance. However, this takes a lot of memory. Go to File -> Project Properties -> General. There you set ^(nbproject|externals|unit_tests|build_debug|build_release)$ as ignored folders. If you still have memory problems, consider disabling code assistance by removing "." from Source Folders.

Running and Debugging

  • Go to File -> Project Properties
  • Select "Run"
  • enter as run command, for example "./ugshell -ex conv_diff/laplace.lua"
  • Run Directory YOURUG4ROOT/bin
  • Build First : Set this on or off, as you like.
  • Terminal: Set External Terminal here if you want to use the shell interactively (i.e. entering something in the shell)

For debugging, do the same in Project Properties -> Debug, where Debug command is the same as your run command, and Working Directory is the same as Run Directory.
To run ug4, select Run -> Run Project or the "play" button.
To debug ug4, select Debug -> Debug Project or the "play" button with 1 square 3 symbols. You can set breakpoints in files by clicking on the line numbers.

Note
Be sure you have configured with -DDEBUG=ON and your last build was the debug build when you try to debug.

Netbeans and LUA

We created an own plugin which provides code completion for the ug4 registry functions/classes: Go here (ugIDE) for further details.