mirror of
https://github.com/edmccard/twoapple-reboot.git
synced 2024-11-26 08:49:28 +00:00
New build.d
This commit is contained in:
parent
bf117ac730
commit
9f8f73f530
@ -16,6 +16,12 @@ Build by running `make` in the `src` directory; if the dependencies aren't insta
|
|||||||
make GTKD=/path/to/gtkd DERELICT=/path/to/Derelict2
|
make GTKD=/path/to/gtkd DERELICT=/path/to/Derelict2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Alternatively, you can run `build.d` from the `src` directory:
|
||||||
|
```
|
||||||
|
cd src
|
||||||
|
rdmd build.d --gtkd=/path/to/gtkd --derelict=/path/to/Derelict2
|
||||||
|
```
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
There are tests for the 6502/65C02 emulation:
|
There are tests for the 6502/65C02 emulation:
|
||||||
|
@ -7,7 +7,7 @@ LINK_OPTS = -L-lpthread -L-lGL -L-ldl -L-lX11 \
|
|||||||
-L-L$(GTKD) -L-lgtkd -L-lgtkdgl \
|
-L-L$(GTKD) -L-lgtkd -L-lgtkdgl \
|
||||||
-L-L$(DERELICT)/lib -L-lDerelictSDL -L-lDerelictUtil
|
-L-L$(DERELICT)/lib -L-lDerelictSDL -L-lDerelictUtil
|
||||||
|
|
||||||
ALL_SRC = $(shell find -name "*.d" \! -name "ctfe*")
|
ALL_SRC = $(shell find -name "*.d" \! -name "ctfe*" \! -name "build.d")
|
||||||
|
|
||||||
all: ${ALL_SRC}
|
all: ${ALL_SRC}
|
||||||
dmd $(COMPILE_OPTS) ${ALL_SRC} -oftwoapple ${LINK_OPTS}
|
dmd $(COMPILE_OPTS) ${ALL_SRC} -oftwoapple ${LINK_OPTS}
|
||||||
|
66
src/build.d
Normal file
66
src/build.d
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import std.algorithm, std.array, std.exception, std.getopt, std.process,
|
||||||
|
std.stdio;
|
||||||
|
|
||||||
|
|
||||||
|
string GTKD = "";
|
||||||
|
string DERELICT = "";
|
||||||
|
|
||||||
|
|
||||||
|
version(GNU)
|
||||||
|
string OPMODE = " -version=OpSwitch ";
|
||||||
|
else version(DigitalMars)
|
||||||
|
string OPMODE = " -version=OpNestedSwitch ";
|
||||||
|
else
|
||||||
|
static assert(0, "Unsupported compiler");
|
||||||
|
|
||||||
|
|
||||||
|
bool notGTKD(string a)
|
||||||
|
{
|
||||||
|
return indexOf(a, GTKD) == -1;
|
||||||
|
}
|
||||||
|
bool compilable(string a)
|
||||||
|
{
|
||||||
|
return endsWith(a, ".d") && indexOf(a, "ctfe") == -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(string[] args)
|
||||||
|
{
|
||||||
|
getopt(
|
||||||
|
args,
|
||||||
|
"gtkd", >KD,
|
||||||
|
"derelict", &DERELICT);
|
||||||
|
|
||||||
|
string opts = "-Jdata " ~ OPMODE;
|
||||||
|
if (GTKD.length)
|
||||||
|
opts ~= " -I" ~ GTKD ~ "/src -I" ~ GTKD ~ "/srcgl ";
|
||||||
|
if (DERELICT.length)
|
||||||
|
opts ~= " -I" ~ DERELICT ~ "/import ";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
auto deps = split(shell("rdmd --makedepend " ~ opts ~ " twoapple.d"));
|
||||||
|
auto d_files = array(filter!compilable(deps));
|
||||||
|
auto without_gtkd = array(filter!notGTKD(d_files));
|
||||||
|
opts = " -inline -release -O -noboundscheck " ~ opts ~
|
||||||
|
" -d -L-lGL -L-ldl -L-lX11 " ~
|
||||||
|
" -L-L" ~ DERELICT ~ "/lib -L-lDerelictSDL -L-lDerelictUtil ";
|
||||||
|
version(DigitalMars)
|
||||||
|
{
|
||||||
|
if (GTKD.length)
|
||||||
|
opts ~= " -L-L" ~ GTKD ~ " -L-lgtkd -L-lgtkdgl ";
|
||||||
|
auto files = join(without_gtkd, " ");
|
||||||
|
return system("dmd " ~ opts ~ " " ~ files);
|
||||||
|
}
|
||||||
|
else version(GNU)
|
||||||
|
{
|
||||||
|
auto files = join(d_files, " ");
|
||||||
|
return system("gdmd " ~ opts ~ " " ~ files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ErrnoException e)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user