Blame README-CMake.md

7c321a
### CMake status
7c321a
7c321a
We're currently in the [process of switching to CMake build system][cmake] and
7c321a
you're welcome to take part in testing and improving it.
7c321a
7c321a
- all major components are buildable, installable and runnable
7c321a
- building all components without installing ETL & core is not tested
7c321a
7c321a
Tested to work on (this will be updated as reports come in):
7c321a
7c321a
- Debian Sid
7c321a
7c321a
7c321a
### Dependencies
7c321a
f498a9
For full list  of required libraries please check this page - https://synfig-docs-dev.readthedocs.io/en/latest/common/dependencies.html
7c321a
7c321a
Generally CMake will throw error if it doesn't find something, so you can just
7c321a
run it and see what's missing. Also note that this list might not be full.
7c321a
7c321a
7c321a
### CMake backend
7c321a
7c321a
CMake provides generators for multiple build systems. You can use default `make`
7c321a
or `ninja`, which should generally work somewhat faster. The following
7c321a
configuration commands assume you want to use `ninja`. If you don't, remove
7c321a
`-GNinja` from all commands containing it. All the building commands here are
7c321a
invoked via cmake to make them (almost) backend-agnostic, but you can run `make`
7c321a
or `ninja` directly (i.e.
7c321a
`ninja all test` instead of `cmake --build . -- all test`).
7c321a
7c321a
### Build options
7c321a
7c321a
You may want to add `-jN` (where N is amount of threads you want to run) option
7c321a
to build commands, because default for `make` is to run single-threaded and
7c321a
`ninja` tends to use too much threads which eat up your RAM (may vary).
7c321a
Voldracarno Draconor 1de9b5
Note for packagers:
Voldracarno Draconor acb820
On Unix systems, the Synfig Studio looks out for its symbols, sounds and plugins at CMAKE_INSTALL_PREFIX/share.
Voldracarno Draconor acb820
If you want to change the prefix you need to overwrite the `DATA_PREFIX` variable.
Voldracarno Draconor acb820
Pass `-DDATA_PREFIX=/usr` for example to made Synfig Studio look at /usr/share for its data.
Voldracarno Draconor acb820
7c321a
### Building
7c321a
7c321a
```
7c321a
$ pushd ETL
7c321a
$ mkdir build && pushd build
7c321a
$ cmake -GNinja .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
7c321a
$ cmake --build . -- all test
7c321a
$ sudo cmake --build . -- install
7c321a
$ popd # build
7c321a
$ popd # ETL
7c321a
$ pushd synfig-core
7c321a
$ mkdir build && pushd build
7c321a
$ cmake -GNinja .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-fdiagnostics-color"
7c321a
$ cmake --build . -- all
7c321a
$ sudo cmake --build . -- install
7c321a
$ popd # build
7c321a
$ popd # synfig-core
7c321a
$ pushd synfig-studio
7c321a
$ mkdir build && pushd build
7c321a
$ cmake -GNinja .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-fdiagnostics-color"
7c321a
$ cmake --build . -- all
7c321a
# this will take a while; alternatively, you can move/copy required images
7c321a
# to build/images directory and skip this step
7c321a
$ cmake --build . -- build_images
7c321a
$ sudo cmake --build . -- install
7c321a
$ popd # build
7c321a
$ popd # synfig-studio
7c321a
```
7c321a
Voldracarno Draconor bb9d74
### Auto building (portable)
Voldracarno Draconor bb9d74
You can also build synfig-studio and run it without installation.
Voldracarno Draconor 1de9b5
To build change the directory to the project path (where README-CMake.md is located) and start the build process with:
Voldracarno Draconor bb9d74
```
3bfc75
$ ./2-build-cmake.sh
Voldracarno Draconor bb9d74
```
Voldracarno Draconor bb9d74
Voldracarno Draconor bb9d74
This can take some time.
Voldracarno Draconor 1de9b5
If the build was successful, cd to _debug/out and after that you can run Synfig Studio directly with:
Voldracarno Draconor bb9d74
```
Voldracarno Draconor 1de9b5
$ ./run-portable.sh
Voldracarno Draconor bb9d74
```
Voldracarno Draconor bb9d74
Voldracarno Draconor bb9d74
It is also passible to run the Synfig CLI program:
Voldracarno Draconor bb9d74
```
Voldracarno Draconor 1de9b5
$ ./run-portable.sh "synfig [PARAMETERS]"
Voldracarno Draconor bb9d74
```
Voldracarno Draconor bb9d74
Voldracarno Draconor bb9d74
You can also create a bash session, where you can run the binary's directly:
Voldracarno Draconor bb9d74
```
Voldracarno Draconor 1de9b5
$ ./run-portable.sh bash
Voldracarno Draconor bb9d74
```
Voldracarno Draconor bb9d74
Voldracarno Draconor bb9d74
Now you can type "synfig" or "synfigstudio" to run the build programs. It now behaves exactly as if Synfig Studio was installed to the system.
Voldracarno Draconor bb9d74
To exit the session just type the following:
Voldracarno Draconor bb9d74
```
Voldracarno Draconor bb9d74
$ exit
Voldracarno Draconor bb9d74
```
Voldracarno Draconor bb9d74
Voldracarno Draconor 1de9b5
For for options open the build-cmake.sh in a text editor.
Voldracarno Draconor 1de9b5
The available options are on the top of the file (the same also in the run-portable.sh).
Voldracarno Draconor 1de9b5
7c321a
[cmake]:        https://github.com/synfig/synfig/issues/279