Zeus IDE Forum Index Zeus IDE
Use this forum to ask for help, submit a bug report or make a suggestion.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

D Language Tutorial - Getting D to Work with Zeus

 
Post new topic   Reply to topic    Zeus IDE Forum Index -> Tutorials, Tips and Tricks
View previous topic :: View next topic  
Author Message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2103

PostPosted: Thu Jul 02, 2009 12:51 pm    Post subject: D Language Tutorial - Getting D to Work with Zeus Reply with quote

Install the D Compiler
Before attempting to use these D language build tools make sure the D compiler has been installed correctly.

NOTE: For information on using the DUB Build Manager refer to this link.

Using a Build Tool to Manage the Project Build

As the D project grows in complexity, the management of the build will be made easier if a build tool is used.

Zeus really does not care which build tool is used and when it comes to D it turns out there are several options Wink


Using Bud to Manage the Project Build

The first option would be manage the build using the Bud build tool.

To manage the project using Bud change the Workspace Options to use the following command lines:
  • Make Command Line: bud main
  • Clean Command Line: bud -clean main
  • Make Command Line: bud -full main
NOTE: Bud expects the top most file of the application's hierarchy to be passed in via the command line, so for this example that file is main. If your project uses a different top file then just change the name to suit.

IMPORTANT: For this to work make sure the Bud executable is in the system PATH.


Using DSSS to Manage the Project Build

Another option would be to use DSSS to manage the build.

To use DSSS requires the creation of a dsss.conf for each of the two projects in the workspace. Here is a DSSS tutorial on how to create these conf files.

With the dsss.conf files created in the correct folder location, just change the Zeus workspace Make Command Line: to be: dsss build


Using a Make File to Manage the Project Build
It is also possible to manage the build using a simple make file.

Because the main.d references some functions in the mathLIB module, a compile and link process will be needed to create the executable.

The command line in the D Document type could be adjusted to include the missing files, but a better alternative is to create a make file to handle the process of building the project.

1: Create the main.mak file in this folder location:
Code:
C:\d\main\main.mak

The main.mak file should look like this:
Code:
# Simple Makefile to Create my main.exe

DMD=dmd.exe

# Make sure the mathLib location is in the include path
DFLAGS=-O -release -nofloat -w -Ic:\d

.d.obj:
   $(DMD) -c $(DFLAGS) $*

main : main.exe

# ink the exectutable with the mathLIB.lib file
main.exe : main.obj
   dmd -ofmain.exe main.obj ..\mathLIB\mathLIB.lib

clean:
   del main.exe math.obj

2: Create the mathLIB.mak file in this folder location:
Code:
C:\d\mathLIB\mathLIB.mak

The mathLIB.mak file should look like this:
Code:
# Simple Makefile to Create my mathLIB

DFLAGS=-O -release -nofloat -w

DMD=dmd.exe

.d.obj:
   $(DMD) -c $(DFLAGS) $*

mathLIB : mathLIB.lib

mathLIB.lib : math1.obj math2.obj
   dmd -ofmathLIB.lib -lib math1.obj math2.obj

clean:
   del math1.obj math2.obj mathLIB.lib

3: Use the Zeus Workspace, Options menu and in the General section for the main project add the following command lines:
  • Make Command Line: make -f main.mak
  • Clean Command Line: make -f main.mak clean
4: Use the Zeus Workspace, Options menu and in the General section for the mathLIB project
  • Make Command Line: make -f mathLIB.mak
  • Clean Command Line: make -f mathLIB.mak clean
5: Now the build and clean operations can be run from withing Zeus using the Workspace, Build menu or by right clicking on the project in the Workspace navigator and selecting make or clean options.

Now when these make menus are run on the mathLIB and main projects a mathLIB.lib and main.exe files are produced:
Code:
C:\d\main>dir *.exe
 Directory of C:\d\main

09/03/2009  11:39           133,660 main.exe
               1 File(s)        133,660 bytes
               0 Dir(s)     789,381,120 bytes free

Related Topics:
Using the D Programming Language with Zeus.
Getting the D language debugger to work with Zeus.
Intergrating the D programming language help file.
Intergrating the D programming language Tango help file.
Writing Zeus macros using D scripting module.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Zeus IDE Forum Index -> Tutorials, Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group