JD2022-TU1/main/build/sharpmake/README.md

3.9 KiB

Sharpmake

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 C# for scripting, hence the name. That means that you can edit your scripts in Visual Studio (or Visual Studio Code) and have a complete IntelliSense programming experience.

Sources

The sources of Sharpmake can be found on GitLab for Ubisoft internal version https://gitlab-ncsa.ubisoft.org/Sharpmake/sharpmake or on GitHub for public version https://github.com/ubisoftinc/Sharpmake/

Documentation

The official documentation of Shaprmake is located here https://github.com/ubisoftinc/Sharpmake/wiki

Sharpmake on Just Dance

How to generate solutions

The easiest way of doing is to run TeaBox, and launch the Generate solutions macro.

But you can also run Sharpmake manually by running the command line

Sharpmake.Application.exe /sources(@"D:\JD_CODE\sharpmake\build\sharpmake\main.cs") /project("JD2019") /branch("MAIN")  

How to edit scripts

Sharpmake scripts for Just Dance are located in /build/sharpmake. It contains scripts to generate all engine and tools projects. You can directly edit them with Visual Studio Code, or generate a Visual Studio project that will give you intellisense.

The easiest way of doing is using TeaBox and check the option Generate Sharpmake Debug Solution in the Generate solutions macro.

Or you can also pass the argument /generateDebugSolution to sharpmake application.

Sharpmake.Application.exe /sources(@"D:\JD_CODE\sharpmake\build\sharpmake\main.cs") /project("JD2019") /branch("MAIN") /generateDebugSolution

How to upgrade sharpmake version

Sharpmake application located on this perforce uses a Facade version of Sharpmake. It means it's just a simple light application that will never change. On loading of the application it will download the version of sharpmake that is defined in the Sharpmake.Application.config file.

    <!-- The version specified in the package version will be used if not specified in command line. Otherwise it will get the latest version available. -->
    <add key="PackageVersion" value="0.4.2"/>

    <!-- The package name can be overridden in the config file. -->
    <add key="PackageName" value="Sharpmake"/>

So upgrading Sharpmake only consists on changing this version in the xml.

How to modify sharpmake

If for some reasons, Sharpmake doesn't support what you want to achieve: a new platform, some missing options... Then you can modify the source code of Sharpmake. For that you will need to use the system of Merge requests from Gitlab.

  • Fork the official repository located here https://gitlab-ncsa.ubisoft.org/Sharpmake/sharpmake
  • Clone it on your pc
  • Do your changes
  • Test it.
  • when you are happy with it, create a Merge request from Gitlab.
  • The owner of the project will eventually give you some feedbacks, and then merge it in the official repository.

The difference with previous way of doing it is that now we will be always synced with the official sharpmake, and all our changes will benefit to everyone!

For more documentation about merge request, please read https://docs.gitlab.com/ee/user/project/merge_requests/