1 module build; 2 3 import std.stdio; 4 import std.file; 5 import std.process; 6 import std.algorithm; 7 import std.array; 8 9 10 version(DigitalMars) 11 { 12 bool isDMD = true; 13 bool isGDC = false; 14 bool isLDC = false; 15 string compiler = "dmd "; 16 } 17 else version(GNU) 18 { 19 bool isDMD = false; 20 bool isGDC = true; 21 bool isLDC = false; 22 string compiler = "gdc "; 23 } 24 else version(LDC) 25 { 26 bool isDMD = false; 27 bool isGDC = false; 28 bool isLDC = true; 29 string compiler = "ldc2 "; 30 } 31 else 32 { 33 static assert(false, "Unknown or unsupported compiler."); 34 } 35 36 //location settings 37 string currentDirectory; 38 string impDirectory; 39 string libDirectory; 40 string interfaceDirectory; 41 string docDirectory; 42 string unittestDirectory; 43 44 //build settings 45 string prefix; 46 string extension; 47 string libCompilerSwitches; 48 string docCompilerSwitches; 49 string interfaceCompilerSwitches; 50 string unittestCompilerSwitches; 51 bool buildStop; 52 53 54 //switch settings 55 bool buildingLibs; 56 bool buildingInterfaceFiles; 57 bool buildingDoc; 58 bool showingHelp; 59 bool force32Build; 60 bool force64Build; 61 62 bool buildingUnittests; 63 string unittestLibraryLocation; 64 65 bool buildingAll; 66 67 bool hasUnrecognizedSwitch; 68 string unrecognizedSwitch; 69 70 71 version(Windows) 72 { 73 bool isWindows = true; 74 bool isLinux = false; 75 bool isMac = false; 76 } 77 else version(linux) 78 { 79 bool isWindows = false; 80 bool isLinux = true; 81 bool isMac = false; 82 } 83 else version(OSX) 84 { 85 bool isWindows = false; 86 bool isLinux = false; 87 bool isMac = true; 88 } 89 else 90 { 91 static assert(false, "DSFML is only supported on OSX, Windows, and Linux."); 92 } 93 94 95 string[5] modules = ["system", "audio", "network", "window", "graphics"]; 96 97 //This is to circumvent a bug in GDC's current Windows 32 bit builds. 98 //The aa is set up in the initialize function. 99 string[][string] fileList; 100 101 102 103 104 //parses and finds all given switches 105 void parseSwitches(string[] switches) 106 { 107 //no switches passed 108 if(switches.length ==0) 109 { 110 buildingLibs = true; 111 return; 112 } 113 114 //find those switches! 115 foreach(clswitch;switches) 116 { 117 118 switch(clswitch) 119 { 120 case "-help": 121 { 122 showingHelp = true; 123 break; 124 } 125 case "-lib": 126 { 127 buildingLibs = true; 128 break; 129 } 130 case "-doc": 131 { 132 buildingDoc = true; 133 break; 134 } 135 case "-import": 136 { 137 buildingInterfaceFiles = true; 138 break; 139 } 140 case "-m32": 141 { 142 force32Build = true; 143 break; 144 } 145 case "-m64": 146 { 147 force64Build = true; 148 break; 149 } 150 case "-dmd": 151 { 152 isDMD = true; 153 isGDC = false; 154 isLDC = false; 155 compiler = "dmd "; 156 break; 157 } 158 case "-gdc": 159 { 160 isDMD = false; 161 isGDC = true; 162 isLDC = false; 163 compiler = "gdc "; 164 break; 165 } 166 case "-ldc": 167 { 168 isDMD = false; 169 isGDC = false; 170 isLDC = true; 171 compiler = "ldc2 "; 172 break; 173 } 174 case "-unittest": 175 { 176 buildingUnittests = true; 177 unittestLibraryLocation = ""; 178 break; 179 } 180 case "-all": 181 { 182 buildingAll = true; 183 unittestLibraryLocation = ""; 184 break; 185 } 186 187 default: 188 { 189 190 191 //check for unittest switch 192 auto result = clswitch.findSplit(":"); 193 194 //if some unknown switch 195 if(result[0] == clswitch) 196 { 197 hasUnrecognizedSwitch = true; 198 unrecognizedSwitch = clswitch; 199 return; 200 } 201 else 202 { 203 //found unittest or all Switch 204 if((result[0] == "-unittest")) 205 { 206 buildingUnittests = true; 207 unittestLibraryLocation = result[2]; 208 } 209 else if((result[0] == "-all")) 210 { 211 buildingAll = true; 212 unittestLibraryLocation = result[2]; 213 } 214 //found unknown switch that happened to have a : in it 215 else 216 { 217 hasUnrecognizedSwitch = true; 218 unrecognizedSwitch = clswitch; 219 return; 220 } 221 } 222 } 223 } 224 } 225 226 227 //make sure the default happens if not building anything else 228 if(!buildingLibs || !buildingDoc || !buildingInterfaceFiles || !buildingUnittests || !buildingAll) 229 { 230 buildingLibs = true; 231 } 232 233 } 234 235 //checks for any inconsistencies with the passed switchs. Returns true if everything is ok and false if an error was found. 236 bool checkSwitchErrors() 237 { 238 239 //if Switchs are used with -help 240 if(showingHelp) 241 { 242 if(buildingLibs || buildingDoc || buildingInterfaceFiles || buildingUnittests || buildingAll || hasUnrecognizedSwitch || force32Build || force64Build) 243 { 244 writeln("Using -help will ignore all other switches."); 245 return false; 246 } 247 } 248 249 //can't force both 250 if(force32Build && force64Build) 251 { 252 writeln("Can't use -m32 and -m64 together"); 253 return false; 254 } 255 256 //if other Switchs are used with -all 257 if(buildingAll) 258 { 259 if(buildingLibs || buildingDoc || buildingInterfaceFiles || buildingUnittests) 260 { 261 writeln("Can't use -all with any other build switches (-lib, -doc, -import, -unittest)"); 262 return false; 263 } 264 265 if(unittestLibraryLocation == "") 266 { 267 writeln("Not putting in a location for shared libraries will work if they are in a standard location."); 268 } 269 270 } 271 272 if(buildingUnittests) 273 { 274 if(unittestLibraryLocation == "") 275 { 276 writeln("Note: Not putting in a location for shared libraries will work only if they are in a standard location."); 277 } 278 } 279 280 return true; 281 } 282 283 //initialize all build settings 284 void initialize() 285 { 286 287 //Setting up our aa with our lists of files because GDC crashes when searching for them at runtime 288 fileList["system"] = ["clock.d", "config.d", "err.d", "inputstream.d", "lock.d", "mutex.d", "package.d", "sleep.d", "string.d", "thread.d", "vector2.d", "vector3.d"]; 289 fileList["audio"] = ["listener.d", "music.d", "package.d", "sound.d", "soundbuffer.d", "soundbufferrecorder.d", "soundfile.d", "soundrecorder.d", "soundsource.d", "soundstream.d"]; 290 fileList["network"] = ["ftp.d", "http.d", "ipaddress.d", "package.d", "packet.d", "socket.d", "socketselector.d", "tcplistener.d", "tcpsocket.d", "udpsocket.d"]; 291 fileList["window"] = ["context.d", "contextsettings.d", "event.d", "joystick.d", "keyboard.d", "mouse.d", "package.d", "videomode.d", "window.d", "windowhandle.d"]; 292 fileList["graphics"] = ["blendmode.d", "circleshape.d", "color.d", "convexshape.d", "drawable.d", "font.d", "glyph.d", "image.d", "package.d", "primitivetype.d", "rect.d", "rectangleshape.d", "renderstates.d", "rendertarget.d", "rendertexture.d", "renderwindow.d", "shader.d", "shape.d", "sprite.d", "text.d", "texture.d", "transform.d", "transformable.d", "vertex.d", "vertexarray.d", "view.d"]; 293 294 295 if(isWindows) 296 { 297 currentDirectory = getcwd; 298 impDirectory = currentDirectory~"\\src"; 299 libDirectory = currentDirectory~"\\lib\\"; 300 interfaceDirectory = currentDirectory~"\\import\\"; 301 docDirectory = currentDirectory~"\\doc\\"; 302 unittestDirectory = currentDirectory~"\\unittest\\"; 303 304 if(!exists(currentDirectory~"\\lib\\")) 305 { 306 mkdir(currentDirectory~"\\lib\\"); 307 } 308 } 309 else 310 { 311 currentDirectory = getcwd; 312 impDirectory = `"`~currentDirectory~"/src"~`"`; 313 libDirectory = `"`~currentDirectory~"/lib/"~`"`; 314 interfaceDirectory = `"`~currentDirectory~"/import/"~`"`; 315 docDirectory = `"`~currentDirectory~"/doc/"~`"`; 316 unittestDirectory = `"`~currentDirectory~"/unittest/"~`"`; 317 318 if(!exists(currentDirectory~"/lib/")) 319 { 320 mkdir(currentDirectory~"/lib/"); 321 } 322 } 323 324 325 326 if(isDMD) 327 { 328 initializeDMD(); 329 } 330 else if(isGDC) 331 { 332 initializeGDC(); 333 } 334 else 335 { 336 initializeLDC(); 337 } 338 339 if(force32Build) 340 { 341 libCompilerSwitches = "-m32 "~libCompilerSwitches; 342 unittestCompilerSwitches = "-m32 "~unittestCompilerSwitches; 343 } 344 345 if(force64Build) 346 { 347 libCompilerSwitches = "-m64 "~libCompilerSwitches; 348 unittestCompilerSwitches = "-m64 "~unittestCompilerSwitches; 349 } 350 351 352 writeln(); 353 } 354 355 void initializeDMD() 356 { 357 if(isWindows) 358 { 359 writeln("Building for Windows with dmd"); 360 prefix = ""; 361 extension = ".lib"; 362 unittestCompilerSwitches = "-main -unittest -cov -I"~impDirectory~" dsfml-graphics.lib dsfml-window.lib dsfml-audio.lib dsfml-network.lib dsfml-system.lib dsfmlc-graphics.lib dsfmlc-window.lib dsfmlc-audio.lib dsfmlc-network.lib dsfmlc-system.lib "; 363 364 if(!force64Build) 365 { 366 unittestCompilerSwitches~="-L+"~libDirectory; 367 } 368 else 369 { 370 unittestCompilerSwitches~="-L/LIBPATH:"~libDirectory; 371 } 372 } 373 else if(isLinux) 374 { 375 writeln("Building for Linux with dmd"); 376 prefix = "lib"; 377 extension = ".a"; 378 unittestCompilerSwitches = "-main -unittest -cov -I"~impDirectory~" -L-ldsfml-graphics -L-ldsfml-window -L-ldsfml-audio -L-ldsfml-network -L-ldsfml-system -L-ldsfmlc-graphics -L-ldsfmlc-window -L-ldsfmlc-audio -L-ldsfmlc-network -L-ldsfmlc-system -L-L"~libDirectory; 379 } 380 else 381 { 382 writeln("Building for OSX with dmd"); 383 prefix = "lib"; 384 extension = ".a"; 385 unittestCompilerSwitches = "-main -unittest -cov -I"~impDirectory~" -L-ldsfml-graphics -L-ldsfml-window -L-ldsfml-audio -L-ldsfml-network -L-ldsfml-system -L-ldsfmlc-graphics -L-ldsfmlc-window -L-ldsfmlc-audio -L-ldsfmlc-network -L-ldsfmlc-system -L-L"~libDirectory; 386 } 387 388 unittestCompilerSwitches ="-version=DSFML_Unittest_System -version=DSFML_Unittest_Window -version=DSFML_Unittest_Graphics -version=DSFML_Unittest_Audio -version=DSFML_Unittest_Network "~unittestCompilerSwitches; 389 390 391 libCompilerSwitches = "-lib -O -release -inline -I"~impDirectory; 392 docCompilerSwitches = "-D -Dd"~docDirectory~" -c -o- -op"; 393 interfaceCompilerSwitches = "-H -Hd"~interfaceDirectory~" -c -o- -op"; 394 } 395 396 void initializeGDC() 397 { 398 if(isWindows) 399 { 400 writeln("Building for Windows with gdc"); 401 } 402 else if(isLinux) 403 { 404 writeln("Building for Linux with gdc"); 405 } 406 else 407 { 408 writeln("Building for OSX with gdc"); 409 } 410 prefix = "lib"; 411 extension = ".a"; 412 unittestCompilerSwitches = "-fversion=DSFML_Unittest_System -fversion=DSFML_Unittest_Window -fversion=DSFML_Unittest_Graphics -fversion=DSFML_Unittest_Audio -fversion=DSFML_Unittest_Network -funittest -I"~impDirectory~" -ldsfml-graphics -ldsfml-window -ldsfml-audio -ldsfml-network -ldsfml-system -ldsfmlc-graphics -ldsfmlc-window -ldsfmlc-audio -ldsfmlc-network -ldsfmlc-system -L"~libDirectory; 413 414 libCompilerSwitches = "-c -O3 -frelease -I"~impDirectory; 415 docCompilerSwitches = " -fdoc -c"; 416 interfaceCompilerSwitches = " -fintfc -c"; 417 418 } 419 420 void initializeLDC() 421 { 422 //The stuff for windows probbly needs to be fixed 423 if(isWindows) 424 { 425 writeln("Building for Windows with ldc"); 426 427 428 429 if(!force64Build) 430 { 431 prefix = "lib"; 432 extension = ".a"; 433 434 unittestCompilerSwitches = "-main -unittest -I="~impDirectory~" -L=-ldsfml-graphics -L=-ldsfml-window -L=-ldsfml-audio -L=-ldsfml-network -L=-ldsfml-system -L=-ldsfmlc-graphics -L=-ldsfmlc-window -L=-ldsfmlc-audio -L=-ldsfmlc-network -L=-ldsfmlc-system -L=-L"~libDirectory; 435 436 unittestCompilerSwitches~="-L=-L"~libDirectory; 437 } 438 else 439 { 440 prefix = ""; 441 extension = ".lib"; 442 443 unittestCompilerSwitches = "-main -unittest -I="~impDirectory~" dsfml-graphics.lib dsfml-window.lib dsfml-audio.lib dsfml-network.lib dsfml-system.lib dsfmlc-graphics.lib dsfmlc-window.lib dsfmlc-audio.lib dsfmlc-network.lib dsfmlc-system.lib "; 444 445 unittestCompilerSwitches~="-L=/LIBPATH:"~libDirectory; 446 447 } 448 } 449 else if(isLinux) 450 { 451 writeln("Building for Linux with ldc"); 452 prefix = "lib"; 453 extension = ".a"; 454 unittestCompilerSwitches = "-main -singleobj -unittest -I="~impDirectory~" -L=-ldsfml-graphics -L=-ldsfml-window -L=-ldsfml-audio -L=-ldsfml-network -L=-ldsfml-system -L=-ldsfmlc-graphics -L=-ldsfmlc-window -L=-ldsfmlc-audio -L=-ldsfmlc-network -L=-ldsfmlc-system -L=-L"~libDirectory; 455 } 456 else 457 { 458 writeln("Building for OSX with ldc"); 459 prefix = "lib"; 460 extension = ".a"; 461 unittestCompilerSwitches = "-main -unittest -I="~impDirectory~" -L=-ldsfml-graphics -L=-ldsfml-window -L=-ldsfml-audio -L=-ldsfml-network -L=-ldsfml-system -L=-ldsfmlc-graphics -L=-ldsfmlc-window -L=-ldsfmlc-audio -L=-ldsfmlc-network -L=-ldsfmlc-system -L=-L"~libDirectory; 462 } 463 464 unittestCompilerSwitches ="-d-version=DSFML_Unittest_System -d-version=DSFML_Unittest_Window -d-version=DSFML_Unittest_Graphics -d-version=DSFML_Unittest_Audio -d-version=DSFML_Unittest_Network -oq "~unittestCompilerSwitches; 465 466 467 libCompilerSwitches = `-lib -O3 -release -oq -enable-inlining -I=`~impDirectory; 468 docCompilerSwitches = "-D -Dd="~docDirectory~" -c -o- -op"; 469 interfaceCompilerSwitches = "-H -Hd="~interfaceDirectory~" -c -o- -op"; 470 } 471 472 //build the static libraries. Returns true on successful build, false on unsuccessful build 473 bool buildLibs() 474 { 475 476 //This is because there is a bug that I haven't bothered to track down yet 477 //It causes the static libs to be built twice if building unit tests. 478 //Will fix properly when I care more. 479 static bool builtOnce = false; 480 481 if(builtOnce) 482 { 483 return true; 484 } 485 486 487 writeln("Building static libraries!"); 488 foreach(theModule;modules) 489 { 490 string files = ""; 491 492 foreach (string name; fileList[theModule]) 493 { 494 if(isDFile(name)) 495 { 496 files~= "src/dsfml/" ~theModule~"/"~name ~ " "; 497 } 498 499 } 500 501 string buildCommand = compiler~ files ~ libCompilerSwitches; 502 503 if(isDMD) 504 { 505 //build the static libs directly 506 buildCommand ~= " -of"~libDirectory~prefix~"dsfml-"~theModule~extension; 507 } 508 else if(isGDC) 509 { 510 //build the object stuff and then build the archive 511 buildCommand ~= " -o"~libDirectory~"dsfml-"~theModule~".o"~" && ar rcs lib/libdsfml-"~theModule~extension~" " ~"lib/dsfml-"~theModule~".o"; 512 } 513 else 514 { 515 buildCommand ~= " -of="~libDirectory~prefix~"dsfml-"~theModule~extension; 516 } 517 518 writeln("Building " ~ theModule~ " module."); 519 520 auto status = executeShell(buildCommand); 521 522 if(status.status !=0) 523 { 524 writeln(status.output); 525 return false; 526 } 527 528 //If we had to build object files, let's delete them. 529 if(exists("lib/dsfml-"~theModule~".o")) 530 { 531 remove("lib/dsfml-"~theModule~".o"); 532 } 533 if(exists("lib/libdsfml-"~theModule~".o")) 534 { 535 remove("lib/libdsfml-"~theModule~".o"); 536 } 537 538 } 539 540 builtOnce = true; 541 return true; 542 } 543 544 //build the unit test. Returns true on successful build, false on unsuccessful build 545 bool buildUnittests() 546 { 547 writeln("Building unit tests!"); 548 string files = ""; 549 550 foreach(theModule;modules) 551 { 552 foreach (string name; fileList[theModule]) 553 { 554 if(isDFile(name)) 555 { 556 files~= "src/dsfml/" ~theModule~"/"~name ~ " "; 557 } 558 559 } 560 } 561 562 if(isGDC) 563 { 564 std.file.write("main.d", "void main(){}"); 565 files = "main.d "~files; 566 } 567 568 string buildCommand = compiler~files ~ unittestCompilerSwitches; 569 570 if(isDMD) 571 { 572 buildCommand~=" -of"~unittestDirectory~"unittest"; 573 } 574 else if(isGDC) 575 { 576 buildCommand~=" -o"~unittestDirectory~"unittest"; 577 } 578 else 579 { 580 buildCommand~=" -of="~unittestDirectory~"unittest"; 581 } 582 583 if(isWindows) 584 { 585 buildCommand~=".exe" ; 586 } 587 588 //set up unit test library location 589 { 590 591 if(unittestLibraryLocation != "") 592 { 593 if(isDMD) 594 { 595 if(isWindows) 596 { 597 598 if(!force64Build) 599 { 600 buildCommand~=" -L+"~unittestLibraryLocation; 601 } 602 else 603 { 604 buildCommand~=" -L/LIBPATH:"~unittestLibraryLocation; 605 } 606 } 607 else 608 { 609 buildCommand~=" -L-L"~unittestLibraryLocation; 610 } 611 } 612 else if(isGDC) 613 { 614 buildCommand~=" -L"~unittestLibraryLocation; 615 } 616 else 617 { 618 if(isWindows) 619 { 620 buildCommand~=" -L=/LIBPATH:"~unittestLibraryLocation; 621 } 622 else 623 { 624 buildCommand~=" -L=-L"~unittestLibraryLocation; 625 } 626 } 627 628 } 629 } 630 631 632 633 //writeln(buildCommand); 634 635 auto status = executeShell(buildCommand); 636 637 if(status.status !=0) 638 { 639 writeln(status.output); 640 return false; 641 } 642 return true; 643 } 644 645 void buildDoc() 646 { 647 writeln("Building documentation!"); 648 649 chdir("src"); 650 651 string files = ""; 652 foreach(theModule;modules) 653 { 654 foreach (string name; fileList[theModule]) 655 { 656 if(isDFile(name)) 657 { 658 files~= "dsfml/" ~theModule~"/"~name ~ " "; 659 } 660 661 } 662 } 663 664 string buildCommand = compiler~files ~ docCompilerSwitches; 665 666 auto status = executeShell(buildCommand); 667 668 if(status.status !=0) 669 { 670 writeln(status.output); 671 } 672 673 chdir(".."); 674 } 675 void buildDocGDC() 676 { 677 writeln("Building documentation!"); 678 679 chdir("src"); 680 681 foreach(theModule;modules) 682 { 683 foreach (string name; fileList[theModule]) 684 { 685 if(isDFile(name)) 686 { 687 string buildCommand = compiler~ "dsfml/" ~ theModule ~ name ~ docCompilerSwitches ~ " -fdoc-dir="~docDirectory~"dsfml/"~theModule; 688 689 auto status = executeShell(buildCommand); 690 691 if(status.status !=0) 692 { 693 writeln(status.output); 694 } 695 } 696 } 697 } 698 699 chdir(".."); 700 } 701 702 void buildInterfaceFiles() 703 { 704 writeln("Building interface files!"); 705 706 chdir("src"); 707 708 string filelist = ""; 709 foreach(theModule;modules) 710 { 711 foreach (string name; dirEntries("dsfml/"~theModule, SpanMode.depth)) 712 { 713 if(isDFile(name)) 714 { 715 filelist~= name ~ " "; 716 } 717 } 718 } 719 720 //TODO: Fix this for GDC 721 string buildCommand = compiler~filelist ~ interfaceCompilerSwitches; 722 723 auto status = executeShell(buildCommand); 724 725 if(status.status !=0) 726 { 727 writeln(status.output); 728 } 729 730 chdir(".."); 731 } 732 733 void buildInterfaceFilesGDC() 734 { 735 writeln("Building interface files!"); 736 737 chdir("src"); 738 739 foreach(theModule;modules) 740 { 741 foreach (string name; dirEntries("dsfml/"~theModule, SpanMode.depth)) 742 { 743 744 if(isDFile(name)) 745 { 746 747 string buildCommand = compiler~ name ~ interfaceCompilerSwitches ~ " -fintfc-dir="~interfaceDirectory~"dsfml/"~theModule; 748 749 auto status = executeShell(buildCommand); 750 751 if(status.status !=0) 752 { 753 writeln(status.output); 754 } 755 } 756 757 } 758 } 759 760 chdir(".."); 761 } 762 763 void showHelp() 764 { 765 writeln("Main switches:"); 766 writeln("-help : Show all supported switches."); 767 writeln("-lib : Build static libraries"); 768 writeln("-doc : Build documentation"); 769 writeln("-import : Build interface files for importing"); 770 writeln("-unittest : Build static libs and unittests"); 771 writeln("-all : Build everything"); 772 writeln("-unittest:sharedDir : Build static libs and unittests, sharedDir is the location of DSFMLC shared libraries"); 773 writeln("-all:sharedDir : Build everything, sharedDir is the location of DSFMLC shared libraries"); 774 writeln(); 775 writeln("Modifier switches:"); 776 writeln("-m32 : force a 32 bit build"); 777 writeln("-m64 : force a 64 bit build"); 778 writeln("-dmd : force using dmd as the compiler"); 779 writeln("-gdc : force using gdc as the compiler"); 780 writeln("-ldc : force using ldc as the compiler"); 781 782 writeln(); 783 writeln("Default (no switches passed) will be to build static libraries only with the compiler that built this script."); 784 } 785 786 //used to add quotes around full directories 787 //To be used in the next update (2.3) 788 string quoteString(string s) 789 { 790 return `"`~s~`"`; 791 } 792 793 //checks if a file is a .d file. 794 //osx adds those stupid .DS_Store files when I am working on things, and I hate them. 795 bool isDFile(string name) 796 { 797 string[] splitName = split(name, "."); 798 799 return (splitName[$-1] == "d"); 800 } 801 802 int main(string[] args) 803 { 804 805 parseSwitches(args[1..$]); 806 807 if(!checkSwitchErrors()) 808 { 809 return -1; 810 } 811 812 813 if(unrecognizedSwitch || showingHelp) 814 { 815 if(unrecognizedSwitch) 816 { 817 writeln("Found unrecognized switch: ", unrecognizedSwitch); 818 } 819 820 showHelp(); 821 return -1; 822 } 823 824 writeln(); 825 initialize(); 826 if(buildingLibs) 827 { 828 if(!buildLibs()) 829 { 830 return -1; 831 } 832 } 833 if(buildingUnittests) 834 { 835 if(!buildLibs()) 836 { 837 return -1; 838 } 839 if(!buildUnittests()) 840 { 841 return -1; 842 } 843 } 844 if(buildingDoc) 845 { 846 if(isGDC) 847 { 848 buildDocGDC(); 849 } 850 else 851 { 852 buildDoc(); 853 } 854 } 855 if(buildingInterfaceFiles) 856 { 857 if(isGDC) 858 { 859 buildInterfaceFilesGDC(); 860 } 861 else 862 { 863 buildInterfaceFiles(); 864 } 865 } 866 if(buildingAll) 867 { 868 if(!buildLibs()) 869 { 870 return -1; 871 } 872 buildDoc(); 873 buildInterfaceFiles(); 874 if(!buildUnittests()) 875 { 876 return -1; 877 } 878 } 879 880 writeln("Done!"); 881 return 0; 882 }