tusharkant15
tusharkant15

Reputation: 137

Meson build: Specify output directories

I have a c++ project that builds shared libraries, it also has a few binaries for packing resources into single files and trans-compiling few things into files easier for the library to process during runtime. To test the project I have a few tests. Earlier I used to use handwritten makefiles to build the following structure:

build/
  lib/
  bin/
  tests/
src/
  graphics/
  ui/
  util/
  network

As the names suggest, the source files are in src/, .so files go in build/lib/, the helper binaries go in build/bin/ and the tests go in build/tests.

I have managed to get meson to build everything, however it builds everything in build/. How do I specify the output paths in the targets?

Thanks!

Upvotes: 0

Views: 2856

Answers (1)

Elvis Oric
Elvis Oric

Reputation: 1364

You can check official documentation for installation here. You need to provide install and install_dir

executable('prog', 'prog.c', install : true, install_dir : 'my/special/dir')

What I usually do for tests is to make meson.build in tests directory and then call subdir('tests') from top level meson.build. Here is the structure:

── meson.build

└── test
    ├── meson.build

    ├── component_tests

    │   └── meson.build

    └── unit_tests

        └── meson.build

Upvotes: 2

Related Questions