From 867fa915a5204e01262d772174b1ee128f3146bb Mon Sep 17 00:00:00 2001 From: Jaeyun Date: Wed, 12 Dec 2018 13:25:08 +0900 Subject: [PATCH] [Example/Cmake] remove unnecessary link Examples don't need to link nnstreamer libs. Remove this link and add modules for each examples. Signed-off-by: Jaeyun Jung --- nnstreamer_example/CMakeLists.txt | 12 ------------ nnstreamer_example/custom_example_LSTM/CMakeLists.txt | 2 +- nnstreamer_example/custom_example_RNN/CMakeLists.txt | 2 -- .../custom_example_average/CMakeLists.txt | 2 -- nnstreamer_example/custom_example_opencv/CMakeLists.txt | 17 ++++++----------- .../custom_example_passthrough/CMakeLists.txt | 3 --- nnstreamer_example/custom_example_scaler/CMakeLists.txt | 10 ++++++---- nnstreamer_example/example_cam/CMakeLists.txt | 9 +++++---- .../example_decoder_image_labelling/CMakeLists.txt | 9 +++++---- nnstreamer_example/example_filter/CMakeLists.txt | 9 +++++---- .../example_filter_performance_profile/CMakeLists.txt | 8 +++++--- .../example_object_detection/CMakeLists.txt | 9 ++++----- nnstreamer_example/example_sink/CMakeLists.txt | 14 ++++++++------ .../tizen_app_build_example/CMakeLists.txt | 10 ---------- 14 files changed, 45 insertions(+), 71 deletions(-) diff --git a/nnstreamer_example/CMakeLists.txt b/nnstreamer_example/CMakeLists.txt index d0868d5..2909bec 100644 --- a/nnstreamer_example/CMakeLists.txt +++ b/nnstreamer_example/CMakeLists.txt @@ -1,15 +1,3 @@ -# Example App build requires a few additional attention if tizen_app_build_example is not used. - -SET(PKGAPP_MODULES - gstreamer-1.0 - gstreamer-base-1.0 - gstreamer-controller-1.0 - gstreamer-video-1.0 - gstreamer-audio-1.0 - gstreamer-app-1.0 -) -pkg_check_modules(apppkgs REQUIRED ${PKGAPP_MODULES}) - ADD_SUBDIRECTORY(custom_example_passthrough) ADD_SUBDIRECTORY(custom_example_scaler) ADD_SUBDIRECTORY(custom_example_average) diff --git a/nnstreamer_example/custom_example_LSTM/CMakeLists.txt b/nnstreamer_example/custom_example_LSTM/CMakeLists.txt index 9ba8391..1e5c63f 100644 --- a/nnstreamer_example/custom_example_LSTM/CMakeLists.txt +++ b/nnstreamer_example/custom_example_LSTM/CMakeLists.txt @@ -1,6 +1,6 @@ ADD_LIBRARY(dummyLSTM SHARED dummy_LSTM.c) -TARGET_LINK_LIBRARIES(dummyLSTM nnstreamer) +TARGET_LINK_LIBRARIES(dummyLSTM m) INSTALL(TARGETS dummyLSTM LIBRARY DESTINATION ${LIB_INSTALL_DIR} diff --git a/nnstreamer_example/custom_example_RNN/CMakeLists.txt b/nnstreamer_example/custom_example_RNN/CMakeLists.txt index 068bd0c..2915fe5 100644 --- a/nnstreamer_example/custom_example_RNN/CMakeLists.txt +++ b/nnstreamer_example/custom_example_RNN/CMakeLists.txt @@ -1,7 +1,5 @@ ADD_LIBRARY(dummyRNN SHARED dummy_RNN.c) -TARGET_LINK_LIBRARIES(dummyRNN nnstreamer) - INSTALL(TARGETS dummyRNN 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 58a421f..d6774fb 100644 --- a/nnstreamer_example/custom_example_average/CMakeLists.txt +++ b/nnstreamer_example/custom_example_average/CMakeLists.txt @@ -1,7 +1,5 @@ ADD_LIBRARY(nnstreamer_customfilter_average SHARED nnstreamer_customfilter_example_average.c) -TARGET_LINK_LIBRARIES(nnstreamer_customfilter_average nnstreamer) - INSTALL(TARGETS nnstreamer_customfilter_average 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 ff89e3a..2d39d90 100644 --- a/nnstreamer_example/custom_example_opencv/CMakeLists.txt +++ b/nnstreamer_example/custom_example_opencv/CMakeLists.txt @@ -1,19 +1,14 @@ -pkg_check_modules(opencv_pkg REQUIRED opencv) +pkg_check_modules(custfilter_ex_opencv_pkgs glib-2.0 opencv REQUIRED) ADD_LIBRARY(nnstreamer_customfilter_opencv_scaler SHARED nnstreamer_customfilter_opencv_scaler.cc) -TARGET_LINK_LIBRARIES(nnstreamer_customfilter_opencv_scaler ${opencv_pkg_LIBRARIES} nnstreamer) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_customfilter_opencv_scaler PUBLIC ${opencv_pkg_INCLUDE_DIRS}) +TARGET_LINK_LIBRARIES(nnstreamer_customfilter_opencv_scaler ${custfilter_ex_opencv_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_customfilter_opencv_scaler PUBLIC ${custfilter_ex_opencv_pkgs_INCLUDE_DIRS}) ADD_LIBRARY(nnstreamer_customfilter_opencv_average SHARED nnstreamer_customfilter_opencv_average.cc) -TARGET_LINK_LIBRARIES(nnstreamer_customfilter_opencv_average ${opencv_pkg_LIBRARIES} nnstreamer) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_customfilter_opencv_average PUBLIC ${opencv_pkg_INCLUDE_DIRS}) +TARGET_LINK_LIBRARIES(nnstreamer_customfilter_opencv_average ${custfilter_ex_opencv_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_customfilter_opencv_average PUBLIC ${custfilter_ex_opencv_pkgs_INCLUDE_DIRS}) -INSTALL(TARGETS nnstreamer_customfilter_opencv_scaler - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} -) - -INSTALL(TARGETS nnstreamer_customfilter_opencv_average +INSTALL(TARGETS nnstreamer_customfilter_opencv_scaler nnstreamer_customfilter_opencv_average 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 3637bf3..461415b 100644 --- a/nnstreamer_example/custom_example_passthrough/CMakeLists.txt +++ b/nnstreamer_example/custom_example_passthrough/CMakeLists.txt @@ -1,9 +1,6 @@ ADD_LIBRARY(nnstreamer_customfilter_passthrough SHARED nnstreamer_customfilter_example_passthrough.c) ADD_LIBRARY(nnstreamer_customfilter_passthrough_variable SHARED nnstreamer_customfilter_example_passthrough_variable.c) -TARGET_LINK_LIBRARIES(nnstreamer_customfilter_passthrough nnstreamer) -TARGET_LINK_LIBRARIES(nnstreamer_customfilter_passthrough_variable nnstreamer) - INSTALL(TARGETS nnstreamer_customfilter_passthrough nnstreamer_customfilter_passthrough_variable 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 a5e1241..ebb99c5 100644 --- a/nnstreamer_example/custom_example_scaler/CMakeLists.txt +++ b/nnstreamer_example/custom_example_scaler/CMakeLists.txt @@ -1,10 +1,12 @@ -ADD_LIBRARY(nnstreamer_customfilter_scaler SHARED nnstreamer_customfilter_example_scaler.c) +pkg_check_modules(custfilter_ex_scaler_pkgs glib-2.0 REQUIRED) -TARGET_LINK_LIBRARIES(nnstreamer_customfilter_scaler nnstreamer) +ADD_LIBRARY(nnstreamer_customfilter_scaler SHARED nnstreamer_customfilter_example_scaler.c) +TARGET_LINK_LIBRARIES(nnstreamer_customfilter_scaler ${custfilter_ex_scaler_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_customfilter_scaler PUBLIC ${custfilter_ex_scaler_pkgs_INCLUDE_DIRS}) ADD_LIBRARY(nnstreamer_customfilter_scaler_allocator SHARED nnstreamer_customfilter_example_scaler_allocator.c) - -TARGET_LINK_LIBRARIES(nnstreamer_customfilter_scaler_allocator nnstreamer) +TARGET_LINK_LIBRARIES(nnstreamer_customfilter_scaler_allocator ${custfilter_ex_scaler_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_customfilter_scaler PUBLIC ${custfilter_ex_scaler_pkgs_INCLUDE_DIRS}) INSTALL(TARGETS nnstreamer_customfilter_scaler nnstreamer_customfilter_scaler_allocator LIBRARY DESTINATION ${LIB_INSTALL_DIR} diff --git a/nnstreamer_example/example_cam/CMakeLists.txt b/nnstreamer_example/example_cam/CMakeLists.txt index b010555..cc90f72 100644 --- a/nnstreamer_example/example_cam/CMakeLists.txt +++ b/nnstreamer_example/example_cam/CMakeLists.txt @@ -1,9 +1,10 @@ -# example app for webcam +pkg_check_modules(app_ex_cam_pkgs gstreamer-1.0 glib-2.0 REQUIRED) + ADD_EXECUTABLE(nnstreamer_example_cam nnstreamer_example_cam.c) -TARGET_LINK_LIBRARIES(nnstreamer_example_cam ${apppkgs_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_cam PUBLIC ${apppkgs_INCLUDE_DIRS}) -TARGET_COMPILE_OPTIONS(nnstreamer_example_cam PUBLIC ${apppkgs_CFLAGS_OTHER}) +TARGET_LINK_LIBRARIES(nnstreamer_example_cam ${app_ex_cam_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_cam PUBLIC ${app_ex_cam_pkgs_INCLUDE_DIRS}) +TARGET_COMPILE_OPTIONS(nnstreamer_example_cam PUBLIC ${app_ex_cam_pkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) INSTALL(TARGETS nnstreamer_example_cam RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) diff --git a/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt b/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt index d2fc05b..41ba40a 100644 --- a/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt +++ b/nnstreamer_example/example_decoder_image_labelling/CMakeLists.txt @@ -1,9 +1,10 @@ -# demo app +pkg_check_modules(app_ex_imglabel_pkgs gstreamer-1.0 glib-2.0 REQUIRED) + ADD_EXECUTABLE(nnstreamer_example_decoder_image_labelling nnstreamer_example_decoder_image_labelling.c) -TARGET_LINK_LIBRARIES(nnstreamer_example_decoder_image_labelling ${apppkgs_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_decoder_image_labelling PUBLIC ${apppkgs_INCLUDE_DIRS}) -TARGET_COMPILE_OPTIONS(nnstreamer_example_decoder_image_labelling PUBLIC ${apppkgs_CFLAGS_OTHER}) +TARGET_LINK_LIBRARIES(nnstreamer_example_decoder_image_labelling ${app_ex_imglabel_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_decoder_image_labelling PUBLIC ${app_ex_imglabel_pkgs_INCLUDE_DIRS}) +TARGET_COMPILE_OPTIONS(nnstreamer_example_decoder_image_labelling PUBLIC ${app_ex_imglabel_pkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) INSTALL(TARGETS nnstreamer_example_decoder_image_labelling RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) diff --git a/nnstreamer_example/example_filter/CMakeLists.txt b/nnstreamer_example/example_filter/CMakeLists.txt index a245bbc..4cf7863 100644 --- a/nnstreamer_example/example_filter/CMakeLists.txt +++ b/nnstreamer_example/example_filter/CMakeLists.txt @@ -1,9 +1,10 @@ -# demo app +pkg_check_modules(app_ex_filter_pkgs gstreamer-1.0 glib-2.0 REQUIRED) + ADD_EXECUTABLE(nnstreamer_example_filter nnstreamer_example_filter.c) -TARGET_LINK_LIBRARIES(nnstreamer_example_filter ${apppkgs_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_filter PUBLIC ${apppkgs_INCLUDE_DIRS}) -TARGET_COMPILE_OPTIONS(nnstreamer_example_filter PUBLIC ${apppkgs_CFLAGS_OTHER}) +TARGET_LINK_LIBRARIES(nnstreamer_example_filter ${app_ex_filter_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_filter PUBLIC ${app_ex_filter_pkgs_INCLUDE_DIRS}) +TARGET_COMPILE_OPTIONS(nnstreamer_example_filter PUBLIC ${app_ex_filter_pkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) INSTALL(TARGETS nnstreamer_example_filter RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) diff --git a/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt b/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt index d0b5259..4392648 100644 --- a/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt +++ b/nnstreamer_example/example_filter_performance_profile/CMakeLists.txt @@ -1,9 +1,11 @@ +pkg_check_modules(app_ex_performance_pkgs gstreamer-1.0 glib-2.0 REQUIRED) + SET(EXAMPLE_APP_NAME "nnstreamer_example_filter_performance_profile") ADD_EXECUTABLE(${EXAMPLE_APP_NAME} ${EXAMPLE_APP_NAME}.c) -TARGET_LINK_LIBRARIES(${EXAMPLE_APP_NAME} ${apppkgs_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES(${EXAMPLE_APP_NAME} PUBLIC ${apppkgs_INCLUDE_DIRS}) -TARGET_COMPILE_OPTIONS(${EXAMPLE_APP_NAME} PUBLIC ${apppkgs_CFLAGS_OTHER}) +TARGET_LINK_LIBRARIES(${EXAMPLE_APP_NAME} ${app_ex_performance_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(${EXAMPLE_APP_NAME} PUBLIC ${app_ex_performance_pkgs_INCLUDE_DIRS}) +TARGET_COMPILE_OPTIONS(${EXAMPLE_APP_NAME} PUBLIC ${app_ex_performance_pkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) INSTALL(TARGETS ${EXAMPLE_APP_NAME} RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) diff --git a/nnstreamer_example/example_object_detection/CMakeLists.txt b/nnstreamer_example/example_object_detection/CMakeLists.txt index 69fa6bc..30cfbeb 100644 --- a/nnstreamer_example/example_object_detection/CMakeLists.txt +++ b/nnstreamer_example/example_object_detection/CMakeLists.txt @@ -1,11 +1,10 @@ -# demo app -pkg_check_modules(cairo_pkg REQUIRED cairo) +pkg_check_modules(app_ex_obj_pkgs gstreamer-1.0 gstreamer-video-1.0 glib-2.0 cairo REQUIRED) ADD_EXECUTABLE(nnstreamer_example_object_detection nnstreamer_example_object_detection.cc) -TARGET_LINK_LIBRARIES(nnstreamer_example_object_detection ${apppkgs_LIBRARIES} ${cairo_pkg_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_object_detection PUBLIC ${apppkgs_INCLUDE_DIRS} ${cairo_pkg_INCLUDE_DIRS}) -TARGET_COMPILE_OPTIONS(nnstreamer_example_object_detection PUBLIC ${apppkgs_CFLAGS_OTHER}) +TARGET_LINK_LIBRARIES(nnstreamer_example_object_detection ${app_ex_obj_pkgs_LIBRARIES} m) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_example_object_detection PUBLIC ${app_ex_obj_pkgs_INCLUDE_DIRS}) +TARGET_COMPILE_OPTIONS(nnstreamer_example_object_detection PUBLIC ${app_ex_obj_pkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) INSTALL(TARGETS nnstreamer_example_object_detection RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) diff --git a/nnstreamer_example/example_sink/CMakeLists.txt b/nnstreamer_example/example_sink/CMakeLists.txt index d9d0311..29e6170 100644 --- a/nnstreamer_example/example_sink/CMakeLists.txt +++ b/nnstreamer_example/example_sink/CMakeLists.txt @@ -1,16 +1,18 @@ +pkg_check_modules(app_ex_sink_pkgs gstreamer-1.0 gstreamer-app-1.0 glib-2.0 REQUIRED) + # example 1 ADD_EXECUTABLE(nnstreamer_sink_example nnstreamer_sink_example.c) -TARGET_LINK_LIBRARIES(nnstreamer_sink_example ${apppkgs_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_sink_example PUBLIC ${apppkgs_INCLUDE_DIRS}) -TARGET_COMPILE_OPTIONS(nnstreamer_sink_example PUBLIC ${apppkgs_CFLAGS_OTHER}) +TARGET_LINK_LIBRARIES(nnstreamer_sink_example ${app_ex_sink_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_sink_example PUBLIC ${app_ex_sink_pkgs_INCLUDE_DIRS}) +TARGET_COMPILE_OPTIONS(nnstreamer_sink_example PUBLIC ${app_ex_sink_pkgs_CFLAGS_OTHER}) # example 2 ADD_EXECUTABLE(nnstreamer_sink_example_play nnstreamer_sink_example_play.c) -TARGET_LINK_LIBRARIES(nnstreamer_sink_example_play ${apppkgs_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES(nnstreamer_sink_example_play PUBLIC ${apppkgs_INCLUDE_DIRS}) -TARGET_COMPILE_OPTIONS(nnstreamer_sink_example_play PUBLIC ${apppkgs_CFLAGS_OTHER}) +TARGET_LINK_LIBRARIES(nnstreamer_sink_example_play ${app_ex_sink_pkgs_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES(nnstreamer_sink_example_play PUBLIC ${app_ex_sink_pkgs_INCLUDE_DIRS}) +TARGET_COMPILE_OPTIONS(nnstreamer_sink_example_play PUBLIC ${app_ex_sink_pkgs_CFLAGS_OTHER}) IF (INSTALL_EXAMPLE_APP) INSTALL(TARGETS nnstreamer_sink_example nnstreamer_sink_example_play RUNTIME DESTINATION ${EXAMPLE_EXEC_PREFIX}) diff --git a/nnstreamer_example/tizen_app_build_example/CMakeLists.txt b/nnstreamer_example/tizen_app_build_example/CMakeLists.txt index 60be57c..6f94ee0 100644 --- a/nnstreamer_example/tizen_app_build_example/CMakeLists.txt +++ b/nnstreamer_example/tizen_app_build_example/CMakeLists.txt @@ -22,16 +22,6 @@ ELSE(LIB_INSTALL_DIR) ENDIF(LIB_INSTALL_DIR) FIND_PACKAGE(PkgConfig REQUIRED) -SET(PKGAPP_MODULES - nnstreamer - gstreamer-1.0 - gstreamer-base-1.0 - gstreamer-controller-1.0 - gstreamer-video-1.0 - gstreamer-audio-1.0 - gstreamer-app-1.0 -) -pkg_check_modules(apppkgs REQUIRED ${PKGAPP_MODULES}) ADD_SUBDIRECTORY(../example_sink ${CMAKE_CURRENT_BINARY_DIR}/example_sink) ADD_SUBDIRECTORY(../example_cam ${CMAKE_CURRENT_BINARY_DIR}/example_cam) -- 2.7.4