Meson build system
Posted: Wed Mar 21, 2018 3:24 pm
Hello folks! I'm investigating meson build system to use it with my projects. It seems far simpler than using makefiles. Is someone experienced with it or has any opinions of it?
I switched. I feel its simpler and faster.Lyberta wrote: CMake?
Code: Select all
project(
'noise-repellent',
'c',
default_options: 'c_std=c99'
)
#shared object name
lv2_name = 'nrepel'
#source to compile
src = 'src/nrepel.c'
#dependencies for noise repellent
fftw_dep = dependency('fftw3f')
lv2_dep = dependency('lv2')
nr_dep = [
fftw_dep,
lv2_dep
]
#compiler optimization flags
cflags = [
'-msse',
'-msse2',
'-mfpmath=sse',
'-ffast-math',
'-fomit-frame-pointer',
'-fno-finite-math-only'
]
#linking flags (besides dependencies)
largs = [
'-lm'
]
#install destination
i_path = '/usr/local/lib/lv2/nrepel.lv2'
#Ensamble ttl files in order to be copied to install folder
current_os = build_machine.system()
if current_os == 'linux'
extension = '.so'
endif
if current_os == 'darwin'
extension = '.dylib'
endif
if current_os == 'windows'
extension = '.dll'
endif
run_command('lv2ttl/generate_ttl.sh',extension)
#add generated ttl and nrepel.ttl to be installed with the shared object
install_data(
['lv2ttl/manifest.ttl', 'lv2ttl/nrepel.ttl'],
install_dir : i_path
)
#build configuration for the shared object
shared_library(
lv2_name,
src,
name_prefix: '',
dependencies: nr_dep,
c_args: cflags,
link_args: largs,
install: true,
install_dir : i_path
)
Code: Select all
#!/bin/bash
LIB_EXT=$1
sed "s/@LIB_EXT@/$LIB_EXT/" lv2ttl/manifest.ttl.in > lv2ttl/manifest.ttl
Code: Select all
@prefix lv2: <http://lv2plug.in/ns/lv2core#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
<https://github.com/lucianodato/noise-repellent>
a lv2:Plugin;
lv2:binary <nrepel@LIB_EXT@> ;
rdfs:seeAlso <nrepel.ttl> .
Code: Select all
#Configure manifest ttl in order to be copied to install folder
manifest_conf = configuration_data()
manifest_conf.set('LIB_EXT',extension)
configure_file(input : 'lv2ttl/manifest.ttl.in',
output : 'manifest.ttl',
configuration : manifest_conf)
Code: Select all
project(
'noise-repellent',
'c',
default_options: 'c_std=c99'
)
#shared object name
lv2_name = 'nrepel'
#source to compile
src = 'src/nrepel.c'
#dependencies for noise repellent
cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required : true)
fftw_dep = dependency('fftw3f', required : true)
lv2_dep = dependency('lv2', required : true)
nr_dep = [
m_dep,
fftw_dep,
lv2_dep
]
#compiler optimization flags
cflags = [
'-msse',
'-msse2',
'-mfpmath=sse',
'-ffast-math',
'-fomit-frame-pointer',
'-fno-finite-math-only'
]
#install destination
i_path = '/usr/local/lib/lv2/nrepel.lv2'
#build of the shared object
shared_library(
lv2_name,
src,
name_prefix: '',
dependencies: nr_dep,
c_args: cflags,
install: true,
install_dir : i_path
)
#get the build operating system
current_os = build_machine.system()
if current_os == 'darwin'
extension = '.dylib' #mac
else
extension = '.so' #linux and others
endif
if current_os == 'windows'
extension = '.dll' #windows
endif
#Configure manifest ttl in order to replace the correct shared object extension
manifest_conf = configuration_data()
manifest_conf.set('LIB_EXT',extension)
configure_file(input : 'lv2ttl/manifest.ttl.in',
output : 'manifest.ttl',
configuration : manifest_conf)
#add manifest.ttl and nrepel.ttl to be installed with the shared object
install_data(
['build/manifest.ttl', 'lv2ttl/nrepel.ttl'],
install_dir : i_path
)
Code: Select all
#get the build operating system and configure install path and shared object extension
current_os = build_machine.system()
if current_os == 'darwin' #mac
i_path = '/Library/Audio/Plug-Ins/LV2/nrepel.lv2'
extension = '.dylib'
else #unix like
i_path = '/usr/local/lib/lv2/nrepel.lv2'
extension = '.so'
endif #windows
if current_os == 'windows'
i_path = '%COMMONPROGRAMFILES%/LV2/nrepel.lv2'
extension = '.dll'
endif