Compilation: Update for native MS Windows build. Cesare Guardino

This commit is contained in:
Hrvoje Jasak 2016-06-03 17:13:21 +01:00
parent 564a76cc82
commit 3df928d553
11 changed files with 71 additions and 338 deletions

View file

@ -69,8 +69,10 @@ echo "Build foam-extend ... (see `pwd`/Allwmake.log)"
./Allwmake > Allwmake.log 2>&1
echo "Copying MinGW dependencies to $FOAM_APPBIN ..."
cp -p $MINGW_HOME/bin/libgcc_s_seh-1.dll $FOAM_APPBIN
cp -p $MINGW_HOME/bin/libgomp-1.dll $FOAM_APPBIN
cp -p $MINGW_HOME/bin/libstdc++-6.dll $FOAM_APPBIN
cp -p $MINGW_HOME/bin/libwinpthread-1.dll $FOAM_APPBIN
cp -p $WM_THIRD_PARTY_DIR/packages/pthreads-w32-2-9-1-release/Pre-built.2/dll/x64/pthreadGC2.dll $FOAM_APPBIN
echo "Creating release package ... (see `pwd`/createWindowsBinaryPackage.log)"
./bin/createWindowsBinaryPackage > createWindowsBinaryPackage.log 2>&1

View file

@ -1,290 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::floatScalar
Description
single floating point number identical to float
SourceFiles
floatScalar.C
\*---------------------------------------------------------------------------*/
#ifndef floatScalar_H
#define floatScalar_H
#include "label.H"
#include "word.H"
#include <cmath>
#ifdef ibm
float lgamma(float);
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Define floatScalar as a float
namespace Foam
{
typedef float floatScalar;
}
/*
// Define floatScalar as a float
namespace Foam
{
typedef float floatScalar;
// Largest and smallest floatScalar values allowed in certain parts of the code
// (6 is the number of significant figures in an
// IEEE single precision number. See limits.h or float.h)
static const floatScalar GREAT = 1.0e+6;
static const floatScalar VGREAT = 1.0e+37;
static const floatScalar SMALL = 1.0e-6;
static const floatScalar VSMALL = 1.0e-37;
}
*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pTraits.H"
#include "products.H"
#include "direction.H"
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// template specialisation for pTraits<floatScalar>
template<>
class pTraits<floatScalar>
{
floatScalar p_;
public:
//- Component type
typedef floatScalar cmptType;
// Member constants
enum
{
dim = 3, // Dimensionality of space
rank = 0, // Rank od floatScalar is 0
nComponents = 1 // Number of components in floatScalar is 1
};
// Static data members
static const char* const typeName;
static const char* componentNames[];
static const floatScalar zero;
static const floatScalar one;
// Constructors
//- Construct from Istream
pTraits(Istream& is);
// Member Functions
operator floatScalar() const
{
return p_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//template<class Cmpt>
//class typeOfRank<Cmpt, 0>
//{
//public:
//
// typedef Cmpt type;
//};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Return a string representation of a floatScalar
word name(const floatScalar s)
{
return name(scalar(s));
}
#define MAXMINPOW(retType, type1, type2) \
\
MAXMIN(retType, type1, type2) \
\
inline float pow(const type1 s, const type2 e) \
{ \
return ::pow(float(s), float(e)); \
}
//MAXMINPOW(float, float, float)
//MAXMINPOW(float, float, int)
//MAXMINPOW(float, int, float)
//MAXMINPOW(float, float, long)
//MAXMINPOW(float, long, float)
//MAXMINPOW(float, float, int)
//MAXMINPOW(float, int, float)
//MAXMINPOW(float, float, long)
//MAXMINPOW(float, long, float)
#undef MAXMINPOW
inline floatScalar mag(const floatScalar s)
{
return ::fabs(s);
}
inline floatScalar sign(const floatScalar s)
{
return (s >= 0)? 1: -1;
}
inline floatScalar pos(const floatScalar s)
{
return (s >= 0)? 1: 0;
}
inline floatScalar neg(const floatScalar s)
{
return (s < 0)? 1: 0;
}
inline floatScalar limit(const floatScalar s1, const floatScalar s2)
{
return (mag(s1) < mag(s2))? s1: 0.0;
}
inline floatScalar magSqr(const floatScalar s)
{
return s*s;
}
inline floatScalar sqr(const floatScalar s)
{
return s*s;
}
inline floatScalar pow3(const floatScalar s)
{
return s*s*s;
}
inline floatScalar pow4(const floatScalar s)
{
return sqr(sqr(s));
}
inline floatScalar cmptAv(const floatScalar s)
{
return s;
}
inline floatScalar cmptMag(const floatScalar s)
{
return mag(s);
}
inline floatScalar scale(const floatScalar s, const floatScalar d)
{
return s*d;
}
#define transFunc(func) \
inline floatScalar func(const floatScalar s) \
{ \
return ::func(s); \
}
// Standard C++ transcendental functions
transFunc(sqrt)
transFunc(exp)
transFunc(log)
transFunc(log10)
transFunc(sin)
transFunc(cos)
transFunc(tan)
transFunc(asin)
transFunc(acos)
transFunc(atan)
transFunc(sinh)
transFunc(cosh)
transFunc(tanh)
transFunc(asinh)
transFunc(acosh)
transFunc(atanh)
// Standard ANSI-C (but not in <cmath>) transcendental functions
transFunc(erf)
transFunc(erfc)
transFunc(lgamma)
transFunc(j0)
transFunc(j1)
transFunc(y0)
transFunc(y1)
#undef transFunc
// Stabilisation around zero for division
inline floatScalar stabilise(const floatScalar s, const floatScalar small)
{
if (s >= 0)
{
return s + small;
}
else
{
return s - small;
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
//floatScalar readScalar(Istream& is);
Istream& operator>>(Istream&, floatScalar&);
Ostream& operator<<(Ostream&, const floatScalar);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -93,6 +93,9 @@ echo "Copying extra files from bin directory ..."
cp -p $WM_PROJECT_DIR/bin/setWindowsEnvironment.bat $PACKAGE_DIR/
cp -p $WM_PROJECT_DIR/bin/foamWindowsShell.bat $PACKAGE_DIR/
cp -p $WM_PROJECT_DIR/bin/paraFoam.bat $PACKAGE_DIR/bin
unix2dos $PACKAGE_DIR/setWindowsEnvironment.bat
unix2dos $PACKAGE_DIR/foamWindowsShell.bat
unix2dos $PACKAGE_DIR/bin/paraFoam.bat
echo "Copying extra files from etc directory ..."
mkdir $PACKAGE_DIR/etc
@ -103,8 +106,13 @@ echo "Copying doc and license files ..."
cp -p $WM_PROJECT_DIR/doc/buildInstructions/Windows/READMEBinaryPackage.txt $PACKAGE_DIR/
cp -p $WM_PROJECT_DIR/COPYING $PACKAGE_DIR/LICENSE.txt
unix2dos $PACKAGE_DIR/LICENSE.txt
unix2dos $PACKAGE_DIR/READMEBinaryPackage.txt
echo "Creating archives ..."
create_package $PACKAGE_DIR zip
create_package $PACKAGE_DIR 7z
echo "Removing package directory ..."
rm -rf $PACKAGE_DIR
echo "All done!"

View file

@ -6,7 +6,7 @@ call %FOAM_HOME%\setWindowsEnvironment.bat
mode 160,40
color 81
echo ---------------------------------
echo Command shell for foam-extend-3.1
echo Command shell for foam-extend-4.0
echo ---------------------------------
echo/
cmd.exe

View file

@ -13,4 +13,4 @@ set MPI_BUFFER_SIZE=20000000
if defined PARAVIEW_HOME set PATH=%PARAVIEW_HOME%\bin;%PATH%
if defined MPI_ROOTDIR set PATH=%MPI_ROOTDIR%\bin;%PATH%
set PATH=%FOAM_HOME%\lib;%FOAM_HOME%\lib\openmpi-1.6.1;%FOAM_HOME%\bin;%PATH%
set PATH=%FOAM_HOME%\lib;%FOAM_HOME%\bin;%PATH%

View file

@ -1,7 +1,7 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 3.2
# \\ / O peration | Version: 4.0
# \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------
@ -53,25 +53,16 @@ already have the correct tools installed on your system.
version numbers.
3) Download and install MSYS (see reference list below). If this is your first
use of MSYS, create a file fstab in c/MinGW/msys/1.0/etc with single-line
contents:
use of MSYS, create a file fstab in c/MinGW/msys/1.0/etc with single-line contents:
c:/mingw /mingw
to mount your home directory (this assumes you have installed MSYS to the default
c:/MinGW directory).
From Windows, you will find your home directory under
This mounts your home directory (this assumes you have installed MSYS to the default
c:/MinGW directory). From Windows, you will find your home directory under
c:/MinGW/msys/1.0/home/<user name>
4) Download the foam-extend source code from
4) Download the foam-extend 4.0 source code using Git:
git clone -b nextRelease http://git.code.sf.net/p/foam-extend/foam-extend-3.2 foam-extend-4.0
http://sourceforge.net/projects/openfoam-extend/
using the command:
git clone --branch nextRelease git://git.code.sf.net/p/foam-extend/foam-extend-3.2
5) Open a new MSYS shell and chdir to your foam-extend-3.2 source directory.
5) Open a new MSYS shell and chdir to your foam-extend-4.0 source directory.
6) Edit the user-modifiable entries in etc/bashrc.mingw to point to the
locations where you have installed the required system tools in the first two
@ -102,7 +93,7 @@ already have the correct tools installed on your system.
approach for developers.
(b). From a standard Windows CMD.exe command prompt using the created
foam-extend-3.2-win-x64.zip stand-alone package. This can be used on any
foam-extend-4.0-win-x64.{7z,zip} stand-alone package. This can be used on any
Windows machine without access to MSYS shells or compilers. See the
READMEBinaryPackage.txt contained within the package for further details.
@ -162,10 +153,10 @@ Version: 0.44 (or above)
URL : http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/pexports-0.46/pexports-0.46-mingw32-bin.tar.xz/download
For : Extracting symbols from OpenMPI DLLs to pass to dlltool.exe (supplied in MinGW-w64 package). Move directory "bin" to "pexports-0.46" after unpacking.
Name : Pyhton
Name : Python
Version: 2.7
URL : https://www.python.org/download/releases/2.7/
For : Not essential
For : Running Python scripts. Not essential
Name : Strawberry Perl
Version: 5.20.2.1 (or above)
@ -175,15 +166,13 @@ For : Running Perl scripts, "pexports.exe" and "gmake.exe" utilities
Name : Subversion
Version: 1.8.13
URL : http://sourceforge.net/projects/win32svn/files/1.8.13/
For : ??????????
For : Version control system. Not essential.
Name : wget
Version: 1.11.4-1 (or above)
URL : http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-bin.zip, http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-dep.zip, http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-doc.zip
For : Automatically downloading files from internet (eg. for use in automated build scripts)
git clone --branch nextRelease git://git.code.sf.net/p/openfoam-extend/foam-extend-3.1
4. EXAMPLE OUTPUT FROM SOURCING etc/bashrc.mingw
================================================

View file

@ -1,7 +1,7 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 3.2
# \\ / O peration | Version: 4.0
# \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------
@ -87,3 +87,6 @@ NOTES
1) This version does not fully support runtime selection of extended features. If necessary, you can
explicitly load the required DLL using the "libs" function in system/controlDict, for example:
libs ("liblduSolvers.dll");
2) The original foam-extend 4.0 source code is available from Git:
git clone -b nextRelease http://git.code.sf.net/p/foam-extend/foam-extend-3.2 foam-extend-4.0

View file

@ -42,14 +42,15 @@ export PROGRAMS_HOME=/c/Programs
set_system_paths() {
echo "Setting environment variables for user-defined installed system tools and utilities ..."
export CMAKE_HOME=$PROGRAMS_HOME/cmake-3.2.3-win32-x86
export GIT_HOME=$PROGRAMS_HOME/Git
export MINGW_HOME=$PROGRAMS_HOME/mingw64
#export GIT_HOME=$PROGRAMS_HOME/Git
#export JAVA_HOME="/c/Program Files/Java/jre1.8.0_45"
export MINGW_HOME=$PROGRAMS_HOME/x86_64-4.8.2-release-win32-seh-rt_v3-rev3/mingw64
export MPI_ROOTDIR=$PROGRAMS_HOME/OpenMPI_v1.6.1-x64
export PARAVIEW_HOME=$PROGRAMS_HOME/ParaView-4.3.1
#export PERL_HOME=$PROGRAMS_HOME/strawberry-perl-5.20.2.1-64bit/perl
export PEXPORTS_HOME=$PROGRAMS_HOME/pexports-0.46
export PYTHON_HOME=$PROGRAMS_HOME/Python27
export SUBVERSION_HOME=$PROGRAMS_HOME/svn-win32-1.8.13
export PERL_HOME=$PROGRAMS_HOME/strawberry-perl-5.20.2.1-64bit/perl
#export PEXPORTS_HOME=$PROGRAMS_HOME/pexports-0.46-mingw32
#export PYTHON_HOME=$PROGRAMS_HOME/Python27
#export SUBVERSION_HOME=$PROGRAMS_HOME/svn-win32-1.8.13
export WGET_HOME=$PROGRAMS_HOME/wget-1.11.4-1
export ZIP_HOME="/c/Program Files/7-Zip"
}
@ -59,16 +60,16 @@ add_to_path() {
echo "Adding user-defined installed system tools to PATH ..."
export PATH=$ZIP_HOME:$PATH
export PATH=$WGET_HOME/bin:$PATH
export PATH=$PYTHON_HOME:$PATH
export PATH=$SUBVERSION_HOME/bin:$PATH
export PATH=$GIT_HOME/cmd:$PATH
#export PATH=$PERL_HOME/bin:$PATH
#export PATH=$JAVA_HOME/bin:$PATH
#export PATH=$PYTHON_HOME:$PATH
#export PATH=$SUBVERSION_HOME/bin:$PATH
#export PATH=$GIT_HOME/cmd:$PATH
export PATH=$PARAVIEW_HOME/bin:$PATH
export PATH=$PERL_HOME/bin:$PATH
export PATH=$CMAKE_HOME/bin:$PATH
export PATH=$PEXPORTS_HOME/bin:$PATH
export PATH=$MINGW_HOME/bin:$PATH
# MPI comes last to enforce the path
export PATH=$MPI_ROOTDIR/bin:$PATH
#export PATH=$PEXPORTS_HOME/bin:$PATH
export PATH=$MINGW_HOME/bin:$PATH
}
# }}}

17
etc/dosrc.mingw.bat Normal file
View file

@ -0,0 +1,17 @@
@echo off
rem =========== USER EDITABLE SETTINGS ===========
set MPI_ROOTDIR=C:\Programs\OpenMPI_v1.6.1-x64
set PARAVIEW_HOME=C:\Programs\ParaView-4.3.1
rem ==============================================
set FOAM_HOME=%~dp0..
set WM_PROJECT_DIR=%FOAM_HOME%
set MPI_BUFFER_SIZE=20000000
if defined PARAVIEW_HOME set PATH=%PARAVIEW_HOME%\bin;%PATH%
if defined MPI_ROOTDIR set PATH=%MPI_ROOTDIR%\bin;%PATH%
set PATH=%FOAM_HOME%\lib\mingwGccDPOpt;%FOAM_HOME%\applications\bin\mingwGccDPOpt;%FOAM_HOME%\bin;%PATH%
set PATH=%FOAM_HOME%\..\site\4.0\lib\mingwGccDPOpt;%FOAM_HOME%\..\site\4.0\bin\mingwGccDPOpt;%PATH%

View file

@ -64,7 +64,11 @@ CLASSES_DIR = $(MAKE_DIR)/classes
SYS_INC =
SYS_LIBS =
ifeq ($(WM_ARCH_BASE),mingw)
PROJECT_INC = -I$(FOAM_SRC) -I$(FOAM_APP) -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
else
PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
endif
PROJECT_LIBS = -l$(WM_PROJECT)
PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g'))

13
wmake/genInclude.pl Normal file → Executable file
View file

@ -52,16 +52,15 @@ $cwd =~ s/lnInclude//;
$source =~ s/$cwd//;
my $dir = $cwd;
$dir =~ s/^.*\/src\///;
if ($dir =~ /^.*\/src\//) {
$dir =~ s/^.*\/src\///;
}
elsif ($dir =~ /^.*\/applications\//) {
$dir =~ s/^.*\/applications\///;
}
my $link = $dir . $source;
my $incGuardName = uc "INC_$fileName";
$incGuardName =~ s/\./_/;
open (FILE, '>', $fileName) or die ("ERROR: Can't open '$fileName' [$!]");
print FILE "#ifndef $incGuardName\n";
print FILE "#define $incGuardName\n";
print FILE "#include \"$link\"\n";
print FILE "#endif\n";
close (FILE);