diff --git a/applications/test/00-dummy/Allwclean b/applications/test/00-dummy/Allwclean new file mode 100755 index 0000000000000000000000000000000000000000..a5522688fab1603db58a6bf4fd59c5a2bb02be77 --- /dev/null +++ b/applications/test/00-dummy/Allwclean @@ -0,0 +1,7 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +wclean libso dummy +wclean + +#------------------------------------------------------------------------------ diff --git a/applications/test/00-dummy/Allwmake b/applications/test/00-dummy/Allwmake new file mode 100755 index 0000000000000000000000000000000000000000..2e571752f1972507fed65e4bb57b4a48d3f47629 --- /dev/null +++ b/applications/test/00-dummy/Allwmake @@ -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 + +#------------------------------------------------------------------------------ diff --git a/applications/test/00-dummy/Make/files b/applications/test/00-dummy/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..17afc125f448de59f5a04d568f89144ab433e1fb --- /dev/null +++ b/applications/test/00-dummy/Make/files @@ -0,0 +1,3 @@ +Test-dummyLib.C + +EXE = $(FOAM_APPBIN)/Test-dummyLib diff --git a/applications/test/00-dummy/Make/options b/applications/test/00-dummy/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..48247685e4d407b1b9924f48d076d8a77376dac2 --- /dev/null +++ b/applications/test/00-dummy/Make/options @@ -0,0 +1,9 @@ +/* Without the normal defaults */ +PROJECT_INC = +PROJECT_LIBS = + + +EXE_INC = -Idummy + +EXE_LIBS = \ + -lOpenFOAM-dummy diff --git a/applications/test/00-dummy/Test-dummyLib.C b/applications/test/00-dummy/Test-dummyLib.C new file mode 100644 index 0000000000000000000000000000000000000000..640c0fa4dc1a75fc30ecef634c46caeadafd5e24 --- /dev/null +++ b/applications/test/00-dummy/Test-dummyLib.C @@ -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; +} + + +// ************************************************************************* // diff --git a/applications/test/00-dummy/dummy/Make/files b/applications/test/00-dummy/dummy/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..2c3af1a8956768fd46594f089ef9e5e125f77c46 --- /dev/null +++ b/applications/test/00-dummy/dummy/Make/files @@ -0,0 +1,3 @@ +dummyLib.C + +LIB = $(FOAM_LIBBIN)/libOpenFOAM-dummy diff --git a/applications/test/00-dummy/dummy/Make/options b/applications/test/00-dummy/dummy/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..1f01bba39beb42d6fba82dc39ac8fd12bfd98b26 --- /dev/null +++ b/applications/test/00-dummy/dummy/Make/options @@ -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 = */ diff --git a/applications/test/00-dummy/dummy/dummyLib.C b/applications/test/00-dummy/dummy/dummyLib.C new file mode 100644 index 0000000000000000000000000000000000000000..383c431de51f8fa823ec98d8fcc96611c52171af --- /dev/null +++ b/applications/test/00-dummy/dummy/dummyLib.C @@ -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 +); + + +// ************************************************************************* // diff --git a/applications/test/00-dummy/dummy/dummyLib.H b/applications/test/00-dummy/dummy/dummyLib.H new file mode 100644 index 0000000000000000000000000000000000000000..97b7acf66e8af252ce760e7e31eb387ac0191fcb --- /dev/null +++ b/applications/test/00-dummy/dummy/dummyLib.H @@ -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 + +// ************************************************************************* //