Commit 53dec91c authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: add -help-man for Test-dummyLib (minimal packaging tests)

parent e693f21d
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -32,33 +32,121 @@ Description
\*---------------------------------------------------------------------------*/
#include "dummyLib.H"
#include <cstring>
#include <iostream>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
constexpr char nl = '\n';
constexpr const char* const bold = "\\fB"; // nroff
constexpr const char* const norm = "\\fR"; // nroff
int main(int argc, char *argv[])
{
using wmake = Foam::Detail::dummyLib;
constexpr const char* const website = "www.openfoam.com";
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';
using std::cout;
using wmake = Foam::Detail::dummyLib;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static void printMan(const char* exeName)
{
cout
<< ".TH \"" << exeName << "\" 1 "
<< "\"OpenFOAM-v" << OPENFOAM
<< "\" \"" << website << "\" \"OpenFOAM Commands Manual\""
<< nl;
cout
<< ".SH NAME" << nl
<< exeName
<< " \\- part of " << bold << "OpenFOAM" << norm
<< " (The Open Source CFD Toolbox)." << nl
<< ".SH SYNOPSIS" << nl
<< bold << exeName << norm << " [OPTIONS]" << nl;
cout
<< ".SH DESCRIPTION" << nl
<< ".nf" << nl
<< "Minimal compilation test with wmake, without OpenFOAM libraries."
<< nl
<< ".fi" << nl;
cout
<< ".SH OPTIONS" << nl
<< ".TP" << nl
<< "-help-man" << nl
<< "Display manpage" << nl;
cout
<< ".SH INFORMATION" << nl
<< ".nf" << nl
<< "label = " << wmake::label_size << nl
<< "scalar = " << wmake::scalar_size;
if
(
wmake::solveScalar_size
&& wmake::solveScalar_size != wmake::scalar_size
)
{
cout
<< " [solve=" << wmake::solveScalar_size << "]";
}
cout
<< " (" << wmake::precision << ')' << nl
<< "arch = " << wmake::arch << nl
<< "compiler = " << wmake::compiler << nl;
cout
<< nl
<< "archComp = " << wmake::archComp << nl
<< "archCompBase = " << wmake::archCompBase << nl
<< "archCompFull = " << wmake::archCompFull << nl;
cout
<< ".fi" << nl;
cout
<< ".SH \"SEE ALSO\"" << nl
<< "Online documentation https://" << website << "/documentation/"
<< nl;
}
std::cout
<< '\n'
<< "archComp = " << wmake::archComp << '\n'
<< "archCompBase = " << wmake::archCompBase << '\n'
<< "archCompFull = " << wmake::archCompFull << '\n';
std::cout
<< '\n';
int main(int argc, char *argv[])
{
// Process -help-man
if (argc > 1 && strcmp(argv[1], "-help-man") == 0)
{
printMan("Test-dummyLib");
return 0;
}
cout
<< 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
<< "solve = " << wmake::solveScalar_size << nl;
}
cout
<< "arch = " << wmake::arch << nl
<< "compiler = " << wmake::compiler << nl;
cout
<< nl
<< "archComp = " << wmake::archComp << nl
<< "archCompBase = " << wmake::archCompBase << nl
<< "archCompFull = " << wmake::archCompFull << nl;
cout<< nl;
return 0;
}
......
......@@ -29,12 +29,15 @@ License
// We know that our options file has properly defined types here
#undef SOLVE_SIZE
#if defined WM_SP
# define PRECISION "SP"
# define SCALAR_SIZE (8*sizeof(float))
#elif defined(WM_SPDP)
# define PRECISION "SPDP"
# define SCALAR_SIZE (8*sizeof(float))
# define SOLVE_SIZE (8*sizeof(double))
#elif defined WM_DP
# define PRECISION "DP"
# define SCALAR_SIZE (8*sizeof(double))
......@@ -66,14 +69,17 @@ 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 int Foam::Detail::dummyLib::label_size(WM_LABEL_SIZE);
const int Foam::Detail::dummyLib::scalar_size(SCALAR_SIZE);
const std::string Foam::Detail::dummyLib::label_size
const int Foam::Detail::dummyLib::solveScalar_size
(
std::to_string(WM_LABEL_SIZE)
#ifdef SOLVE_SIZE
SOLVE_SIZE
#else
SCALAR_SIZE
#endif
);
const std::string Foam::Detail::dummyLib::archComp
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -60,14 +60,17 @@ struct dummyLib
//- 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_PRECISION_OPTION
static const std::string precision;
//- Compile-time of WM_LABEL_SIZE
static const std::string label_size;
static const int label_size;
//- Compile-time value of WM_PRECISION_OPTION
static const std::string precision;
//- Compile-time equivalent to WM_PRECISION_OPTION
static const int scalar_size;
//- Compile-time equivalent to WM_PRECISION_OPTION
static const int solveScalar_size;
//- Compile-time value of WM_ARCH + WM_COMPILER
static const std::string archComp;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment