本文整理汇总了C++中ProjectPtr::SetSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectPtr::SetSettings方法的具体用法?C++ ProjectPtr::SetSettings怎么用?C++ ProjectPtr::SetSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectPtr
的用法示例。
在下文中一共展示了ProjectPtr::SetSettings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showSettingsDialogFor
//.........这里部分代码省略.........
projPath.SetFullName(wxT(""));
const wxString projectDirName = projPath.GetFullPath();
wxString iconFileDest = projectDirName + wxT("/") + configDlg.getIconDestName();
// sips doesn't like double slashes in path names
iconFileDest.Replace(wxT("//"), wxT("/"));
std::cout << "Copying icon '" << iconSourcePath.mb_str() << "' to project\n";
if(iconSourcePath.EndsWith(wxT(".icns"))) {
if(not wxCopyFile(iconSourcePath, iconFileDest)) {
wxMessageBox(_("Sorry, could not copy icon"));
}
} else {
wxString cmd =
wxT("sips -s format icns '") + iconSourcePath + wxT("' --out '") + iconFileDest + wxT("'");
std::cout << cmd.mb_str() << std::endl;
wxExecute(cmd, wxEXEC_SYNC);
if(not wxFileExists(iconFileDest)) {
wxMessageBox(_("Sorry, could not convert selected icon to icns format"));
}
}
// FIXME: if the file was already present, it will be added again and appear twice in the file tree
if(wxFileExists(iconFileDest)) {
wxArrayString paths;
paths.Add(iconFileDest);
m_mgr->CreateVirtualDirectory(project->GetName(), wxT("osx"));
m_mgr->AddFilesToVirtualFolder(project->GetName() + wxT(":osx"), paths);
}
} // end if icon not null
} // end if generate icon
}
if(!accepted) return;
for(int n = 0; n < targetsToSet.GetCount(); n++) {
BuildConfigPtr buildConfig = configs[targetsToSet[n]];
wxString outputFileName = buildConfig->GetOutputFileName();
wxString output = wxT("$(ProjectName).app/Contents/MacOS/$(ProjectName)");
buildConfig->SetOutputFileName(wxT("$(IntermediateDirectory)/") + output);
buildConfig->SetCommand(wxT("./") + output);
if(generateInfoPlistFile or generateIcon) {
// get existing custom makefile targets, if any
wxString customPreBuild = buildConfig->GetPreBuildCustom();
wxString deps, rules;
deps = customPreBuild.BeforeFirst(wxT('\n'));
rules = customPreBuild.AfterFirst(wxT('\n'));
rules = rules.Trim();
rules = rules.Trim(false);
deps = deps.Trim();
deps = deps.Trim(false);
if(generateInfoPlistFile) {
// augment existing rules with new rules to manage Info.plist file
deps.Append(wxT(" $(IntermediateDirectory)/$(ProjectName).app/Contents/Info.plist"));
rules.Append(wxString(wxT("\n## rule to copy the Info.plist file into the bundle\n")) +
wxT("$(IntermediateDirectory)/$(ProjectName).app/Contents/Info.plist: Info.plist\n") +
wxT("\tmkdir -p '$(IntermediateDirectory)/$(ProjectName).app/Contents' && cp -f "
"Info.plist '$(IntermediateDirectory)/$(ProjectName).app/Contents/Info.plist'"));
}
if(generateIcon) {
// augment existing rules with new rules to manage Info.plist file
deps.Append(wxT(" $(IntermediateDirectory)/$(ProjectName).app/Contents/Resources/") + iconName);
rules.Append(
wxT("\n## rule to copy the icon file into the "
"bundle\n$(IntermediateDirectory)/$(ProjectName).app/Contents/Resources/") +
iconName + wxT(": ") + iconName +
wxT("\n\tmkdir -p '$(IntermediateDirectory)/$(ProjectName).app/Contents/Resources/' && cp -f ") +
iconName + wxT(" '$(IntermediateDirectory)/$(ProjectName).app/Contents/Resources/") + iconName +
wxT("'"));
}
// set the new rules
rules = rules.Trim();
rules = rules.Trim(false);
deps = deps.Trim();
deps = deps.Trim(false);
wxString prebuilstep;
prebuilstep << deps << wxT("\n");
prebuilstep << rules;
prebuilstep << wxT("\n");
// Set the content only if there is real content to add
wxString tmpPreBuildStep(prebuilstep);
tmpPreBuildStep.Trim().Trim(false);
buildConfig->SetPreBuildCustom(prebuilstep);
} // end if
settings->SetBuildConfiguration(buildConfig);
} // end for
project->SetSettings(settings);
}
示例2: AddProjectToBuildMatrix
void clCxxWorkspace::AddProjectToBuildMatrix(ProjectPtr prj)
{
if(!prj) {
wxMessageBox(_("AddProjectToBuildMatrix was called with NULL project"), _("CodeLite"), wxICON_WARNING | wxOK);
return;
}
BuildMatrixPtr matrix = GetBuildMatrix();
wxString selConfName = matrix->GetSelectedConfigurationName();
std::list<WorkspaceConfigurationPtr> wspList = matrix->GetConfigurations();
std::list<WorkspaceConfigurationPtr>::iterator iter = wspList.begin();
for(; iter != wspList.end(); iter++) {
WorkspaceConfigurationPtr workspaceConfig = (*iter);
WorkspaceConfiguration::ConfigMappingList prjList = workspaceConfig->GetMapping();
wxString wspCnfName = workspaceConfig->GetName();
ProjectSettingsCookie cookie;
// getSettings is a bit misleading, since it actually create new instance which represents the layout
// of the XML
ProjectSettingsPtr settings = prj->GetSettings();
BuildConfigPtr prjBldConf = settings->GetFirstBuildConfiguration(cookie);
BuildConfigPtr matchConf;
if(!prjBldConf) {
// the project does not have any settings, create new one and add it
prj->SetSettings(settings);
settings = prj->GetSettings();
prjBldConf = settings->GetFirstBuildConfiguration(cookie);
matchConf = prjBldConf;
} else {
matchConf = prjBldConf;
// try to locate the best match to add to the workspace
while(prjBldConf) {
wxString projBldConfName = prjBldConf->GetName();
if(wspCnfName == projBldConfName) {
// we found a suitable match use it instead of the default one
matchConf = prjBldConf;
break;
}
prjBldConf = settings->GetNextBuildConfiguration(cookie);
}
}
ConfigMappingEntry entry(prj->GetName(), matchConf->GetName());
prjList.push_back(entry);
(*iter)->SetConfigMappingList(prjList);
matrix->SetConfiguration((*iter));
}
// and set the configuration name
matrix->SetSelectedConfigurationName(selConfName);
// this will also reset the build matrix pointer
SetBuildMatrix(matrix);
}
示例3: ConvertProject
bool VcImporter::ConvertProject(VcProjectData& data)
{
wxXmlDocument doc(data.filepath);
if(!doc.IsOk()) {
return false;
}
// to create a project skeleton, we need the project type
// since VS allows each configuration to be of different
// type, while LE allows single type for all configurations
// we use the first configuration type that we find
wxXmlNode* configs = XmlUtils::FindFirstByTagName(doc.GetRoot(), wxT("Configurations"));
if(!configs) {
return false;
}
// find the first configuration node
wxXmlNode* config = XmlUtils::FindFirstByTagName(configs, wxT("Configuration"));
if(!config) return false;
// read the configuration type, default is set to Executeable
long type = XmlUtils::ReadLong(config, wxT("ConfigurationType"), 1);
wxString projectType;
wxString errMsg;
switch(type) {
case 2: // dll
projectType = Project::DYNAMIC_LIBRARY;
break;
case 4: // static library
projectType = Project::STATIC_LIBRARY;
break;
case 1: // exe
default:
projectType = Project::EXECUTABLE;
break;
}
// now we can create the project
wxFileName fn(data.filepath);
fn.MakeAbsolute();
if(!WorkspaceST::Get()->CreateProject(data.name, fn.GetPath(), projectType, true, errMsg)) {
return false;
}
// get the new project instance
ProjectPtr proj = WorkspaceST::Get()->FindProjectByName(data.name, errMsg);
ProjectSettingsPtr le_settings(new ProjectSettings(NULL));
// remove the default 'Debug' configuration
le_settings->RemoveConfiguration(wxT("Debug"));
le_settings->SetProjectType(projectType);
while(config) {
if(config->GetName() == wxT("Configuration")) {
AddConfiguration(le_settings, config);
}
config = config->GetNext();
}
proj->SetSettings(le_settings);
// add all virtual folders
wxXmlNode* files = XmlUtils::FindFirstByTagName(doc.GetRoot(), wxT("Files"));
if(files) {
proj->BeginTranscation();
CreateFiles(files, wxEmptyString, proj);
proj->CommitTranscation();
}
return true;
}
示例4: Import
//.........这里部分代码省略.........
for(GenericEnvVarsValueType envVar : cfg->envVars) {
envVars += envVar.first + wxT("=") + envVar.second + wxT("\n");
}
le_conf->SetEnvvars(envVars);
BuildCommandList preBuildCommandList;
BuildCommandList postBuildCommandList;
for (wxString preBuildCmd : cfg->preBuildCommands) {
BuildCommand preBuildCommand;
preBuildCommand.SetCommand(preBuildCmd);
preBuildCommand.SetEnabled(true);
preBuildCommandList.push_back(preBuildCommand);
}
for (wxString postBuildCmd : cfg->postBuildCommands) {
BuildCommand postBuildCommand;
postBuildCommand.SetCommand(postBuildCmd);
postBuildCommand.SetEnabled(true);
postBuildCommandList.push_back(postBuildCommand);
}
le_conf->SetPreBuildCommands(preBuildCommandList);
le_conf->SetPostBuildCommands(postBuildCommandList);
le_settings->SetBuildConfiguration(le_conf);
if(!project->deps.IsEmpty())
proj->SetDependencies(project->deps, cfg->name);
}
proj->SetSettings(le_settings);
proj->BeginTranscation();
// Delete default virtual directory
proj->DeleteVirtualDir("include");
proj->DeleteVirtualDir("src");
for(GenericProjectFilePtr file : project->files) {
wxString vpath;
if(file->vpath.IsEmpty()) {
wxFileName fileInfo(file->name);
wxString ext = fileInfo.GetExt().Lower();
if(ext == wxT("h") || ext == wxT("hpp") || ext == wxT("hxx") || ext == wxT("hh") ||
ext == wxT("inl") || ext == wxT("inc")) {
vpath = wxT("include");
} else if(ext == wxT("c") || ext == wxT("cpp") || ext == wxT("cxx") || ext == wxT("cc")) {
vpath = wxT("src");
} else if(ext == wxT("s") || ext == wxT("S") || ext == wxT("asm")) {
vpath = wxT("src");
} else {
vpath = wxT("resource");
}
} else {
vpath = file->vpath;
if(file->vpath.Contains(wxT("\\"))) {
vpath.Replace(wxT("\\"), wxT(":"));
} else if(file->vpath.Contains(wxT("/"))) {
vpath.Replace(wxT("/"), wxT(":"));
}
}
proj->CreateVirtualDir(vpath);
proj->AddFile(file->name, vpath);
}
proj->CommitTranscation();
}
if(clWorkspace) {
BuildMatrixPtr clMatrix = clWorkspace->GetBuildMatrix();
WorkspaceConfigurationPtr wsconf = clMatrix->GetConfigurationByName(wxT("Debug"));
if(wsconf) {
wsconf->SetConfigMappingList(cmlDebug);
}
wsconf = clMatrix->GetConfigurationByName(wxT("Release"));
if(wsconf) {
wsconf->SetConfigMappingList(cmlRelease);
}
clWorkspace->SetBuildMatrix(clMatrix);
}
return true;
}
}
}
return false;
}