Exemplo n.º 1
0
VCProject* SBWorkspace::generateGlueProject() const
{
  // Get a set of all configurations appearing in all projects
  StringSet slnConfigs;
  for (auto project : m_openProjects) {
    const StringSet& configs = project.second->getSelectedConfigurations();
    slnConfigs.insert(configs.begin(), configs.end());
  }

  // Get the template
  VSTemplate* vstemplate = VSTemplate::getTemplate("WinRT");
  sbAssertWithTelemetry(vstemplate, "Failed to get WinRT VS template");

  // Set up basis template parameters
  string projectName = getName() + "WinRT";
  VSTemplateParameters templateParams;
  templateParams.setProjectName(projectName);

  // Expand the template and get the template project
  vstemplate->expand(sb_dirname(getPath()), templateParams);
  const VSTemplateProjectVec& projTemplates = vstemplate->getProjects();
  sbAssertWithTelemetry(projTemplates.size() == 1, "Unexpected WinRT template size");

  // Create the glue project and add it to the solution
  VCProject* glueProject = new VCProject(projTemplates.front());

  // Get path to WinObjC SDK
  BuildSettings globalBS(NULL);
  String useRelativeSdkPath = globalBS.getValue("VSIMPORTER_RELATIVE_SDK_PATH");
  String sdkDir = globalBS.getValue("WINOBJC_SDK_ROOT");

  // Try to create a relative path to the SDK, if requested
  if (strToUpper(useRelativeSdkPath) == "YES") {
    String projectDir = sb_dirname(projTemplates.front()->getPath());
    sdkDir = getRelativePath(projectDir, sdkDir);
  }
  glueProject->addGlobalProperty("WINOBJC_SDK_ROOT", platformPath(sdkDir), "'$(WINOBJC_SDK_ROOT)' == ''");

  // Set configuration properties
  for (auto configName : slnConfigs) {
    VCProjectConfiguration *projConfig = glueProject->addConfiguration(configName);
    projConfig->setProperty("TargetName", getName());
  }

  // Set RootNamespace
  glueProject->addGlobalProperty("RootNamespace", getName());

  return glueProject;
}
Exemplo n.º 2
0
VCProject* SBWorkspace::generateGlueProject(bool packageable) const {
    // Get a set of all configurations appearing in all projects
    StringSet slnConfigs;
    for (auto project : m_openProjects) {
        const StringSet& configs = project.second->getSelectedConfigurations();
        slnConfigs.insert(configs.begin(), configs.end());
    }

    // Get the template
    VSTemplate* vstemplate = VSTemplate::getTemplate("WinRT");
    sbAssertWithTelemetry(vstemplate, "Failed to get WinRT VS template");

    // Set up basis template parameters
    string projectName = getName() + "WinRT";
    VSTemplateParameters templateParams;
    templateParams.setProjectName(projectName);
    templateParams.setIsPackageable(packageable);

    // Expand the template and get the template project
    vstemplate->expand(sb_dirname(getPath()), templateParams);
    const VSTemplateProjectVec& projTemplates = vstemplate->getProjects();
    sbAssertWithTelemetry(projTemplates.size() == 1, "Unexpected WinRT template size");

    // Create the glue project and add it to the solution
    VCProject* glueProject = new VCProject(projTemplates.front());

    // Set configuration properties
    for (auto configName : slnConfigs) {
        VCProjectConfiguration* projConfig = glueProject->addConfiguration(configName);
        projConfig->setProperty("TargetName", getName());
    }

    // Set RootNamespace
    glueProject->addGlobalProperty("RootNamespace", getName());

    return glueProject;
}
Exemplo n.º 3
0
void VSTemplateProject::expand(const std::string& srcDir, const std::string& destDir, const VSTemplateParameters& params)
{
  // Make a copy of the parameters map
  m_params = params.getValuesMap();

  // Expand the output directory and update destDir
  expandString(m_outputDir, m_params);
  std::string updatedDestDir = joinPaths(destDir, m_outputDir);

  // Handle the project items
  for (auto item : m_items) {
    expandProjectItem(srcDir, updatedDestDir, m_params, item);;
  }

}