[Meson] add installation
authorJaeyun <jy1210.jung@samsung.com>
Wed, 12 Dec 2018 11:30:23 +0000 (20:30 +0900)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Wed, 19 Dec 2018 04:41:28 +0000 (13:41 +0900)
1. add option to install examples
2. set install path and add configuration
3. install libraries, headers, and examples

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
15 files changed:
gst/tensor_filter/meson.build
meson.build
meson_options.txt
nnstreamer_example/custom_example_LSTM/meson.build
nnstreamer_example/custom_example_RNN/meson.build
nnstreamer_example/custom_example_average/meson.build
nnstreamer_example/custom_example_opencv/meson.build
nnstreamer_example/custom_example_passthrough/meson.build
nnstreamer_example/custom_example_scaler/meson.build
nnstreamer_example/example_cam/meson.build
nnstreamer_example/example_decoder_image_labelling/meson.build
nnstreamer_example/example_filter/meson.build
nnstreamer_example/example_filter_performance_profile/meson.build
nnstreamer_example/example_object_detection/meson.build
nnstreamer_example/example_sink/meson.build

index eba228d..f938ffd 100644 (file)
@@ -10,7 +10,9 @@ if have_tensorflow
     ['tensor_filter_tensorflow_core.cc'],
     cpp_args: nnstreamer_base_args + ['-Wno-sign-compare'],
     dependencies: [tf_dep, protobuf_dep, glib_dep, gst_dep],
-    include_directories: nnstreamer_inc
+    include_directories: nnstreamer_inc,
+    install: true,
+    install_dir: subplugins_install_dir
   )
 
   tensor_filter_tfcore_dep = declare_dependency(link_with: tensor_filter_tfcore_lib)
@@ -24,7 +26,9 @@ if have_tensorflow_lite
     ['tensor_filter_tensorflow_lite_core.cc'],
     cpp_args: nnstreamer_base_args + ['-Wno-sign-compare'],
     dependencies: [tflite_dep, libpthread_dep, libdl_dep, glib_dep, gst_dep],
-    include_directories: nnstreamer_inc
+    include_directories: nnstreamer_inc,
+    install: true,
+    install_dir: subplugins_install_dir
   )
 
   tensor_filter_tflitecore_dep = declare_dependency(link_with: tensor_filter_tflitecore_lib)
index 985f230..c0faae8 100644 (file)
@@ -19,10 +19,38 @@ cxx = meson.get_compiler('cpp')
 
 gst_api_verision = '1.0'
 
+# Set configuration
+nnstreamer_conf = configuration_data()
+nnstreamer_conf.set('VERSION', meson.project_version())
+
 nnstreamer_inc = include_directories('gst/nnstreamer')
 nnstreamer_sources = []
 nnstreamer_base_args = []
 
+# Common headers to be installed
+nnstreamer_headers = [
+  'gst/nnstreamer/tensor_common.h',
+  'gst/nnstreamer/tensor_typedef.h',
+  'gst/nnstreamer/tensor_filter_custom.h'
+]
+
+# Set install path
+nnstreamer_prefix = get_option('prefix')
+nnstreamer_libdir = join_paths(nnstreamer_prefix, get_option('libdir'))
+nnstreamer_bindir = join_paths(nnstreamer_prefix, get_option('bindir'))
+nnstreamer_includedir = join_paths(nnstreamer_prefix, get_option('includedir'))
+
+libs_install_dir = nnstreamer_libdir
+plugins_install_dir = join_paths(nnstreamer_libdir, 'gstreamer-' + gst_api_verision)
+subplugins_install_dir = nnstreamer_libdir
+examples_install_dir = nnstreamer_bindir
+
+nnstreamer_conf.set('PREFIX', nnstreamer_prefix)
+nnstreamer_conf.set('EXEC_PREFIX', nnstreamer_bindir)
+nnstreamer_conf.set('LIB_INSTALL_DIR', libs_install_dir)
+nnstreamer_conf.set('GST_INSTALL_DIR', plugins_install_dir)
+nnstreamer_conf.set('INCLUDE_INSTALL_DIR', nnstreamer_includedir)
+
 # Dependencies
 glib_dep = dependency('glib-2.0')
 gst_dep = dependency('gstreamer-' + gst_api_verision)
@@ -123,14 +151,18 @@ nnstreamer_shared = shared_library('nnstreamer',
   nnstreamer_sources,
   c_args: nnstreamer_base_args,
   dependencies: [nnstreamer_base_deps, nnstreamer_extra_deps],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: plugins_install_dir
 )
 
 nnstreamer_static = static_library('nnstreamer',
   nnstreamer_sources,
   c_args: nnstreamer_base_args,
   dependencies: [nnstreamer_base_deps, nnstreamer_extra_deps],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: true,
+  install_dir: libs_install_dir
 )
 
 nnstreamer_lib = nnstreamer_shared
@@ -140,6 +172,17 @@ endif
 
 nnstreamer_dep = declare_dependency(link_with: nnstreamer_lib)
 
+# Install headers into /{includedir}/nnstreamer
+install_headers(nnstreamer_headers,
+  subdir: 'nnstreamer'
+)
+
+configure_file(input: 'nnstreamer.pc.in', output: 'nnstreamer.pc',
+  install: true,
+  install_dir: join_paths(libs_install_dir, 'pkgconfig'),
+  configuration: nnstreamer_conf
+)
+
 # Build nnstreamer examples
 subdir('nnstreamer_example')
 
