From ff33a6cfb752dc3020bf883faf1110e844dbf9dd Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Mon, 26 Nov 2018 16:16:31 +0900 Subject: [PATCH] [CMake] Install example apps to "EXAMPLE_EXEC_PREFIX". Do not install example apps into /usr/bin, but to /usr/lib/nnstreamer/bin/ Partially addresses the third subitem of #866 Signed-off-by: MyungJoo Ham --- CMakeLists.txt | 8 ++++++++ nnstreamer_example/custom_example_RNN/CMakeLists.txt | 1 - nnstreamer_example/custom_example_average/CMakeLists.txt | 1 - nnstreamer_example/custom_example_opencv/CMakeLists.txt | 2 -- nnstreamer_example/custom_example_passthrough/CMakeLists.txt | 1 - nnstreamer_example/custom_example_scaler/CMakeLists.txt | 1 - nnstreamer_example/example_cam/CMakeLists.txt | 2 +- nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt | 2 +- nnstreamer_example/example_filter/CMakeLists.txt | 2 +- .../example_filter_performance_profile/CMakeLists.txt | 2 +- nnstreamer_example/example_object_detection/CMakeLists.txt | 3 ++- nnstreamer_example/example_sink/CMakeLists.txt | 2 +- nnstreamer_example/tizen_app_build_example/CMakeLists.txt | 8 ++++++++ packaging/nnstreamer.spec | 3 ++- packaging/nnstreamer_testapp.spec | 2 +- 15 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f415cee..c3f481b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,14 @@ OPTION(ENABLE_MODEL_DOWNLOAD "Enable download the model files" ON) OPTION(INSTALL_EXAMPLE_APP "Install example applications" OFF) OPTION(ENABLE_TEST "Enable tests" ON) +IF(INSTALL_EXAMPLE_APP) + IF(EXAMPLE_EXEC_PREFIX) + MESSAGE("Example application will be installed to ${EXAMPLE_EXEC_PREFIX}") + ELSE(EXAMPLE_EXEC_PREFIX) + SET(EXAMPLE_EXEC_PREFIX /usr/lib/nnstreamer/bin/) + ENDIF(EXAMPLE_EXEC_PREFIX) +ENDIF(INSTALL_EXAMPLE_APP) + SET(VERSION "0.0.3") ADD_DEFINITIONS(-DVERSION="${VERSION}") diff --git a/nnstreamer_example/custom_example_RNN/CMakeLists.txt b/nnstreamer_example/custom_example_RNN/CMakeLists.txt index 5710682..068bd0c 100644 --- a/nnstreamer_example/custom_example_RNN/CMakeLists.txt +++ b/nnstreamer_example/custom_example_RNN/CMakeLists.txt @@ -3,7 +3,6 @@ ADD_LIBRARY(dummyRNN SHARED dummy_RNN.c) TARGET_LINK_LIBRARIES(dummyRNN nnstreamer) INSTALL(TARGETS dummyRNN - RUNTIME DESTINATION ${EXEC_PREFIX} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/nnstreamer_example/custom_example_average/CMakeLists.txt b/nnstreamer_example/custom_example_average/CMakeLists.txt index aa3ce4f..58a421f 100644 --- a/nnstreamer_example/custom_example_average/CMakeLists.txt +++ b/nnstreamer_example/custom_example_average/CMakeLists.txt @@ -3,7 +3,6 @@ ADD_LIBRARY(nnstreamer_customfilter_average SHARED nnstreamer_customfilter_examp TARGET_LINK_LIBRARIES(nnstreamer_customfilter_average nnstreamer) INSTALL(TARGETS nnstreamer_customfilter_average - RUNTIME DESTINATION ${EXEC_PREFIX} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/nnstreamer_example/custom_example_opencv/CMakeLists.txt b/nnstreamer_example/custom_example_opencv/CMakeLists.txt index 2be045d..ff89e3a 100644 --- a/nnstreamer_example/custom_example_opencv/CMakeLists.txt +++ b/nnstreamer_example/custom_example_opencv/CMakeLists.txt @@ -9,13 +9,11 @@ TARGET_LINK_LIBRARIES(nnstreamer_customfilter_opencv_average ${opencv_pkg_LIBRAR TARGET_INCLUDE_DIRECTORIES(nnstreamer_customfilter_opencv_average PUBLIC ${opencv_pkg_INCLUDE_DIRS}) INSTALL(TARGETS nnstreamer_customfilter_opencv_scaler - RUNTIME DESTINATION ${EXEC_PREFIX} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) INSTALL(TARGETS nnstreamer_customfilter_opencv_average - RUNTIME DESTINATION ${EXEC_PREFIX} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/nnstreamer_example/custom_example_passthrough/CMakeLists.txt b/nnstreamer_example/custom_example_passthrough/CMakeLists.txt index 6d8f50a..3637bf3 100644 --- a/nnstreamer_example/custom_example_passthrough/CMakeLists.txt +++ b/nnstreamer_example/custom_example_passthrough/CMakeLists.txt @@ -5,7 +5,6 @@ TARGET_LINK_LIBRARIES(nnstreamer_customfilter_passthrough nnstreamer) TARGET_LINK_LIBRARIES(nnstreamer_customfilter_passthrough_variable nnstreamer) INSTALL(TARGETS nnstreamer_customfilter_passthrough nnstreamer_customfilter_passthrough_variable - RUNTIME DESTINATION ${EXEC_PREFIX} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/nnstreamer_example/custom_example_scaler/CMakeLists.txt b/nnstreamer_example/custom_example_scaler/CMakeLists.txt index a495171..a5e1241 100644 --- a/nnstreamer_example/custom_example_scaler/CMakeLists.txt +++ b/nnstreamer_example/custom_example_scaler/CMakeLists.txt @@ -7,7 +7,6 @@ ADD_LIBRARY(nnstreamer_customfilter_scaler_allocator SHARED nnstreamer_customfil TARGET_LINK_LIBRARIES(nnstreamer_customfilter_scaler_allocator nnstreamer) INSTALL(TARGETS nnstreamer_customfilter_scaler nnstreamer_customfilter_scaler_allocator - RUNTIME DESTINATION ${EXEC_PREFIX} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/nnstreamer_example/example_cam/CMakeLists.txt b/nnstreamer_example/example_cam/CMakeLists.txt index 72eb85c..b010555 100644 --- a/nnstreamer_example/example_cam/CMakeLists.txt +++ b/nnstreamer_example/example_cam/CMakeLists.txt @@ -6,5 +6,5 @@ TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_cam PUBLIC ${apppkgs_INCLUDE_DIRS} TARGET_COMPILE_OPTIONS(nnstreamer_example_cam PUBLIC ${apppkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) - INSTALL(TARGETS nnstreamer_example_cam RUNTIME DESTINATION ${EXEC_PREFIX}) + INSTALL(TARGETS nnstreamer_example_cam RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) ENDIF (INSTALL_EXAMPLE_APP) diff --git a/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt b/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt index 0ce6023..d2fc05b 100644 --- a/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt +++ b/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt @@ -6,5 +6,5 @@ TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_decoder_image_labelling PUBLIC ${a TARGET_COMPILE_OPTIONS(nnstreamer_example_decoder_image_labelling PUBLIC ${apppkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) - INSTALL(TARGETS nnstreamer_example_decoder_image_labelling RUNTIME DESTINATION ${EXEC_PREFIX}) + INSTALL(TARGETS nnstreamer_example_decoder_image_labelling RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) ENDIF (INSTALL_EXAMPLE_APP) diff --git a/nnstreamer_example/example_filter/CMakeLists.txt b/nnstreamer_example/example_filter/CMakeLists.txt index b7da6da..a245bbc 100644 --- a/nnstreamer_example/example_filter/CMakeLists.txt +++ b/nnstreamer_example/example_filter/CMakeLists.txt @@ -6,5 +6,5 @@ TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_filter PUBLIC ${apppkgs_INCLUDE_DI TARGET_COMPILE_OPTIONS(nnstreamer_example_filter PUBLIC ${apppkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) - INSTALL(TARGETS nnstreamer_example_filter RUNTIME DESTINATION ${EXEC_PREFIX}) + INSTALL(TARGETS nnstreamer_example_filter RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) ENDIF (INSTALL_EXAMPLE_APP) diff --git a/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt b/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt index d0fa1ce..d0b5259 100644 --- a/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt +++ b/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt @@ -6,5 +6,5 @@ TARGET_INCLUDE_DIRECTORIES(${EXAMPLE_APP_NAME} PUBLIC ${apppkgs_INCLUDE_DIRS}) TARGET_COMPILE_OPTIONS(${EXAMPLE_APP_NAME} PUBLIC ${apppkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) - INSTALL(TARGETS ${EXAMPLE_APP_NAME} RUNTIME DESTINATION ${EXEC_PREFIX}) + INSTALL(TARGETS ${EXAMPLE_APP_NAME} RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) ENDIF (INSTALL_EXAMPLE_APP) diff --git a/nnstreamer_example/example_object_detection/CMakeLists.txt b/nnstreamer_example/example_object_detection/CMakeLists.txt index ef9f82e..1968c06 100644 --- a/nnstreamer_example/example_object_detection/CMakeLists.txt +++ b/nnstreamer_example/example_object_detection/CMakeLists.txt @@ -42,5 +42,6 @@ TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_object_detection PUBLIC ${apppkgs_ TARGET_COMPILE_OPTIONS(nnstreamer_example_object_detection PUBLIC ${apppkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) - INSTALL(TARGETS nnstreamer_example_object_detection RUNTIME DESTINATION ${EXEC_PREFIX}) + INSTALL(TARGETS nnstreamer_example_object_detection RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) + INSTALL(FILES get_model.sh gst-launch-object-detection.sh DESTINATION ${EXAMPLE_EXEC_PREFIX}) ENDIF (INSTALL_EXAMPLE_APP) diff --git a/nnstreamer_example/example_sink/CMakeLists.txt b/nnstreamer_example/example_sink/CMakeLists.txt index 01b2b0a..d9d0311 100644 --- a/nnstreamer_example/example_sink/CMakeLists.txt +++ b/nnstreamer_example/example_sink/CMakeLists.txt @@ -13,5 +13,5 @@ TARGET_INCLUDE_DIRECTORIES(nnstreamer_sink_example_play PUBLIC ${apppkgs_INCLUDE TARGET_COMPILE_OPTIONS(nnstreamer_sink_example_play PUBLIC ${apppkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) - INSTALL(TARGETS nnstreamer_sink_example nnstreamer_sink_example_play RUNTIME DESTINATION ${EXEC_PREFIX}) + INSTALL(TARGETS nnstreamer_sink_example nnstreamer_sink_example_play RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) ENDIF (INSTALL_EXAMPLE_APP) diff --git a/nnstreamer_example/tizen_app_build_example/CMakeLists.txt b/nnstreamer_example/tizen_app_build_example/CMakeLists.txt index 4ef3588..60be57c 100644 --- a/nnstreamer_example/tizen_app_build_example/CMakeLists.txt +++ b/nnstreamer_example/tizen_app_build_example/CMakeLists.txt @@ -4,6 +4,14 @@ PROJECT(nnstreamer_testapp C) OPTION(INSTALL_EXAMPLE_APP "Install example applications" ON) +IF(INSTALL_EXAMPLE_APP) + IF(EXAMPLE_EXEC_PREFIX) + MESSAGE("Example application will be installed to ${EXAMPLE_EXEC_PREFIX}") + ELSE(EXAMPLE_EXEC_PREFIX) + SET(EXAMPLE_EXEC_PREFIX /usr/lib/nnstreamer/bin/) + ENDIF(EXAMPLE_EXEC_PREFIX) +ENDIF(INSTALL_EXAMPLE_APP) + SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}/bin") SET(INCLUDEDIR "${PREFIX}/include/nnstreamer") diff --git a/packaging/nnstreamer.spec b/packaging/nnstreamer.spec index 9106de1..a79aab5 100644 --- a/packaging/nnstreamer.spec +++ b/packaging/nnstreamer.spec @@ -89,7 +89,7 @@ mkdir -p build pushd build export GST_PLUGIN_PATH=$(pwd) export LD_LIBRARY_PATH=$(pwd):$(pwd)/gst/tensor_filter -%cmake .. -DGST_INSTALL_DIR=%{gstlibdir} -DENABLE_MODEL_DOWNLOAD=OFF +%cmake .. -DGST_INSTALL_DIR=%{gstlibdir} -DENABLE_MODEL_DOWNLOAD=OFF -DINSTALL_EXAMPLE_APP=ON make %{?_smp_mflags} %if 0%{?unit_test} ./tests/unittest_common @@ -169,6 +169,7 @@ install build/gst/tensor_filter/*.a %{buildroot}%{_libdir}/ %defattr(-,root,root,-) %license LICENSE %{_libdir}/*.so +/usr/lib/nnstreamer/bin/* %exclude %{_libdir}/libtensor_filter_tflitecore.so %changelog diff --git a/packaging/nnstreamer_testapp.spec b/packaging/nnstreamer_testapp.spec index dece07e..e0317f6 100644 --- a/packaging/nnstreamer_testapp.spec +++ b/packaging/nnstreamer_testapp.spec @@ -48,7 +48,7 @@ popd %files %manifest nnstreamer.manifest %defattr(-,root,root,-) -%{_bindir}/* +/usr/lib/nnstreamer/bin/* %changelog * Wed Jul 18 2018 MyungJoo Ham -- 2.7.4