Setup - Blueprint documentation

Skip to content
Back to top
View this page

# Setup

## Setting up Blueprint on a new or existing project

### Using the porting tool

Clone blueprint-compiler from source. You can install it using `meson _build` and `ninja -C _build install`, or you can leave it uninstalled.

In your project’s directory, run `blueprint-compiler port` (or `<path to blueprint-compiler.py> port`) to start the porting process. It will walk you through the steps outlined below. It should work for most projects, but if something goes wrong you may need to follow the manual steps instead.

### Manually

blueprint-compiler works as a meson subproject.

1. Save the following file as `subprojects/blueprint-compiler.wrap`:

       [wrap-git]
       directory = blueprint-compiler
       url = https://gitlab.gnome.org/GNOME/blueprint-compiler.git
       revision = main
       depth = 1

       [provide]
       program_names = blueprint-compiler

2. Add this to your `.gitignore`:

       /subprojects/blueprint-compiler

3. Rewrite your .ui XML files in blueprint format.

4. Add this to the `meson.build` file where you build your GResources:

       blueprints = custom_target('blueprints',
         input: files(
           # LIST YOUR BLUEPRINT FILES HERE
         ),
         output: '.',
         command: [find_program('blueprint-compiler'), 'batch-compile', '--minify', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
       )

5. In the same `meson.build` file, add this argument to your `gnome.compile_resources` command:

       dependencies: blueprints,