function processTemplates()
 {
     $data = $this->readTemplate("safari_Info_plist.tpl");
     $data = str_replace("__CFBundleExecutable__", $this->BUNDLE, $data);
     $data = str_replace("__CFBundleIdentifier__", $this->IDENTIFIER, $data);
     $data = str_replace("__WebPluginDescription__", $this->DESCRIPTION, $data);
     $data = str_replace("__WebPluginMIMEType__", "application/" . $this->MIMETYPE, $data);
     $data = str_replace("__WebPluginName__", $this->PLUGINNAME, $data);
     $data = str_replace("__GameName__", getGameProjectName(), $data);
     //TODO: handled by Toolbox
     $data = str_replace("__GameInstallPath__", $this->GAMEFOLDER, $data);
     $this->writeFile('Info.plist', $data);
     WebPlugin::processNPPlugin($this);
 }
Exemple #2
0
 public function generate($tpl, $platform, $root_dir)
 {
     // Project container for templates
     $projects = array();
     $refs = array();
     // make sure that startup project is the first in the solution
     if (getGameProjectName()) {
         array_push($refs, getGameProjectName());
     }
     foreach ($this->project_refs as $pname) {
         if (getGameProjectName() && $pname == getGameProjectName()) {
             continue;
         }
         array_push($refs, $pname);
     }
     // Look up each project ref and add its info to the list
     foreach ($refs as $pname) {
         $project = Generator::lookupProjectByName($pname);
         if (isset($project)) {
             echo "      - project ref: " . $pname . " = " . $project->guid . "\n";
             array_push($projects, $project);
             // Let the project update any dependencies
             $project->validateDependencies();
         } else {
             trigger_error("Solution::generate() - project ref not found: " . $pname . "\n", E_USER_ERROR);
         }
     }
     // No use going forward if there were no projects for this solution is there?
     // (Would we ever want to generate an empty solution at all?)
     if (count($projects) == 0) {
         echo "Solution::generate() - no project refs found for solution: " . $this->name . "\n";
         continue;
     }
     //
     //sort( $projects );
     // Set smarty params that dont change during loop once here
     $tpl->assign_by_ref("solution_guid", $this->guid);
     $tpl->assign_by_ref("projects", $projects);
     $tpl->assign_by_ref("projectExtRefs", $this->project_extRefs);
     // Generate a solution file for all outputs for this solution
     foreach ($this->outputs as $output) {
         // Supported platform?
         if (!$output->supportsPlatform($platform)) {
             //echo( "      # Skipping output: '$outputName'.\n" );
             continue;
         }
         // Reset to base dir
         chdir($root_dir);
         // Then offset
         if (!FileUtil::prepareOutputDir($output->output_dir) || !$output->template_sln) {
             continue;
         }
         $outfile = $this->name . $output->solution_ext;
         echo "   - Writing solution file: " . $output->output_dir . "/" . $outfile;
         // Project filenames are <projectname>.<outputext> where ext is set per output.
         // The template builds each project output using the project name and this ext.
         $tpl->assign_by_ref("project_ext", $output->output_ext);
         if ($f = fopen($outfile, 'w')) {
             fputs($f, $tpl->fetch($output->template_sln));
             fclose($f);
             echo " - success " . "\n";
         } else {
             trigger_error("\nCould not write output file: " . $outfile, E_USER_ERROR);
         }
     }
 }
