Advertisement
Benjamin_Loison

compile.php

Aug 15th, 2017
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.    $files = "";
  3.  
  4.    function listFolderFiles($dir)
  5.    {
  6.        global $files;
  7.        $ffs = scandir($dir);
  8.  
  9.        unset($ffs[array_search('.', $ffs, true)]);
  10.        unset($ffs[array_search('..', $ffs, true)]);
  11.  
  12.        if(count($ffs) < 1)
  13.            return;
  14.  
  15.        foreach($ffs as $ff)
  16.        {
  17.            if(!is_dir($dir.'/'.$ff) && (endsWith($ff, ".h") || endsWith($ff, ".cpp"))) $files .= $dir . '/' . $ff . ' ';
  18.            if(is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff);
  19.        }
  20.     }
  21.  
  22.     function endsWith($haystack, $needle)
  23.     {
  24.         $length = strlen($needle);
  25.         if($length == 0) return true;
  26.         return (substr($haystack, -$length) === $needle);
  27.     }
  28.  
  29.     listFolderFiles('.');
  30.     system("g++ " . $files . "-o Server -w -Wall -pedantic -lSOIL -lSDL2main -lSDL2 -lGL -lGLU -lSDL2_ttf -lSDL2_image -std=c++11 -lpthread -lcurl");
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement