bu5hm4n pushed a commit to branch feature/meson. http://git.enlightenment.org/core/efl.git/commit/?id=b828aa49590182aa6f43e71c0fa34c9507e3154c
commit b828aa49590182aa6f43e71c0fa34c9507e3154c Author: Marcel Hollerbach <marcel-hollerb...@t-online.de> Date: Wed Dec 20 19:57:23 2017 +0100 meson: add inital eina support things that are working: - tests - benchmarks - lib - modules - bin Due to the fact that eina depends on efl (why?!) efl is already there just to generate the Efl_Config.h file. --- header_checks/meson.build | 136 +++++++++++ meson.build | 86 +++++++ meson_options.txt | 28 +++ src/benchmarks/eina/meson.build | 41 ++++ src/bin/eina/eina_btlog/meson.build | 5 + src/bin/eina/eina_modinfo/meson.build | 5 + src/bin/eina/meson.build | 2 + src/examples/eina/meson.build | 47 ++++ src/examples/meson.build | 1 + src/lib/efl/meson.build | 22 ++ src/lib/eina/meson.build | 348 +++++++++++++++++++++++++++ src/modules/eina/meson.build | 9 + src/modules/eina/mp/chained_pool/meson.build | 3 + src/modules/eina/mp/one_big/meson.build | 3 + src/modules/eina/mp/pass_through/meson.build | 3 + src/tests/eina/meson.build | 69 ++++++ src/tests/meson.build | 2 + 17 files changed, 810 insertions(+) diff --git a/header_checks/meson.build b/header_checks/meson.build new file mode 100644 index 0000000000..d9c6a83216 --- /dev/null +++ b/header_checks/meson.build @@ -0,0 +1,136 @@ +header_checks = [ + 'alloca.h', + 'asm/hwcap.h', + 'bsd/string.h', + 'dirent.h', + 'execinfo.h', + 'mcheck.h', + 'netinet/in.h', + 'stdlib.h', + 'sys/auxv.h', + 'sys/inotify.h', + 'sys/ioctl.h', + 'sys/mman.h', + 'sys/types.h', + 'sys/socket.h', + 'arpa/inet.h', + 'sys/epoll.h', + 'sys/un.h', + 'dirent.h'] + +function_checks = [ +# function name | headers that are needed | libraries to include | Defines that are needed + ['alloca', ['alloca.h']], + ['backtrace', ['execinfo.h']], + ['backtrace_symbols', ['execinfo.h']], + ['clock_gettime', ['time.h']], + ['dirfd', ['dirent.h sys/types.h']], + ['fchmod', ['sys/stat.h']], + ['fcntl', ['fcntl.h']], + ['fork', ['unistd.h']], + ['fpathconf', ['unistd.h']], + ['geteuid', ['unistd.h']], + ['getpagesize', ['unistd.h']], + ['getpwent', ['sys/types.h', 'pwd.h']], + ['getuid', ['unistd.h']], + ['getxattr', ['sys/types.h', 'sys/xattr.h']], + ['iconv_t', ['iconv.h']], + ['listxattr', ['sys/types.h', 'sys/xattr.h']], + ['mallinfo', ['malloc.h']], + ['malloc_info', ['malloc.h']], + ['malloc_usable_size', ['malloc.h']], + ['mkdirat', ['sys/stat.h']], + ['mmap', ['sys/mman.h']], + ['mtrace', ['mcheck.h']], + ['prctl', ['sys/prctl.h']], + ['realpath', ['stdlib.h']], + ['setxattr', ['sys/types.h', 'sys/xattr.h']], + ['siglongjmp', ['setjmp.h']], + ['strerror_r', ['string.h']], +#FIXME strlcpy is detected by meson but drops at compilation time +# ['strlcpy', ['string.h']], + ['siginfo_t', ['signal.h']], + ['strerror_r', ['string.h']], +#from here on we specify the dependencies + ['dlopen', ['dlfcn.h'], ['dl']], + ['dlsym', ['dlfcn.h'], ['dl']], + ['lround', ['math.h'], ['m']], + ['shm_open', ['sys/mman.h', 'sys/stat.h', 'fcntl.h'], ['rt']], +#from here on we specify arguments + ['splice', ['fcntl.h'], [], '-D_GNU_SOURCE=1'], + ['sched_getcpu', ['sched.h'], [], '-D_GNU_SOURCE=1'], + ['dladdr', ['dlfcn.h'], ['dl'], '-D_GNU_SOURCE=1'] +] + +strerror_r_char_p = cc.compiles('''#define _GNU_SOURCE + #include <string.h> + int func (void) + { + char error_string[256]; + char *ptr = strerror_r (-2, error_string, 256); + char c = *strerror_r (-2, error_string, 256); + return c != 0 && ptr != (void*) 0L; + } + ''', + name : 'strerror_r() returns char *') + +if strerror_r_char_p + config_h.set('STRERROR_R_CHAR_P', '1') +endif + +#for later use, a bunch of librarie findings +m = cc.find_library('m') +#just keep this here as required false, if it is not inplace the library rt will just be linked as NOP +dl = cc.find_library('dl', required: false) +rt = cc.find_library('rt', required: false) + +thread_dep = dependency('threads') + +#check for the headers +foreach header : header_checks + if cc.has_header(header) + config_h.set10('HAVE_'+header.underscorify().to_upper(), true) + endif +endforeach + +foreach function : function_checks + function_name = function[0] + headers_to_search = function[1] + dependencies = [] + args = [] + + # if there is a library, make sure they exist + if function.length() > 2 + foreach library : function[2] + lib = cc.find_library(library, required : false) + if lib.found() == true + dependencies += lib + endif + endforeach + endif + + #check if there are args + if function.length() > 3 + args = function[3] + endif + + # Only check the header if the dependencies are ready + foreach header : headers_to_search + if cc.has_header_symbol(header, function_name, + dependencies : dependencies, + args : args) + config_h.set10('HAVE_'+function_name.to_upper(), true) + endif + endforeach +endforeach + +# The next checks are manually for now due to the fact that some names are not within the default pattern +if (cc.has_header_symbol('sys/stat.h', 'fstatat')) + config_h.set10('HAVE_ATFILE_SOURCE', true) +endif + +config_h.set('VMAJ', version_major) +config_h.set('VMIN', version_minor) +config_h.set('VMIC', version_micro) +config_h.set('VREV', '0') +config_h.set_quoted('SHARED_LIB_SUFFIX', '.so') diff --git a/meson.build b/meson.build new file mode 100644 index 0000000000..a566a5381d --- /dev/null +++ b/meson.build @@ -0,0 +1,86 @@ +project('efl', ['c','cpp'], version: '1.20.99') + +pkgconfig = import('pkgconfig') + +version_arr = meson.project_version().split('.') + +version_major = version_arr[0] +version_minor = version_arr[1] +version_micro = version_arr[2] + +cc = meson.get_compiler('c') +host_os = host_machine.system() + +if host_os == 'linux' + if cc.has_header_symbol('features.h', '__UCLIBC__') + host_os = 'linux-uclibc' + elif cc.has_header_symbol('features.h', '__dietlibc__') + host_os = 'linux-dietlibc' + else + host_os = 'linux-gnu' + endif +endif + +module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), meson.project_version()) + +#install paths +dir_prefix = get_option('prefix') +dir_sysconf = join_paths(dir_prefix, get_option('sysconfdir')) +dir_bin = join_paths(dir_prefix, get_option('bindir')) +dir_data = join_paths(dir_prefix, get_option('datadir')) +dir_include = join_paths(dir_prefix, get_option('includedir')) +dir_lib = join_paths(dir_prefix, get_option('libdir')) + +#local paths +local_lib = join_paths('src', 'lib') +local_bin = join_paths('src', 'bin') +local_module = join_paths('src', 'modules') +local_tests = join_paths('src', 'tests') +local_benchmark = join_paths('src', 'benchmarks') +local_examples = join_paths('src', 'examples') + +add_global_arguments('-DHAVE_CONFIG_H=1', language: 'c') +add_global_arguments('-D_GNU_SOURCE=1', language: 'c') +add_global_arguments('-DEFL_EO_API_SUPPORT=1', language: 'c') +add_global_arguments('-DEFL_BETA_API_SUPPORT=1', language: 'c') + +config_h = configuration_data() +config_h.set_quoted('MODULE_ARCH', module_arch) +config_h.set_quoted('PACKAGE', meson.project_name()) +config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) +config_h.set_quoted('VERSION', meson.project_version()) +config_h.set_quoted('LOCALE_DIR', join_paths([dir_prefix, 'share/locale'])) +config_h.set_quoted('PACKAGE_URL', 'https://www.enlightenment.org') +config_h.set_quoted('PACKAGE_TARNAME', meson.project_name()) +config_h.set_quoted('PACKAGE_BUGREPORT', 'enlightenment-de...@lists.sourceforge.net') +config_h.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version()) +config_h.set_quoted('PACKAGE_NAME', meson.project_name()) +config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin) +config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib) +config_h.set_quoted('PACKAGE_BUILD_DIR', meson.current_source_dir()) +config_h.set_quoted('PACKAGE_DATA_DIR', join_paths(dir_data, meson.project_name())) +config_h.set_quoted('PACKAGE_SYSCONF_DIR', dir_sysconf) +config_h.set_quoted('BINDIR', dir_bin) +config_h.set_quoted('DATADIR', dir_data) +config_h.set10('EFL_HAVE_THREADS', true) + +config_dir = [include_directories('.')] + +subdir('header_checks') + +subdir(join_paths(local_lib, 'efl')) + +subdir(join_paths(local_module, 'eina')) +subdir(join_paths(local_lib, 'eina')) +subdir(join_paths(local_bin, 'eina')) +subdir(join_paths(local_benchmark, 'eina')) + +if get_option('build-tests') + subdir(join_paths(local_tests)) +endif + +if get_option('build-examples') + subdir(join_paths(local_examples)) +endif + +configure_file(output: 'config.h', install: false, configuration: config_h) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000..f9985b7d64 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,28 @@ +option('build-id', + type : 'string', + value : 'none', + description : 'The build id to attach to the efl build') + +option('eina-magic-debug', + type : 'boolean', + value : true, + description : 'magic debug of eina structure' +) + +option('debug-threads', + type : 'boolean', + value : false, + description : 'thread debugging' +) + +option('build-examples', + type : 'boolean', + value : true, + description : 'build examples' +) + +option('build-tests', + type : 'boolean', + value : true, + description : 'build examples' +) diff --git a/src/benchmarks/eina/meson.build b/src/benchmarks/eina/meson.build new file mode 100644 index 0000000000..aa9081cef2 --- /dev/null +++ b/src/benchmarks/eina/meson.build @@ -0,0 +1,41 @@ +eina_bench_src = files( +'eina_bench.c', +'eina_bench_sort.c', +'eina_bench_hash.c', +'eina_bench_crc_hash.c', +'eina_bench_stringshare.c', +'eina_bench_convert.c', +'eina_bench_mempool.c', +'eina_bench_stringshare_e17.c', +'eina_bench_array.c', +'eina_bench_rectangle_pool.c', +'ecore_list.c', +'ecore_strings.c', +'ecore_hash.c', +'ecore_sheap.c', +'evas_hash.c', +'evas_list.c', +'evas_mempool.c', +'evas_object_list.c', +'evas_stringshare.c', +'eina_bench_quad.c', +'eina_bench.h', +'Ecore_Data.h', +'Evas_Data.h', +'evas_mempool.h') + +city = shared_library('city', + sources : ['city.cc','city.h'], +) + +eina_bench = executable('eina_bench', + sources : eina_bench_src, + dependencies : eina, + c_args : ['-fPIC','-DCITYHASH_BENCH', '-DEINA_ENABLE_BENCH_E17'], + include_directories : config_dir, + link_with : city, +) + +benchmark('eina_bench', eina_bench, + timeout : 20*60 +) \ No newline at end of file diff --git a/src/bin/eina/eina_btlog/meson.build b/src/bin/eina/eina_btlog/meson.build new file mode 100644 index 0000000000..3d56f9cfbf --- /dev/null +++ b/src/bin/eina/eina_btlog/meson.build @@ -0,0 +1,5 @@ +executable('eina_btlog', + 'eina_btlog.c', + dependencies: eina, + install: true, +) diff --git a/src/bin/eina/eina_modinfo/meson.build b/src/bin/eina/eina_modinfo/meson.build new file mode 100644 index 0000000000..a57dc6fc42 --- /dev/null +++ b/src/bin/eina/eina_modinfo/meson.build @@ -0,0 +1,5 @@ +executable('eina_modinfo', + 'eina_modinfo.c', + dependencies: eina, + install: true, +) diff --git a/src/bin/eina/meson.build b/src/bin/eina/meson.build new file mode 100644 index 0000000000..7c5f64b950 --- /dev/null +++ b/src/bin/eina/meson.build @@ -0,0 +1,2 @@ +subdir('eina_btlog') +subdir('eina_modinfo') diff --git a/src/examples/eina/meson.build b/src/examples/eina/meson.build new file mode 100644 index 0000000000..78aa46a290 --- /dev/null +++ b/src/examples/eina/meson.build @@ -0,0 +1,47 @@ +examples = [ +'eina_accessor_01', +'eina_array_01', +'eina_array_02', +'eina_error_01', +'eina_file_01', +'eina_file_02', +'eina_hash_01', +'eina_hash_02', +'eina_hash_03', +'eina_hash_04', +'eina_hash_05', +'eina_hash_06', +'eina_hash_07', +'eina_hash_08', +'eina_iterator_01', +'eina_list_01', +'eina_list_02', +'eina_list_03', +'eina_list_04', +'eina_log_01', +'eina_log_02', +'eina_log_03', +'eina_inlist_01', +'eina_inlist_02', +'eina_inlist_03', +'eina_str_01', +'eina_strbuf_01', +'eina_stringshare_01', +'eina_tmpstr_01', +#that examples is using ecore evas ... WTF +#'eina_tiler_01', +'eina_simple_xml_parser_01', +'eina_value_01', +'eina_value_02', +'eina_value_03', +'eina_inarray_01', +'eina_inarray_02', +'eina_inarray_03', +'eina_magic_01', +'eina_xattr_01', +'eina_xattr_02' +] + +foreach example : examples + executable(example, example + '.c', dependencies: eina) +endforeach diff --git a/src/examples/meson.build b/src/examples/meson.build new file mode 100644 index 0000000000..39eb335298 --- /dev/null +++ b/src/examples/meson.build @@ -0,0 +1 @@ +subdir('eina') diff --git a/src/lib/efl/meson.build b/src/lib/efl/meson.build new file mode 100644 index 0000000000..f6462f4b4a --- /dev/null +++ b/src/lib/efl/meson.build @@ -0,0 +1,22 @@ +#FIXME +#weird to have here ... but oooooh well and its not correct aaarg +efl_config_h = configuration_data() +efl_config_h.set('EFL_VERSION_MAJOR', version_major) +efl_config_h.set('EFL_VERSION_MINOR', version_minor) +efl_config_h.set('EFL_VERSION_MICRO', version_micro) +efl_config_h.set('EFL_BUILD_ID', get_option('build-id')) + +#FIXME placeholder +efl_config_h.set('EFL_API_EO_DEF', '#define EFL_API_EO_DEF "FIXME NOT IMPLEMENTED"') +efl_config_h.set('EFL_API_LEGACY_DEF', '#define EFL_API_LEGACY_DEF "FIXME NOT IMPLEMENTED"') + +efl_config_file = configure_file( + input: '../efl/Efl_Config.h.in', + output: 'Efl_Config.h', + configuration: efl_config_h) + +install_headers(efl_config_file) + +config_dir += include_directories('.') + +#end FIXME diff --git a/src/lib/eina/meson.build b/src/lib/eina/meson.build new file mode 100644 index 0000000000..c7ec72afac --- /dev/null +++ b/src/lib/eina/meson.build @@ -0,0 +1,348 @@ +eina_deps = [] + +public_sub_headers = [ +'eina_promise.h', +'eina_safety_checks.h', +'eina_error.h', +'eina_debug.h', +'eina_debug_private.h', +'eina_log.h', +'eina_inline_log.x', +'eina_fp.h', +'eina_inline_f32p32.x', +'eina_inline_f16p16.x', +'eina_inline_f8p24.x', +'eina_inline_fp.x', +'eina_hash.h', +'eina_inline_hash.x', +'eina_lalloc.h', +'eina_clist.h', +'eina_inline_clist.x', +'eina_inarray.h', +'eina_inlist.h', +'eina_inline_inlist.x', +'eina_list.h', +'eina_file.h', +'eina_inline_file.x', +'eina_mempool.h', +'eina_module.h', +'eina_rectangle.h', +'eina_types.h', +'eina_array.h', +'eina_counter.h', +'eina_inline_array.x', +'eina_magic.h', +'eina_stringshare.h', +'eina_binshare.h', +'eina_binbuf.h', +'eina_ustringshare.h', +'eina_inline_stringshare.x', +'eina_inline_ustringshare.x', +'eina_inline_list.x', +'eina_accessor.h', +'eina_convert.h', +'eina_rbtree.h', +'eina_benchmark.h', +'eina_inline_rbtree.x', +'eina_inline_mempool.x', +'eina_inline_rectangle.x', +'eina_inline_trash.x', +'eina_thread.h', +'eina_trash.h', +'eina_iterator.h', +'eina_main.h', +'eina_cpu.h', +'eina_inline_cpu.x', +'eina_sched.h', +'eina_tiler.h', +'eina_hamster.h', +'eina_matrixsparse.h', +'eina_inline_tiler.x', +'eina_str.h', +'eina_inline_str.x', +'eina_strbuf.h', +'eina_ustrbuf.h', +'eina_unicode.h', +'eina_quadtree.h', +'eina_simple_xml_parser.h', +'eina_lock.h', +'eina_prefix.h', +'eina_refcount.h', +'eina_mmap.h', +'eina_xattr.h', +'eina_value.h', +'eina_inline_value.x', +'eina_value_util.h', +'eina_inline_value_util.x', +'eina_inline_lock_barrier.x', +'eina_inline_lock_posix.x', +'eina_tmpstr.h', +'eina_alloca.h', +'eina_cow.h', +'eina_inline_unicode.x', +'eina_thread_queue.h', +'eina_matrix.h', +'eina_quad.h', +'eina_crc.h', +'eina_inline_crc.x', +'eina_evlog.h', +'eina_util.h', +'eina_inline_util.x', +'eina_quaternion.h', +'eina_vector.h', +'eina_inline_vector.x', +'eina_bezier.h', +'eina_safepointer.h', +'eina_inline_safepointer.x', +'eina_slice.h', +'eina_inline_slice.x', +'eina_inline_modinfo.x', +'eina_freeq.h', +'eina_slstr.h'] + +public_headers = [ + 'Eina.h' +] + +sources = [ +'eina_abi.c', +'eina_accessor.c', +'eina_array.c', +'eina_benchmark.c', +'eina_binbuf.c', +'eina_binshare.c', +'eina_convert.c', +'eina_counter.c', +'eina_cow.c', +'eina_cpu.c', +'eina_crc.c', +'eina_debug.c', +'eina_debug_bt.c', +'eina_debug_bt_file.c', +'eina_debug_chunk.c', +'eina_debug_thread.c', +'eina_debug_cpu.c', +'eina_debug_timer.c', +'eina_error.c', +'eina_evlog.c', +'eina_file_common.h', +'eina_file_common.c', +'eina_fp.c', +'eina_hamster.c', +'eina_hash.c', +'eina_inarray.c', +'eina_inlist.c', +'eina_iterator.c', +'eina_lalloc.c', +'eina_list.c', +'eina_lock.c', +'eina_log.c', +'eina_magic.c', +'eina_main.c', +'eina_matrix.c', +'eina_matrixsparse.c', +'eina_mempool.c', +'eina_mmap.c', +'eina_module.c', +'eina_prefix.c', +'eina_promise.c', +'eina_promise_private.h', +'eina_quad.c', +'eina_quadtree.c', +'eina_rbtree.c', +'eina_rectangle.c', +'eina_safety_checks.c', +'eina_sched.c', +'eina_share_common.c', +'eina_simple_xml_parser.c', +'eina_str.c', +'eina_strbuf.c', +'eina_strbuf_common.c', +'eina_stringshare.c', +'eina_thread.c', +'eina_thread_queue.c', +'eina_tiler.c', +'eina_tmpstr.c', +'eina_unicode.c', +'eina_ustrbuf.c', +'eina_ustringshare.c', +'eina_util.c', +'eina_value.c', +'eina_value_util.c', +'eina_xattr.c', +'eina_private.h', +'eina_share_common.h', +'eina_strbuf_common.h', +'eina_quaternion.c', +'eina_bezier.c', +'eina_safepointer.c', +'eina_freeq.c', +'eina_slstr.c'] + +if target_machine.system() == 'cygwin' + sources += 'eina_file_win32.c' +else + sources += 'eina_file.c' +endif + +eina_config = configuration_data() + +if get_option('buildtype') == 'plain' + with_max_log_level=-1 + stringshare_usage=false + use_valgrind=true + debug_malloc=false + debug_threads=false + default_mempool=false + want_cow_magic=false +elif get_option('buildtype') == 'debug' + with_max_log_level=-1 + stringshare_usage=true + use_valgrind=true + debug_malloc=true + debug_threads=true + default_mempool=true + want_cow_magic=true +elif get_option('buildtype') == 'release' + with_max_log_level=3 + stringshare_usage=false + use_valgrind=false + debug_malloc=false + debug_threads=false + default_mempool=false + want_cow_magic=false +endif + +if with_max_log_level != -1 + config_h.set('EINA_LOG_LEVEL_MAXIMUM', with_max_log_level) +endif + +if stringshare_usage + config_h.set('EINA_STRINGSHARE_USAGE', 1) +endif + +if use_valgrind + valgrind = dependency('valgrind', required: false) + if valgrind.found() == false + config_h.set('NVALGRIND', 1) + else + config_h.set('HAVE_VALGRIND', 1) + endif + eina_deps += valgrind +else + config_h.set('NVALGRIND', 1) +endif + +if debug_malloc + config_h.set('EINA_DEBUG_MALLOC', 1) +endif + +if want_cow_magic + config_h.set('EINA_COW_MAGIC_ON', 1) +endif + +if get_option('eina-magic-debug') + eina_config.set('EINA_MAGIC_DEBUG', '1') +endif + +if default_mempool + eina_config.set('EINA_DEFAULT_MEMPOOL', '1') +endif + +eina_config.set('EINA_SAFETY_CHECKS', '1') +eina_config.set('EINA_HAVE_THREADS', '1') + +if cc.has_header_symbol('pthread.h', 'pthread_attr_setaffinity_np') + eina_config.set('EINA_HAVE_PTHREAD_AFFINITY', '1') +endif + +if cc.has_header_symbol('pthread.h', 'pthread_barrier_init') + eina_config.set('EINA_HAVE_PTHREAD_BARRIER', '1') +endif + +if cc.has_header_symbol('pthread.h', 'pthread_setname_np') + eina_config.set('EINA_HAVE_PTHREAD_SETNAME', '1') +endif + +# FIXME the author of eina_debug probebly never ran with EINA_HAVE_DEBUG_THREADS +# however eina debug decides to init that lock and never frees it. which means +# the code in eina_main.c will not work in the way it currently is there. + +#if debug_threads or get_option('debug-threads') +# eina_config.set('EINA_HAVE_DEBUG_THREADS', '1') +#endif + +eina_config.set('EINA_SIZEOF_WCHAR_T', cc.sizeof('wchar_t')) + +eina_config.set('EINA_SIZEOF_UINTPTR_T', cc.sizeof('uintptr_t')) + +if cc.has_header('dirent.h') + eina_config.set('EINA_CONFIGURE_HAVE_DIRENT_H', '1') +endif + +eina_config.set('EINA_ENABLE_LOG', '1') + +if cc.has_header_symbol('alloca.h', 'alloca') + eina_config.set('EINA_HAVE_ALLOCA_H', '1') +endif + +if cc.has_header('byteswap.h') + eina_config.set('EINA_HAVE_BYTESWAP_H', '1') +endif + +if cc.has_header_symbol('byteswap.h', 'bswap_16') + eina_config.set('EINA_CONFIGURE_HAVE_BSWAP16', '1') +endif + +if cc.has_header_symbol('byteswap.h', 'bswap_32') + eina_config.set('EINA_CONFIGURE_HAVE_BSWAP32', '1') +endif + +if cc.has_header_symbol('byteswap.h', 'bswap_64') + eina_config.set('EINA_CONFIGURE_HAVE_BSWAP64', '1') +endif + +if cc.has_header_symbol('pthread.h', 'pthread_spin_init') + eina_config.set('EINA_HAVE_POSIX_SPINLOCK', '1') +endif + +if target_machine.system() == 'darwin' + if cc.has_header_symbol('libkern/OSAtomic.h', 'OSSpinLockTry') + eina_config.set('EINA_CONFIGURE_HAVE_OSX_SPINLOCK', 1) + endif + if cc.has_header_symbol('semaphore.h', 'semaphore_create') + eina_config.set('EINA_CONFIGURE_HAVE_OSX_SEMAPHORE', 1) + endif + +endif + +eina_config_file = configure_file( + output: 'eina_config.h', + configuration: eina_config, + install: true) + +public_headers += eina_config_file + +unwind = dependency('libunwind-generic', required: false) +if unwind.found() + config_h.set('HAVE_UNWIND', 1) + eina_deps += unwind +endif + +#for the case that the iconv library is not part of libc but rather libiconv or smth. like that +iconv = dependency('iconv', required: false) +execinfo = cc.find_library('execinfo', required: false) + +eina_lib = shared_library('eina', sources, + include_directories : config_dir, + dependencies: [m, rt, dl, execinfo, iconv, eina_deps, thread_dep, eina_mem_pools], + install: true) + +eina = declare_dependency( + include_directories: [include_directories('.')] + config_dir, + dependencies : [thread_dep], + link_with: eina_lib, +) + +install_headers(public_headers) +install_headers(public_sub_headers, subdir : 'eina') diff --git a/src/modules/eina/meson.build b/src/modules/eina/meson.build new file mode 100644 index 0000000000..17396a198c --- /dev/null +++ b/src/modules/eina/meson.build @@ -0,0 +1,9 @@ +eina_mp_sources = [] + +subdir(join_paths('mp', 'chained_pool')) +subdir(join_paths('mp', 'one_big')) +subdir(join_paths('mp', 'pass_through')) + +eina_mem_pools = declare_dependency( + sources: eina_mp_sources +) diff --git a/src/modules/eina/mp/chained_pool/meson.build b/src/modules/eina/mp/chained_pool/meson.build new file mode 100644 index 0000000000..d4b222c6f2 --- /dev/null +++ b/src/modules/eina/mp/chained_pool/meson.build @@ -0,0 +1,3 @@ +config_h.set10('EINA_BUILD_CHAINED_POOL', true) +config_h.set10('EINA_STATIC_BUILD_CHAINED_POOL', true) +eina_mp_sources += files('eina_chained_mempool.c') diff --git a/src/modules/eina/mp/one_big/meson.build b/src/modules/eina/mp/one_big/meson.build new file mode 100644 index 0000000000..fabe80352c --- /dev/null +++ b/src/modules/eina/mp/one_big/meson.build @@ -0,0 +1,3 @@ +config_h.set10('EINA_BUILD_ONE_BIG', true) +config_h.set10('EINA_STATIC_BUILD_ONE_BIG', true) +eina_mp_sources += files('eina_one_big.c') diff --git a/src/modules/eina/mp/pass_through/meson.build b/src/modules/eina/mp/pass_through/meson.build new file mode 100644 index 0000000000..a60ab6204b --- /dev/null +++ b/src/modules/eina/mp/pass_through/meson.build @@ -0,0 +1,3 @@ +config_h.set10('EINA_BUILD_PASS_THROUGH', true) +config_h.set10('EINA_STATIC_BUILD_PASS_THROUGH', true) +eina_mp_sources += files('eina_pass_through.c') diff --git a/src/tests/eina/meson.build b/src/tests/eina/meson.build new file mode 100644 index 0000000000..cbad7e9580 --- /dev/null +++ b/src/tests/eina/meson.build @@ -0,0 +1,69 @@ +eina_test_src = files( +'eina_suite.c', +'eina_suite.h', +'eina_test_abi.c', +'eina_test_fp.c', +'eina_test_ustringshare.c', +'eina_test_ustr.c', +'eina_test_binshare.c', +'eina_test_binbuf.c', +'eina_test_inarray.c', +'eina_test_array.c', +'eina_test_clist.c', +'eina_test_error.c', +'eina_test_sched.c', +'eina_test_log.c', +'eina_test_magic.c', +'eina_test_inlist.c', +'eina_test_main.c', +'eina_test_counter.c', +'eina_test_lalloc.c', +'eina_test_hash.c', +'eina_test_iterator.c', +'eina_test_accessor.c', +'eina_test_module.c', +'eina_test_convert.c', +'eina_test_rbtree.c', +'eina_test_file.c', +'eina_test_benchmark.c', +'eina_test_mempool.c', +'eina_test_rectangle.c', +'eina_test_list.c', +'eina_test_matrixsparse.c', +'eina_test_tiler.c', +'eina_test_strbuf.c', +'eina_test_str.c', +'eina_test_quadtree.c', +'eina_test_simple_xml_parser.c', +'eina_test_value.c', +'eina_test_cow.c', +'eina_test_barrier.c', +'eina_test_tmpstr.c', +'eina_test_trash.c', +'eina_test_lock.c', +'eina_test_xattr.c', +'eina_test_crc.c', +'eina_test_quad.c', +'eina_test_matrix.c', +'eina_test_quaternion.c', +'eina_test_vector.c', +'eina_test_bezier.c', +'eina_test_safepointer.c', +'eina_test_slice.c', +'eina_test_freeq.c', +'eina_test_slstr.c') + + +eina_test_exe = executable('eina_suite', + include_directories : config_dir, + sources : eina_test_src, + dependencies: [m, check, eina], + c_args : [ + '-DTESTS_WD="`pwd`"', + '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', + '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'] +) + +test('eina', eina_test_exe, + timeout : 5*60, +) diff --git a/src/tests/meson.build b/src/tests/meson.build new file mode 100644 index 0000000000..856d351fa4 --- /dev/null +++ b/src/tests/meson.build @@ -0,0 +1,2 @@ +check = dependency('check') +subdir('eina') --