HMG Beginner

New members who wish to post and participate in HMG Forum, please introduce yourselves in this forum by starting a new thread.

Moderator: Rathinagiri

User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi Danielmaximiliano

I did some tryes and found that it doesn't care if you put the line run=no or run=yes or omit the line in IDE CONFIGURATION TAB.
The HMG IDE runs the application in any case at the end of compilation.
It seems it doesn't use build.bat to run the application.
I think that only Rathinagiri could have an answer for that behaviour.

Thank you in any case for the answer.
Vieri
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG Beginner

Post by danielmaximiliano »

vierirom wrote:Hi Danielmaximiliano

I did some tryes and found that it doesn't care if you put the line run=no or run=yes or omit the line in IDE CONFIGURATION TAB.
The HMG IDE runs the application in any case at the end of compilation.
It seems it doesn't use build.bat to run the application.
I think that only Rathinagiri could have an answer for that behaviour.

Thank you in any case for the answer.
Vieri
HMG IDE using build.bat, you can modify these lines to see and understand its use.

Code: Select all

rem ******************************************************************************
rem CALL HBMK2
rem ******************************************************************************

rem ******************************************************************************
rem The the fourth parameter
rem -gt<name>           link with GT<name> GT driver, can be repeated to link
rem                     with more GTs. First one will be the default at runtime

if "%runafterbuild%" == ".t." (
Echo Run > run.txt
Echo %*  >> run.txt
Echo %runafterbuild% >> Run.txt
HBMK2 -o%~n1.exe %HMGPATH%\hmg.hbc -q %gtdrivers% %debug%  %1 %2 %3 %4 %5 %6 %7 %8  >hbmk.log 2>&1
) ELSE (
Echo NoRun > NoRun.txt
Echo %*  >> NoRun.txt
Echo %runafterbuild% >> NoRun.txt
HBMK2 -o%~n1.exe -q  -norun %HMGPATH%\hmg.hbc %gtdrivers% %debug%  %1 %2 %3 %4 %5 %6 %7 %8 >hbmk.log 2>&1
)
rem ******************************************************************************
rem CREATE LOGS
rem ******************************************************************************
there is a problem of options passed to HBMK2

Code: Select all

Harbour Make (hbmk2) 3.1.0dev (Rev. 17111)
Copyright (c) 1999-2011, Viktor Szakats
http://harbour-project.org/

Syntax:

  hbmk2 [options] [<script[s]>] <src[s][.prg|.c|.obj|.o|.rc|.res|.def|.po|.pot|.hbl|@.clp|.d]>

Options:
-[no]run            run/do not run output executable
I'm looking and trying to understand this option as it really
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi Danielmaximiliano

I made some more in deep investigation....
The HMG IDE runs the executable AFTER completing the execution of build.bat.
It ALWAYS passes " /n" as first parameter to build.bat, so , leaving build.bat as is, build.bat NEVER runs the executable.
If you comment out ("rem") the line :

rem if "%runafterbuild%"==".t." if exist %~n1.exe %~n1.exe
and put two more lines after:

if exist %~n1.exe copy /y %~n1.exe %destexe%\%~n1.exe > nul
if exist %destexe%\%~n1.exe %destexe%\%~n1.exe

The executable runs from %destexe% folder.
(I manually added a set definition in the first lines of build.bat "set destexe=C:\HARBAPP\WORKING_FOLDER")

This way the ececutable runs from build.bat.
As soon as you close the executable it starts again (this time launched from HMG IDE).
What seems to appear is that build.bat is used from HMG IDE but never starts the application when used by the IDE.

Ciao
Vieri
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG Beginner

Post by danielmaximiliano »

vierirom wrote:Hi Danielmaximiliano

I made some more in deep investigation....
The HMG IDE runs the executable AFTER completing the execution of build.bat.
It ALWAYS passes " /n" as first parameter to build.bat, so , leaving build.bat as is, build.bat NEVER runs the executable.
If you comment out ("rem") the line :

Ciao
Vieri
The executable runs HBMK2 account, please copy build.bat to keep the original content and then delete all lines after the line HBMK2

Code: Select all

@echo off

rem *******************************************************************************
rem SYNTAX
rem *******************************************************************************
rem	build [ /n ] [ /d ] [ /c ] <program.prg> | <project.hbp> [<hbmk2 params>]
rem
rem	/n	no run after build
rem	/d	enabled debugger
rem	/c	console mode
rem
rem
rem	This batch file passes information to hbmk2 to make possible an easy (zero
rem	configuration build of HMG applications).
rem 
rem	You can achieve a customized build passing parameters directly to hbmk2.
rem	Please, take a look at hbmk2 help:
rem
rem	hbmk2 --help

rem *******************************************************************************

rem SET DEFAULT OPTIONS
rem *******************************************************************************

	set gtdrivers=-gtgui -gtwin
	set runafterbuild=.t.
	set debug=

rem ******************************************************************************
rem DELETE FILES FROM PREVIOUS BUILD
rem ******************************************************************************

	if exist build.log del build.log
	if exist error.log del error.log

rem ******************************************************************************
rem SET HMGPATH
rem ******************************************************************************
rem
rem Using %~dp0 the HMGPATH is automatically set to current (hmg) folder making it
rem portable (zero config)

	SET HMGPATH=%~dp0

rem ******************************************************************************
rem SET BINARIES PATHS
rem ******************************************************************************

	SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%

rem *******************************************************************************
rem PROCESS PARAMETERS 
rem *******************************************************************************
rem
rem	/n	no run after build
rem	/d	enabled debugger
rem	/c	console mode
rem

	if "%1"=="/n" set runafterbuild=.f.
	if "%1"=="/n" shift

	if "%1"=="/d" set gtdrivers=-gtwin -gtgui
	if "%1"=="/d" set debug=-b
	if "%1"=="/d" echo options norunatstartup > init.cld
	if "%1"=="/d" shift

	if "%1"=="/c" set gtdrivers=-gtwin -gtgui
	if "%1"=="/c" shift
    
rem ******************************************************************************
rem COMPILE RESOURCES
rem ******************************************************************************

	echo #define HMGRPATH %HmgPath%\RESOURCES > _hmg_resconfig.h
	COPY /b %HMGPATH%\resources\hmg.rc+%~n1.rc+%HMGPATH%\resources\filler _temp.rc >NUL
	windres -i _temp.rc -o _temp.o >windres.log 2>&1

