2024-10-10 14:21 UTC+0200 Aleksander Czajczynski (hb fki.pl)

+ config/win/clang-noauto.mk
    + additional clang flavour checking when the compiler is specified
      via set HB_COMPILER=clang (not auto-detected)

      This is important for distributions of clang that bundle both
      gcc and clang in the same directory. Harbour 3.2 by default
      prioritize gcc over clang.

      For example you should be now able to build from winlibs.com by
      Brecht Sanders with environment setup such as:
      PATH=C:\winlibs\mingw64\bin;%PATH%
      HB_COMPILER=clang
      win-make

  * config/global.mk
    ! added workaround for common GNU Make issue with
      $(dir path with spaces/file) macro, commonly striking on Windows
      systems under "Program Files", but also possible in other setups.
      Workaround is to call $(call dir_with_spaces,$(HB_COMP_PATH)).
      I have only used this workaround in clang detection, but keep
      this in mind while revisiting detection of another compiler.

  * config/win/clang.mk
  * utils/hbmk2/hbmk2.prg
    * another rework of Clang on Windows detection (ARM64, x86_64, x86),
      solved problems with different availability of resource compiler,
      They are now probed in order: windres, llvm-windres, llvm-rc.

    * added option to use MinGW INPUT(file.o) link scripts for old tools
      To apply workaround with clang, set HB_USER_DFLAGS=--mingw-script
      It is not supported in at least some of current clang toolchains,
      but it's still needed to succesfully build on old ones (those
      using GNU ld on Windows).
This commit is contained in:
Aleksander Czajczynski
2024-10-10 14:21:17 +02:00
parent 77d37481be
commit 60a10666f4
5 changed files with 246 additions and 34 deletions

View File

@@ -4368,6 +4368,11 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
IF hb_fileExists( hb_DirSepAdd( hbmk[ _HBMK_cHB_INSTALL_LIB ] ) + "hbrtl.lib" ) /* selfcheck if clang ld emits .lib extension */
cLibLibPrefix := ""
cLibLibExt := ".lib"
IF hbmk[ _HBMK_lGUI ]
AAdd( hbmk[ _HBMK_aOPTL ], "-Wl,-subsystem:windows" )
ELSE
AAdd( hbmk[ _HBMK_aOPTL ], "-Wl,-subsystem:console" )
ENDIF
ENDIF
CASE hbmk[ _HBMK_cCOMP ] == "tcc"
cBin_CompCPP := "tcc.exe"
@@ -4571,6 +4576,15 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
cBin_Res := hbmk[ _HBMK_cCCPREFIX ] + "windres" + hbmk[ _HBMK_cCCEXT ]
cResExt := ".reso"
cOpt_Res := "{FR} {IR} -O coff -o {OS}"
IF hbmk[ _HBMK_cCOMP ] == "clang" .AND. FindInPath( cBin_Res ) == NIL
IF FindInPath( cBin_Res := "llvm-" + cBin_Res ) == NIL
cBin_Res := "llvm-rc"
cResExt := ".res"
/* codepage default in llvm-rc is confusing, a .rc file could be multi-language */
cOpt_Res := "/C 1252 {FR} /FO {OS} {IR}"
ENDIF
ENDIF
IF ! Empty( hbmk[ _HBMK_cCCPATH ] )
cBin_Res := FNameEscape( hbmk[ _HBMK_cCCPATH ] + hb_ps() + cBin_Res, hbmk[ _HBMK_nCmd_Esc ] )
ENDIF