How to Change source directory

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

How to Change source directory

Post by bluebird »

New and Blue

My prg files build successfully residing in the c:\hmg3.4.3\mysourcecode directory using "..\build myprog.prg"

However, I want to put files together in a sub-directory off mySourceCode - as in c:\hmg3.4.3\mysourcecode \ProjectXZY

Looking at the HMG SAMPLES directory, there are complex (for me) batch files that work for samples in the SAMPLES directory.

How can I most easily make a batch file for my own subdirectory? Just moving BUILD.BAT does not do it.

Thanks
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

How to Change source directory

Post by Pablo César »

In my mind it's hard to put all your projects inside HMG installation folder. :shock:

I use to separate my projects in "My_Sources" and then I make subdirectories for each project.

Any way, I believe you can based on Build.bat of any HMG in SAMPLES directory. But you will need replace SAMPLES by mysourcecode (no spaces or must be quoted). I do not tested, but I believe it can works (if you have .hbp file ofcourse) in each your project.

I use much IDE. So easy and practical.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: How to Change source directory

Post by KDJ »

bluebird

In your project directory (c:\hmg3.4.3\mysourcecode\ProjectXZY), create build.cmd file with contents:

Code: Select all

call c:\hmg3.4.3\build.bat myprog.hbp
and create myprog.hbp file with contents (# - it is comment line):

Code: Select all

#harbour options:
#-w3

#hbmk2 options:
#-compr

#sources:
myprog.prg
#myprog1.prg
#myprog2.prg
And run build.cmd.
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: How to Change source directory

Post by dragancesu »

Easy, add c:\hmg3.4.3 to PATH
and use build myprog.hbp
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: How to Change source directory

Post by bluebird »

Kind Friend,
please correct this amateur batch file attempt to build mtxtest.hbp which resides in MySourceCode\mtxtestDir
Tel SET Temp1= line comes from the build files in \SAMPLES. I thought it meant the current directory .

BuildMtx.Bat contains

cls
SET Temp1=%~dp0
set PATH=c:\hmg3.4.3
build.bat mtxtest.hbp
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: How to Change source directory

Post by andyglezl »

Hola

La manera mas facíl ( para mí ), es crear un .bat en cada carpeta que tenga un proyecto
para compilar, con lo siguiente:

c.bat
******************************************
echo off
cls
D:\HMG\3.4.3\build agl-shell
******************************************

en donde solo cambio el nombre del programa principal.
------------------------------------------------------------------------------------------------------------
Hello

The easiest way (for me) is to create a .bat in every folder that has a project
To compile, with the following:

c.bat
******************************************
echo off
cls
D:\HMG\3.4.3\build agl-shell
******************************************

Where only the name of the main program changes.

Compilar.jpg
Compilar.jpg (153.38 KiB) Viewed 4392 times


If I change version of HMG, I only add
c.bat
******************************************
echo off
cls
rem D:\HMG\3.4.3\build agl-shell
D:\HMG\3.x.x\build agl-shell
******************************************
Andrés González López
Desde Guadalajara, Jalisco. México.
chrisjx2002
Posts: 190
Joined: Wed Jan 06, 2010 5:39 pm

Re: How to Change source directory

Post by chrisjx2002 »

I create a compile.bat with this line in the directory of the prg programm

FOR %%x IN (*.prg) DO (CALL c:\hmg.3.4.3\build.bat %%x )

It looks for all prg files in the current directory and compile them. You can replace prg by hbp.

That's all!
Post Reply