Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
ThirdParty-common
Commits
d2da5b44
Commit
d2da5b44
authored
Apr 18, 2017
by
mark
Browse files
ENH: provide make script for MGridGen
- follow the standard *_ARCH_PATH style
parent
59be96fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
BUILD.md
View file @
d2da5b44
...
...
@@ -135,6 +135,9 @@ ThirdParty components prior to building OpenFOAM itself.
Automatically invoked from the ThirdParty
`Allwmake`
,
but can be invoked directly to resolve possible build errors.
`makeMGridGen`
-
Optional agglomeration routines.
`makeCCMIO`
-
Only required for conversion to/from STARCD/STARCCM+ files.
...
...
makeMGridGen
0 → 100755
View file @
d2da5b44
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM 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 General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# makeMGridGen
#
# Description
# Build script for MGridGen (serial)
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Run from ThirdParty directory only
wmakeCheckPwd
"
$WM_THIRD_PARTY_DIR
"
||
{
echo
"Error: Current directory is not
\$
WM_THIRD_PARTY_DIR"
echo
" The environment variables are inconsistent with the installation."
echo
" Check the OpenFOAM entries in your dot-files and source them."
exit
1
}
.
etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
# mgridgen version from OpenFOAM etc/config.sh file:
_foamEtc config.sh/mgridgen
mgridgenPACKAGE
=
${
MGRIDGEN_VERSION
:-
mgridgen
-none
}
#------------------------------------------------------------------------------
usage
()
{
exec
1>&2
while
[
"$#"
-ge
1
]
;
do
echo
"
$1
"
;
shift
;
done
cat
<<
USAGE
usage:
${
0
##*/
}
[OPTION] [mgridgen-VERSION]
options:
-gcc Force gcc/g++ instead of the values from
\$
WM_CC,
\$
WM_CXX
-help
* Build MGridGen
$mgridgenPACKAGE
USAGE
exit
1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[
-n
"
$WM_CC
"
]
&&
export
CC
=
"
$WM_CC
"
[
-n
"
$WM_CXX
"
]
&&
export
CXX
=
"
$WM_CXX
"
# Parse options
while
[
"$#"
-gt
0
]
do
case
"
$1
"
in
-h
|
-help
)
usage
;;
-gcc
)
useGcc
# Use gcc/g++
;;
mgridgen-[1-9]
*
|
MGridGen-[1-9]
*
|
parmgridgen-[1-9]
*
|
ParMGridGen-[1-9]
*
)
mgridgenPACKAGE
=
"
${
1
%%/
}
"
;;
*
)
die
"unknown option/argument: '
$1
'"
;;
esac
shift
done
[
-n
"
$mgridgenPACKAGE
"
]
||
die
"The mgridgen-VERSION was not specified"
# nothing to build
if
_foamIsNone
"
$mgridgenPACKAGE
"
then
echo
"Using mgridgen-none (skip ThirdParty build of MGridGen)"
exit
0
elif
_foamIsSystem
"
$mgridgenPACKAGE
"
then
echo
"Using mgridgen-system"
exit
0
fi
#------------------------------------------------------------------------------
#
# Build MGridGen
# MGRIDGEN_SOURCE_DIR : location of the original sources
# MGRIDGEN_ARCH_PATH : installation directory
MGRIDGEN_SOURCE_DIR
=
$WM_THIRD_PARTY_DIR
/
$mgridgenPACKAGE
MGRIDGEN_ARCH_PATH
=
$installBASE$WM_PRECISION_OPTION$WM_LABEL_OPTION
/
$mgridgenPACKAGE
:
${
FOAM_MPI
:
=dummy
}
echo
echo
========================================
echo
"Build mgridgen library
$mgridgenPACKAGE
"
echo
#
# Manual installation
#
install
()
{
echo
"Install into
$MGRIDGEN_ARCH_PATH
"
local
bindir
=
$MGRIDGEN_ARCH_PATH
/bin
local
incdir
=
$MGRIDGEN_ARCH_PATH
/include
local
libdir
=
$MGRIDGEN_ARCH_PATH
/lib
$WM_COMPILER_LIB_ARCH
for
dir
in
$MGRIDGEN_ARCH_PATH
$bindir
$incdir
$libdir
do
mkdir
-m
0755
-p
$dir
done
cp
-vf
mgridgen.h
$incdir
cp
-vf
libmgrid.a
$libdir
cp
-vf
mgridgen
$bindir
chmod
-R
0644
$incdir
/
*
$libdir
/
*
chmod
-R
0755
$bindir
/
*
}
# Needs future adjustment
# - for shared library
# - for mpi-specific library locations
if
[
-f
$MGRIDGEN_ARCH_PATH
/include/mgridgen.h
\
-a
-r
$MGRIDGEN_ARCH_PATH
/lib
$WM_COMPILER_LIB_ARCH
/libmgrid.a
]
then
echo
" MGridGen header in
$MGRIDGEN_ARCH_PATH
/include"
echo
" MGridGen libs in
$MGRIDGEN_ARCH_PATH
/lib
$WM_COMPILER_LIB_ARCH
"
# static
echo
else
(
cd
$MGRIDGEN_SOURCE_DIR
||
exit
1
[
-e
Makefile
]
&&
make realclean 2>/dev/null
# Remove any existing build folder and recreate
rm
-rf
$MGRIDGEN_ARCH_PATH
serial
=
"
${
CC
:-
$WM_CC
}
"
# CC (serial compiler) default=cc
# parallel=$(whichMpicc) # PARCC (parallel compiler) default=mpicc
# PARCC=$parallel
# PARLD=$parallel
# PARLIBS="-L../.. -lparmgrid -lmgrid -lm"
make
\
COPTIONS
=
"-fPIC"
\
LDOPTIONS
=
"-fPIC"
\
CC
=
$serial
\
LD
=
$serial
\
LIBDIR
=
"-L../.."
\
LIBS
=
"-L../.. -lmgrid -lm"
\
make
=
make
\
serial
\
&&
install
\
&&
echo
"Built:
$mgridgenPACKAGE
"
)
||
{
echo
"Error building:
$mgridgenPACKAGE
"
}
fi
#------------------------------------------------------------------------------
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment