forked from enlightenment/efl
Meson.build cleanup.
Summary: This is a 8 commit patch, but only for a while - after agreeing with each of the changes, it shall be squashed into a single commit. I want to make further changes on meson.build (maybe I can end up simplifying the build system, or just let things more organized in the end) and thought that starting with a cleanup would be a good first step. The changes are: 1. build: set arguments scope to project instead of globally If we set arguments globally, it may conflict with other builds - specially considering [meson's subprojects feature](https://mesonbuild.com/Subprojects.html). Setting to project arguments ensures we are only considering EFL and not leaking unwanted flags. 2. build: Fix spacing and indent Mostly because it is not well standardized during the file - sometimes there's spaces between tokens, sometimes there is not, etc. The same applies to indent. 3. build: move test environment closer to test commands Just as a matter of organization. If we're doing things for tests that don't impact other stuff, then leave it when tests are handled. 4. build: Remove unnecessary parenthesis and == true comparisons Less noisy redundancy: `true` is already true, and `false` is already false, no need to re-check. Besides, reading `if sys_windows` and `if sys_windows == true` shouldn't have different effects, as the first you can read as "if the system is windows". It gets better when you have `not` instead of `== false`, so for an example you could read `if not sys_windows` as "if it is not a windows system" more naturally. 5. build: Switch pc_files to dict Just thought it could stay a little better (since it works as a dict), specially in the `foreach` right after. 6. **[removed to a future patch]** build: Use meson's warning_level instead of hardcoded -Wall This way we ensure this is compiler-independant (and use the correct feature for that, since meson even warns when configuring the build dir). 7. build: Use language args from add_project_arguments properly instead of a loop The `language:` kwarg from `add_{project,global}_arguments` receives a list of languages, so no need for that loop. 8. **[removed to a future patch]** build: Use '/' instead of join_paths As it [is recommended by meson since v0.49](https://mesonbuild.com/Release-notes-for-0-49-0.html#joining-paths-with-) (and stays clearer IMO, specially since that's how some languages are adopting path separation, e.g. C++'s filesystem stdlib). Reviewers: bu5hm4n Subscribers: vtorri, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11994
This commit is contained in:
parent
1e06c01f82
commit
98fd37e768
145
meson.build
145
meson.build
|
@ -10,13 +10,6 @@ endif
|
||||||
|
|
||||||
pkgconfig = import('pkgconfig')
|
pkgconfig = import('pkgconfig')
|
||||||
|
|
||||||
test_env = environment()
|
|
||||||
test_env.set('EFL_RUN_IN_TREE', '1')
|
|
||||||
|
|
||||||
if get_option('b_sanitize') == 'address'
|
|
||||||
test_env.set('ASAN_OPTIONS', 'detect_leaks=0:detect_odr_violation=0')
|
|
||||||
endif
|
|
||||||
|
|
||||||
version_arr = meson.project_version().split('.')
|
version_arr = meson.project_version().split('.')
|
||||||
|
|
||||||
version_major = version_arr[0]
|
version_major = version_arr[0]
|
||||||
|
@ -89,46 +82,46 @@ dev_cflags_try = [
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach cf: dev_cflags_try
|
foreach cf: dev_cflags_try
|
||||||
if cc.has_argument(cf) == true
|
if cc.has_argument(cf)
|
||||||
dev_cflags += cf
|
dev_cflags += cf
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
add_global_arguments(dev_cflags, language: 'c')
|
|
||||||
add_global_arguments(dev_cflags, language: 'cpp')
|
add_project_arguments(dev_cflags, language: 'c')
|
||||||
|
add_project_arguments(dev_cflags, language: 'cpp')
|
||||||
|
|
||||||
|
|
||||||
foreach lang : ['c', 'objc', 'cpp']
|
langs = ['c', 'objc', 'cpp']
|
||||||
add_global_arguments('-DHAVE_CONFIG_H=1', language: lang)
|
add_project_arguments('-DHAVE_CONFIG_H=1', language: langs)
|
||||||
add_global_arguments('-D_GNU_SOURCE=1', language: lang)
|
add_project_arguments('-D_GNU_SOURCE=1', language: langs)
|
||||||
add_global_arguments('-DEFL_BETA_API_SUPPORT=1', language: lang)
|
add_project_arguments('-DEFL_BETA_API_SUPPORT=1', language: langs)
|
||||||
add_global_arguments('-DNEED_RUN_IN_TREE=1', language: lang)
|
add_project_arguments('-DNEED_RUN_IN_TREE=1', language: langs)
|
||||||
add_global_arguments('-DELM_INTERNAL_API_ARGESFSDFEFC=1', language: lang)
|
add_project_arguments('-DELM_INTERNAL_API_ARGESFSDFEFC=1', language: langs)
|
||||||
if sys_windows == true
|
if sys_windows
|
||||||
add_global_arguments('-D_POSIX_C_SOURCE=200809L', language: lang)
|
add_project_arguments('-D_POSIX_C_SOURCE=200809L', language: langs)
|
||||||
add_global_arguments('-DDLL_EXPORT=1', language: lang)
|
add_project_arguments('-DDLL_EXPORT=1', language: langs)
|
||||||
if (get_option('windows-version') == 'vista')
|
if get_option('windows-version') == 'vista'
|
||||||
add_global_arguments('-DWINVER=0x060', language: lang)
|
add_project_arguments('-DWINVER=0x060', language: langs)
|
||||||
add_global_arguments('-D_WIN32_WINNT=0x0600', language: lang)
|
add_project_arguments('-D_WIN32_WINNT=0x0600', language: langs)
|
||||||
elif (get_option('windows-version') == 'win7')
|
elif get_option('windows-version') == 'win7'
|
||||||
add_global_arguments('-DWINVER=0x0601', language: lang)
|
add_project_arguments('-DWINVER=0x0601', language: langs)
|
||||||
add_global_arguments('-D_WIN32_WINNT=0x0601', language: lang)
|
add_project_arguments('-D_WIN32_WINNT=0x0601', language: langs)
|
||||||
elif (get_option('windows-version') == 'win8')
|
elif get_option('windows-version') == 'win8'
|
||||||
add_global_arguments('-DWINVER=0x0602', language: lang)
|
add_project_arguments('-DWINVER=0x0602', language: langs)
|
||||||
add_global_arguments('-D_WIN32_WINNT=0x0602', language: lang)
|
add_project_arguments('-D_WIN32_WINNT=0x0602', language: langs)
|
||||||
elif (get_option('windows-version') == 'win81')
|
elif get_option('windows-version') == 'win81'
|
||||||
add_global_arguments('-DWINVER=0x0603', language: lang)
|
add_project_arguments('-DWINVER=0x0603', language: langs)
|
||||||
add_global_arguments('-D_WIN32_WINNT=0x0603', language: lang)
|
add_project_arguments('-D_WIN32_WINNT=0x0603', language: langs)
|
||||||
elif (get_option('windows-version') == 'win10')
|
elif get_option('windows-version') == 'win10'
|
||||||
add_global_arguments('-DWINVER=0x0A00', language: lang)
|
add_project_arguments('-DWINVER=0x0A00', language: langs)
|
||||||
add_global_arguments('-D_WIN32_WINNT=0x0A00', language: lang)
|
add_project_arguments('-D_WIN32_WINNT=0x0A00', language: langs)
|
||||||
else
|
else
|
||||||
error('Version of targetted Windows incorrect')
|
error('Version of targetted Windows incorrect')
|
||||||
endif
|
endif
|
||||||
add_global_arguments('-D__USE_MINGW_ANSI_STDIO', language: lang)
|
add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: langs)
|
||||||
endif
|
endif
|
||||||
endforeach
|
|
||||||
|
|
||||||
if sys_sun == true
|
if sys_sun
|
||||||
# for getpwuid_r()
|
# for getpwuid_r()
|
||||||
add_global_arguments('-D_POSIX_PTHREAD_SEMANTICS', language: 'c')
|
add_global_arguments('-D_POSIX_PTHREAD_SEMANTICS', language: 'c')
|
||||||
endif
|
endif
|
||||||
|
@ -162,7 +155,7 @@ extern char **environ;
|
||||||
|
|
||||||
void func(void) { printf("%p\n", environ); }
|
void func(void) { printf("%p\n", environ); }
|
||||||
'''
|
'''
|
||||||
if cc.compiles(code, args : '-lc', name : 'environ check') == true
|
if cc.compiles(code, args : '-lc', name : 'environ check')
|
||||||
config_h.set10('HAVE_ENVIRON', true)
|
config_h.set10('HAVE_ENVIRON', true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -185,21 +178,21 @@ if get_option('native-arch-optimization')
|
||||||
elif host_machine.cpu_family() == 'arm'
|
elif host_machine.cpu_family() == 'arm'
|
||||||
cpu_neon = true
|
cpu_neon = true
|
||||||
config_h.set10('BUILD_NEON', true)
|
config_h.set10('BUILD_NEON', true)
|
||||||
add_global_arguments('-mfpu=neon', language: 'c')
|
add_project_arguments('-mfpu=neon', language: 'c')
|
||||||
add_global_arguments('-ftree-vectorize', language: 'c')
|
add_project_arguments('-ftree-vectorize', language: 'c')
|
||||||
message('ARM build - NEON enabled')
|
message('ARM build - NEON enabled')
|
||||||
elif host_machine.cpu_family() == 'aarch64'
|
elif host_machine.cpu_family() == 'aarch64'
|
||||||
cpu_neon = true
|
cpu_neon = true
|
||||||
cpu_neon_intrinsics = true
|
cpu_neon_intrinsics = true
|
||||||
config_h.set10('BUILD_NEON', true)
|
config_h.set10('BUILD_NEON', true)
|
||||||
config_h.set10('BUILD_NEON_INTRINSICS', true)
|
config_h.set10('BUILD_NEON_INTRINSICS', true)
|
||||||
add_global_arguments('-ftree-vectorize', language: 'c')
|
add_project_arguments('-ftree-vectorize', language: 'c')
|
||||||
native_arch_opt_c_args = [ '-ftree-vectorize' ]
|
native_arch_opt_c_args = [ '-ftree-vectorize' ]
|
||||||
message('ARM64 build - NEON + intrinsics enabled')
|
message('ARM64 build - NEON + intrinsics enabled')
|
||||||
elif host_machine.cpu_family() == 'ppc' or host_machine.cpu_family() == 'ppc64'
|
elif host_machine.cpu_family() == 'ppc' or host_machine.cpu_family() == 'ppc64'
|
||||||
config_h.set10('BUILD_ALTIVEC', true)
|
config_h.set10('BUILD_ALTIVEC', true)
|
||||||
add_global_arguments('-ftree-vectorize', language: 'c')
|
add_project_arguments('-ftree-vectorize', language: 'c')
|
||||||
add_global_arguments('-maltivec', language: 'c')
|
add_project_arguments('-maltivec', language: 'c')
|
||||||
message('PPC/POWER build - ALTIVEC enabled')
|
message('PPC/POWER build - ALTIVEC enabled')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -207,15 +200,15 @@ endif
|
||||||
config_dir = [include_directories('.')]
|
config_dir = [include_directories('.')]
|
||||||
eolian_include_directories = []
|
eolian_include_directories = []
|
||||||
|
|
||||||
if sys_linux == true or sys_bsd == true or sys_sun == true
|
if sys_linux or sys_bsd or sys_sun
|
||||||
sys_lib_extension = 'so'
|
sys_lib_extension = 'so'
|
||||||
sys_exe_extension = ''
|
sys_exe_extension = ''
|
||||||
sys_mod_extension = 'so'
|
sys_mod_extension = 'so'
|
||||||
elif sys_windows == true
|
elif sys_windows
|
||||||
sys_lib_extension = 'dll'
|
sys_lib_extension = 'dll'
|
||||||
sys_exe_extension = 'exe'
|
sys_exe_extension = 'exe'
|
||||||
sys_mod_extension = 'dll'
|
sys_mod_extension = 'dll'
|
||||||
elif sys_osx == true
|
elif sys_osx
|
||||||
sys_lib_extension = 'dylib'
|
sys_lib_extension = 'dylib'
|
||||||
sys_exe_extension = ''
|
sys_exe_extension = ''
|
||||||
sys_mod_extension = 'so'
|
sys_mod_extension = 'so'
|
||||||
|
@ -225,15 +218,15 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if host_os == 'freebsd' or host_os == 'dragonfly'
|
if host_os == 'freebsd' or host_os == 'dragonfly'
|
||||||
# This is necessary. We MUST use OpenSSL in base as bringing in
|
# This is necessary. We MUST use OpenSSL in base as bringing in from ports
|
||||||
# from ports can cause major issues (2 copies of the same library).
|
# can cause major issues (2 copies of the same library).
|
||||||
crypto = declare_dependency(link_args : [ '-lssl', '-lcrypto'])
|
crypto = declare_dependency(link_args : [ '-lssl', '-lcrypto'])
|
||||||
config_h.set('HAVE_OPENSSL', '1')
|
config_h.set('HAVE_OPENSSL', '1')
|
||||||
elif (get_option('crypto') == 'gnutls')
|
elif get_option('crypto') == 'gnutls'
|
||||||
# gcrypt does not want to provide a pkg config file so we try the lib
|
# gcrypt does not want to provide a pkg config file so we try the lib
|
||||||
crypto = [dependency('gnutls'), cc.find_library('gcrypt')]
|
crypto = [dependency('gnutls'), cc.find_library('gcrypt')]
|
||||||
config_h.set('HAVE_GNUTLS', '1')
|
config_h.set('HAVE_GNUTLS', '1')
|
||||||
elif (get_option('crypto') == 'openssl')
|
elif get_option('crypto') == 'openssl'
|
||||||
crypto = dependency('openssl')
|
crypto = dependency('openssl')
|
||||||
config_h.set('HAVE_OPENSSL', '1')
|
config_h.set('HAVE_OPENSSL', '1')
|
||||||
endif
|
endif
|
||||||
|
@ -251,14 +244,14 @@ else
|
||||||
config_h.set_quoted('EXE_SUFFIX', '.' + sys_exe_extension)
|
config_h.set_quoted('EXE_SUFFIX', '.' + sys_exe_extension)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('tslib') == true
|
if get_option('tslib')
|
||||||
config_h.set('HAVE_TSLIB', '1')
|
config_h.set('HAVE_TSLIB', '1')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
subdir('header_checks')
|
subdir('header_checks')
|
||||||
subdir('po')
|
subdir('po')
|
||||||
|
|
||||||
if get_option('wl') == true
|
if get_option('wl')
|
||||||
subdir(join_paths('src', 'wayland_protocol'))
|
subdir(join_paths('src', 'wayland_protocol'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -284,7 +277,7 @@ if get_option('lua-interpreter') == 'lua'
|
||||||
foreach l : luaold_interpreters
|
foreach l : luaold_interpreters
|
||||||
lua = dependency(l[0], version: l[1], required:false)
|
lua = dependency(l[0], version: l[1], required:false)
|
||||||
lua_pc_name = l[0]
|
lua_pc_name = l[0]
|
||||||
if lua.found() == true
|
if lua.found()
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
@ -307,8 +300,10 @@ else
|
||||||
lua_pc_name = 'luajit'
|
lua_pc_name = 'luajit'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if sys_osx == true and get_option('lua-interpreter') == 'luajit'
|
if sys_osx and get_option('lua-interpreter') == 'luajit'
|
||||||
# luajit on macos is broken, this means we need to generate our own dependency with our arguments, a library later still needs to link to luajit for the pagesize argument thingy
|
# luajit on macro is broken, this means we need to generate our own
|
||||||
|
# dependency with our arguments, a library later still needs to link to
|
||||||
|
# luajit for the pagesize argument thingy
|
||||||
lua = declare_dependency(
|
lua = declare_dependency(
|
||||||
include_directories: include_directories(lua.get_pkgconfig_variable('includedir')),
|
include_directories: include_directories(lua.get_pkgconfig_variable('includedir')),
|
||||||
link_args: ['-L' + lua.get_pkgconfig_variable('libdir'), '-l' + lua.get_pkgconfig_variable('libname')]
|
link_args: ['-L' + lua.get_pkgconfig_variable('libdir'), '-l' + lua.get_pkgconfig_variable('libname')]
|
||||||
|
@ -396,14 +391,16 @@ foreach package : subprojects
|
||||||
dir_package_include = join_paths(dir_include, package_version_name)
|
dir_package_include = join_paths(dir_include, package_version_name)
|
||||||
dir_package_modules = join_paths(dir_lib, package_name, 'modules')
|
dir_package_modules = join_paths(dir_lib, package_name, 'modules')
|
||||||
|
|
||||||
#ensure that we really dont copy the eo file targets from a previous library
|
# ensure that we really dont copy the eo file targets from a previous
|
||||||
#Those are the variables that can be used to reflect the libraries speical handlings
|
# library Those are the variables that can be used to reflect the libraries
|
||||||
# -> at the end is used to indicate where to find this variable outside of this for loop
|
# speical handlings -> at the end is used to indicate where to find this
|
||||||
|
# variable outside of this for loop
|
||||||
|
|
||||||
# public eo and eot files - which probebly have to be used later for bindings
|
# public eo and eot files - which probebly have to be used later for bindings
|
||||||
pub_eo_files = [] # -> package_name + '_eo_files'
|
pub_eo_files = [] # -> package_name + '_eo_files'
|
||||||
pub_eo_types_files = [] # -> package_name + '_eot_files'
|
pub_eo_types_files = [] # -> package_name + '_eot_files'
|
||||||
#All subdirs where eo files that are listed in the pub_* variables can be found
|
# All subdirs where eo files that are listed in the pub_* variables can be
|
||||||
|
# found
|
||||||
# For every element != '' a variable called package_name + '_' + subir + '_eot_files' and package_name + '_' + subir + '_eo_files' must exist.
|
# For every element != '' a variable called package_name + '_' + subir + '_eot_files' and package_name + '_' + subir + '_eo_files' must exist.
|
||||||
package_eo_subdirs = [''] # -> package_name + '_eo_subdirs'
|
package_eo_subdirs = [''] # -> package_name + '_eo_subdirs'
|
||||||
# All subdirs that should be included in order to include every requried header
|
# All subdirs that should be included in order to include every requried header
|
||||||
|
@ -427,7 +424,7 @@ foreach package : subprojects
|
||||||
'-DNEED_RUN_IN_TREE=1',
|
'-DNEED_RUN_IN_TREE=1',
|
||||||
'-DEFL_BUILD=1',
|
'-DEFL_BUILD=1',
|
||||||
]
|
]
|
||||||
if (package[3])
|
if package[3]
|
||||||
subdir(join_paths(local_lib, package_name))
|
subdir(join_paths(local_lib, package_name))
|
||||||
set_variable(package_name + '_eo_files', pub_eo_files)
|
set_variable(package_name + '_eo_files', pub_eo_files)
|
||||||
set_variable(package_name + '_eot_files', pub_eo_types_files)
|
set_variable(package_name + '_eot_files', pub_eo_types_files)
|
||||||
|
@ -466,17 +463,17 @@ foreach package : subprojects
|
||||||
subdir(join_paths(local_bin, package_name))
|
subdir(join_paths(local_bin, package_name))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if (package[6])
|
if package[6]
|
||||||
test_dirs += [package_name]
|
test_dirs += [package_name]
|
||||||
endif
|
endif
|
||||||
if (package[7])
|
if package[7]
|
||||||
example_dirs += [package_name]
|
example_dirs += [package_name]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set_variable('build_' + package_name.underscorify(), true)
|
set_variable('build_' + package_name.underscorify(), true)
|
||||||
|
|
||||||
# generate automatic pc files for libraries
|
# generate automatic pc files for libraries
|
||||||
if automatic_pkgfile == true and package[3]
|
if automatic_pkgfile and package[3]
|
||||||
tmp_lib = get_variable(package_name + '_lib')
|
tmp_lib = get_variable(package_name + '_lib')
|
||||||
tmp_deps = get_variable(package_name + '_deps')
|
tmp_deps = get_variable(package_name + '_deps')
|
||||||
tmp_pub_deps = get_variable(package_name + '_pub_deps')
|
tmp_pub_deps = get_variable(package_name + '_pub_deps')
|
||||||
|
@ -584,6 +581,14 @@ subdir(join_paths('data'))
|
||||||
|
|
||||||
if get_option('build-tests')
|
if get_option('build-tests')
|
||||||
check = dependency('check')
|
check = dependency('check')
|
||||||
|
|
||||||
|
test_env = environment()
|
||||||
|
test_env.set('EFL_RUN_IN_TREE', '1')
|
||||||
|
|
||||||
|
if get_option('b_sanitize') == 'address'
|
||||||
|
test_env.set('ASAN_OPTIONS', 'detect_leaks=0:detect_odr_violation=0')
|
||||||
|
endif
|
||||||
|
|
||||||
subdir(join_paths('src', 'tests'))
|
subdir(join_paths('src', 'tests'))
|
||||||
foreach test : test_dirs
|
foreach test : test_dirs
|
||||||
package_c_args = [
|
package_c_args = [
|
||||||
|
@ -657,15 +662,13 @@ subdir(join_paths('systemd-services'))
|
||||||
subdir(join_paths('dbus-services'))
|
subdir(join_paths('dbus-services'))
|
||||||
|
|
||||||
#output the three new efl-* .pc files
|
#output the three new efl-* .pc files
|
||||||
efl_20_pc_files = [
|
efl_20_pc_files = {
|
||||||
['efl-ui', ['elementary']],
|
'efl-ui' : ['elementary'],
|
||||||
['efl-core', ['ecore', 'efl', 'emile']],
|
'efl-core' : ['ecore', 'efl', 'emile'],
|
||||||
['efl-net', ['ecore', 'ecore-con', 'emile']],
|
'efl-net' : ['ecore', 'ecore-con', 'emile'],
|
||||||
]
|
}
|
||||||
|
|
||||||
foreach pc_file : efl_20_pc_files
|
foreach name, libraries : efl_20_pc_files
|
||||||
name = pc_file[0]
|
|
||||||
libraries = pc_file[1]
|
|
||||||
pkgconfig.generate(
|
pkgconfig.generate(
|
||||||
name : '-'.join(name.split('_')),
|
name : '-'.join(name.split('_')),
|
||||||
description: name+' configutation file',
|
description: name+' configutation file',
|
||||||
|
|
Loading…
Reference in New Issue