Howto Use OpenFOAM with NetBeans

From OpenFOAMWiki
Revision as of 15:54, 26 October 2007 by Deepsterblue (Talk | contribs)

NetBeans is a free, open-source Integrated Development Environment that runs on several platforms including Windows, Linux, Solaris, and MacOS. It is easy to install and use straight out of the box.

The C/C++ development pack (available as a separate download) adds project types for C and C++ NetBeans Projects and includes appropriate C/C++ templates. NetBeans supports C/C++ applications with dynamic and static libraries, and projects with existing code. It also includes an advanced source-code editor which features code-completion, smart-indenting and syntax-highlighting capabilities. It readily integrates with an existing compiler installation (like gcc), and provides an interactive debugging environment (using gdb as a backend).

Screenshot

1 Configuring scripts

NetBeans uses gmake during the compilation process. To configure NetBeans for use with wmake, a few changes to the wmake script will be necessary. For a quick and easy solution, make a copy of the wmake script (located in $WM_PROJECT_DIR/wmake) in the same directory, and give it a new name (like nbmake, for instance). Edit the file, comment out the section between:

 
#------------------------------------------------------------------------------
# check arguments and change to the directory in which to run wmake
#------------------------------------------------------------------------------
.
.
.
#------------------------------------------------------------------------------
# Check the existance of the Make directory and files file
# If both exist make the wmake derived files
#------------------------------------------------------------------------------

and add these lines:

 
curDir=`pwd`
 
makeOption=""
dir="_"
MakeDir=Make
 
# Check for Debug/Release
if [ $# = 3 ]
then
    if [ $3 = "CONF=Debug" ]
    then
	export WM_COMPILE_OPTION=Debug
    fi
    if [ $3 = "CONF=Release" ]
    then
	export WM_COMPILE_OPTION=Opt
    fi
fi
 
# Check if clean-up was requested... If so, call wclean
if [ $# = 4 ]
then
    if [ $4 = "clean" ]
    then
	echo $0: Clean requested...
	wclean
	exit 0
    fi
fi

An example script for OF-1.3 is available here. And one for OF-1.4.1 is available here. Depending on the install configuration, your mileage may vary.

2 Download

NetBeans is available here.

The C/C++ Development Pack is available here.