-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·86 lines (74 loc) · 2.2 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
######### Add your inputs ######
OPENFOAM_ROOT=$HOME/OpenFOAM/OpenFOAM-2.3.1
################################
SRC_DIR=`pwd`
OF_SRC_DIR=$SRC_DIR/mesh
#### Creates the OpenFOAM make files
of_makefile()
{
if [ ! -e "$OF_SRC_DIR/Make" ]; then
echo "Creating Make folder"
mkdir $OF_SRC_DIR/Make
fi
##### Create Make/files
echo "$OF_SRC_DIR/ofreader.cpp" > $OF_SRC_DIR/Make/files
echo "LIB = $SRC_DIR/libCc_ofreader" >> $OF_SRC_DIR/Make/files
##### Create Make/options
echo "EXE_INC = \\" > $OF_SRC_DIR/Make/options
echo "-g -I\$(LIB_SRC)/finiteVolume/lnInclude \\" >> $OF_SRC_DIR/Make/options
echo "-I\$(LIB_SRC)/meshTools/lnInclude \\" >> $OF_SRC_DIR/Make/options
echo "-I$SRC_DIR/mesh" >> $OF_SRC_DIR/Make/options
echo "" >> $OF_SRC_DIR/Make/options
echo "" >> $OF_SRC_DIR/Make/options
echo "EXE_LIBS = \\" >> $OF_SRC_DIR/Make/options
echo " -lfiniteVolume -lmeshTools" >> $OF_SRC_DIR/Make/options
echo "" >> $OF_SRC_DIR/Make/options
}
write_of_make_inc()
{
echo "OF_BASHRC=$OPENFOAM_ROOT/etc/bashrc" > $SRC_DIR/make.of.inc
echo "OF_LDFLAGS=-L$SRC_DIR -L$FOAM_LIBBIN" >> $SRC_DIR/make.of.inc
echo "OF_LIBS=-lCc_ofreader -lfiniteVolume" >> $SRC_DIR/make.of.inc
}
write_Cc_script()
{
echo "#!/bin/bash" > $SRC_DIR/Cc
echo "source $OPENFOAM_ROOT/etc/bashrc" >> $SRC_DIR/Cc
echo "$SRC_DIR/Cc.x $1 $2" >> $SRC_DIR/Cc
chmod +x $SRC_DIR/Cc
}
install_luajit()
{
cd $SRC_DIR/luajit-2.0
mv Makefile Makefile.old
sed 's#/usr/local#'$SRC_DIR'/lua#' Makefile.old > Makefile
make clean
make install
}
install_luaposix()
{
cd $SRC_DIR/luaposix
LUA=$SRC_DIR/lua/bin/luajit CFLAGS=-I$SRC_DIR/lua/include/luajit-2.0 ./configure --prefix=$SRC_DIR/lua
make clean
make install
}
##### Create the OpenFOAM Make script ###
if [ "$OPENFOAM_ROOT" ]; then
if [ -f "$OPENFOAM_ROOT/etc/bashrc" ]; then
source $OPENFOAM_ROOT/etc/bashrc
of_makefile
write_of_make_inc
write_Cc_script
cd $OF_SRC_DIR
wclean; wmake
install_luajit
else
echo "The OpenFOAM bashrc script does not exist at $OPENFOAM_ROOT/etc/bashrc"
echo "Check the path set in OPENFOAM_ROOT"
exit 0
fi
else
echo "Set the OPENFOAM_ROOT variable to the OpenFOAM source"
exit 0
fi