From fb552be9c83a07704008146c7010e064ba54fba3 2019-09-05 13:26:46 From: Alexis Jeandet Date: 2019-09-05 13:26:46 Subject: [PATCH] Update Meson build def Signed-off-by: Alexis Jeandet --- diff --git a/app/PySide2-bindings/SciQLopBindings/meson.build b/app/PySide2-bindings/SciQLopBindings/meson.build new file mode 100644 index 0000000..6efcbe9 --- /dev/null +++ b/app/PySide2-bindings/SciQLopBindings/meson.build @@ -0,0 +1,17 @@ + +shiboken2_generator_out = custom_target('sciqlop_bindings', + build_by_default:true, + output:generated_srcs, + input:'../bindings.xml', + depend_files:sciqlop_bindings_src, + command:[shiboken2,meson.current_source_dir()+'/../bindings.h',meson.current_source_dir()+'/../bindings.xml','--generator-set=shiboken', + '--enable-parent-ctor-heuristic', + '--enable-return-value-heuristic', + '--use-isnull-as-nb_nonzero', + '--avoid-protected-hack', + '--enable-pyside-extensions', + '-std=c++17', + '--typesystem-paths='+shiboken2_typesystem, + sciqlop_bindings_incs, + '--output-directory='+meson.current_build_dir()+'/../'] + ) diff --git a/app/PySide2-bindings/meson.build b/app/PySide2-bindings/meson.build new file mode 100644 index 0000000..4c9c7ac --- /dev/null +++ b/app/PySide2-bindings/meson.build @@ -0,0 +1,43 @@ +shiboken2 = find_program('shiboken2') +qmake = find_program('qmake-qt5','qmake') + +pymod = import('python') +python3 = pymod.find_installation('python3', modules:['PySide2','shiboken2', 'shiboken2_generator']) + +qt5_modules = ['QtCore','QtGui','QtWidgets'] + +qt_headers_path = run_command(qmake, '-query', 'QT_INSTALL_HEADERS').stdout().strip('\n') +generated_srcs = run_command(python3, 'src_list.py', 'meson').stdout().split(';') + +modules_arg = '--modules=@0@'.format(','.join(qt5_modules)) + +shiboken2_build_flags = run_command(python3, 'shiboken-helper.py', '--includes', modules_arg).stdout().strip('\n').split(' ') +shiboken2_link_flags = run_command(python3, 'shiboken-helper.py', '--libs', modules_arg).stdout().strip('\n').split(' ') +shiboken2_typesystem = run_command(python3, 'shiboken-helper.py', '--typesystem').stdout().strip('\n') + +sciqlop_bindings_incs = shiboken2_build_flags + [ + '-I'+meson.current_source_dir()+'/../../gui/include', + '-I'+meson.current_source_dir()+'/../../core/include', + '-I'+meson.current_source_dir()+'/../../core/external/TimeSeries/include', + '-I'+python3.get_path('include'), + '-I'+qt_headers_path + ] + +foreach mod:qt5_modules + sciqlop_bindings_incs += ['-I'+qt_headers_path+'/'+mod] +endforeach + + +sciqlop_bindings_src = files('bindings.h', 'PyDataProvider.h', 'numpy_wrappers.h', 'numpy_wrappers.cpp') + +subdir('SciQLopBindings') + +shiboken_dep = declare_dependency(compile_args: shiboken2_build_flags, link_args: shiboken2_link_flags) + +sciqlop_bindings = python3.extension_module('SciQLopBindings',sciqlop_bindings_src,shiboken2_generator_out, + dependencies : [sciqlop_app_dep, python3.dependency(), shiboken_dep], +) + + +configure_file(input:'main.py', output:'main.py', copy:true) +configure_file(input:'TestPlugin.py', output:'TestPlugin.py', copy:true) diff --git a/app/PySide2-bindings/shiboken-helper.py b/app/PySide2-bindings/shiboken-helper.py new file mode 100755 index 0000000..d191a7b --- /dev/null +++ b/app/PySide2-bindings/shiboken-helper.py @@ -0,0 +1,46 @@ +#!/bin/env python3 + +import os +import sys +import importlib +import argparse +from glob import glob + + +shiboken2_generator = importlib.import_module('shiboken2_generator') +shiboken2 = importlib.import_module('shiboken2') +PySide2 = importlib.import_module('PySide2') + + +parser = argparse.ArgumentParser(description='PySide2/shiboken2 ') +group = parser.add_mutually_exclusive_group() +group.add_argument('--libs',action='store_true') +group.add_argument('--includes',action='store_true') +parser.add_argument('--modules') +group.add_argument('--typesystem', action='store_true') +args = parser.parse_args() + + +def first_existing_path(path_list): + return next((path for path in path_list if os.path.exists(path)), None) + + +if shiboken2.__file__ and shiboken2_generator.__file__ and PySide2.__file__: + PySide2_inc = first_existing_path([PySide2.__path__[0]+'/include','/usr/include/PySide2']) + PySide2_typesys = first_existing_path([PySide2.__path__[0]+'/typesystems','/usr/share/PySide2/typesystems']) + PySide2_includes = first_existing_path([PySide2.__path__[0]+'/include','/usr/include/PySide2']) + shiboken2_includes = first_existing_path([shiboken2.__path__[0]+'/include','/usr/include/shiboken2']) + + if args.typesystem: + print(PySide2_typesys) + modules = args.modules.split(',') + if args.libs: + main_lib = (glob(shiboken2.__path__[0]+'/libshiboken2'+importlib.machinery.EXTENSION_SUFFIXES[0])+glob("/usr/lib64/"+'/libshiboken2'+importlib.machinery.EXTENSION_SUFFIXES[0]))[0] + main_lib += " "+(glob(PySide2.__path__[0]+'/libpyside2'+importlib.machinery.EXTENSION_SUFFIXES[0])+glob("/usr/lib64/"+'/libpyside2'+importlib.machinery.EXTENSION_SUFFIXES[0]))[0] + modules_libs = [importlib.import_module(f'PySide2.{module}').__file__ for module in modules] + print(" ".join([main_lib]+ modules_libs)) + if args.includes: + modules_incs = [f"-I{PySide2_includes}/{module}" for module in modules] + print(" ".join([f"-I{PySide2_includes} -I{shiboken2_includes}"]+ modules_incs)) + + diff --git a/app/meson.build b/app/meson.build index b4ff13d..44cd94f 100644 --- a/app/meson.build +++ b/app/meson.build @@ -46,3 +46,21 @@ sciqlop_app = executable('sciqlop', dependencies : [sciqlop_gui, sciqlop_core], install : true ) + +sciqlop_app_lib = library('sciqlop', + app_sources, + app_moc_files, + rc, + include_directories : [ app_inc], + link_with: app_libs, + cpp_args: cpp_args, + dependencies : [sciqlop_gui, sciqlop_core], + install : true + ) + +sciqlop_app_dep = declare_dependency(link_with : sciqlop_app_lib, + include_directories : app_inc, + dependencies : [sciqlop_gui, sciqlop_core]) + + +subdir('PySide2-bindings') diff --git a/meson.build b/meson.build index 977bbb8..fb61300 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('SciQLOP', 'cpp',default_options : ['cpp_std=c++17'], meson_version:'>=0.47.0') +project('SciQLOP', 'cpp',default_options : ['cpp_std=c++17'], meson_version:'>=0.51.0') add_global_arguments('-DSCIQLOP_VERSION="1.1.0"', language : 'cpp') qt5 = import('qt5') diff --git a/plugins/meson.build b/plugins/meson.build index d1be09b..3a6a7d7 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1,3 +1,3 @@ #subdir('mockplugin') -subdir('python_providers') +#subdir('python_providers') #subdir('amda') diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap index 773a713..ba9c9b9 100644 --- a/subprojects/gtest.wrap +++ b/subprojects/gtest.wrap @@ -1,10 +1,10 @@ [wrap-file] -directory = googletest-release-1.8.0 +directory = googletest-release-1.8.1 -source_url = https://github.com/google/googletest/archive/release-1.8.0.zip -source_filename = gtest-1.8.0.zip -source_hash = f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf +source_url = https://github.com/google/googletest/archive/release-1.8.1.zip +source_filename = gtest-1.8.1.zip +source_hash = 927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7 -patch_url = https://wrapdb.mesonbuild.com/v1/projects/gtest/1.8.0/5/get_zip -patch_filename = gtest-1.8.0-5-wrap.zip -patch_hash = 7eeaede4aa2610a403313b74e04baf91ccfbaef03203d8f56312e22df1834ec5 +patch_url = https://wrapdb.mesonbuild.com/v1/projects/gtest/1.8.1/1/get_zip +patch_filename = gtest-1.8.1-1-wrap.zip +patch_hash = f79f5fd46e09507b3f2e09a51ea6eb20020effe543335f5aee59f30cc8d15805 diff --git a/subprojects/pybind11.wrap b/subprojects/pybind11.wrap index 487bae3..a76ddb1 100644 --- a/subprojects/pybind11.wrap +++ b/subprojects/pybind11.wrap @@ -1,10 +1,10 @@ [wrap-file] -directory = pybind11-2.2.2 +directory = pybind11-2.3.0 -source_url = https://github.com/pybind/pybind11/archive/v2.2.2.zip -source_filename = pybind11-2.2.2.zip -source_hash = 20314968531faa4c8579da2c46c2ce13aecd68ae79b6dd8cf9b99698b2304348 +source_url = https://github.com/pybind/pybind11/archive/v2.3.0.zip +source_filename = pybind11-2.3.0.zip +source_hash = 1f844c071d9d98f5bb08458f128baa0aa08a9e5939a6b42276adb1bacd8b483e -patch_url = https://wrapdb.mesonbuild.com/v1/projects/pybind11/2.2.2/1/get_zip -patch_filename = pybind11-2.2.2-1-wrap.zip -patch_hash = 18a273260a59368b59ae754838d76a606ea6be6126e40c59fff5214252b1e26d +patch_url = https://wrapdb.mesonbuild.com/v1/projects/pybind11/2.3.0/2/get_zip +patch_filename = pybind11-2.3.0-2-wrap.zip +patch_hash = f3bed4bfc8961b3b985ff1e63fc6e57c674f35b353f0d42adbc037f9416381fb