2009-05-01 14:53 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* utils/hbmk2/hbmk2.prg
    + Added MT support for rest of C compilers (gcc, pocc).
      Please test. MT support is now complete, maybe in the 
      future it can be added for resource compiling if that's 
      a bottleneck for some users.
This commit is contained in:
Viktor Szakats
2009-05-01 12:54:58 +00:00
parent db3d6f99ab
commit 079063a91f
2 changed files with 70 additions and 26 deletions

View File

@@ -17,6 +17,13 @@
past entries belonging to these authors: Viktor Szakats.
*/
2009-05-01 14:53 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* utils/hbmk2/hbmk2.prg
+ Added MT support for rest of C compilers (gcc, pocc).
Please test. MT support is now complete, maybe in the
future it can be added for resource compiling if that's
a bottleneck for some users.
2009-05-01 13:17 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* bin/postinst.bat
+ Added generation of libpq.lib from .dll for msvc. (not tested)

View File

@@ -93,7 +93,6 @@
/* TODO: Add support for dynamic library creation for rest of compilers. */
/* TODO: Cleanup on variable names and compiler configuration. */
/* TODO: Finish C++/C mode selection. */
/* TODO: Finish support for multithreaded compilation. */
/* TODO: Add a way to fallback to stop if required headers couldn't be found.
This needs a way to spec what key headers to look for. */
@@ -137,6 +136,8 @@ STATIC s_nHEAD := _HEAD_PARTIAL
STATIC s_aINCPATH
STATIC s_aINCTRYPATH
STATIC s_lREBUILD := .F.
STATIC s_lTRACE := .F.
STATIC s_lDONTEXEC := .F.
STATIC s_lDEBUGTIME := .F.
STATIC s_lDEBUGINC := .F.
@@ -317,8 +318,6 @@ FUNCTION hbmk( aArgs )
LOCAL s_lSTRIP := .F.
LOCAL s_lOPT := .T.
LOCAL s_nCOMPR := _COMPR_OFF
LOCAL s_lTRACE := .F.
LOCAL s_lDONTEXEC := .F.
LOCAL s_lBLDFLGP := .F.
LOCAL s_lBLDFLGC := .F.
LOCAL s_lBLDFLGL := .F.
@@ -420,7 +419,7 @@ FUNCTION hbmk( aArgs )
LOCAL aThreads
LOCAL thread
LOCAL nStart := secondscpu()
LOCAL nStart := Seconds()
IF Empty( aArgs )
ShowHeader()
@@ -2812,30 +2811,25 @@ FUNCTION hbmk( aArgs )
IF "{IC}" $ cOpt_CompC
FOR EACH tmp IN ArrayJoin( ListDirExt( s_aPRG_TODO, cWorkDir, ".c" ), s_aC_TODO )
cCommand := cOpt_CompC
cCommand := StrTran( cCommand, "{IC}", tmp )
cCommand := StrTran( cCommand, "{OO}", PathSepToTarget( FN_DirExtSet( tmp, cWorkDir, cObjExt ) ) )
cCommand := cBin_CompC + " " + AllTrim( cCommand )
IF s_lTRACE
IF ! s_lQuiet
OutStd( "hbmk: C compiler command:" + hb_osNewLine() )
aThreads := {}
FOR EACH aTODO IN ArraySplit( ArrayJoin( ListDirExt( s_aPRG_TODO, cWorkDir, ".c" ), s_aC_TODO ), s_nJOBS )
IF hb_mtvm()
AAdd( aThreads, hb_threadStart( @CompileCLoop(), aTODO, cBin_CompC, cOpt_CompC, cWorkDir, cObjExt, aTODO:__enumIndex() ) )
ELSE
IF ! CompileCLoop( aTODO, cBin_CompC, cOpt_CompC, cWorkDir, cObjExt )
nErrorLevel := 6
ENDIF
OutStd( cCommand + hb_osNewLine() )
ENDIF
IF ! s_lDONTEXEC .AND. ( tmp1 := hbmk_run( cCommand ) ) != 0
OutErr( "hbmk: Error: Running C compiler. " + hb_ntos( tmp1 ) + ":" + hb_osNewLine() )
IF ! s_lQuiet
OutErr( cCommand + hb_osNewLine() )
ENDIF
nErrorLevel := 6
EXIT
ENDIF
NEXT
IF hb_mtvm()
FOR EACH thread IN aThreads
hb_threadJoin( thread, @tmp )
IF ! tmp
nErrorLevel := 6
ENDIF
NEXT
ENDIF
ELSE
cOpt_CompC := StrTran( cOpt_CompC, "{OO}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, cObjExt ) ) )
cOpt_CompC := StrTran( cOpt_CompC, "{OW}" , PathSepToTarget( cWorkDir ) )
@@ -3235,11 +3229,51 @@ FUNCTION hbmk( aArgs )
ENDIF
IF s_lDEBUGTIME
OutStd( "hbmk: Running time: " + hb_ntos( secondscpu() - nStart ) + "s" + hb_osNewLine() )
OutStd( "hbmk: Running time: " + hb_ntos( TimeElapsed( nStart, Seconds() ) ) + "s" + hb_osNewLine() )
ENDIF
RETURN nErrorLevel
STATIC FUNCTION CompileCLoop( aTODO, cBin_CompC, cOpt_CompC, cWorkDir, cObjExt, nJob )
LOCAL lResult := .T.
LOCAL cCommand
LOCAL tmp, tmp1
FOR EACH tmp IN aTODO
cCommand := cOpt_CompC
cCommand := StrTran( cCommand, "{IC}", tmp )
cCommand := StrTran( cCommand, "{OO}", PathSepToTarget( FN_DirExtSet( tmp, cWorkDir, cObjExt ) ) )
cCommand := cBin_CompC + " " + AllTrim( cCommand )
IF s_lTRACE
IF ! s_lQuiet
IF nJob != NIL
OutStd( "hbmk: C compiler command job #" + hb_ntos( nJob ) + ":" + hb_osNewLine() )
ELSE
OutStd( "hbmk: C compiler command:" + hb_osNewLine() )
ENDIF
ENDIF
OutStd( cCommand + hb_osNewLine() )
ENDIF
IF ! s_lDONTEXEC .AND. ( tmp1 := hbmk_run( cCommand ) ) != 0
IF nJob != NIL
OutErr( "hbmk: Error: Running C compiler job #" + hb_ntos( nJob ) + ". " + hb_ntos( tmp1 ) + ":" + hb_osNewLine() )
ELSE
OutErr( "hbmk: Error: Running C compiler. " + hb_ntos( tmp1 ) + ":" + hb_osNewLine() )
ENDIF
IF ! s_lQuiet
OutErr( cCommand + hb_osNewLine() )
ENDIF
lResult := .F.
EXIT
ENDIF
NEXT
RETURN lResult
STATIC FUNCTION SetupForGT( cGT, /* @ */ s_cGT, /* @ */ s_lGUI )
IF IsValidHarbourID( cGT )
@@ -4518,6 +4552,9 @@ STATIC FUNCTION MacroProc( cString, cDirParent )
RETURN cString
STATIC FUNCTION TimeElapsed( nStartSec, nEndSec )
RETURN Round( ( nEndSec - iif( nEndSec < nStartSec, nStartSec - 86399, nStartSec ) ), 1 )
#define HB_ISALPHA( c ) ( Upper( c ) >= "A" .AND. Upper( c ) <= "Z" )
#define HB_ISFIRSTIDCHAR( c ) ( HB_ISALPHA( c ) .OR. ( c ) == '_' )
#define HB_ISNEXTIDCHAR( c ) ( HB_ISFIRSTIDCHAR(c) .OR. IsDigit( c ) )