Some examples
Conditional compiler flags for different OS
For example different libraries for X11 and Windows
1) Project->Build options->Select the project name on the left
2) Linker Settings->Other linker options
3) Add the squirrel script:
[[if(PLATFORM == PLATFORM_MSW ) print(_("-lgdi32")); else if(PLATFORM == PLATFORM_X11 ) printf(_("-lX11"));]]
be aware, this has to be in one line of the other liner options...
After build
Copy the build log after compilation to a new location and rename it with target name and compiler id.
IO.CopyFile(_("$(PROJECTNAME)_build_log.html"), _("$(PROJECTNAME)_build_log_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetTitle() + _("_") + GetProjectManager().GetActiveProject().GetCurrentlyCompilingTarget().GetCompilerID() + _(".html"), true );
This is in one line, so you can copy and paste it in the post build step (but don't forget to add the [[ ]]
)
Add files from a text file to the active project
local pm = GetProjectManager(); if (IsNull(pm)) { ShowError(_T("Could not query the project manager. Cannot continue.")); return 0; } local p = pm.GetActiveProject(); // File with the source files separated by \n // for example: // ''''''''''''''''''' // a.cpp // b.cpp // ''''''''''''''''''' local filecontent = IO.ReadFileContents (_T("D:\\ddddd\\fileList.txt")); // Split the files in lines local fileList = GetArrayFromString(filecontent, _T("\n"), true); print(_T("Files to load:")); for(local i = 0; i < fileList.GetCount(); i++) { print(fileList.Item(i) + _T("\n")); // Print the files in the list, as a check } // Base path, the files in the text files are relative in my case. If they are absolute you can remove this local basePath = _T("D:\\ddddd\\src\\"); for(local i = 0; i < fileList.GetCount(); i++) { // Create file path local filePath = basePath + fileList.Item(i); // Add to all build targets for(local a = 0; a <= p.GetBuildTargetsCount(); a++) pm.AddFileToProject(filePath, p, a); } // Save the project. This triggers also an update of the project UI pm.SaveAllProjects();