[text] wizard.script

Viewer

copydownloadembedprintName: wizard.script
  1. document.write('////////////////////////////////////////////////////////////////////////////////');
  2. document.write('//');
  3. document.write('// GLUT project wizard');
  4. document.write('//');
  5. document.write('////////////////////////////////////////////////////////////////////////////////');
  6. document.write('');
  7. document.write('// globals');
  8. document.write('GlutPathDefault    <- _T("$(#glut)");');
  9. document.write('GlutPathDefaultInc <- _T("$(#glut.include)");');
  10. document.write('GlutPathDefaultLib <- _T("$(#glut.lib)");');
  11. document.write('GlutPath <- _T("");');
  12. document.write('');
  13. document.write('function BeginWizard()');
  14. document.write('{');
  15. document.write('    local intro_msg = _T("Welcome to the new GLUT project wizard!\\n\\n" +');
  16. document.write('                         "This wizard will guide you to create a new project\\n" +');
  17. document.write('                         "using the GLUT OpenGL extensions.\\n\\n" +');
  18. document.write('                         "When you \'re ready to proceed, please click \\"Next\\"...");');
  19. document.write('');
  20. document.write('    local glutpath_descr = _T("Please select the location of GLUT on your computer.\\n" +');
  21. document.write('                              "This is the top-level folder where GLUT was installed (unpacked).\\n" +');
  22. document.write('                              "To help you, this folder must contain the subfolders\\n" +');
  23. document.write('                              "\\"include\\" and \\"lib\\".");');
  24. document.write('');
  25. document.write('    Wizard.AddInfoPage(_T("GlutIntro"), intro_msg);');
  26. document.write('    Wizard.AddProjectPathPage();');
  27. document.write('    if (PLATFORM == PLATFORM_MAC)');
  28. document.write('    {');
  29. document.write('        GlutPathDefault="/System/Library/Frameworks/GLUT.framework";');
  30. document.write('    }');
  31. document.write('    else');
  32. document.write('        Wizard.AddGenericSelectPathPage(_T("GlutPath"), glutpath_descr, _T("Please select GLUT\'s location:"), GlutPathDefault);');
  33. document.write('    Wizard.AddCompilerPage(_T(""), _T("*"), true, true);');
  34. document.write('}');
  35. document.write('');
  36. document.write('////////////////////////////////////////////////////////////////////////////////');
  37. document.write('// GLUT\'s path page');
  38. document.write('////////////////////////////////////////////////////////////////////////////////');
  39. document.write('');
  40. document.write('function OnLeave_GlutPath(fwd)');
  41. document.write('{');
  42. document.write('    if (fwd)');
  43. document.write('    {');
  44. document.write('        local dir         = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage');
  45. document.write('        local dir_nomacro = VerifyDirectory(dir);');
  46. document.write('');
  47. document.write('        if (dir_nomacro.IsEmpty())');
  48. document.write('            return false;');
  49. document.write('');
  50. document.write('        // verify include dependencies');
  51. document.write('        local dir_nomacro_inc = GetCompilerIncludeDir(dir, GlutPathDefault, GlutPathDefaultInc);');
  52. document.write('        if (dir_nomacro_inc.IsEmpty())');
  53. document.write('            return false;');
  54. document.write('        if (!VerifyFile(dir_nomacro_inc + wxFILE_SEP_PATH + _T("GL"), _T("glut.h"), _T("GLUT\'s include"))) return false;');
  55. document.write('');
  56. document.write('        // verify library dependencies');
  57. document.write('        local dir_nomacro_lib = GetCompilerLibDir(dir, GlutPathDefault, GlutPathDefaultLib);');
  58. document.write('        if (dir_nomacro_lib.IsEmpty())');
  59. document.write('            return false;');
  60. document.write('');
  61. document.write('        if (PLATFORM == PLATFORM_MSW)');
  62. document.write('        {');
  63. document.write('            if (!VerifyLibFile(dir_nomacro_lib, _T("glut32"), _T("GLUT\'s"))) return false;');
  64. document.write('        }');
  65. document.write('        else');
  66. document.write('        {');
  67. document.write('            if (!VerifyLibFile(dir_nomacro_lib, _T("glut"), _T("GLUT\'s"))) return false;');
  68. document.write('        }');
  69. document.write('');
  70. document.write('');
  71. document.write('        GlutPath = dir; // Remember the original selection.');
  72. document.write('');
  73. document.write('        local is_macro = _T("");');
  74. document.write('');
  75. document.write('        // try to resolve the include directory as macro');
  76. document.write('        is_macro = GetCompilerIncludeMacro(dir, GlutPathDefault, GlutPathDefaultInc);');
  77. document.write('        if (is_macro.IsEmpty())');
  78. document.write('        {');
  79. document.write('            // not possible -> use the real inc path we had computed instead');
  80. document.write('            GlutPathDefaultInc = dir_nomacro_inc;');
  81. document.write('        }');
  82. document.write('');
  83. document.write('        // try to resolve the library directory as macro');
  84. document.write('        is_macro = GetCompilerLibMacro(dir, GlutPathDefault, GlutPathDefaultLib);');
  85. document.write('        if (is_macro.IsEmpty())');
  86. document.write('        {');
  87. document.write('            // not possible -> use the real lib path we had computed instead');
  88. document.write('            GlutPathDefaultLib = dir_nomacro_lib;');
  89. document.write('        }');
  90. document.write('    }');
  91. document.write('    return true;');
  92. document.write('}');
  93. document.write('');
  94. document.write('// return the files this project contains');
  95. document.write('function GetFilesDir()');
  96. document.write('{');
  97. document.write('    return _T("glut/files");');
  98. document.write('}');
  99. document.write('');
  100. document.write('// setup the already created project');
  101. document.write('function SetupProject(project)');
  102. document.write('{');
  103. document.write('    // set project options');
  104. document.write('    if (PLATFORM != PLATFORM_MAC)');
  105. document.write('    {');
  106. document.write('        project.AddIncludeDir(GlutPathDefaultInc);');
  107. document.write('        project.AddLibDir(GlutPathDefaultLib);');
  108. document.write('    }');
  109. document.write('');
  110. document.write('    // add link libraries');
  111. document.write('    if (PLATFORM == PLATFORM_MSW)');
  112. document.write('    {');
  113. document.write('        project.AddLinkLib(_T("freeglut"));');
  114. document.write('        project.AddLinkLib(_T("opengl32"));');
  115. document.write('        project.AddLinkLib(_T("glu32"));');
  116. document.write('        project.AddLinkLib(_T("winmm"));');
  117. document.write('        project.AddLinkLib(_T("gdi32"));');
  118. document.write('    }');
  119. document.write('    else if (PLATFORM == PLATFORM_MAC)');
  120. document.write('    {');
  121. document.write('        project.AddLinkerOption(_T("-framework GLUT"));');
  122. document.write('        project.AddLinkerOption(_T("-framework OpenGL"));');
  123. document.write('');
  124. document.write('        project.AddLinkerOption(_T("-framework Cocoa")); // GLUT dependency');
  125. document.write('    }');
  126. document.write('    else');
  127. document.write('    {');
  128. document.write('        project.AddLinkLib(_T("glut"));');
  129. document.write('        project.AddLinkLib(_T("GL"));');
  130. document.write('        project.AddLinkLib(_T("GLU"));');
  131. document.write('        project.AddLinkLib(_T("Xxf86vm"));');
  132. document.write('    }');
  133. document.write('');
  134. document.write('    // enable compiler warnings (project-wide)');
  135. document.write('    WarningsOn(project, Wizard.GetCompilerID());');
  136. document.write('');
  137. document.write('    // Debug');
  138. document.write('    local target = project.GetBuildTarget(Wizard.GetDebugName());');
  139. document.write('    if (!IsNull(target))');
  140. document.write('    {');
  141. document.write('        target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging');
  142. document.write('        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);');
  143. document.write('        target.SetWorkingDir(GlutPath + _T("/bin"));');
  144. document.write('        // enable generation of debugging symbols for target');
  145. document.write('        DebugSymbolsOn(target, Wizard.GetCompilerID());');
  146. document.write('    }');
  147. document.write('');
  148. document.write('    // Release');
  149. document.write('    target = project.GetBuildTarget(Wizard.GetReleaseName());');
  150. document.write('    if (!IsNull(target))');
  151. document.write('    {');
  152. document.write('        target.SetTargetType(ttExecutable); // ttExecutable: no console');
  153. document.write('        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);');
  154. document.write('        target.SetWorkingDir(GlutPath + _T("/bin"));');
  155. document.write('        // enable optimizations for target');
  156. document.write('        OptimizationsOn(target, Wizard.GetCompilerID());');
  157. document.write('    }');
  158. document.write('');
  159. document.write('    return true;');
  160. document.write('}');
  161. document.write('');
  162.  

Editor

You can edit this paste and save as new:


File Description
  • wizard.script
  • Paste Code
  • 23 Mar-2023
  • 8.59 Kb
You can Share it: