ecore_wl2_window: check current geometry in window_sync_geometry_set function
[platform/upstream/efl.git] / meson.build
1 project('efl', ['c','cpp'],
2   version: '1.25.1',
3   default_options : ['buildtype=release', 'cpp_std=c++11'],
4   meson_version : '>=0.50'
5 )
6
7 if host_machine.system() == 'darwin'
8   add_languages('objc')
9 endif
10
11 pkgconfig = import('pkgconfig')
12
13 version_arr = meson.project_version().split('.')
14
15 version_major = version_arr[0]
16 version_minor = version_arr[1]
17 version_micro = version_arr[2]
18 version_name = 'v-' + version_major + '.' + version_minor
19
20 cc = meson.get_compiler('c')
21 host_os = host_machine.system()
22
23 if host_os == 'linux'
24   if cc.has_header_symbol('features.h', '__UCLIBC__')
25     host_os = 'linux-uclibc'
26   elif cc.has_header_symbol('features.h', '__dietlibc__')
27     host_os = 'linux-dietlibc'
28   else
29     host_os = 'linux-gnu'
30   endif
31 endif
32
33 #prepare a special linker args flag for binaries on macos
34 bin_linker_args = []
35 if host_machine.system() == 'darwin'
36   bin_linker_args = ['-pagezero_size', '10000', '-image_base', '100000000']
37 endif
38
39 windows = ['windows', 'cygwin']
40 #bsd for meson 0.46 and 0.47
41 bsd = ['bsd', 'freebsd', 'dragonfly', 'netbsd', 'openbsd']
42 linux = ['linux']
43 osx = ['darwin']
44 sun = ['sunos']
45
46 sys_linux = linux.contains(host_machine.system())
47 sys_bsd = bsd.contains(host_machine.system())
48 sys_windows = windows.contains(host_machine.system())
49 sys_osx = osx.contains(host_machine.system())
50 sys_sun = sun.contains(host_machine.system())
51
52 module_files = []
53 evas_loader_map = []
54
55 #install paths
56 dir_prefix    = get_option('prefix')
57 dir_sysconf   = join_paths(dir_prefix, get_option('sysconfdir'))
58 dir_bin       = join_paths(dir_prefix, get_option('bindir'))
59 dir_data      = join_paths(dir_prefix, get_option('datadir'))
60 dir_include   = join_paths(dir_prefix, get_option('includedir'))
61 dir_lib       = join_paths(dir_prefix, get_option('libdir'))
62
63 #local paths
64 local_lib = join_paths('src', 'lib')
65 local_bindings = join_paths('src', 'bindings')
66 local_bin = join_paths('src', 'bin')
67 local_module = join_paths('src', 'modules')
68 local_tests = join_paths('src', 'tests')
69 local_benchmark = join_paths('src', 'benchmarks')
70 local_examples = join_paths('src', 'examples')
71 local_scripts = join_paths('src', 'scripts')
72
73 dev_cflags = []
74 dev_cflags_try = [
75   '-fvisibility=hidden',
76   '-Wall',
77   '-Wfloat-compare',
78   '-Wpointer-arith',
79   '-Wunused-parameter',
80   '-Wsign-compare',
81   '-Wno-missing-field-initializers',
82 ]
83
84 foreach cf: dev_cflags_try
85   if cc.has_argument(cf)
86     dev_cflags += cf
87   endif
88 endforeach
89
90 add_project_arguments(dev_cflags, language: 'c')
91 add_project_arguments(dev_cflags, language: 'cpp')
92
93
94 langs = ['c', 'objc', 'cpp']
95 add_project_arguments('-DHAVE_CONFIG_H=1', language: langs)
96 add_project_arguments('-D_GNU_SOURCE=1', language: langs)
97 add_project_arguments('-DEFL_BETA_API_SUPPORT=1', language: langs)
98 add_project_arguments('-DNEED_RUN_IN_TREE=1', language: langs)
99 add_project_arguments('-DELM_INTERNAL_API_ARGESFSDFEFC=1', language: langs)
100 if sys_windows
101   add_project_arguments('-D_POSIX_C_SOURCE=200809L', language: langs)
102   add_project_arguments('-DDLL_EXPORT=1', language: langs)
103   if get_option('windows-version') == 'vista'
104     add_project_arguments('-DWINVER=0x060', language: langs)
105     add_project_arguments('-D_WIN32_WINNT=0x0600', language: langs)
106   elif get_option('windows-version') == 'win7'
107     add_project_arguments('-DWINVER=0x0601', language: langs)
108     add_project_arguments('-D_WIN32_WINNT=0x0601', language: langs)
109   elif get_option('windows-version') == 'win8'
110     add_project_arguments('-DWINVER=0x0602', language: langs)
111     add_project_arguments('-D_WIN32_WINNT=0x0602', language: langs)
112   elif get_option('windows-version') == 'win81'
113     add_project_arguments('-DWINVER=0x0603', language: langs)
114     add_project_arguments('-D_WIN32_WINNT=0x0603', language: langs)
115   elif get_option('windows-version') == 'win10'
116     add_project_arguments('-DWINVER=0x0A00', language: langs)
117     add_project_arguments('-D_WIN32_WINNT=0x0A00', language: langs)
118   else
119     error('Version of targetted Windows incorrect')
120   endif
121   add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: langs)
122 endif
123
124 if sys_sun
125 # for getpwuid_r()
126   add_global_arguments('-D_POSIX_PTHREAD_SEMANTICS', language: 'c')
127 endif
128
129 env = find_program('env', native: true)
130
131 config_h = configuration_data()
132 config_h.set_quoted('MODULE_ARCH', version_name)
133 config_h.set_quoted('PACKAGE', meson.project_name())
134 config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
135 config_h.set_quoted('VERSION', meson.project_version())
136 config_h.set_quoted('LOCALE_DIR', join_paths([dir_prefix, 'share/locale']))
137 config_h.set_quoted('PACKAGE_URL', 'https://www.enlightenment.org')
138 config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
139 config_h.set_quoted('PACKAGE_BUGREPORT', 'enlightenment-devel@lists.sourceforge.net')
140 config_h.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
141 config_h.set_quoted('PACKAGE_NAME', meson.project_name())
142 config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin)
143 config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib)
144 config_h.set_quoted('PACKAGE_SRC_DIR', meson.source_root())
145 config_h.set_quoted('PACKAGE_BUILD_DIR', meson.current_build_dir())
146 config_h.set_quoted('PACKAGE_SYSCONF_DIR', dir_sysconf)
147 config_h.set_quoted('BINDIR', dir_bin)
148 config_h.set10('EFL_HAVE_THREADS', true)
149 config_h.set10('SLOPPY_SPEC', true)
150
151 ## have to get compiler again for this to work
152 code = '''#define _GNU_SOURCE 1
153 #include <unistd.h>
154 #include <stdio.h>
155
156 extern char **environ;
157
158 void func(void) { printf("%p\n", environ); }
159 '''
160 if cc.compiles(code, args : '-lc', name : 'environ check')
161   config_h.set10('HAVE_ENVIRON', true)
162 endif
163
164 cpu_sse3 = false
165 cpu_neon = false
166 cpu_neon_intrinsics = false
167 native_arch_opt_c_args = [ ]
168
169 if host_machine.endian() == 'big'
170   config_h.set10('WORDS_BIGENDIAN', true)
171 endif
172
173 if get_option('native-arch-optimization')
174   if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
175     cpu_sse3 = true
176     config_h.set10('BUILD_MMX', true)
177     config_h.set10('BUILD_SSE3', true)
178     native_arch_opt_c_args = [ '-msse3' ]
179     message('x86 build - MMX + SSE3 enabled')
180   elif host_machine.cpu_family() == 'arm'
181     cpu_neon = true
182     config_h.set10('BUILD_NEON', true)
183     add_project_arguments('-mfpu=neon', language: 'c')
184     add_project_arguments('-ftree-vectorize', language: 'c')
185     message('ARM build - NEON enabled')
186   elif host_machine.cpu_family() == 'aarch64'
187     cpu_neon = true
188     cpu_neon_intrinsics = true
189     config_h.set10('BUILD_NEON', true)
190     config_h.set10('BUILD_NEON_INTRINSICS', true)
191     add_project_arguments('-ftree-vectorize', language: 'c')
192     native_arch_opt_c_args = [ '-ftree-vectorize' ]
193     message('ARM64 build - NEON + intrinsics enabled')
194   elif host_machine.cpu_family() == 'ppc' or host_machine.cpu_family() == 'ppc64'
195     config_h.set10('BUILD_ALTIVEC', true)
196     add_project_arguments('-ftree-vectorize', language: 'c')
197     add_project_arguments('-maltivec', language: 'c')
198     message('PPC/POWER build - ALTIVEC enabled')
199   endif
200 endif
201
202 config_dir = [include_directories('.')]
203 eolian_include_directories = []
204
205 if sys_linux or sys_bsd or sys_sun
206   sys_lib_extension = 'so'
207   sys_exe_extension = ''
208   sys_mod_extension = 'so'
209 elif sys_windows
210   sys_lib_extension = 'dll'
211   sys_exe_extension = 'exe'
212   sys_mod_extension = 'dll'
213 elif sys_osx
214   sys_lib_extension = 'dylib'
215   sys_exe_extension = ''
216   sys_mod_extension = 'so'
217   config_h.set('environ', '(*_NSGetEnviron())')
218 else
219   error('System ' + host_machine.system() + ' not known')
220 endif
221
222 if host_os == 'freebsd' or host_os == 'dragonfly'
223   # This is necessary. We MUST use OpenSSL in base as bringing in from ports
224   # can cause major issues (2 copies of the same library).
225   crypto = declare_dependency(link_args : [ '-lssl', '-lcrypto'])
226   config_h.set('HAVE_OPENSSL', '1')
227 elif get_option('crypto') == 'gnutls'
228   # gcrypt does not want to provide a pkg config file so we try the lib
229   crypto = [dependency('gnutls'), cc.find_library('gcrypt')]
230   config_h.set('HAVE_GNUTLS', '1')
231 elif get_option('crypto') == 'openssl'
232   crypto = dependency('openssl1.1')
233   config_h.set('HAVE_OPENSSL', '1')
234 endif
235
236 if get_option('crypto') != ''
237   config_h.set('HAVE_CIPHER', '1')
238   config_h.set('HAVE_SIGNATURE', '1')
239 endif
240
241 config_h.set_quoted('SHARED_LIB_SUFFIX', '.' + sys_lib_extension)
242 config_h.set_quoted('MOD_SUFFIX', '.' + sys_mod_extension)
243 if sys_exe_extension == ''
244   config_h.set_quoted('EXE_SUFFIX', '')
245 else
246   config_h.set_quoted('EXE_SUFFIX', '.' + sys_exe_extension)
247 endif
248
249 if get_option('tslib')
250   config_h.set('HAVE_TSLIB', '1')
251 endif
252
253 subdir('header_checks')
254 subdir('po')
255 subdir('tracing')
256
257 if get_option('wl')
258   subdir(join_paths('src', 'wayland_protocol'))
259 endif
260
261 ecore_evas_wayland_engine_include_dir = []
262
263 evas_static_list = []
264
265 luaold_interpreters = [
266   ['lua',     ['>=5.1.0', '<5.3.0']],
267   ['lua51',   ['>=5.1.0', '<5.2.0']],
268   ['lua-5.1', ['>=5.1.0', '<5.2.0']],
269   ['lua5.1',  ['>=5.1.0', '<5.2.0']],
270   ['lua52',   ['>=5.2.0', '<5.3.0']],
271   ['lua-5.2', ['>=5.2.0', '<5.3.0']],
272   ['lua5.2',  ['>=5.2.0', '<5.3.0']],
273 ]
274
275 lua_pc_name = ''
276 have_elua = get_option('elua')
277
278 if get_option('lua-interpreter') == 'lua'
279   config_h.set('ENABLE_LUA_OLD', '1')
280   foreach l : luaold_interpreters
281     lua = dependency(l[0], version: l[1], required:false)
282     lua_pc_name = l[0]
283     if lua.found()
284       break
285     endif
286   endforeach
287   if not lua.found()
288     error('Lua not found')
289   endif
290   if have_elua
291     message('Using experimental Elua with interpreter support...')
292   endif
293 else
294   lua = dependency(get_option('lua-interpreter'))
295   lua_pc_name = 'luajit'
296 endif
297
298 if sys_osx and get_option('lua-interpreter') == 'luajit'
299   # luajit on macro is broken, this means we need to generate our own
300   # dependency with our arguments, a library later still needs to link to
301   # luajit for the pagesize argument thingy
302   lua = declare_dependency(
303     include_directories: include_directories(lua.get_pkgconfig_variable('includedir')),
304     link_args: ['-L' + lua.get_pkgconfig_variable('libdir'), '-l' + lua.get_pkgconfig_variable('libname')]
305   )
306 endif
307
308 subprojects = [
309   # name              |   option             | mod  | lib  | bin  | bench | tests | examples | true if build in efl-one | pkg-config options | name of static libs
310   ['evil'             ,[]                    , false,  true, false,  false,  false,     false,  true, [], []],
311   ['eina'             ,[]                    , false,  true,  true,   true,   true,      true,  true, [], []],
312   ['eolian'           ,[]                    , false,  true,  true,  false,   true,     false, false, ['eina'], []],
313   ['eo'               ,[]                    , false,  true, false,   true,   true,     false,  true, ['eina'], []],
314   ['efl'              ,[]                    , false,  true, false,  false,   true,     false,  true, ['eo'], []],
315   ['emile'            ,[]                    , false,  true, false,  false,   true,      true,  true, ['eina', 'efl'], ['lz4', 'rg_etc']],
316   ['eet'              ,[]                    , false,  true,  true,  false,   true,      true,  true, ['eina', 'emile', 'efl'], []],
317   ['ecore'            ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'eo', 'efl'], ['buildsystem']],
318   ['eldbus'           ,[]                    , false,  true,  true,  false,   true,      true,  true, ['eina', 'eo', 'efl'], []],
319   ['ecore'            ,[]                    ,  true, false, false,  false,   true,      true,  true, ['eina', 'eo', 'efl'], []], #ecores modules depend on eldbus
320   ['ecore_audio'      ,['audio']             , false,  true, false,  false,  false,     false,  true, ['eina', 'eo'], []],
321   ['ecore_avahi'      ,['avahi']             , false,  true, false,  false,  false,      true, false, ['eina', 'ecore'], []],
322   ['ecore_con'        ,[]                    , false,  true,  true,  false,   true,     false,  true, ['eina', 'eo', 'efl', 'ecore'], ['http-parser']],
323   ['ecore_file'       ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina'], []],
324   ['eeze'             ,['eeze']              ,  true,  true,  true,  false,   true,     false,  true, ['eina', 'efl'], []],
325   ['ecore_input'      ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'eo'], []],
326   ['ecore_x'          ,['x11']               , false,  true, false,  false,  false,     false,  true, ['eina', 'efl'], []],
327   ['ecore_fb'         ,['fb']                , false,  true, false,  false,  false,     false,  true, ['eina'], []],
328   ['ecore_sdl'        ,['sdl']               , false,  true, false,  false,  false,     false,  true, ['eina'], []],
329   ['ecore_win32'      ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina'], []],
330   ['ecore_ipc'        ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina'], []],
331   ['ecore_buffer'     ,['buffer']            ,  true,  true,  true,  false,  false,     false,  true, ['eina'], []],
332   ['ector'            ,[]                    , false,  true, false,  false,   true,     false,  true, ['eina', 'efl'], ['draw', 'triangulator', 'freetype']],
333   ['elput'            ,['drm']               , false,  true, false,  false,   true,     false,  true, ['eina', 'eldbus'], []],
334   ['ecore_drm2'       ,['drm']               , false,  true, false,  false,  false,     false,  true, ['ecore'], ['libdrm']],
335   ['ecore_cocoa'      ,['cocoa']             , false,  true, false,  false,  false,     false,  true, ['eina'], []],
336   ['evas'             ,[]                    ,  true,  true, false,  false,   true,      true,  true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']],
337   ['efreet'           ,[]                    , false,  true, false,  false,   true,     false,  true, ['eina', 'efl', 'eo'], []],
338   ['eio'              ,[]                    , false,  true, false,  false,   true,      true,  true, ['eina', 'eet'], []],
339   ['ecore_wl2'        ,['wl']                ,  true,  true, false,  false,   true,     false,  true, ['eina'], ['libdrm']],
340   ['ecore_input_evas' ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'evas'], []],
341   ['ecore_evas'       ,[]                    ,  true,  true,  true,  false,  false,     false,  true, ['evas', 'ector'], []],
342   ['ecore_imf'        ,[]                    ,  true,  true, false,  false,  false,     false,  true, ['eina'], []],
343   ['embryo'           ,[]                    , false,  true,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
344   ['efreet'           ,[]                    , false, false,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
345   ['ecore_imf_evas'   ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
346   ['ephysics'         ,['physics']           , false,  true, false,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
347   ['edje'             ,[]                    , false,  true,  true,  false,   true,      true,  true, ['evas', 'eo', 'efl', lua_pc_name], []],
348   ['emotion'          ,[]                    ,  true,  true, false,  false,   true,      true,  true, ['eina', 'efl', 'eo'], []],
349   ['ethumb'           ,[]                    ,  true,  true,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
350   ['ethumb_client'    ,[]                    , false,  true,  true,  false,  false,      true,  true, ['eina', 'efl', 'eo', 'ethumb'], []],
351   ['elementary'       ,[]                    ,  true,  true,  true,   true,   true,      true,  true, ['eina', 'efl', 'eo', 'eet', 'evas', 'ecore', 'ecore-evas', 'ecore-file', 'ecore-input', 'edje', 'ethumb-client', 'emotion', 'ecore-imf', 'ecore-con', 'eldbus', 'efreet', 'efreet-mime', 'efreet-trash', 'eio'], ['atspi']],
352   ['efl_canvas_wl'    ,['wl']                , false,  true,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo', 'evas', 'ecore'], []],
353   ['elua'             ,['elua']              , false,  true,  true,  false,   true,     false, false, ['eina', lua_pc_name], []],
354   ['ecore_wayland'    ,['wl-deprecated']     , false,  true, false,  false,  false,     false, false, ['eina'], []],
355   ['ecore_drm'        ,['drm-deprecated']    , false,  true, false,  false,  false,     false, false, ['eina'], []],
356   ['exactness'        ,['exactness']         , false,  false,  true, false,  false,     false, false, ['eina, evas, eet'], []],
357 ]
358
359 # We generate Efl_Config.h and config.h later, they will be available here
360 config_dir += include_directories('.')
361
362 #we have to do that first, eina modules are required by eina
363 #the other modules require theire package
364 subdir(join_paths(local_module, 'eina'))
365
366 # List of dependency objects that might be disabled due to configurations
367 # If they are enabled, the object gets overwritten by the library file.
368 ecore_audio = declare_dependency()
369
370 test_dirs = []
371 example_dirs = []
372 efl_one_parts = []
373 efl_one_deps = []
374 efl_one_eo_deps = []
375 efl_one_include_dirs = []
376 efl_one_sub_dirs = []
377 tmp_empty = declare_dependency()
378
379 foreach package : subprojects
380   package_name = package[0]
381   package_version_name = '-'.join(package_name.split('_')) + '-' + version_major
382   automatic_pkgfile = true
383   if package[1].length() == 0 or get_option(package[1][0])
384     config_h.set('HAVE_' + package_name.to_upper().underscorify(), '1')
385
386     dir_package_include = join_paths(dir_include, package_version_name)
387     dir_package_modules = join_paths(dir_lib, package_name, 'modules')
388
389     # ensure that we really dont copy the eo file targets from a previous
390     # library Those are the variables that can be used to reflect the libraries
391     # speical handlings -> at the end is used to indicate where to find this
392     # variable outside of this for loop
393
394     # public eo and eot files - which probebly have to be used later for bindings
395     pub_eo_files = []           # -> package_name + '_eo_files'
396     pub_eo_types_files = []     # -> package_name + '_eot_files'
397     # All subdirs where eo files that are listed in the pub_* variables can be
398     # found
399     # For every element != '' a variable called package_name + '_' + subir + '_eot_files' and package_name + '_' + subir + '_eo_files' must exist.
400     package_eo_subdirs = ['']     # -> package_name + '_eo_subdirs'
401     # All subdirs that should be included in order to include every requried header
402     package_header_subdirs = [] # -> package_name + '_include_subdirs'
403     # eo file targets, this list of targets can be used to ensure the files are created before accessed
404     pub_eo_file_target = []
405     # private eo files target - never use this :)
406     priv_eo_file_target = []
407     # use this variable to store custom variables in that should be placed in the .pc file
408     package_pc_variables = ['module_arch='+version_name,]
409
410     foreach static_lib : package[10]
411       if get_variable(static_lib, tmp_empty) == tmp_empty
412         subdir(join_paths('src', 'static_libs', static_lib))
413       endif
414     endforeach
415
416     #package_c_args definition for lib and module
417     package_c_args = [
418       '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
419       '-DNEED_RUN_IN_TREE=1',
420       '-DEFL_BUILD=1',
421     ]
422     if package[3]
423       subdir(join_paths(local_lib, package_name))
424       set_variable(package_name + '_eo_files', pub_eo_files)
425       set_variable(package_name + '_eot_files', pub_eo_types_files)
426       set_variable(package_name + '_header_subdirs', package_header_subdirs)
427       set_variable(package_name + '_eo_subdirs', package_eo_subdirs)
428       if (package[8] and get_option('efl-one'))
429         src = get_variable(package_name+'_src')
430         external_deps = get_variable(package_name+'_ext_deps')
431         efl_one_include_dirs += [include_directories('.'), include_directories(join_paths(local_lib, package_name))]
432
433         foreach subdirs : package_eo_subdirs
434           efl_one_include_dirs += include_directories(join_paths(local_lib, package_name))
435         endforeach
436
437         tmp = static_library('efl_one_part_'+package_name,
438             src, pub_eo_file_target, priv_eo_file_target,
439             include_directories: efl_one_include_dirs,
440             dependencies: external_deps + efl_one_eo_deps,
441             c_args : package_c_args,
442         )
443         # dependency for all the .eo file targets
444         efl_one_eo_deps += declare_dependency(
445           sources: pub_eo_file_target + priv_eo_file_target, #this here *needs* to be public and private, because our binaries and modules do depend on internal headers
446         )
447         efl_one_deps += external_deps
448         efl_one_parts += tmp
449       endif
450     endif
451     #special case for eolian, this is never efl-one, but will be required in the library
452     if (package_name == 'eolian')
453       package_c_args = [
454         '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
455         '-DNEED_RUN_IN_TREE=1',
456       ]
457       if (package[4])
458          subdir(join_paths(local_bin, package_name))
459       endif
460     endif
461     if package[6]
462        test_dirs += [package_name]
463     endif
464     if package[7]
465        example_dirs += [package_name]
466     endif
467
468     set_variable('build_' + package_name.underscorify(), true)
469
470     # generate automatic pc files for libraries
471     if automatic_pkgfile and package[3]
472       tmp_lib = get_variable(package_name + '_lib')
473       tmp_deps = get_variable(package_name + '_deps')
474       tmp_pub_deps = get_variable(package_name + '_pub_deps')
475       tmp_package_subdirs = []
476
477       foreach subdir : package_header_subdirs
478         tmp_package_subdirs += join_paths(package_version_name, subdir)
479       endforeach
480       if (package[8] and get_option('efl-one'))
481         efl_one_sub_dirs += [package_version_name] + tmp_package_subdirs
482       endif
483       if package_name == 'ector'
484           pkgconfig.generate(tmp_lib,
485             name : package_name,
486             subdirs : tmp_package_subdirs,
487             version : version_major + '.' + version_minor + '.' + version_micro,
488             libraries : tmp_pub_deps,
489             requires : package[9],
490             variables : package_pc_variables
491           )
492       else
493         pkgconfig.generate(tmp_lib,
494           name : '-'.join(package_name.split('_')),
495           subdirs : [package_version_name] + tmp_package_subdirs,
496           version : version_major + '.' + version_minor + '.' + version_micro,
497           libraries : tmp_pub_deps,
498           requires : package[9],
499           variables : package_pc_variables
500         )
501         if package_name == 'ethumb_client'
502           pkgconfig.generate(tmp_lib,
503             name : package_name,
504             subdirs : [package_version_name] + tmp_package_subdirs,
505             version : version_major + '.' + version_minor + '.' + version_micro,
506             libraries : tmp_pub_deps,
507             requires : package[9],
508             variables : package_pc_variables
509           )
510         elif package_name == 'ecore'
511           pkgconfig.generate(tmp_lib,
512             name : package_name+'-core',
513             subdirs : [package_version_name] + tmp_package_subdirs,
514             version : version_major + '.' + version_minor + '.' + version_micro,
515             libraries : tmp_pub_deps,
516             requires : package[9],
517             variables : package_pc_variables
518           )
519         endif
520       endif
521     endif
522   else
523     message(package_name+' disabled!')
524   endif
525 endforeach
526
527 if (get_option('efl-one'))
528   #building efl-one
529   efl_one_lib = shared_library('efl-one',
530     link_whole : efl_one_parts,
531     install : true,
532     version : meson.project_version(),
533   )
534
535   efl_one = declare_dependency(
536     link_with: efl_one_lib,
537     include_directories : efl_one_include_dirs,
538     dependencies : [thread_dep, intl] + efl_one_eo_deps,
539     version: meson.project_version()
540   )
541
542   pkgconfig.generate(
543     name : 'efl-one',
544     subdirs : efl_one_sub_dirs,
545     description: 'Configureation for efl in one big fat .so',
546     libraries : [efl_one] + eina_pc_deps, #eina is a special case here which drags in m dl & threads
547   )
548
549   #overwrite all the dependencies of subprojects with efl-one, in order to link the modules and binaries to the correct .so
550   foreach package : subprojects
551     package_name = package[0]
552     if package[1].length() == 0 or get_option(package[1][0])
553       if (package[3])
554         if (package[8] and get_option('efl-one'))
555           set_variable(package_name, efl_one)
556         endif
557       endif
558     endif
559   endforeach
560 endif
561
562 #delayed build of bin, modules, and benchmarks
563 foreach package : subprojects
564   package_name = package[0]
565   if package[1].length() == 0 or get_option(package[1][0])
566     dir_package_include = join_paths(dir_include, package_version_name)
567     dir_package_modules = join_paths(dir_lib, package_name, 'modules')
568     package_c_args = [
569       '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
570       '-DNEED_RUN_IN_TREE=1',
571       '-DEFL_BUILD=1',
572     ]
573     if (package[2])
574        subdir(join_paths(local_module, package_name))
575     endif
576     package_c_args = [
577       '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
578       '-DNEED_RUN_IN_TREE=1',
579     ]
580     if (package[4] and package_name != 'eolian')
581        subdir(join_paths(local_bin, package_name))
582     endif
583     if (package[5])
584        subdir(join_paths(local_benchmark, package_name))
585     endif
586   endif
587 endforeach
588
589 #build this later, as the debug services are depending on ecore
590 subdir(join_paths('src', 'bin', 'efl'))
591
592 subdir(join_paths('src', 'generic', 'evas'))
593 if sys_windows == false
594   subdir(join_paths('src', 'generic', 'emotion'))
595 endif
596 subdir('cmakeconfig')
597 subdir(join_paths('src', 'bindings'))
598 subdir(join_paths('src', 'edje_external'))
599 subdir(join_paths('data'))
600
601 if get_option('build-tests')
602   check = dependency('check')
603
604   if (check.version() == '0.15.1')
605     error('There is a bug in check@0.15.1 which does not allow efl to be compiled with it. Please downgrade / upgrade or disable tests')
606   endif
607
608   test_env = environment()
609   test_env.set('EFL_RUN_IN_TREE', '1')
610
611   if get_option('b_sanitize') == 'address'
612     test_env.set('ASAN_OPTIONS', 'detect_leaks=0:detect_odr_violation=0')
613   endif
614
615   subdir(join_paths('src', 'tests'))
616   foreach test : test_dirs
617     package_c_args = [
618       '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, test)+'"',
619       '-DNEED_RUN_IN_TREE=1',
620     ]
621     subdir(join_paths(local_tests, test))
622   endforeach
623 endif
624
625 if get_option('build-examples')
626   foreach example : example_dirs
627     package_c_args = [
628       '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, example)+'"',
629       '-DNEED_RUN_IN_TREE=1',
630     ]
631     subdir(join_paths(local_examples, example))
632   endforeach
633 endif
634
635 subdir(join_paths(local_scripts))
636
637 meson.add_install_script('meson/meson_modules.sh', module_files)
638
639 foreach evas_loader_map_inst : evas_loader_map
640   evas_loader_original = evas_loader_map_inst[0]
641   evas_loader_link_types = evas_loader_map_inst[1]
642
643   meson.add_install_script('meson/evas_loader_conf.sh', evas_loader_original, evas_loader_link_types)
644 endforeach
645
646 doxygen = find_program('doxygen', required : false)
647
648 if doxygen.found()
649   subdir('doc')
650 endif
651
652 #
653 # Configure files
654 #
655
656 efl_config_h = configuration_data()
657 efl_config_h.set('EFL_VERSION_MAJOR', version_major)
658 efl_config_h.set('EFL_VERSION_MINOR', version_minor)
659 efl_config_h.set('EFL_VERSION_MICRO', version_micro)
660 efl_config_h.set('EFL_BUILD_ID', get_option('build-id'))
661
662 # FIXME placeholder
663 efl_config_h.set('EFL_API_LEGACY_DEF', '#define EFL_API_LEGACY_DEF "FIXME NOT IMPLEMENTED"')
664
665 configure_file(
666   output: 'config.h',
667   configuration: config_h
668 )
669
670 configure_file(
671   input: join_paths('src','lib', 'efl', 'Efl_Config.h.in'),
672   output: 'Efl_Config.h',
673   install_dir : join_paths(dir_include,'eina-'+version_major),
674   configuration: efl_config_h
675 )
676
677 configure_file(
678   input: 'elm_intro.h.in',
679   output: 'elm_intro.h',
680   configuration: config_h,
681   install_dir : join_paths(dir_include,'elementary-'+version_major)
682 )
683
684 subdir(join_paths('systemd-services'))
685 subdir(join_paths('dbus-services'))
686
687 #output the three new efl-* .pc files
688 efl_20_pc_files = {
689   'efl-ui' : ['elementary'],
690   'efl-core' : ['ecore', 'efl', 'emile'],
691   'efl-net' : ['ecore', 'ecore-con', 'emile'],
692 }
693
694 foreach name, libraries : efl_20_pc_files
695   pkgconfig.generate(
696     name : '-'.join(name.split('_')),
697     description: name+' configutation file',
698     requires: libraries,
699   )
700 endforeach