rem *******************************************************************************
rem SET PROJECT OUTPUT FILE NAME 
rem *******************************************************************************
rem
rem The first parameter sent to hbmk2 is -o%~n1.exe. I've added to it create the 
rem application with the project basename (<projectname.hbp> specified by the user.

rem *******************************************************************************
rem SET DEFAULT CONFIGURATION FILE
rem *******************************************************************************
rem
rem The second parameter sent to hbmk2 is the hmg.hbc script to set config required.

rem *******************************************************************************
rem SET QUIET MODE
rem *******************************************************************************
rem
rem The third parameter sent to hbmk2 is -q (Harbour quiet mode)

rem ******************************************************************************
rem CALL HBMK2
rem ******************************************************************************

rem ******************************************************************************
rem The the fourth parameter
rem -gt<name>           link with GT<name> GT driver, can be repeated to link
rem                     with more GTs. First one will be the default at runtime


if "%runafterbuild%" == ".t." (
Echo Run > run.txt
Echo %*  >> run.txt
Echo %runafterbuild% >> Run.txt
HBMK2 -o%~n1.exe %HMGPATH%\hmg.hbc -q %gtdrivers% %debug%  %1 %2 %3 %4 %5 %6 %7 %8  >hbmk.log 2>&1
) ELSE (
Echo NoRun > NoRun.txt
Echo %*  >> NoRun.txt
Echo %runafterbuild% >> NoRun.txt
HBMK2 -o%~n1.exe -q  -norun %HMGPATH%\hmg.hbc %gtdrivers% %debug%  %1 %2 %3 %4 %5 %6 %7 %8 >hbmk.log 2>&1
)
REM EOF Build.bat
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi Danielmaximiliano

No. It's not the HBMK2 Line that starts the appllication.
I already tried that way.
The application start anyway AFTER HBMK2 has completing his task.
If you Put a "Pause" after the line of HBMK2 you'll see what I mean.

Thank you for your Replay.

Vieri
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG Beginner

Post by danielmaximiliano »

vierirom wrote:Hi Danielmaximiliano

No. It's not the HBMK2 Line that starts the appllication.
I already tried that way.
The application start anyway AFTER HBMK2 has completing his task.
If you Put a "Pause" after the line of HBMK2 you'll see what I mean.

Thank you for your Replay.

Vieri
In my case, HBMK2 is running the application I'm compiling.

after modifying build.bat as previously published application runs.
not know why your build.bat is different because it is the same version of HMG.
HMG.3.0.40
Harbour compiler
Administrador Cwindowssystem32cmd.png
Administrador Cwindowssystem32cmd.png (111.99 KiB) Viewed 5452 times
can test the modification made ​​by me to check.
Greenshot_2012-03-05_16-19-11.png
Greenshot_2012-03-05_16-19-11.png (243.76 KiB) Viewed 5452 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi Danielmaximiliano

I copy The same Lines (those belonging to HBMK2 Execution).
The .txt response files is the same as your.
So Runafterbuild = .f. (as it apper from norun.txt)

NoRun
/n C:\HARBAPP\AUTOMAN2\AUTOMAN2.hbp C:\HARBAPP\AUTOMAN2\AUTOMAN2.hbc
.f.

The application starts after building.... as before
The problem remains the same.
I don't Know why the IDE starts the application
Could be a good Idea if someone else reports his behaviour of the IDE.
Are you shure you are using HMG 3.0.40 IDE ?
Thank you for your intersting

Vieri
User avatar
vierirom
Posts: 22
Joined: Sat Aug 20, 2011 3:49 pm
Location: Rome, Italy

Re: HMG Beginner

Post by vierirom »

Hi Danilemaximiliano
one more thing....
double seeing your build.bat I observe that it's not EXACTLY same as mine.
Following is an exact copy of the original Build.bat

--------------------------------------
@echo off

rem *******************************************************************************
rem SYNTAX
rem *******************************************************************************
rem build [ /n ] [ /d ] [ /c ] <program.prg> | <project.hbp> [<hbmk2 params>]
rem
rem /n no run after build
rem /d enabled debugger
rem /c console mode
rem
rem
rem This batch file passes information to hbmk2 to make possible an easy (zero
rem configuration build of HMG applications).
rem
rem You can achieve a customized build passing parameters directly to hbmk2.
rem Please, take a look at hbmk2 help:
rem
rem hbmk2 --help

rem *******************************************************************************
rem SET DEFAULT OPTIONS
rem *******************************************************************************

set gtdrivers=-gtgui -gtwin
set runafterbuild=.t.
set debug=

rem ******************************************************************************
rem DELETE FILES FROM PREVIOUS BUILD
rem ******************************************************************************

if exist build.log del build.log
if exist error.log del error.log

rem ******************************************************************************
rem SET HMGPATH
rem ******************************************************************************
rem
rem Using %~dp0 the HMGPATH is automatically set to current (hmg) folder making it
rem portable (zero config)

SET HMGPATH=%~dp0

rem ******************************************************************************
rem SET BINARIES PATHS
rem ******************************************************************************

SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%

rem *******************************************************************************
rem PROCESS PARAMETERS
rem *******************************************************************************
rem
rem /n no run after build
rem /d enabled debugger
rem /c console mode
rem

if "%1"=="/n" set runafterbuild=.f.
if "%1"=="/n" shift

if "%1"=="/d" set gtdrivers=-gtwin -gtgui
if "%1"=="/d" set debug=-b
if "%1"=="/d" echo options norunatstartup > init.cld
if "%1"=="/d" shift

if "%1"=="/c" set gtdrivers=-gtwin -gtgui
if "%1"=="/c" shift

rem ******************************************************************************
rem COMPILE RESOURCES
rem ******************************************************************************

echo #define HMGRPATH %HmgPath%\RESOURCES > _hmg_resconfig.h
COPY /b %HMGPATH%\resources\hmg.rc+%~n1.rc+%HMGPATH%\resources\filler _temp.rc >NUL
windres -i _temp.rc -o _temp.o >windres.log 2>&1

rem *******************************************************************************
rem SET PROJECT OUTPUT FILE NAME
rem *******************************************************************************
rem
rem The first parameter sent to hbmk2 is -o%~n1.exe. I've added to it create the
rem application with the project basename (<projectname.hbp> specified by the user.

rem *******************************************************************************
rem SET DEFAULT CONFIGURATION FILE
rem *******************************************************************************
rem
rem The second parameter sent to hbmk2 is the hmg.hbc script to set config required.

rem *******************************************************************************
rem SET QUIET MODE
rem *******************************************************************************
rem
rem The third parameter sent to hbmk2 is -q (Harbour quiet mode)

rem ******************************************************************************
rem CALL HBMK2
rem ******************************************************************************

HBMK2 -o%~n1.exe %HMGPATH%\hmg.hbc %gtdrivers% %debug% -q %1 %2 %3 %4 %5 %6 %7 %8 >hbmk.log 2>&1

rem ******************************************************************************
rem CREATE LOGS
rem ******************************************************************************

if errorlevel 1 if exist windres.log copy /a windres.log+hbmk.log error.log >nul
if errorlevel 1 if not exist windres.log copy /a hbmk.log error.log >nul

if errorlevel 0 if exist windres.log copy /a windres.log+hbmk.log build.log >nul
if errorlevel 0 if not exist windres.log copy /a hbmk.log build.log >nul

rem ******************************************************************************
rem CLEANUP
rem ******************************************************************************

if exist windres.log del windres.log
if exist hbmk.log del hbmk.log
if exist _hmg_resconfig.h del _hmg_resconfig.h
if exist _temp.rc del _temp.rc
if exist _temp.o del _temp.o

rem ******************************************************************************
rem SHOW LOG
rem ******************************************************************************

if exist error.log type error.log
if exist build.log type build.log

rem ******************************************************************************
rem RUN APPLICATION
rem ******************************************************************************

if "%runafterbuild%"==".t." if exist %~n1.exe %~n1.exe
------------------------------------------------

The differences are in the HBMK2 Line
and there is no "fourth parameter"
In any case this doesn't change the Ide beahviour (.. mean it launches the application AFTER build, AFTER the complete execution of all build.bat)

Thank you
Post Reply