index e442f09..0e22c17 100644 (file)
@@ -1,3 +1,4 @@
 option('ENABLE_TEST', type: 'boolean', value: true)
 option('ENABLE_TENSORFLOW_LITE', type: 'boolean', value: true)
 option('ENABLE_TENSORFLOW', type: 'boolean', value: true)
+option('INSTALL_EXAMPLES', type: 'boolean', value: false)
index db06e6c..c7fd9e5 100644 (file)
@@ -1,5 +1,7 @@
 dummyLSTM = shared_library('dummyLSTM',
   'dummy_LSTM.c',
   dependencies: [libm_dep],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
index 9c36274..cba0730 100644 (file)
@@ -1,4 +1,6 @@
 dummyRNN = shared_library('dummyRNN',
   'dummy_RNN.c',
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
index 3bdc3b6..d744345 100644 (file)
@@ -1,4 +1,6 @@
 nnstreamer_customfilter_average = shared_library('nnstreamer_customfilter_average',
   'nnstreamer_customfilter_example_average.c',
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
index 997df93..3f97782 100644 (file)
@@ -3,11 +3,15 @@ opencv_dep = dependency('opencv')
 nnstreamer_customfilter_opencv_scaler = shared_library('nnstreamer_customfilter_opencv_scaler',
   'nnstreamer_customfilter_opencv_scaler.cc',
   dependencies: [glib_dep, opencv_dep],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
 
 nnstreamer_customfilter_opencv_average = shared_library('nnstreamer_customfilter_opencv_average',
   'nnstreamer_customfilter_opencv_average.cc',
   dependencies: [glib_dep, opencv_dep],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
index 22140d0..96978cc 100644 (file)
@@ -1,9 +1,13 @@
 nnstreamer_customfilter_passthrough = shared_library('nnstreamer_customfilter_passthrough',
   'nnstreamer_customfilter_example_passthrough.c',
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
 
 nnstreamer_customfilter_passthrough_variable = shared_library('nnstreamer_customfilter_passthrough_variable',
   'nnstreamer_customfilter_example_passthrough_variable.c',
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
index dc86837..17be4a1 100644 (file)
@@ -1,11 +1,15 @@
 nnstreamer_customfilter_scaler = shared_library('nnstreamer_customfilter_scaler',
   'nnstreamer_customfilter_example_scaler.c',
   dependencies: [glib_dep],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
 
 nnstreamer_customfilter_scaler_allocator = shared_library('nnstreamer_customfilter_scaler_allocator',
   'nnstreamer_customfilter_example_scaler_allocator.c',
   dependencies: [glib_dep],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: subplugins_install_dir
 )
index 4375591..ce3a44a 100644 (file)
@@ -1,4 +1,6 @@
 nnstreamer_example_cam = executable('nnstreamer_example_cam',
   'nnstreamer_example_cam.c',
-  dependencies: [glib_dep, gst_dep]
+  dependencies: [glib_dep, gst_dep],
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: examples_install_dir
 )
index 0ec411b..a85fef3 100644 (file)
@@ -1,4 +1,6 @@
 nnstreamer_example_decoder_image_labelling = executable('nnstreamer_example_decoder_image_labelling',
   'nnstreamer_example_decoder_image_labelling.c',
-  dependencies: [glib_dep, gst_dep]
+  dependencies: [glib_dep, gst_dep],
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: examples_install_dir
 )
index 6a65f7a..8a2cd61 100644 (file)
@@ -1,4 +1,6 @@
 nnstreamer_example_filter = executable('nnstreamer_example_filter',
   'nnstreamer_example_filter.c',
-  dependencies: [glib_dep, gst_dep]
+  dependencies: [glib_dep, gst_dep],
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: examples_install_dir
 )
index e58e8a4..69b8ac5 100644 (file)
@@ -1,4 +1,6 @@
 nnstreamer_example_filter_performance_profile = executable('nnstreamer_example_filter_performance_profile',
   'nnstreamer_example_filter_performance_profile.c',
-  dependencies: [glib_dep, gst_dep]
+  dependencies: [glib_dep, gst_dep],
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: examples_install_dir
 )
index 4a847e6..83236aa 100644 (file)
@@ -3,5 +3,13 @@ cairo_dep = dependency('cairo')
 nnstreamer_example_object_detection = executable('nnstreamer_example_object_detection',
   'nnstreamer_example_object_detection.cc',
   dependencies: [glib_dep, gst_dep, gst_video_dep, cairo_dep, libm_dep],
-  include_directories: nnstreamer_inc
+  include_directories: nnstreamer_inc,
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: examples_install_dir
 )
+
+if get_option('INSTALL_EXAMPLES')
+  install_data(['get_model.sh', 'gst-launch-object-detection.sh'],
+    install_dir: examples_install_dir
+  )
+endif
index b27bddd..fe24d04 100644 (file)
@@ -1,9 +1,13 @@
 nnstreamer_sink_example = executable('nnstreamer_sink_example',
   'nnstreamer_sink_example.c',
-  dependencies: [glib_dep, gst_dep, gst_app_dep]
+  dependencies: [glib_dep, gst_dep, gst_app_dep],
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: examples_install_dir
 )
 
 nnstreamer_sink_example_play = executable('nnstreamer_sink_example_play',
   'nnstreamer_sink_example_play.c',
-  dependencies: [glib_dep, gst_dep, gst_app_dep]
+  dependencies: [glib_dep, gst_dep, gst_app_dep],
+  install: get_option('INSTALL_EXAMPLES'),
+  install_dir: examples_install_dir
 )