Skip to content
  • Mark OLESEN's avatar
    CONFIG: improve support for compiler derivatives (#1671) · 4200774d
    Mark OLESEN authored
    - add '[-+.~]' to the recognized qualifiers.
      This allows simple readable names such as
    
          WM_COMPILER=Clang-vendor
    
      but also opens the FUTURE (not yet supported) possibility of
      combining in additional information. For example,
    
          WM_COMPILER=Clang~openmp
          WM_COMPILER=Clang+cuda~openmp
    
      by using '+' (add) and '~' (subtract) notation similar to what
      spack uses.
    
    CONFIG: support 'override' rules
    
    - if present, compiler-family 'override' rules are included after
      compiler-family 'general' rules have been included. This allows a
      central means for including dynamically generated content to
      override some values.
    
      Some examples:
    
      To handle different gcc versions (system compiler):
    
      wmake/rules/...Gcc/override
    
      ```
      ifneq (,$(findstring 9, $(WM_COMPILER)))
          cc  := gcc-9
          CC  := g++-9 -std=c++11
      endif
      ```
    
      To handle different openmp on Darwin (#1656):
    
      wmake/rules/darwin64Clang/override
    
      ```
      # Use libomp (not libgomp) unless openmp is disabled
      ifeq (,$(findstring "~openmp", "$(WM_COMPILER)"))
          COMP_OPENMP = -DUSE_OMP -Xpreprocessor -fopenmp
          LINK_OPENMP = -lomp
      else
          include $(GENERAL_RULES)/no-openmp
      endif
      ```
    
      This treatment arguably fits into wmake/rules/darwin64Clang/general,
      but it serves to illustrate a possible use case.
    4200774d