diff --git a/jni/prepare_iniparser.sh b/jni/prepare_iniparser.sh deleted file mode 100755 index 2572df6447..0000000000 --- a/jni/prepare_iniparser.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -TARGET=$1 -set -e - -if [ ! -d ${TARGET} ]; then - mkdir -p ${TARGET} -fi - -pushd ${TARGET} - -# Get Iniparser -if [ ! -d "iniparser" ]; then - echo "PREPARING ini parser at ${TARGET}" - git clone https://github.com/ndevilla/iniparser.git iniparser -fi - -popd diff --git a/meson.build b/meson.build index 6550087cc9..f02db1aa86 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('nntrainer', 'c', 'cpp', version: '0.5.0', license: ['apache-2.0'], - meson_version: '>=0.50.0', + meson_version: '>=0.55.0', default_options: [ 'werror=true', 'warning_level=1', @@ -347,37 +347,20 @@ libdl_dep = cxx.find_library('dl') # DL library thread_dep = dependency('threads') # pthread for tensorflow-lite iniparser_dep = dependency('iniparser', required : false, version : '>=4.1') # iniparser -if get_option('platform') == 'android' - message('preparing iniparser') - run_command(meson.source_root() / 'jni' / 'prepare_iniparser.sh', meson.build_root(), check: true) - iniparser_root = meson.build_root() / 'iniparser' - iniparser_dep = declare_dependency(include_directories: [ 'iniparser/src' ]) -endif if not iniparser_dep.found() - message('falling back to find libiniparser library and header files') - libiniparser_dep = cxx.find_library('iniparser') - sysroot = run_command( - cxx.cmd_array() + ['-print-sysroot'] - ).stdout().split('\n')[0] - - if sysroot.startswith('/') - sysroot_inc_cflags_template = '-I@0@/usr/include@1@' - sysroot_inc = sysroot_inc_cflags_template.format(sysroot, '') - add_project_arguments(sysroot_inc, language: ['c', 'cpp']) - sysroot_inc_cflags_iniparser = sysroot_inc_cflags_template.format(sysroot, - '/iniparser') - else - sysroot_inc_cflags_iniparser = '-I/usr/include/iniparser' - endif - - if libiniparser_dep.found() and cxx.has_header('iniparser.h', \ - args : sysroot_inc_cflags_iniparser) - iniparser_dep = declare_dependency (dependencies : libiniparser_dep, - compile_args : sysroot_inc_cflags_iniparser) - else - error('Failed to resolve dependency on iniparser') - endif + # CMake module + cmake = import('cmake') + + # iniparser + iniparser_root = meson.source_root() / 'subprojects' / 'iniparser' + iniparser_options = cmake.subproject_options() + iniparser_options.add_cmake_defines({'BUILD_DOCS': false}) + iniparser_options.add_cmake_defines({'BUILD_EXAMPLES': false}) + iniparser_options.add_cmake_defines({'BUILD_TESTING': false}) + iniparser_options.add_cmake_defines({'BUILD_SHARED_LIBS': false}) + iniparser_subproject = cmake.subproject('iniparser', options: iniparser_options, required: true) + iniparser_dep = iniparser_subproject.dependency('iniparser-static') endif if get_option('platform') == 'android' diff --git a/subprojects/iniparser.wrap b/subprojects/iniparser.wrap new file mode 100644 index 0000000000..a5b77b0184 --- /dev/null +++ b/subprojects/iniparser.wrap @@ -0,0 +1,4 @@ +[wrap-git] +url = https://github.com/ndevilla/iniparser.git +directory=iniparser +revision = v4.2.4