Jump to page: 1 2
Thread overview
building a D app with multiple source files
Aug 05, 2014
nikki
Aug 05, 2014
Vladimir Panteleev
Aug 05, 2014
nikki
Aug 05, 2014
Vladimir Panteleev
Aug 05, 2014
Vladimir Panteleev
Aug 05, 2014
nikki
Aug 05, 2014
Vladimir Panteleev
Aug 05, 2014
nikki
Aug 05, 2014
Mike Parker
Aug 05, 2014
nikki
Aug 05, 2014
Gary Willoughby
Aug 05, 2014
nikki
Aug 05, 2014
Vladimir Panteleev
Aug 05, 2014
Gary Willoughby
August 05, 2014
Hello, I am completely new to D and have been paying around with
the tutorials, some docs and little test programs.

Now I want to try and use https://github.com/elvisxzhou/artemisd
for little gamedev experiment but I am running into build issues.
That project doesn't have a Makefile in the repo, and I am on
linux so I need to build it on the terminal,

I've read about rdmd (and tried it without success) and found a
few 'general' usage Makefiles, can't get any to just work when I
type 'make all'.

in the repo I linked to (artemisd) there are dozens of source
files in various folders, and an example i have to compile at the
same time I think.

could someone show me how it's done ?
August 05, 2014
On Tuesday, 5 August 2014 at 07:27:18 UTC, nikki wrote:
> Hello, I am completely new to D and have been paying around with
> the tutorials, some docs and little test programs.
>
> Now I want to try and use https://github.com/elvisxzhou/artemisd
> for little gamedev experiment but I am running into build issues.
> That project doesn't have a Makefile in the repo, and I am on
> linux so I need to build it on the terminal,
>
> I've read about rdmd (and tried it without success) and found a
> few 'general' usage Makefiles, can't get any to just work when I
> type 'make all'.
>
> in the repo I linked to (artemisd) there are dozens of source
> files in various folders, and an example i have to compile at the
> same time I think.
>
> could someone show me how it's done ?

What issues have you had with rdmd?

The library seems to have a package.json file, so you could also try dub:
http://code.dlang.org/download
August 05, 2014
edit : btw, I understand how to build an app that conscists out of a few source files, I'd just do 'dmd file1.d file2.d' I amtalking here about the situation where that's unpractical because of the amount and folder structure.


August 05, 2014
On Tuesday, 5 August 2014 at 07:29:46 UTC, nikki wrote:
> edit : btw, I understand how to build an app that conscists out of a few source files, I'd just do 'dmd file1.d file2.d' I amtalking here about the situation where that's unpractical because of the amount and folder structure.

With rdmd, simply run `rdmd --build-only mainfile.d` (mainfile.d being the file that contains the "main" function). Omit --build-only to build the program to a temporary directory, then run it.
August 05, 2014
On Tuesday, 5 August 2014 at 07:29:46 UTC, nikki wrote:
> edit : btw, I understand how to build an app that conscists out of a few source files, I'd just do 'dmd file1.d file2.d' I amtalking here about the situation where that's unpractical because of the amount and folder structure.

You can take a look at the dub build tool to automate all this (as mentioned above). Dub works by compiling and linking everything together in your source folder. You specify the main entry point in a dub.json file. It's pretty easy to use and good for handling dependencies over the internet.

To compile things manually you can use rdmd to automatically parse the files that need compiling. When using rdmd you only need to specify the file that contains the main function to build everything around it. for example:

rdmd program.d

This will pull in all imports inside program.d and compile and link them too.
August 05, 2014
>
> What issues have you had with rdmd?
>
> The library seems to have a package.json file, so you could also try dub:
> http://code.dlang.org/download


nikki@crunchbang:~/projects/d/artemisd$ rdmd example/source/app.d
example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which cannot be read
import path[0] = example/source
import path[1] = /usr/include/dmd/phobos
import path[2] = /usr/include/dmd/druntime/import
Failed: ["dmd", "-v", "-o-", "example/source/app.d", "-Iexample/source"]

nikki@crunchbang:~/projects/d/artemisd$ rdmd --makedepend example/source/app.d
example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which cannot be read
import path[0] = example/source
import path[1] = /usr/include/dmd/phobos
import path[2] = /usr/include/dmd/druntime/import
Failed: ["dmd", "-v", "-o-", "example/source/app.d", "-Iexample/source"]

August 05, 2014
On Tuesday, 5 August 2014 at 07:43:56 UTC, nikki wrote:
>
>>
>> What issues have you had with rdmd?
>>
>> The library seems to have a package.json file, so you could also try dub:
>> http://code.dlang.org/download
>
>
> nikki@crunchbang:~/projects/d/artemisd$ rdmd example/source/app.d
> example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which cannot be read
> import path[0] = example/source
> import path[1] = /usr/include/dmd/phobos
> import path[2] = /usr/include/dmd/druntime/import
> Failed: ["dmd", "-v", "-o-", "example/source/app.d", "-Iexample/source"]
>
> nikki@crunchbang:~/projects/d/artemisd$ rdmd --makedepend example/source/app.d
> example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which cannot be read
> import path[0] = example/source
> import path[1] = /usr/include/dmd/phobos
> import path[2] = /usr/include/dmd/druntime/import
> Failed: ["dmd", "-v", "-o-", "example/source/app.d", "-Iexample/source"]

The search path does not include the artemisd package.

Try: cd .. && rdmd artemisd/example/source/app.d
Or : rdmd -I.. example/source/app.d
August 05, 2014
On Tuesday, 5 August 2014 at 07:46:05 UTC, Vladimir Panteleev wrote:
> On Tuesday, 5 August 2014 at 07:43:56 UTC, nikki wrote:
>>
>>>
>>> What issues have you had with rdmd?
>>>
>>> The library seems to have a package.json file, so you could also try dub:
>>> http://code.dlang.org/download
>>
>>
>> nikki@crunchbang:~/projects/d/artemisd$ rdmd example/source/app.d
>> example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which cannot be read
>> import path[0] = example/source
>> import path[1] = /usr/include/dmd/phobos
>> import path[2] = /usr/include/dmd/druntime/import
>> Failed: ["dmd", "-v", "-o-", "example/source/app.d", "-Iexample/source"]
>>
>> nikki@crunchbang:~/projects/d/artemisd$ rdmd --makedepend example/source/app.d
>> example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which cannot be read
>> import path[0] = example/source
>> import path[1] = /usr/include/dmd/phobos
>> import path[2] = /usr/include/dmd/druntime/import
>> Failed: ["dmd", "-v", "-o-", "example/source/app.d", "-Iexample/source"]
>
> The search path does not include the artemisd package.
>
> Try: cd .. && rdmd artemisd/example/source/app.d
> Or : rdmd -I.. example/source/app.d

Correction:

rdmd -Isource example/source/app.d
August 05, 2014
> Correction:
>
> rdmd -Isource example/source/app.d

that one worked, woohoo thanks.

what did the -Isource do? it's not in the 'rdmd --help'
August 05, 2014
On Tuesday, 5 August 2014 at 07:51:53 UTC, nikki wrote:
>> Correction:
>>
>> rdmd -Isource example/source/app.d
>
> that one worked, woohoo thanks.
>
> what did the -Isource do? it's not in the 'rdmd --help'

You'll find it in dmd's --help. It adds the "source" directory to the search path, the list of directories where the compiler looks for imported modules.
« First   ‹ Prev
1 2