Convert Figma logo to code with AI

ubisoft logoSharpmake

Sharpmake is an open-source C#-based solution for generating project definition files, such as Visual Studio projects and solutions, GNU makefiles, Xcode projects, etc.

1,016
185
1,016
65

Top Related Projects

5,407

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.

3,452

🏗 The AKEless Build System for C#/.NET

3,992

:cake: Cake (C# Make) is a cross platform build automation system.

5,404

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.

High performance build system for Windows, OSX and Linux. Supporting caching, network distribution and more.

Quick Overview

Sharpmake is an open-source build system generator developed by Ubisoft. It uses C# scripts to generate project files for various build systems, including Visual Studio, Xcode, and makefiles. Sharpmake aims to simplify and streamline the process of managing complex build configurations across multiple platforms and projects.

Pros

  • Highly flexible and customizable build configuration using C# scripts
  • Supports multiple platforms and build systems from a single source
  • Faster project generation compared to traditional build systems
  • Integrates well with existing development workflows and tools

Cons

  • Steep learning curve for developers unfamiliar with C# or build systems
  • Limited documentation and community support compared to more established build tools
  • May require additional setup and maintenance for complex projects
  • Not as widely adopted as other build systems, potentially limiting third-party integrations

Code Examples

  1. Defining a simple project:
[Generate]
public class MyProject : Project
{
    public MyProject()
    {
        Name = "MyProject";
        SourceRootPath = @"[project.SharpmakeCsPath]\codebase\";

        AddTargets(new Target(
            Platform.win64,
            DevEnv.vs2019,
            Optimization.Debug | Optimization.Release));
    }
}
  1. Configuring build settings:
[Configure]
public void ConfigureAll(Project.Configuration conf, Target target)
{
    conf.Output = Configuration.OutputType.Lib;
    conf.IntermediatePath = @"[conf.ProjectPath]\obj\[target.Platform]\[conf.Name]";
    conf.TargetPath = @"[conf.ProjectPath]\bin\[target.Platform]\[conf.Name]";
}
  1. Adding source files to the project:
[Configure]
public void ConfigureAll(Project.Configuration conf, Target target)
{
    conf.IncludePaths.Add(@"[project.SourceRootPath]");
    conf.SourceFilesBuildExclude.Add(@"[project.SourceRootPath]\exclude\*.cpp");
    conf.SourceFilesBuildExclude.Add(@"[project.SourceRootPath]\exclude\*.h");
}

Getting Started

  1. Install Sharpmake via NuGet or build from source
  2. Create a new C# file for your Sharpmake configuration
  3. Define your projects, solutions, and targets using Sharpmake classes
  4. Run Sharpmake to generate project files:
Sharpmake.Application.exe /sources(@"path\to\your\sharpmake\script.cs")
  1. Open the generated project files in your preferred IDE or build system

Competitor Comparisons

5,407

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.

Pros of MSBuild

  • Widely adopted and well-established in the .NET ecosystem
  • Extensive documentation and community support
  • Native integration with Visual Studio and other Microsoft tools

Cons of MSBuild

  • XML-based syntax can be verbose and difficult to read/write
  • Limited flexibility for complex build scenarios
  • Steeper learning curve for advanced customization

Code Comparison

MSBuild (XML):

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
</Project>

Sharpmake (C#):

[Generate]
public class MyProject : Project
{
    public MyProject()
    {
        Name = "MyProject";
        AddTargets(new Target(Platform.win64, DevEnv.vs2022, Optimization.Debug | Optimization.Release));
    }
}

Sharpmake uses a more programmatic approach with C# syntax, offering greater flexibility and easier maintenance for complex build configurations. MSBuild, while powerful, relies on XML which can become unwieldy for large projects. Sharpmake's code-based configuration allows for better version control and easier debugging, but may require more initial setup and learning for developers familiar with traditional build systems.

3,452

🏗 The AKEless Build System for C#/.NET

Pros of Nuke

  • Written in C#, allowing for easier integration with .NET projects
  • Supports cross-platform builds (Windows, macOS, Linux)
  • Extensive plugin ecosystem for additional functionality

Cons of Nuke

  • Steeper learning curve for developers not familiar with C#
  • Less mature and less widely adopted compared to Sharpmake
  • May require more setup and configuration for complex build scenarios

Code Comparison

Sharpmake:

[Generate]
public class MyProject : Project
{
    public MyProject()
    {
        Name = "MyProject";
        SourceRootPath = @"[project.SharpmakeCsPath]\codebase";
    }
}

Nuke:

class Build : NukeBuild
{
    public static int Main() => Execute<Build>(x => x.Compile);

    Target Compile => _ => _
        .Executes(() =>
        {
            DotNetBuild(s => s
                .SetProjectFile(Solution)
                .SetConfiguration(Configuration));
        });
}

Both Sharpmake and Nuke aim to simplify the build process for software projects, but they take different approaches. Sharpmake focuses on generating project files for various IDEs, while Nuke provides a more flexible, code-based build automation system. The choice between the two depends on specific project requirements, team expertise, and desired build workflow.

3,992

:cake: Cake (C# Make) is a cross platform build automation system.

Pros of Cake

  • More extensive documentation and community support
  • Cross-platform compatibility (Windows, macOS, Linux)
  • Larger ecosystem with numerous add-ins and extensions

Cons of Cake

  • Steeper learning curve for developers not familiar with C# scripting
  • Potentially slower execution compared to native build tools
  • Limited IDE integration compared to some alternatives

Code Comparison

Cake:

Task("Build")
    .Does(() =>
{
    DotNetCoreBuild("./src/MyProject.sln", new DotNetCoreBuildSettings
    {
        Configuration = configuration
    });
});

Sharpmake:

[Generate]
public class MyProject : Project
{
    public MyProject()
    {
        Name = "MyProject";
        SourceRootPath = @"[project.SharpmakeCsPath]\src";
    }
}

Both Cake and Sharpmake use C# for build scripting, but Cake focuses on task-based scripting while Sharpmake generates project files. Cake's syntax is more procedural, while Sharpmake uses a more declarative approach with attributes and classes.

5,404

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.

Pros of MSBuild

  • Widely adopted and well-established in the .NET ecosystem
  • Extensive documentation and community support
  • Native integration with Visual Studio and other Microsoft tools

Cons of MSBuild

  • XML-based syntax can be verbose and difficult to read/write
  • Limited flexibility for complex build scenarios
  • Steeper learning curve for advanced customization

Code Comparison

MSBuild (XML):

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
</Project>

Sharpmake (C#):

[Generate]
public class MyProject : Project
{
    public MyProject()
    {
        Name = "MyProject";
        AddTargets(new Target(Platform.win64, DevEnv.vs2022, Optimization.Debug | Optimization.Release));
    }
}

Sharpmake uses a more programmatic approach with C# syntax, offering greater flexibility and easier maintenance for complex build configurations. MSBuild, while powerful, relies on XML which can become unwieldy for large projects. Sharpmake's code-based configuration allows for better version control and easier debugging, but may require more initial setup and learning for developers familiar with traditional build systems.

High performance build system for Windows, OSX and Linux. Supporting caching, network distribution and more.

Pros of FASTBuild

  • Faster build times due to distributed compilation and caching
  • Language-agnostic, supporting multiple programming languages
  • More mature and widely adopted in the game development industry

Cons of FASTBuild

  • Steeper learning curve and more complex configuration
  • Less integrated with Visual Studio and other IDEs
  • Requires more manual setup for project structures

Code Comparison

Sharpmake (C# configuration):

[Generate]
public class MyProject : Project
{
    public MyProject()
    {
        Name = "MyProject";
        SourceRootPath = @"[project.SharpmakeCsPath]\codebase";
    }
}

FASTBuild (BFF configuration):

.Project = 
{
    .Name = 'MyProject'
    .ProjectPath = 'path/to/project'
    .ProjectInputPaths = { 'src' }
}

Both Sharpmake and FASTBuild are build automation tools used in game development, but they have different approaches. Sharpmake uses C# for configuration, making it more familiar for C# developers and easier to integrate with .NET projects. FASTBuild focuses on performance and cross-platform support, using its own configuration language. While Sharpmake is more tightly integrated with Visual Studio, FASTBuild offers better performance for large-scale projects and supports a wider range of build scenarios.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Sharpmake

build

Introduction

Sharpmake is a generator for Visual Studio projects and solutions. It is similar to CMake and Premake, but it is designed for speed and scale. Sharpmake has been used at Ubisoft to generate several thousands of .vcxproj, .csproj and .sln files in a matter of seconds, and each of these projects can support a large number of Visual Studio configurations as well.

That makes Sharpmake ideal for the development of multi-platform games, where the number of platforms, the different levels of optimization, the multiple rendering APIs on PC and the level editor can quickly multiply the number of configurations a given code base must support. Sharpmake generates all those configurations at once, very quickly. Thus, it becomes trivial to generate and regenerate the entire project.

Sharpmake uses the C# language for its scripts, hence the name. That means you can edit your scripts in Visual Studio (or Visual Studio Code) and benefits from the default C# tooling (auto-completion, refactoring, debugger...).

Sharpmake can also generate makefiles and Xcode projects and can be run "natively" on any modern OSes that support recent version of the dotnet runtime.

Sharpmake was developed internally at Ubisoft for Assassin's Creed 3 in 2011. After experimenting with the other existing tools, it became clear that none of these solutions were performant enough to generate the number of configurations needed (at least not in a trivial way) and that a custom generator was needed.

Documentation

The Sharpmake documentation is split in two places:

The Sharpmake source code also comes with samples that you can study.

Building and running Sharpmake

Building and running Sharpmake is quite straightforward:

  • Clone the Git repository
  • Open the Sharpmake.sln solution located in the root folder
  • If you want to debug Sharpmake using a sample:
    1. Set the Samples project as the Startup Project
    2. Choose from the dropdown list which sample you want to run
  • If you want to debug Sharpmake using a functional test:
    1. Set the Sharpmake.FunctionalTests project as the Startup Project
    2. Choose from the dropdown list which functional test you want to run

More Platforms

Sharpmake originally had support for game consoles, but Ubisoft pulled it out because those could not be open sourced. Sharpmake now has an extension system that allows support for these consoles to be added back at runtime.

More information about platforms can be found here.

Extending Sharpmake

Sharpmake is an open source project that come with some generic built-in features.

But as soon as we start speaking about additional features restricted by NDA (like for platforms), or for internal use only, it is handy to have a way to extend it.

The recommended solution is to follow this folder layout:

SharpmakeExtended:
 - 📁 Sharpmake
 - 📁 Sharpmake.Platforms
 - 📁 Sharpmake.Extensions
 -    Directory.build.props
 -    SharpmakeExtended.sln
  1. 📁 Sharpmake

The Sharpmake folder contains all the files of this Git repository.

We commonly call it Sharpmake core.

If you plan to version your SharpmakeExtended project under Git, you can use a Git submodule to pull on it directly.

  1. 📁 Sharpmake.Platforms (and 📁 Sharpmake.Extensions)

Platforms vs. Extensions: there is no difference between them, these two folders are only used to tidy/split things a little.

These two locations are where you can add any additional platforms (or extensions) in their own dedicated folder:

📁 Sharpmake.Platforms
 - 📁 Sharpmake.Platform_A
      - *.cs
      - Sharpmake.Platform_A.csproj
 - 📁 Sharpmake.Platform_B
      - *.cs
      - Sharpmake.Platform_B.csproj

Sharpmake.Application.csproj (from Sharpmake core), automatically adds .csproj from these folders to its dependency list. This means they will automatically be built and copied to its output folder, and simply hitting the "Start Debugging" button will just work.

  1. Directory.build.props

This file is used automatically by your .csproj from your platforms and extensions folders.

We recommend to - at least - import the same file from the Sharpmake core folder to re-use the same basic setup (target framework...). You can also customize/override any option after the import.

<Project>
  <!-- Rely on Sharpmake build setup -->
  <Import Project="Sharpmake/Directory.Build.props" />

  <!-- Add customization/override here -->
  <!-- ... -->
</Project>
  1. SharpmakeExtended.sln

This solution is only to ease development for humans. It allows to have in a single IDE all the projects from both Sharpmake core and the extended ones.