DlangScience / scid

Scientific library for the D programming language
Boost Software License 1.0
90 stars 31 forks source link

Add makefile build system to support all compiller #9

Closed bioinfornatics closed 10 years ago

bioinfornatics commented 11 years ago

A Powerful way to build and install scid

$ make
$ make install

Parallel

Here we used 4 thread

$ make -j4
$ make install -j4

Setting a compiler

$ make -j4 DC=ldc2

Setting install directory

$ make install -j4 PREFIX=/usr LIB_DIR=/usr/lib64

Setting DFLAGS

$ make DFLAGS="-w -d -g -O3"

Unittest

I do not see how you use unitest To use it with make should to be something close to:

$ make -j9 DFLAGS="-unittest -w -g "
$ ldc2  -L-lgfortran -L-llapack -L-lblas -of test -unittest  unittests.d lib/libscid-ldc.a 
$ ./test

Building as shared lib

Default build as static lib to get a shared lib use all-shared target

make -j9 all-shared
bioinfornatics commented 11 years ago

@kyllingstad ping

kyllingstad commented 11 years ago

Thanks for pinging me. (I wish GitHub would send me an e-mail when someone opens a pull request...)

Let me start off by saying that I have a strong dislike for makefiles. That said, this one of the more well-written I have seen. :-) Nice work, thanks!

The plan is, and has always been, to either (1) improve the current build system, or (2) use another D build system. However, I still haven't gotten around to doing (1), and so far the community doesn't seem to have settled on anything for (2) (though DUB seems to be sailing up as a strong contender). I understand that there is a need for something better than the current build.d, so I will add your makefile, but please be warned that it may be a temporary solution, and that it will be replaced if/when a good D build system comes along.

Which compiler/platform combinations have you tested this with?

kyllingstad commented 11 years ago

I see that you have added Windows support. Which make variant is it for – the one bundled with DMC?

bioinfornatics commented 11 years ago

gl3n project use this makefile and some others D project gdc ldc and dmd works fine. This makefile allow to me to puth scid into official fedora repo whereas dub do not allow this. Because dub install file in non standard path. dub is a good tool for users but not for packagers.

The filter variable for your projct is useless. Some project like tango have some scial file which need to be build for a specific OS. And usually d file are put into a package where name corresponding to OS.

project/
├── freebsd
│   └── module.d
├── linux
│   └── module.d
└── windows
    └── module.d

Like this you are able to import somewhere the right module to given OS.

version( freebsd ) import project.freebsd.module;
version( linux )   import project.linux.module;
version( windows ) import project.windows.module;

This was put mainly for tango(2)

The platform less tested is windows

bioinfornatics commented 10 years ago

@kyllingstad these files come from the project https://github.com/bioinfornatics/MakefileForD This allow to me to put easily D project into fedora repo. I wait this pull request to finnish scid packaging https://bugzilla.redhat.com/show_bug.cgi?id=865371

kyllingstad commented 10 years ago

Merged. And let me say that I think it is awesome that you're trying to get SciD into the Fedora repos. :-) Thanks!