/*
 * Copyright (c) 2012-2013:  G-CSC, Goethe University Frankfurt
 * Author: Martin Rupp
 * 
 * This file is part of UG4.
 * 
 * UG4 is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License version 3 (as published by the
 * Free Software Foundation) with the following additional attribution
 * requirements (according to LGPL/GPL v3 §7):
 * 
 * (1) The following notice must be displayed in the Appropriate Legal Notices
 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
 * 
 * (2) The following notice must be displayed at a prominent place in the
 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
 * 
 * (3) The following bibliography is recommended for citation and must be
 * preserved in all covered files:
 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
 *   parallel geometric multigrid solver on hierarchically distributed grids.
 *   Computing and visualization in science 16, 4 (2013), 151-164"
 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
 *   flexible software system for simulating pde based models on high performance
 *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 */

/** \page pageInstallNetbeans Developing with the Netbeans IDE

[TOC]

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

<hr>
\section secInstallNetbeansDownload Download Netbeans

<ul>
  <li>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.</li>
  <li>Open the downloaded file (e.g. netbeans-7.2-ml-macosx.dmg), install.</li>
  <li> Start \em Netbeans. </li>
  <li> Select View -> Show Versioning Labels (for SVN info) </li>
  <li> Netbeans -> Properties -> Miscellaneous -> Versioning: At "Format", enter <tt>{folder} {revision} {status}</tt>.</li>
</ul>

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 \ref secInstallNetbeansCreateProject.

To use NetBeans for checkout, choose <em> Team -> Subversion -> Checkout</em>. 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 \ref secInstallNetbeansCreateProject.

<hr>
\section secInstallNetbeansCreateProject Create the ug4 project in Netbeans

<ul>
  <li>In Netbeans's Menu, choose \em File -> \em New Project ...-> <em>C/C++ </em>, <em> C/C++ Project with Existing Sources</em>, click \em Next.  </li>
  <li>As folder, specify your ug4 root (where the CMakeLists.txt is). Select "Custom Make Mode". \em Next.</li>
  <li>
  <ul>
  <li>If you already have a makefile (like when you already used cmake) specify it.</li>
   <li>If not, select "Using the makefile generated by the configure script".<br>
		set configure arguments to -DDIM=2 -DCPU=1  -DDEBUG=ON<br>
		select run configure script in subfolder, and set "build_debug"</li>
  </ul>
  \em Next.
  </li>
  <li>add -j8 to make if you want to compile parallel (and you have enough RAM). \em Next</li>
  <li>Source Files: \em Next</li>
  <li>Code Assistance: \em Next</li>
  <li>Project Name: Choose one. \em finish </li>
</ul>
 ug4 will be built automatically for the first time. You can select Run -> Build Project to build it manually or use the "hammer" symbol.
<br>
If you use build flags, you must tell \em Netbeans to recognize them.
Specially, if you do not use \c UG_PARALLEL, all Parallel Code will not be highlighted but regarded as dead code.
So, add it to the Environment:
<ol>
  <li>Click right on folder \c ug4 -> Choose \em Properties </li>
  <li>Under <em>Code Assistance</em> -> Subfolder <em>C++ Compiler</em></li>
  <li>Under Preprocessor Definitions:</li>
  <li>Fill in \c UG_PARALLEL</li>
</ol> 
You might also want to add that for C Code Assistance.



<hr>
\section secInstallNetbeansCreateOtherConfigurations 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
 <ul>
 <li>In Netbeans menu, select \em Window -> \em Files. Then, right click on your project -> Properies. (also available in \em File -> <em>Project Properties</em>)</li>
 <li> Select \em Build -> \em Make</li>
 <li>Click on "Manage Configurations…", Duplicate & rename to e.g. Release</li>
 <li> Set Working Directory to ug4/release_build</li>
</ul>
 
\note Netbeans has a nice code assistance. However, this takes a lot of memory. Go to \em File -> <em>Project Properties</em> -> \em General. There you set <tt>^(nbproject|externals|unit_tests|build_debug|build_release)$</tt> 
 * as ignored folders. If you still have memory problems, consider disabling code assistance by removing "." from Source Folders.
 
\section secInstallNetbeansRunningAndDebugging Running and Debugging
 <ul>
 <li> Go to \em File -> <em>Project Properties</em></li>
 <li>Select "Run"</li>
 <li>enter as run command, for example "./ugshell -ex conv_diff/laplace.lua"
 <li>Run Directory YOURUG4ROOT/bin</li>
 <li>Build First : Set this on or off, as you like.</li>
 <li>Terminal: Set External Terminal here if you want to use the shell interactively (i.e. entering something in the shell)</li>
 </ul>
 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.<br>
 To run ug4, select \em Run -> <em>Run Project</em> or the "play" button.<br>
 To debug ug4, select \em Debug -> <em>Debug Project</em>  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.


\section secInstallNetbeansLUA Netbeans and LUA
We created an own plugin which provides code completion for the ug4 registry functions/classes: <a href="http://gcsc.uni-frankfurt.de/Members/mrupp/ug4-auto-completion/">Go here (ugIDE)</a> for further details.

 */
