by rhlawek » Thu Oct 03, 2013 11:18 pm
Perhaps this will help. Sorry for being verbose.
I use hbmk2 with .hbp and .hbm files for building everything I do, which has the added benefit of making it easy to use different compilers and move across platforms. I use msvc, both 32 and 64 bit, for regular work, but I can switch to any compiler seamlessly, as well as to Linux depending upon the features of an app. Please note that I don't take credit for this work Viktor Szakáts provided the original ideas, did all the hbmk2 work, and deserves a great deal of credit for his work. There is much more to hbmk2 than I've noted below.
For my VS2012 machine I use a batch file such as the following to set up the environment for building.
//hb32.bat
set PATH=c:\harbour\bin;%PATH%
cd c:\fwh\samples
call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
start "Harbour 32 bit Environment"
Given hello.prg
procedure main()
? "Hello World!"
return
Compiling hello.prg then becomes:
hbmk2 hello.prg
If there are a number of prg files it could be:
hbmk2 hello.prg mod1.prg mod2.prg
If I have code with xharbour syntax, as follows, the hbcompat.ch file can be included on the build line without having to add it to each separate source, it gets included as would any standard header:
procedure main()
TRY
? "Hello World!"
CATCH
END
return
hbmk2 hello.prg hbcompat.ch
As for FWH, I started with harbour well before I ever used FWH and I had an established build environment already. I long ago ported the batch files FiveWin provides and put the libraries and paths referenced there within a single .hbm file, which I can use unchanged regardless of compiler being used, or platform. I've included below a version edited to match what FWH would normally install for 32 bits on Windows. I actually use a different directory structure than this to make it easier to deal with multiple compilers without having to maintain multiple build scripts. I'll be happy to share that, but I want to discuss it with Antonio offline first.
procedure main()
USE "customer.dbf" ALIAS cust
TRY
Browse()
CATCH
END
return
hbmk2 hello.prg hbcompat.ch c:\harbour\fwh.hbm
Below is the fwh.hbm file I use, but I've edited it to be usable with standard FWH paths, as the actual one I use conforms to harbour's standard library placement. One thing you will note is the libraries do not include the .lib extension. This is intentional and is done in all my build scripts because it makes them compiler agnostic, I don't change anything to go from msvc and its xhb.lib file to mingw and its xhb.a lib file. hbmk2 will actually warn about including extensions making things less portable.
You will notice I use forward slashes instead of back slashes for WIndows, it works and keeps things more compatible with my linux builds. These lines all start with {win}, which seems redundant if compiling on windows, but I use the same build files for linux, where they get prefixed by {linux} for the linux specific stuff...the linux tags are ignore on windows and vice versa. I've just not included them here to avoid confusing things.
// fwh.hbm
# Should be compatible with standard FWH 32 bit install.
# it's a multithreaded gui
-gui
-mt
-incpath=/fwh/include
-L/fwh/lib
# Harbour libraries required by FWH
{win}-lxhb
{win}-lhbct
{win}-lhbwin
{win}-lpng
# All FWH for windows
{win}-lFiveH
{win}-lFiveHC
# All Windows libraries required for FWH
{win}-lversion
{win}-lmsimg32
{win}-loledlg
{win}-lpsapi
{win}-lkernel32
{win}-luser32
{win}-lgdi32
{win}-lwinspool
{win}-lcomctl32
{win}-lcomdlg32
{win}-ladvapi32
{win}-lshell32
{win}-lole32
{win}-loleaut32
{win}-luuid
{win}-lodbc32
{win}-lodbccp32
{win}-liphlpapi
{win}-lmpr
{win}-lwsock32
{win}-lgdiplus
{win}-lwinmm
{win}-lWS2_32
// fwh.hbm - eof.
Best regards,
Robb