mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: add minimal test application
- uses wmake, without OpenFOAM libraries. The application and libray serve as a minimal test case for wmake, but can also be used to generate a minimal library/executable pair target for testing of packaging etc.
This commit is contained in:
7
applications/test/00-dummy/Allwclean
Executable file
7
applications/test/00-dummy/Allwclean
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
|
wclean libso dummy
|
||||||
|
wclean
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
13
applications/test/00-dummy/Allwmake
Executable file
13
applications/test/00-dummy/Allwmake
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
|
# Can never be too certain ...
|
||||||
|
# Compile tools for wmake
|
||||||
|
( cd "${WM_DIR:?}/src" && make )
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wmake libso dummy
|
||||||
|
wmake
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
3
applications/test/00-dummy/Make/files
Normal file
3
applications/test/00-dummy/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-dummyLib.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/Test-dummyLib
|
||||||
9
applications/test/00-dummy/Make/options
Normal file
9
applications/test/00-dummy/Make/options
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/* Without the normal defaults */
|
||||||
|
PROJECT_INC =
|
||||||
|
PROJECT_LIBS =
|
||||||
|
|
||||||
|
|
||||||
|
EXE_INC = -Idummy
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lOpenFOAM-dummy
|
||||||
65
applications/test/00-dummy/Test-dummyLib.C
Normal file
65
applications/test/00-dummy/Test-dummyLib.C
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 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/>.
|
||||||
|
|
||||||
|
Description
|
||||||
|
Minimal compilation test with wmake, without OpenFOAM libraries.
|
||||||
|
|
||||||
|
The application and libray can also serve as a minimal test case for
|
||||||
|
wmake, or to provide a minimal library/executable target for testing.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "dummyLib.H"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
using wmake = Foam::Detail::dummyLib;
|
||||||
|
|
||||||
|
std::cout
|
||||||
|
<< '\n'
|
||||||
|
<< "OPENFOAM = " << OPENFOAM << '\n'
|
||||||
|
<< "label = " << wmake::label_size << '\n'
|
||||||
|
<< "scalar = " << wmake::scalar_size
|
||||||
|
<< " (" << wmake::precision << ")\n"
|
||||||
|
<< "arch = " << wmake::arch << '\n'
|
||||||
|
<< "compiler = " << wmake::compiler << '\n';
|
||||||
|
|
||||||
|
|
||||||
|
std::cout
|
||||||
|
<< '\n'
|
||||||
|
<< "archComp = " << wmake::archComp << '\n'
|
||||||
|
<< "archCompBase = " << wmake::archCompBase << '\n'
|
||||||
|
<< "archCompFull = " << wmake::archCompFull << '\n';
|
||||||
|
|
||||||
|
std::cout
|
||||||
|
<< '\n';
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
3
applications/test/00-dummy/dummy/Make/files
Normal file
3
applications/test/00-dummy/dummy/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
dummyLib.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libOpenFOAM-dummy
|
||||||
12
applications/test/00-dummy/dummy/Make/options
Normal file
12
applications/test/00-dummy/dummy/Make/options
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/* Without the normal defaults */
|
||||||
|
PROJECT_INC =
|
||||||
|
PROJECT_LIBS =
|
||||||
|
|
||||||
|
EXE_INC = \
|
||||||
|
-DWM_ARCH=\"$(WM_ARCH)\" \
|
||||||
|
-DWM_COMPILER=\"$(WM_COMPILER)\" \
|
||||||
|
-DWM_COMPILE_OPTION=\"$(WM_COMPILE_OPTION)\" \
|
||||||
|
-DWM_OPTIONS=\"$(WM_OPTIONS)\"
|
||||||
|
|
||||||
|
|
||||||
|
/* LIB_LIBS = */
|
||||||
79
applications/test/00-dummy/dummy/dummyLib.C
Normal file
79
applications/test/00-dummy/dummy/dummyLib.C
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "dummyLib.H"
|
||||||
|
|
||||||
|
// We know that our options file has properly defined types here
|
||||||
|
|
||||||
|
#if defined WM_SP
|
||||||
|
# define PRECISION "SP"
|
||||||
|
# define SCALAR_SIZE (8*sizeof(float))
|
||||||
|
#elif defined WM_DP
|
||||||
|
# define PRECISION "DP"
|
||||||
|
# define SCALAR_SIZE (8*sizeof(double))
|
||||||
|
#else
|
||||||
|
# define PRECISION "QP"
|
||||||
|
# define SCALAR_SIZE (8*sizeof(long double))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::arch(WM_ARCH);
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::compiler(WM_COMPILER);
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::precision(PRECISION);
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::scalar_size
|
||||||
|
(
|
||||||
|
std::to_string(SCALAR_SIZE)
|
||||||
|
);
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::label_size
|
||||||
|
(
|
||||||
|
std::to_string(WM_LABEL_SIZE)
|
||||||
|
);
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::archComp
|
||||||
|
(
|
||||||
|
WM_ARCH WM_COMPILER
|
||||||
|
);
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::archCompBase
|
||||||
|
(
|
||||||
|
WM_ARCH WM_COMPILER PRECISION "Int"
|
||||||
|
+ std::to_string(WM_LABEL_SIZE)
|
||||||
|
);
|
||||||
|
|
||||||
|
const std::string Foam::Detail::dummyLib::archCompFull
|
||||||
|
(
|
||||||
|
WM_ARCH WM_COMPILER PRECISION "Int"
|
||||||
|
+ std::to_string(WM_LABEL_SIZE)
|
||||||
|
+ WM_COMPILE_OPTION
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
90
applications/test/00-dummy/dummy/dummyLib.H
Normal file
90
applications/test/00-dummy/dummy/dummyLib.H
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Detail::dummyLib
|
||||||
|
|
||||||
|
Description
|
||||||
|
This class serves little useful purpose, but can be used to compile
|
||||||
|
into a dummy library and link against for a minimal application
|
||||||
|
that uses the wmake framework
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
dummyLib.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef dummyLib_H
|
||||||
|
#define dummyLib_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Detail
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class dummyLib Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
struct dummyLib
|
||||||
|
{
|
||||||
|
//- Compile-time value of WM_ARCH
|
||||||
|
static const std::string arch;
|
||||||
|
|
||||||
|
//- Compile-time value of WM_COMPILER
|
||||||
|
static const std::string compiler;
|
||||||
|
|
||||||
|
//- Compile-time equivalent to WM_PRECISION_OPTION
|
||||||
|
static const std::string scalar_size;
|
||||||
|
|
||||||
|
//- Compile-time of WM_LABEL_SIZE
|
||||||
|
static const std::string label_size;
|
||||||
|
|
||||||
|
//- Compile-time value of WM_PRECISION_OPTION
|
||||||
|
static const std::string precision;
|
||||||
|
|
||||||
|
//- Compile-time value of WM_ARCH + WM_COMPILER
|
||||||
|
static const std::string archComp;
|
||||||
|
|
||||||
|
//- Compile-time value of WM_ARCH + WM_COMPILER, precision, label-size
|
||||||
|
static const std::string archCompBase;
|
||||||
|
|
||||||
|
//- DIY Compile-time value of WM_OPTIONS
|
||||||
|
static const std::string archCompFull;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Detail
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user