Commit Graph

38 Commits

Author SHA1 Message Date
Mark Olesen
d086cc5a0e COMP: stricter handling of openmp vs no-openmp
- give precedence to ~openmp (-no-openmp) over +openmp (-openmp)
  in the general rules and in the Makefile. This makes it robuster
  when specifying +openmp in general, but ~openmp for specific build
  components.

- disable openmp for OSspecific and Pstream components.
  Neither should contain any openmp code anyhow.

  Additionally, since OSspecific is generally built as a static
  object, it can become problematic (eg, with AMD ROCm) if the
  compiler generates information that openmp is required but then uses
  static linkage.
2023-12-11 15:56:00 +01:00
Mark Olesen
9f7cfa9419 ENH: support libz disabling via WM_COMPILE_CONTROL (as ~libz)
- eg, for partially incomplete systems (without libz devel header)

ENH: clearer binding of dummy Pstream in OpenFOAM/Make/options

- link of dummy stub Pstream now contingent on linking libOpenFOAM as
  well. This makes the purpose slightly clearer

ENH: cleaner option naming/handling in wmake script

- allow special purpose -no-openfoam option.
  Eg, compiling test programs without OpenFOAM and Pstream libraries
  but using the rest of the wmake system.

ENH: add +openmp support into WM_COMPILE_CONTROL (#2633)

- this adds compile/link flags for openmp.
  For single-use, can also use 'wmake -openmp'.

  If both +openmp and ~openmp are specified in WM_COMPILE_CONTROL
  the ~openmp will have priority.

  This is actually done indirectly since ~openmp will set empty
  COMP_OPENMP, LINK_OPENMP internal variables, which the +openmp then
  adds to the c++FLAGS and linkexe targets (ie, won't actually add
  anything).

ENH: add +ccache or ccache=... support into WM_COMPILE_CONTROL (#2633)

- with the first version (+ccache), simply use ccache from the path
  without any extra options.

- with the second version (ccache=...), can be more specific about
  what is called.

  Using "+ccache" is identical to "ccache=ccache", but the later could
  be used in other ways. For example,

     ccache=/strange/install/path/ccache
     ccache=</path/my-tooling --option>

  Have the choice of unquoted, single or double quoted or '< >' quoted

STYLE: relocate FOAM_EXTRA_LDFLAGS in general makefile

- removes clutter for different linkers (eg, gold, mold, ldd)
  making it easier to extend for other linkers.

STYLE: protect makefile checks with 'strip' function
2022-11-15 14:00:18 +01:00
Mark Olesen
793f4e3a37 CONFIG: add support for WM_COMPILE_OPTION='Dbg'
- uses '-g -DFULLDEBUG' (like Debug), but with -O3 (like Opt).

  This adds in debug symbols and FULLDEBUG code segments (good for
  code development) but retains -O3 optimizations and code paths and
  avoids the much slower -O0 associated with 'Debug'.

- add in central wmake/General/common/{c,c++}XXX tuning,
  which helps reduce the number of nearly identical files

ENH: add support for wmake -debug-Og
2022-09-09 11:55:33 +02:00
Mark Olesen
4730c381ef COMP: avoid cpp replacement of linux,unix,... in Make/options (fixes #2548)
- the cpp command is used to process Make/{files,options}, but builtin
  defines such as `linux` will cause problems (macro replacement) if
  these is present in the Make/{files,options}.

  Solve by undefining -Ulinux, -Uunix macros, which will leave directory
  names such as "/usr/lib/x86_64-linux-gnu/..." intact.

  Directories with _linux, __linux__ content (for example), could
  still pose future issues.
2022-08-19 15:01:43 +02:00
Mark Olesen
a27af5e369 ENH: add optional control to use clang lld linker (#2449)
Eg,
    export WM_COMPILER=Clang130
    export WM_COMPILE_CONTROL="version=13.0 +lld"

- also support the mold linker (+mold) for clang

STYLE: report as 'link' stage instead of 'ld' in short messages
2022-04-29 11:44:28 +02:00
Mark Olesen
79e110aeb0 ENH: update lemon version, wmake wrappers 2021-11-09 21:17:51 +01:00
Mark Olesen
c7bde70ecb ENH: robustness, consistency for wmake -show-api, -version
- add to wmakeFunctions to ensure it works even without 'make' being
  installed. Exit immediately after -show-api for consistency with
  -version.

foamEtcFile:
  - drop warnings for some old (pre-v1812) defunct options
    and simply flag as unknown options.
  - handle -version, --version as equivalent to -show-api
2021-06-10 08:34:43 +02:00
Mark Olesen
d5260b18d7 ENH: add wmake -show-mpi-compile, -show-mpi-link options
- useful for diagnosing which MPI paths and flags are being used
  when setting up for a new MPI configuration.
2020-12-15 21:45:59 +01:00
Mark Olesen
9423d2bd83 CONFIG: improve support for compiler/link options (#1830)
- introduce WM_COMPILE_CONTROL variable to convey control information
  into the build rules.

  The convention (as per spack):
      - '+' to select a feature
      - '~' to deselect a feature

  Eg, to select the gold linker, and disable openmp
  (spaces are not required):

      WM_COMPILE_CONTROL="+gold ~openmp"

CONFIG: accept FOAM_EXTRA_LDFLAGS for AMD, gold, Mingw linkers

CONFIG: generalize PROJECT_LIBS (-ldl used almost universally)
2020-09-07 09:45:51 +02:00
Mark Olesen
8bd9f41efd ENH: wmakeLnInclude support for multiple dirs and -force option (#1693)
STYLE: minor changes to makefiles
2020-05-12 08:00:26 +02:00
Mark Olesen
595579e01d COMP: use -iquotedir for including the local '.' directory
- adds into the include-quoted search list instead the general (-Idir)
  search list.

  * makes it less subject to ordering (since it will now generally be
    searched first) and makes it less subject to how duplicate removal
    is implemented. In some compilers (#1627), the last instance of
    a duplicate directory would be used and not the first instance.

  * removes clutter in some Make/options files

COMP: add missing linkage libraries
2020-05-06 13:06:40 +02:00
Mark Olesen
c853080d91 COMP: provide makefile fallbacks for FOAM_SOLVERS, FOAM_UTILITIES
- improves build robustness, even with a reduced environment (#517)
2020-05-06 09:11:04 +02:00
Andrew Heather
ae2ab06312 REL: Release preparations 2019-12-23 09:49:23 +00:00
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
Mark Olesen
66a100997f COMP: force dlOpen for windows application binaries (#1238)
- when windows portable executables (.exe or .dll) files are loaded,
  their dependent libraries not fully loaded. For OpenFOAM this means
  that the static constructors which are responsible for populating
  run-time selection tables are not triggered, and most of the run-time
  selectable models will simply not be available.

Possible Solution
=================

  Avoid this problem by defining an additional library symbol such as
  the following:

      extern "C" void libName_Load() {}

  in the respective library, and tag this symbol as 'unresolved' for
  the linker so that it will attempt to resolve it at run-time by
  loading the known libraries until it finds it. The link line would
  resemble the following:

      -L/some/path -llibName -ulibName_Load

  Pros:
    - Allows precise control of forced library loading

  Cons:
    - Moderately verbose adjustment of some source files (even with macro
      wrapping for the declaration).
    - Adjustment of numerous Make/options files and somewhat ad hoc
      in nature.
    - Requires additional care when implementing future libraries and/or
      applications.

  - This is the solution taken by the symscape patches (Richard Smith)

Possible Solution
=================

  Avoid this problem by simply force loading all linked libraries.
  This is done by "scraping" the information out of the respective
  Make/options file (after pre-processing) and using that to define
  the library list that will be passed to Foam::dlOpen() at run-time.

  Pros:
    - One-time (very) minimal adjustment of the sources and wmake toolchain
    - Automatically applies to future applications

  Cons:
    - Possibly larger memory footprint of application (since all dependent
      libraries are loaded).
    - Possible impact on startup time (while loading libraries)
    - More sensitive to build failures. Since the options files are
      read and modified based on the existence of the dependent
      libraries as a preprocessor step, if the libraries are initially
      unavailable for the first attempt at building the application,
      the dependencies will be inaccurate for later (successful) builds.

  - This is solution taken by the bluecape patches (Bruno Santos)

Adopted Solution
================

  The approach taken by Bruno was adopted in a modified form since
  this appears to be the most easily maintained.

Additional Notes
================

  It is always possible to solve this problem by defining a corresponding
  'libs (...)' entry in the case system/controlDict, which forces a dlOpen
  of the listed libraries. This is obviously less than ideal for large-scale
  changes, but can work to resolve an individual problem.

  The peldd utility (https://github.com/gsauthof/pe-util), which is
  also packaged as part of MXE could provide yet another alternative.
  Like ldd it can be used to determine the library dependencies of
  binaries or libraries. This information could be used to define an
  additional load layer for Windows.
2019-05-25 19:10:14 +02:00
Mark Olesen
a54aff9d26 COMP: add wmake rules for mingw (#1238) 2019-04-28 13:36:50 +02:00
Mark Olesen
4a1208ed30 ENH: add handling of exe file extensions in wmake/src/Makefile (#1238)
- change internal naming from 'EXE_EXT' to 'EXT_EXE' for symmetry with
  'EXT_SO'
2019-04-26 14:20:01 +02:00
Mark Olesen
2d7c266d37 STYLE: formatting in makefiles, config files
- fix typo in makefiles/info that affected wmake -show-compile-c

- additional safeguard in src/OpenFOAM/Make/options against self-linking.
  This is not normally required unless PROJECT_LIBS has been added into
  the link stage.
2019-04-16 12:39:25 +02:00
Mark Olesen
787325a916 COMP: manage cpu architecture with cARCH, c++ARCH internal make variables
- allows better separation from compiler settings

- use -fPIC instead of legacy -KPIC for intel compiler
2019-04-12 12:59:11 +02:00
Mark Olesen
63a1826211 ENH: provide 'sanitized' values for wmake -show compiler information (#1256)
- with the wmake rules we may have some compiler options bound to the
  internal compiler variable. For example,

     CC  = g++ -std=c++11 -m64

     c++FLAGS = ...

  So shift any flags from CC to CXXFLAGS for the output of
  'wmake -show-cxx', 'wmake -show-cxxflags', etc.

  This makes it much easier to handle the values correctly elsewhere.
  Eg,

      CXX="$(wmake -show-cxx)" CXXFLAGS="$(wmake -show-cxxflags)" \
         ./configure
2019-04-05 15:30:30 +02:00
Mark Olesen
939144233c STYLE: adjusted wording and messages for wmake
- add an additional test for wmake pre-processing
2019-04-03 08:57:01 +02:00
Mark Olesen
51bf7af8ae ENH: support wmake -show options for compiler information (#1256)
- can be useful for retrieving the compilation flags for use with other
  make systems (eg, cmake)

  * wmake -show-compile   (C++ not C)
  * wmake -show-cxx
  * wmake -show-cxxflags
2019-04-01 09:03:48 +02:00
Mark Olesen
d2eb50832c ENH: add handling of lib/exe file extensions in makefile (#1238)
- relocates some logic from makefiles/general into platform-specific
  overrides
2019-03-14 10:42:57 +01:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
e3bb7ffd25 STYLE: avoid mix of 'sinclude' and '-include' in make files 2018-05-28 10:46:40 +02:00
Mark Olesen
52cf2d68c4 STYLE: avoid 'sed -i' in wmake rules
- less efficient and less portable than using single-pass processing
2018-04-08 22:15:21 +02:00
Henry Weller
961b653183 wmake: Suppress the "is up to date" messages
Avoids a lot of unnecessary clutter in the compilation log.
2016-11-13 22:41:42 +00:00
Henry Weller
b50d7d78f7 wmake: Removed unnecessary '->>' line from output
Changed 'ld' line to include path of target library or executable.
2016-11-13 22:14:53 +00:00
Henry Weller
82faf7eff0 wmake: Indent the 'result' message 2016-11-13 18:42:08 +00:00
Henry Weller
985abe023e wmake: Declare all makefiles to be specifically GNU make files 2016-11-13 15:18:09 +00:00
Henry Weller
8a4c43e377 wmake: suppress "Nothing to be done for" messages 2016-11-13 15:16:42 +00:00
Henry Weller
79081ba3bb wmake: Simplified QUIET_MESSAGE function 2016-11-13 11:19:29 +00:00
Henry Weller
997f1713cb wmake: Update '-s' option to print the files processed without the rules
Based on patch contributed by Alexey Matveichev
Resolves feature request http://bugs.openfoam.org/view.php?id=2328
2016-11-12 22:01:44 +00:00
Henry Weller
74e1352cc2 src/Pstream: Added Allwclean consistent with the Allwmake
Patch contributed by Bruno Santos
Resolves bug-report http://bugs.openfoam.org/view.php?id=2218
2016-08-25 08:25:12 +01:00
Henry Weller
e7fc198592 Allwmake: improved '-update' option to handle out-of-date '.dep' files
Patch contributed by Bruno Santos
Resolves bug-report http://bugs.openfoam.org/view.php?id=2091
2016-05-16 12:21:57 +01:00
Henry Weller
cd265693f5 wmake: Update comments 2016-01-24 14:37:39 +00:00
Henry Weller
c3a03105c4 wmake: Add support for compiler type default rules
which may be optionally overridden by version-specific rules.

For example the default rules for gcc on GNU/Linux x86_64 are in the
wmake/rules/linux64Gcc directory.  If there is a need to change any of
the rules for a specific version of gcc, e.g. gcc-4.8.4 the directory
wmake/rules/linux64Gcc48 may be created into which any of the language
files may be provided containing the rules to override the defaults.
2016-01-24 14:10:07 +00:00
Henry Weller
5355dbc5fe wmake: General cleanup to improve consistency and maintainability
The Makefiles are now in the makefiles sub-directory

The "-f | -force" option in wmakeLnInclude is now "-u | -update" for
consistency with the other scripts.

The "Usage" entry in the headers is now consistently formatted in all
scripts.
2015-12-16 18:31:02 +00:00