Exemple #3
0
 private function setTemplateParams($tpl, $output, &$projectFiles)
 {
     // Set the template delimiters
     $tpl->left_delimiter = $output->ldelim ? $output->ldelim : '{';
     $tpl->right_delimiter = $output->rdelim ? $output->rdelim : '}';
     $gameProjectName = getGameProjectName();
     // Evaluate template into a file.
     $tpl->assign_by_ref('projSettings', $this);
     $tpl->assign_by_ref('projOutput', $output);
     $tpl->assign_by_ref('fileArray', $projectFiles);
     $tpl->assign_by_ref('projName', $this->name);
     $tpl->assign_by_ref('projOutName', $this->outputName);
     $tpl->assign_by_ref('gameFolder', $this->game_dir);
     $tpl->assign_by_ref('GUID', $this->guid);
     $tpl->assign_by_ref('projDefines', $this->defines);
     $tpl->assign_by_ref('projDisabledWarnings', $this->disabledWarnings);
     $tpl->assign_by_ref('projIncludes', $this->includes);
     $tpl->assign_by_ref('projLibs', $this->libs);
     $tpl->assign_by_ref('projLibsDebug', $this->libsDebug);
     $tpl->assign_by_ref('projLibsIgnore', $this->libsIgnore);
     $tpl->assign_by_ref('projLibDirs', $this->lib_dirs);
     $tpl->assign_by_ref('projDepend', $this->dependencies);
     $tpl->assign_by_ref('gameProjectName', $gameProjectName);
     $tpl->assign_by_ref('projModuleDefinitionFile', $this->moduleDefinitionFile);
     $tpl->assign_by_ref('projSubSystem', $this->projSubSystem);
     if (T3D_Generator::$useDLLRuntime) {
         // /MD and /MDd
         $tpl->assign('projRuntimeRelease', 2);
         $tpl->assign('projRuntimeDebug', 3);
     } else {
         // /MT and /MTd
         $tpl->assign('projRuntimeRelease', 0);
         $tpl->assign('projRuntimeDebug', 1);
     }
     if (!$this->commandDebug && ($this->isSharedLib() || $this->isSharedApp())) {
         $command = "\$(TargetDir)\\" . $this->outputName;
         $tpl->assign('commandDebug', $command . "_DEBUG.exe");
         $tpl->assign('commandRelease', $command . ".exe");
         $tpl->assign('commandOptimized', $command . "_OPTIMIZEDDEBUG.exe");
     } else {
         $tpl->assign_by_ref('commandDebug', $this->commandDebug);
         $tpl->assign_by_ref('commandRelease', $this->commandRelease);
         $tpl->assign_by_ref('commandOptimized', $this->commandOptimized);
     }
     $tpl->assign_by_ref('argsDebug', $this->argsDebug);
     $tpl->assign_by_ref('argsRelease', $this->argsRelease);
     $tpl->assign_by_ref('argsOptimized', $this->argsOptimized);
     $ptypes = array();
     $projectDepends = array();
     foreach ($this->dependencies as $pname) {
         $p = T3D_Generator::lookupProjectByName($pname);
         $projectDepends[$pname] = $p;
         if ($p) {
             $ptypes[$pname] = $p->isSharedLib() || $p->isSafari();
         }
     }
     $tpl->assign_by_ref('projTypes', $ptypes);
     $tpl->assign_by_ref('projectDepends', $projectDepends);
     // Assign some handy paths for the template to reference
     $tpl->assign('projectOffset', $output->project_rel_path);
     if (T3D_Generator::$absPath) {
         $tpl->assign('srcDir', T3D_Generator::$absPath . "/" . str_replace("../", "", getAppEngineSrcDir()));
     } else {
         $tpl->assign('srcDir', $output->project_rel_path . getAppEngineSrcDir());
     }
     if (T3D_Generator::$absPath) {
         $tpl->assign('libDir', T3D_Generator::$absPath . "/" . str_replace("../", "", getAppLibSrcDir()));
     } else {
         $tpl->assign('libDir', $output->project_rel_path . getAppLibSrcDir());
     }
     if (T3D_Generator::$absPath) {
         $tpl->assign('binDir', T3D_Generator::$absPath . "/" . str_replace("../", "", getAppEngineBinDir()));
     } else {
         $tpl->assign('binDir', $output->project_rel_path . getAppEngineBinDir());
     }
     $tpl->assign('uniformOutputFile', $this->uniformOutputFile);
 }
Exemple #4
0
 static function endConfig()
 {
     //end shared/static config
     if (self::$sharedConfig) {
         endSharedLibConfig();
     } else {
         endAppConfig();
     }
     //add the shared application only if this is a shared config
     if (self::$sharedConfig) {
         /////// Application Config
         beginSharedAppConfig(getGameProjectName(), '{CDECDFF9-E125-523F-87BC-2D89DB971CAB}');
         addProjectDefine('TORQUE_SHARED');
         addEngineSrcDir('main');
         if (Generator::$platform == "win32") {
             addProjectDefine('WIN32');
             addProjectDependency(getGameProjectName() . ' DLL');
         }
         if (Generator::$platform == "mac") {
             addProjectDefine('__MACOSX__');
             addProjectDependency(getGameProjectName() . ' Bundle');
             addProjectDependency(getGameProjectName() . ' Plugin');
         }
         endSharedAppConfig();
     }
     // Add solution references for Visual Studio projects
     if (Generator::$platform == "win32" || Generator::$platform == "360" || Generator::$platform == "ps3") {
         if (!self::$sharedConfig) {
             beginSolutionConfig(getGameProjectName(), '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}');
         }
         addSolutionProjectRef(getGameProjectName());
         if (self::$sharedConfig) {
             addSolutionProjectRef(getGameProjectName() . ' DLL');
         }
         addSolutionProjectRef('collada_dom');
         addSolutionProjectRef('ljpeg');
         addSolutionProjectRef('lmng');
         addSolutionProjectRef('lpng');
         addSolutionProjectRef('lungif');
         addSolutionProjectRef('opcode');
         addSolutionProjectRef('pcre');
         addSolutionProjectRef('squish');
         addSolutionProjectRef('tinyxml');
         addSolutionProjectRef('zlib');
         addSolutionProjectRef('convexDecomp');
         if (Generator::$platform == "win32") {
             addSolutionProjectRef('libogg');
             addSolutionProjectRef('libvorbis');
             addSolutionProjectRef('libtheora');
         }
         if (!self::$sharedConfig) {
             endSolutionConfig();
         }
     }
     endProject(self::$sharedConfig);
 }