mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: handle wmake -debug option via FOAM_EXTRA_CXX_FLAGS
- ensures that subsequent Allwmake scripts know about it. ENH: add bin/tools/query-detect wrapper for wmake have_* scripts CONFIG: use project/ThirdParty without additional sanity checks - no need to test for Allwmake or platforms/ if ThirdParty is located within the project directory itself. COMP: add simple mpi test to 00-dummy - for testing library linkage, etc.
This commit is contained in:
2
Allwmake
2
Allwmake
@ -18,7 +18,7 @@ fi
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Preamble. Report tools or at least the mpirun location
|
# Preamble. Report tools or at least the mpirun location
|
||||||
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/list_tools ]
|
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/list_tools ]
|
||||||
then . "$WM_PROJECT_DIR"/wmake/scripts/list_tools
|
then sh "$WM_PROJECT_DIR"/wmake/scripts/list_tools || true
|
||||||
else
|
else
|
||||||
echo "mpirun=$(command -v mpirun || true)"
|
echo "mpirun=$(command -v mpirun || true)"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
library/Allwclean
|
||||||
|
|
||||||
wclean libso dummy
|
|
||||||
wclean
|
wclean
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
|
||||||
# Can never be too certain ...
|
|
||||||
# Compile tools for wmake
|
|
||||||
( cd "${WM_DIR:-${WM_PROJECT_DIR}/wmake}/src" && ./Allmake )
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
wmake libso dummy
|
# Toolchain binaries (wmake)
|
||||||
|
"${WM_DIR:-${WM_PROJECT_DIR}/wmake}"/src/Allmake
|
||||||
|
|
||||||
|
library/Allwmake
|
||||||
|
|
||||||
wmake
|
wmake
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
/* Without the normal project defaults */
|
/* Disable normal project defaults */
|
||||||
PROJECT_INC =
|
PROJECT_INC =
|
||||||
PROJECT_LIBS =
|
PROJECT_LIBS =
|
||||||
|
|
||||||
EXE_INC = -Idummy
|
EXE_INC = \
|
||||||
EXE_LIBS = -lOpenFOAM-dummy
|
-I./library
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lTestDummy-OpenFOAM \
|
||||||
|
-L$(FOAM_LIBBIN)/dummy -lTestDummyMpi
|
||||||
|
|||||||
@ -32,6 +32,7 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "dummyLib.H"
|
#include "dummyLib.H"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ constexpr const char* const norm = "\\fR"; // nroff
|
|||||||
constexpr const char* const website = "www.openfoam.com";
|
constexpr const char* const website = "www.openfoam.com";
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using wmake = Foam::Detail::dummyLib;
|
using dummyLib = Foam::Detail::dummyLib;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -71,6 +72,16 @@ static void printMan(const char* exeName)
|
|||||||
|
|
||||||
cout
|
cout
|
||||||
<< ".SH OPTIONS" << nl
|
<< ".SH OPTIONS" << nl
|
||||||
|
<< ".TP" << nl
|
||||||
|
<< "-parallel" << nl
|
||||||
|
<< "Run parallel and provide simple report" << nl;
|
||||||
|
|
||||||
|
if (!Foam::Detail::dummyLib::hasMPI())
|
||||||
|
{
|
||||||
|
cout << "[warning: no mpi]" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout
|
||||||
<< ".TP" << nl
|
<< ".TP" << nl
|
||||||
<< "-help-man" << nl
|
<< "-help-man" << nl
|
||||||
<< "Display manpage" << nl;
|
<< "Display manpage" << nl;
|
||||||
@ -78,28 +89,28 @@ static void printMan(const char* exeName)
|
|||||||
cout
|
cout
|
||||||
<< ".SH INFORMATION" << nl
|
<< ".SH INFORMATION" << nl
|
||||||
<< ".nf" << nl
|
<< ".nf" << nl
|
||||||
<< "label = " << wmake::label_size << nl
|
<< "label = " << dummyLib::label_size << nl
|
||||||
<< "scalar = " << wmake::scalar_size;
|
<< "scalar = " << dummyLib::scalar_size;
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
wmake::solveScalar_size
|
dummyLib::solveScalar_size
|
||||||
&& wmake::solveScalar_size != wmake::scalar_size
|
&& dummyLib::solveScalar_size != dummyLib::scalar_size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
cout
|
cout
|
||||||
<< " [solve=" << wmake::solveScalar_size << "]";
|
<< " [solve=" << dummyLib::solveScalar_size << "]";
|
||||||
}
|
}
|
||||||
cout
|
cout
|
||||||
<< " (" << wmake::precision << ')' << nl
|
<< " (" << dummyLib::precision << ')' << nl
|
||||||
<< "arch = " << wmake::arch << nl
|
<< "arch = " << dummyLib::arch << nl
|
||||||
<< "compiler = " << wmake::compiler << nl;
|
<< "compiler = " << dummyLib::compiler << nl;
|
||||||
|
|
||||||
cout
|
cout
|
||||||
<< nl
|
<< nl
|
||||||
<< "archComp = " << wmake::archComp << nl
|
<< "archComp = " << dummyLib::archComp << nl
|
||||||
<< "archCompBase = " << wmake::archCompBase << nl
|
<< "archCompBase = " << dummyLib::archCompBase << nl
|
||||||
<< "archCompFull = " << wmake::archCompFull << nl;
|
<< "archCompFull = " << dummyLib::archCompFull << nl;
|
||||||
cout
|
cout
|
||||||
<< ".fi" << nl;
|
<< ".fi" << nl;
|
||||||
|
|
||||||
@ -110,43 +121,61 @@ static void printMan(const char* exeName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void printInfo()
|
||||||
|
{
|
||||||
|
cout
|
||||||
|
<< nl
|
||||||
|
<< "OPENFOAM = " << OPENFOAM << nl
|
||||||
|
<< "label = " << dummyLib::label_size << nl
|
||||||
|
<< "scalar = " << dummyLib::scalar_size
|
||||||
|
<< " (" << dummyLib::precision << ')' << nl;
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
dummyLib::solveScalar_size
|
||||||
|
&& dummyLib::solveScalar_size != dummyLib::scalar_size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
cout
|
||||||
|
<< "solve = " << dummyLib::solveScalar_size << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout
|
||||||
|
<< "arch = " << dummyLib::arch << nl
|
||||||
|
<< "compiler = " << dummyLib::compiler << nl;
|
||||||
|
|
||||||
|
cout
|
||||||
|
<< nl
|
||||||
|
<< "archComp = " << dummyLib::archComp << nl
|
||||||
|
<< "archCompBase = " << dummyLib::archCompBase << nl
|
||||||
|
<< "archCompFull = " << dummyLib::archCompFull << nl;
|
||||||
|
|
||||||
|
cout<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Process -help-man
|
bool master = true;
|
||||||
if (argc > 1 && strcmp(argv[1], "-help-man") == 0)
|
|
||||||
|
if (argc > 1)
|
||||||
|
{
|
||||||
|
if (strcmp(argv[1], "-help-man") == 0)
|
||||||
{
|
{
|
||||||
printMan("Test-dummyLib");
|
printMan("Test-dummyLib");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout
|
if (strcmp(argv[1], "-parallel") == 0)
|
||||||
<< nl
|
|
||||||
<< "OPENFOAM = " << OPENFOAM << nl
|
|
||||||
<< "label = " << wmake::label_size << nl
|
|
||||||
<< "scalar = " << wmake::scalar_size
|
|
||||||
<< " (" << wmake::precision << ')' << nl;
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
wmake::solveScalar_size
|
|
||||||
&& wmake::solveScalar_size != wmake::scalar_size
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
cout
|
master = dummyLib::printMPI();
|
||||||
<< "solve = " << wmake::solveScalar_size << nl;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cout
|
if (master)
|
||||||
<< "arch = " << wmake::arch << nl
|
{
|
||||||
<< "compiler = " << wmake::compiler << nl;
|
printInfo();
|
||||||
|
}
|
||||||
cout
|
|
||||||
<< nl
|
|
||||||
<< "archComp = " << wmake::archComp << nl
|
|
||||||
<< "archCompBase = " << wmake::archCompBase << nl
|
|
||||||
<< "archCompFull = " << wmake::archCompFull << nl;
|
|
||||||
|
|
||||||
cout<< nl;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
/* Install into FOAM_LIBBIN to support 'fake' builds (to test packaging) */
|
|
||||||
dummyLib.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libOpenFOAM-dummy
|
|
||||||
11
applications/test/00-dummy/library/Allwclean
Executable file
11
applications/test/00-dummy/library/Allwclean
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wclean dummy
|
||||||
|
|
||||||
|
./Allwclean-mpi
|
||||||
|
|
||||||
|
wclean
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
9
applications/test/00-dummy/library/Allwclean-mpi
Executable file
9
applications/test/00-dummy/library/Allwclean-mpi
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wcleanLibMpi mpi
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
11
applications/test/00-dummy/library/Allwmake
Executable file
11
applications/test/00-dummy/library/Allwmake
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wmake libso dummy
|
||||||
|
|
||||||
|
./Allwmake-mpi
|
||||||
|
|
||||||
|
wmake libso
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
12
applications/test/00-dummy/library/Allwmake-mpi
Executable file
12
applications/test/00-dummy/library/Allwmake-mpi
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
|
||||||
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Environment
|
||||||
|
# - FOAM_MPI_LIBBIN (optional: defaults to FOAM_LIBBIN/FOAM_MPI)
|
||||||
|
|
||||||
|
wmakeLibMpi mpi
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
4
applications/test/00-dummy/library/Make/files
Normal file
4
applications/test/00-dummy/library/Make/files
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/* Install into central FOAM_LIBBIN for 'fake' builds (test packaging) */
|
||||||
|
dummyLib.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libTestDummy-OpenFOAM
|
||||||
@ -8,4 +8,4 @@ EXE_INC = \
|
|||||||
-DWM_COMPILE_OPTION=\"$(WM_COMPILE_OPTION)\" \
|
-DWM_COMPILE_OPTION=\"$(WM_COMPILE_OPTION)\" \
|
||||||
-DWM_OPTIONS=\"$(WM_OPTIONS)\"
|
-DWM_OPTIONS=\"$(WM_OPTIONS)\"
|
||||||
|
|
||||||
/* LIB_LIBS = */
|
LIB_LIBS =
|
||||||
4
applications/test/00-dummy/library/dummy/Make/files
Normal file
4
applications/test/00-dummy/library/dummy/Make/files
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/* Install into central FOAM_LIBBIN/dummy for 'fake' builds (test packaging) */
|
||||||
|
dummyMpiLib.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/dummy/libTestDummyMpi
|
||||||
8
applications/test/00-dummy/library/dummy/Make/options
Normal file
8
applications/test/00-dummy/library/dummy/Make/options
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* Disable normal project defaults */
|
||||||
|
PROJECT_INC =
|
||||||
|
PROJECT_LIBS =
|
||||||
|
|
||||||
|
EXE_INC = \
|
||||||
|
-I../
|
||||||
|
|
||||||
|
/* LIB_LIBS = */
|
||||||
46
applications/test/00-dummy/library/dummy/dummyMpiLib.C
Normal file
46
applications/test/00-dummy/library/dummy/dummyMpiLib.C
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "dummyLib.H"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::Detail::dummyLib::hasMPI()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::Detail::dummyLib::printMPI()
|
||||||
|
{
|
||||||
|
std::cout << "Compiled without mpi\n";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -24,20 +24,22 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::Detail::dummyLib
|
Foam::Detail::dummy
|
||||||
|
|
||||||
Description
|
Description
|
||||||
This class serves little useful purpose, but can be used to compile
|
No useful purpose other than to use the wmake framework to generate
|
||||||
into a dummy library and link against for a minimal application
|
a dummy library for testing/packaging purposes
|
||||||
that uses the wmake framework
|
|
||||||
|
Note
|
||||||
|
Pure C++ without any OpenFOAM classes or libraries.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
dummyLib.C
|
dummyLib.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef dummyLib_H
|
#ifndef testing_dummyLib_H
|
||||||
#define dummyLib_H
|
#define testing_dummyLib_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -80,6 +82,12 @@ struct dummyLib
|
|||||||
|
|
||||||
//- DIY Compile-time value of WM_OPTIONS
|
//- DIY Compile-time value of WM_OPTIONS
|
||||||
static const std::string archCompFull;
|
static const std::string archCompFull;
|
||||||
|
|
||||||
|
//- Compiled/linked with mpi?
|
||||||
|
static bool hasMPI();
|
||||||
|
|
||||||
|
//- Print ranks (trivial mpi test). Return true for master only.
|
||||||
|
static bool printMPI();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
4
applications/test/00-dummy/library/mpi/Make/files
Normal file
4
applications/test/00-dummy/library/mpi/Make/files
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/* Install into central FOAM_MPI_LIBBIN for 'fake' builds (test packaging) */
|
||||||
|
dummyMpiLib.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_MPI_LIBBIN)/libTestDummyMpi
|
||||||
17
applications/test/00-dummy/library/mpi/Make/options
Normal file
17
applications/test/00-dummy/library/mpi/Make/options
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/* Disable normal project defaults */
|
||||||
|
PROJECT_INC =
|
||||||
|
PROJECT_LIBS =
|
||||||
|
|
||||||
|
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
|
||||||
|
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
|
||||||
|
|
||||||
|
/* Default is PROJECT LIB/mpi target */
|
||||||
|
ifeq (,$(FOAM_MPI_LIBBIN))
|
||||||
|
FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXE_INC = \
|
||||||
|
-I.. \
|
||||||
|
$(PFLAGS) $(PINC) $(c++LESSWARN) -DFOAM_MPI=\"$(FOAM_MPI)\"
|
||||||
|
|
||||||
|
LIB_LIBS = $(PLIBS)
|
||||||
76
applications/test/00-dummy/library/mpi/dummyMpiLib.C
Normal file
76
applications/test/00-dummy/library/mpi/dummyMpiLib.C
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "dummyLib.H"
|
||||||
|
#include <iostream>
|
||||||
|
#include <mpi.h>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::Detail::dummyLib::hasMPI()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::Detail::dummyLib::printMPI()
|
||||||
|
{
|
||||||
|
int rank = 0, nprocs = 0;
|
||||||
|
|
||||||
|
MPI_Init(nullptr, nullptr);
|
||||||
|
|
||||||
|
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||||
|
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
||||||
|
|
||||||
|
// Hello world
|
||||||
|
std::cout
|
||||||
|
<<
|
||||||
|
(
|
||||||
|
std::string("mpi rank ")
|
||||||
|
+ std::to_string(rank) + '/' + std::to_string(nprocs)
|
||||||
|
+ '\n'
|
||||||
|
);
|
||||||
|
|
||||||
|
MPI_Finalize();
|
||||||
|
|
||||||
|
#ifdef FOAM_MPI
|
||||||
|
if (rank == 0)
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<<
|
||||||
|
(
|
||||||
|
std::string("FOAM_MPI=") + std::string(FOAM_MPI)
|
||||||
|
+ '\n'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return rank == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
169
bin/tools/query-detect
Executable file
169
bin/tools/query-detect
Executable file
@ -0,0 +1,169 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration |
|
||||||
|
# \\ / A nd | www.openfoam.com
|
||||||
|
# \\/ M anipulation |
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# License
|
||||||
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
#
|
||||||
|
# Script
|
||||||
|
# query-detect
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Calls various wmake 'have_*' scripts with -test to report the
|
||||||
|
# detected software locations
|
||||||
|
#
|
||||||
|
# Environment
|
||||||
|
# Needs the OpenFOAM environment
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
printHelp() {
|
||||||
|
cat<<USAGE
|
||||||
|
|
||||||
|
Usage: ${0##*/} [OPTIONS] [name1 .. [nameN]]
|
||||||
|
options:
|
||||||
|
-all Test all
|
||||||
|
-mode=MODE Pass-through option for foamEtcFile
|
||||||
|
-help Display short help and exit
|
||||||
|
|
||||||
|
Calls various wmake 'have_*' scripts with -test to report the
|
||||||
|
detected software locations
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
exit 0 # A clean exit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Report error and exit
|
||||||
|
die()
|
||||||
|
{
|
||||||
|
exec 1>&2
|
||||||
|
echo
|
||||||
|
echo "Error encountered:"
|
||||||
|
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||||
|
echo
|
||||||
|
echo "See '${0##*/} -help' for usage"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Parse options
|
||||||
|
unset optAall optMode
|
||||||
|
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
(-h | -help*)
|
||||||
|
printHelp
|
||||||
|
;;
|
||||||
|
(-all | all)
|
||||||
|
optAll=true
|
||||||
|
;;
|
||||||
|
(-mode=[ugo]*)
|
||||||
|
optMode="${1#*=}"
|
||||||
|
;;
|
||||||
|
(--)
|
||||||
|
shift
|
||||||
|
break # Stop here
|
||||||
|
;;
|
||||||
|
(-*)
|
||||||
|
echo "Ignore unknown option: $1" 1>&2
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
projectDir="$WM_PROJECT_DIR"
|
||||||
|
scriptsDir="$projectDir/wmake/scripts"
|
||||||
|
|
||||||
|
[ -d "$projectDir" ] || {
|
||||||
|
echo "OpenFOAM environment appears to be missing" 1>&2
|
||||||
|
echo " $projectDir" 1>&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
[ -d "$scriptsDir" ] || {
|
||||||
|
echo "No scripts directory: $scriptsDir" 1>&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$#" = 0 ] && [ -z "$optAll" ]
|
||||||
|
then
|
||||||
|
echo "Nothing specified" 1>&2
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$optMode" ]
|
||||||
|
then
|
||||||
|
export FOAM_CONFIG_MODE="$optMode"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Examine the "wmake/scripts/have_..." scripts for query_...() functions,
|
||||||
|
# assume they also have a -query option
|
||||||
|
|
||||||
|
if [ -n "$optAll" ]
|
||||||
|
then
|
||||||
|
set -- $(
|
||||||
|
for script in "$scriptsDir"/have_*
|
||||||
|
do
|
||||||
|
if [ -f "$script" ]
|
||||||
|
then
|
||||||
|
script="${script##*/}"
|
||||||
|
|
||||||
|
case "$script" in
|
||||||
|
(*.bak | *.orig)
|
||||||
|
;;
|
||||||
|
|
||||||
|
(*)
|
||||||
|
echo "${script#have_}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## echo "Test: $@" 1>&2
|
||||||
|
|
||||||
|
echo "#----------------"
|
||||||
|
# Assume they each have a -test option
|
||||||
|
for name
|
||||||
|
do
|
||||||
|
script="$scriptsDir/have_${name}"
|
||||||
|
case "$name" in
|
||||||
|
(*.bak | *.orig)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo
|
||||||
|
if [ -f "$script" ]
|
||||||
|
then
|
||||||
|
echo "# Detection for '$name'"
|
||||||
|
bash "$script" -test
|
||||||
|
else
|
||||||
|
echo "# No detection support for '$name'"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "#----------------"
|
||||||
|
|
||||||
|
exit 0 # A clean exit
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -39,40 +39,43 @@ source "$WM_PROJECT_DIR/etc/config.csh/functions"
|
|||||||
# [WM_THIRD_PARTY_DIR] - Location of third-party software components
|
# [WM_THIRD_PARTY_DIR] - Location of third-party software components
|
||||||
# \- This may be installed in a directory parallel to the OpenFOAM project
|
# \- This may be installed in a directory parallel to the OpenFOAM project
|
||||||
# directory, with the same version name or using the API value.
|
# directory, with the same version name or using the API value.
|
||||||
# It may also not be required at all, in which case a dummy "ThirdParty"
|
# It may also not be required at all, in which case use a dummy
|
||||||
# directory inside of the OpenFOAM project directory.
|
# "ThirdParty" inside of the OpenFOAM project directory.
|
||||||
#
|
#
|
||||||
# Note: only accept if the directory exists and contains either
|
# Test out-of-source directories for an "Allwmake" file (source)
|
||||||
# a "Allwmake" file (source) or a "platforms" directory (runtime-only)
|
# or a "platforms/" directory (runtime-only)
|
||||||
|
|
||||||
setenv WM_THIRD_PARTY_DIR
|
setenv WM_THIRD_PARTY_DIR "" # Empty value (before detection)
|
||||||
set foundDir=''
|
|
||||||
|
|
||||||
_foamEcho "Locating ThirdParty directory"
|
if ( -e "$WM_PROJECT_DIR/ThirdParty" ) then
|
||||||
|
# Directory or file (masks use of ThirdParty entirely)
|
||||||
foreach foamDir (\
|
setenv WM_THIRD_PARTY_DIR "$WM_PROJECT_DIR/ThirdParty"
|
||||||
"$WM_PROJECT_DIR/ThirdParty" \
|
else
|
||||||
|
_foamEcho "Locating ThirdParty directory"
|
||||||
|
foreach foundDir (\
|
||||||
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
|
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
|
||||||
"$prefixDir/ThirdParty-v$FOAM_API" \
|
"$prefixDir/ThirdParty-v$FOAM_API" \
|
||||||
"$prefixDir/ThirdParty-$FOAM_API" \
|
"$prefixDir/ThirdParty-$FOAM_API" \
|
||||||
"$prefixDir/ThirdParty-common" \
|
"$prefixDir/ThirdParty-common" \
|
||||||
)
|
)
|
||||||
_foamEcho "... $foamDir"
|
_foamEcho "... $foundDir"
|
||||||
if ( -d "$foamDir" ) then
|
if ( -d "$foundDir" ) then
|
||||||
if ( -f "$foamDir/Allwmake" || -d "$foamDir/platforms" ) then
|
if ( -f "$foundDir/Allwmake" || -d "$foundDir/platforms" ) then
|
||||||
setenv WM_THIRD_PARTY_DIR "$foamDir"
|
setenv WM_THIRD_PARTY_DIR "$foundDir"
|
||||||
set foundDir=true
|
|
||||||
break
|
break
|
||||||
|
else
|
||||||
|
_foamEcho " does not have Allwmake or platforms/"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
|
endif
|
||||||
|
|
||||||
if ("${foundDir}" == true) then
|
if ("${WM_THIRD_PARTY_DIR}" == "") then
|
||||||
_foamEcho "Using $WM_THIRD_PARTY_DIR"
|
|
||||||
else
|
|
||||||
# Dummy fallback value
|
# Dummy fallback value
|
||||||
setenv WM_THIRD_PARTY_DIR "$WM_PROJECT_DIR/ThirdParty"
|
setenv WM_THIRD_PARTY_DIR "$WM_PROJECT_DIR/ThirdParty"
|
||||||
_foamEcho "Dummy $WM_THIRD_PARTY_DIR"
|
_foamEcho "Dummy ThirdParty $WM_THIRD_PARTY_DIR"
|
||||||
|
else
|
||||||
|
_foamEcho "ThirdParty $WM_THIRD_PARTY_DIR"
|
||||||
endif
|
endif
|
||||||
# Done with ThirdParty discovery
|
# Done with ThirdParty discovery
|
||||||
|
|
||||||
@ -206,6 +209,6 @@ unalias _foamAddLib
|
|||||||
unalias _foamAddLibAuto
|
unalias _foamAddLibAuto
|
||||||
|
|
||||||
# Variables (done as final statement for a clean exit code)
|
# Variables (done as final statement for a clean exit code)
|
||||||
unset cleaned foamOldDirs foundDir foamDir prefixDir
|
unset cleaned foamOldDirs foundDir prefixDir
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -40,44 +40,49 @@ unset WM_SHELL_FUNCTIONS
|
|||||||
# [WM_THIRD_PARTY_DIR] - Location of third-party software components
|
# [WM_THIRD_PARTY_DIR] - Location of third-party software components
|
||||||
# \- This may be installed in a directory parallel to the OpenFOAM project
|
# \- This may be installed in a directory parallel to the OpenFOAM project
|
||||||
# directory, with the same version name or using the API value.
|
# directory, with the same version name or using the API value.
|
||||||
# It may also not be required at all, in which case a dummy "ThirdParty"
|
# It may also not be required at all, in which case use a dummy
|
||||||
# directory inside of the OpenFOAM project directory.
|
# "ThirdParty" inside of the OpenFOAM project directory.
|
||||||
#
|
#
|
||||||
# Note: only accept if the directory exists and contains either
|
# Test out-of-source directories for an "Allwmake" file (source)
|
||||||
# a "Allwmake" file (source) or a "platforms" directory (runtime-only)
|
# or a "platforms/" directory (runtime-only)
|
||||||
|
|
||||||
export WM_THIRD_PARTY_DIR
|
export WM_THIRD_PARTY_DIR="" # Empty value (before detection)
|
||||||
unset foundDir
|
|
||||||
|
|
||||||
_foamEcho "Locating ThirdParty directory"
|
if [ -e "$WM_PROJECT_DIR/ThirdParty" ]
|
||||||
|
then
|
||||||
for WM_THIRD_PARTY_DIR in \
|
# Directory or file (masks use of ThirdParty entirely)
|
||||||
"$WM_PROJECT_DIR/ThirdParty" \
|
WM_THIRD_PARTY_DIR="$WM_PROJECT_DIR/ThirdParty"
|
||||||
|
else
|
||||||
|
_foamEcho "Locating ThirdParty directory"
|
||||||
|
for foundDir in \
|
||||||
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
|
"$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
|
||||||
"$prefixDir/ThirdParty-v$FOAM_API" \
|
"$prefixDir/ThirdParty-v$FOAM_API" \
|
||||||
"$prefixDir/ThirdParty-$FOAM_API" \
|
"$prefixDir/ThirdParty-$FOAM_API" \
|
||||||
"$prefixDir/ThirdParty-common" \
|
"$prefixDir/ThirdParty-common" \
|
||||||
;
|
;
|
||||||
do
|
do
|
||||||
_foamEcho "... $WM_THIRD_PARTY_DIR"
|
_foamEcho "... $foundDir"
|
||||||
if [ -d "$WM_THIRD_PARTY_DIR" ]
|
if [ -d "$foundDir" ]
|
||||||
then
|
then
|
||||||
if [ -f "$WM_THIRD_PARTY_DIR/Allwmake" ] || \
|
if [ -f "$foundDir/Allwmake" ] || \
|
||||||
[ -d "$WM_THIRD_PARTY_DIR/platforms" ]
|
[ -d "$foundDir/platforms" ]
|
||||||
then
|
then
|
||||||
foundDir=true
|
WM_THIRD_PARTY_DIR="$foundDir"
|
||||||
break
|
break
|
||||||
|
else
|
||||||
|
_foamEcho " does not have Allwmake or platforms/"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$foundDir" ]
|
if [ -z "$WM_THIRD_PARTY_DIR" ]
|
||||||
then
|
then
|
||||||
_foamEcho "Using $WM_THIRD_PARTY_DIR"
|
|
||||||
else
|
|
||||||
# Dummy fallback value
|
# Dummy fallback value
|
||||||
WM_THIRD_PARTY_DIR="$WM_PROJECT_DIR/ThirdParty"
|
WM_THIRD_PARTY_DIR="$WM_PROJECT_DIR/ThirdParty"
|
||||||
_foamEcho "Dummy $WM_THIRD_PARTY_DIR"
|
_foamEcho "Dummy ThirdParty $WM_THIRD_PARTY_DIR"
|
||||||
|
else
|
||||||
|
_foamEcho "ThirdParty $WM_THIRD_PARTY_DIR"
|
||||||
fi
|
fi
|
||||||
# Done with ThirdParty discovery
|
# Done with ThirdParty discovery
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,7 @@
|
|||||||
# Copyright (C) 2019 OpenCFD Ltd.
|
# Copyright (C) 2019 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# list_tools
|
# list_tools
|
||||||
|
|||||||
28
wmake/wmake
28
wmake/wmake
@ -195,7 +195,7 @@ allCores()
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Default to compiling the local target only
|
# Default to compiling the local target only
|
||||||
unset optAll optUpdate optDebug optQuiet optShow optPwd
|
unset optAll optUpdate optCxx optDebug optQuiet optShow optPwd
|
||||||
|
|
||||||
# Consistency with inherited values
|
# Consistency with inherited values
|
||||||
if [ "$WM_QUIET" = true ]
|
if [ "$WM_QUIET" = true ]
|
||||||
@ -231,7 +231,7 @@ do
|
|||||||
export WM_QUIET=true
|
export WM_QUIET=true
|
||||||
;;
|
;;
|
||||||
-debug)
|
-debug)
|
||||||
optDebug="-DFULLDEBUG -g -O0"
|
optDebug=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-module-prefix=*)
|
-module-prefix=*)
|
||||||
@ -489,13 +489,29 @@ unset exitCode
|
|||||||
# Recurse the source tree to compile "all" targets
|
# Recurse the source tree to compile "all" targets
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -n "$optDebug" ]
|
||||||
|
then
|
||||||
|
# Convey -debug via FOAM_EXTRA_CXXFLAGS
|
||||||
|
optDebug="-DFULLDEBUG -g"
|
||||||
|
oldFlags="$FOAM_EXTRA_CXXFLAGS"
|
||||||
|
|
||||||
|
case "$oldFlags" in
|
||||||
|
(*-DFULLDEBUG*)
|
||||||
|
# Already there
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
export FOAM_EXTRA_CXXFLAGS="$oldFlags${oldFlags:+ }$optDebug"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$optAll" = all ]
|
if [ "$optAll" = all ]
|
||||||
then
|
then
|
||||||
if [ -e Allwmake.override ]
|
if [ -e Allwmake.override ]
|
||||||
then
|
then
|
||||||
if [ -x Allwmake.override ]
|
if [ -x Allwmake.override ]
|
||||||
then
|
then
|
||||||
./Allwmake.override -fromWmake ${optDebug:+-debug} $targetType
|
./Allwmake.override -fromWmake $targetType
|
||||||
exitCode="$?"
|
exitCode="$?"
|
||||||
else
|
else
|
||||||
# Allow empty or non-executable file (eg, touch Allwmake.override)
|
# Allow empty or non-executable file (eg, touch Allwmake.override)
|
||||||
@ -503,7 +519,7 @@ then
|
|||||||
fi
|
fi
|
||||||
elif [ -e Allwmake ]
|
elif [ -e Allwmake ]
|
||||||
then
|
then
|
||||||
./Allwmake -fromWmake ${optDebug:+-debug} $targetType
|
./Allwmake -fromWmake $targetType
|
||||||
exitCode="$?"
|
exitCode="$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -531,7 +547,6 @@ then
|
|||||||
# Compile all applications in sub-directories
|
# Compile all applications in sub-directories
|
||||||
$make ${WM_CONTINUE_ON_ERROR:+-k} \
|
$make ${WM_CONTINUE_ON_ERROR:+-k} \
|
||||||
-f $WM_DIR/makefiles/apps \
|
-f $WM_DIR/makefiles/apps \
|
||||||
${optDebug:+c++DBUG="$optDebug"} \
|
|
||||||
TARGET="$targetType" FOAM_APPS="$FOAM_APPS"
|
TARGET="$targetType" FOAM_APPS="$FOAM_APPS"
|
||||||
exitCode=$?
|
exitCode=$?
|
||||||
fi
|
fi
|
||||||
@ -558,7 +573,7 @@ then
|
|||||||
"$WM_SCHEDULER" -clean \
|
"$WM_SCHEDULER" -clean \
|
||||||
&& wmake -all objects \
|
&& wmake -all objects \
|
||||||
&& "$WM_SCHEDULER"
|
&& "$WM_SCHEDULER"
|
||||||
) && wmake -all ${optDebug:+-debug}
|
) && wmake -all
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -678,7 +693,6 @@ fi
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
exec $make -f $WM_DIR/makefiles/general \
|
exec $make -f $WM_DIR/makefiles/general \
|
||||||
${optDebug:+c++DBUG="$optDebug"} \
|
|
||||||
MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir $targetType
|
MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir $targetType
|
||||||
|
|
||||||
exit 0 # clean exit
|
exit 0 # clean exit
|
||||||
|
|||||||
Reference in New Issue
Block a user