Build specific sample only 39/276639/12
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 22 Jun 2022 08:40:37 +0000 (17:40 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Sat, 18 Feb 2023 07:28:42 +0000 (16:28 +0900)
How to use :
(Tizen)
gbs build -A i586 --include-all --define "build_example_name color-visual"
(Ubuntu)
cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX -DBUILD_EXAMPLE_NAME=color-visual .

Change-Id: I919af4adadcee6475672a2cd4bf92bebdc9b71c8
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
build/tizen/CMakeLists.txt
build/tizen/examples/CMakeLists.txt
packaging/com.samsung.dali-demo.spec

index 5198d34aba8e13ef676e33d6f184075380f16dfc..480561fcedb4cd9e113a17a78fa86b3803126101 100644 (file)
@@ -144,40 +144,52 @@ MACRO(INSTALL_TREE_FILES ROOT TREE FILTER DESTINATION)
 ENDMACRO()
 
 GET_TREE(LOCAL_IMAGES_TREE "${LOCAL_IMAGES_DIR}")
+
+# If we try to build specific samples, we don't install some heavy things.
+# TODO : Currently, we did hard-coding.
+IF( NOT BUILD_EXAMPLE_NAME )
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.png" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.jpg" ${IMAGES_DIR})
+INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.ico" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.gif" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.webp" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.bmp" ${IMAGES_DIR})
-INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.ico" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.wbmp" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.ktx" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.astc" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.svg" ${IMAGES_DIR})
 INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*.json" ${IMAGES_DIR})
+ELSE()
+INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*com.samsung.dali-demo.png" ${IMAGES_DIR})
+INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*dali-examples.png" ${IMAGES_DIR})
+INSTALL_TREE_FILES(${LOCAL_IMAGES_DIR} "${LOCAL_IMAGES_TREE}" "*dali-tests.png" ${IMAGES_DIR})
+ENDIF()
 
-FILE(GLOB LOCAL_VIDEOS_LIST RELATIVE "${LOCAL_VIDEOS_DIR}" "${LOCAL_VIDEOS_DIR}/*")
-FOREACH(flag ${LOCAL_VIDEOS_LIST})
-        INSTALL(FILES ${LOCAL_VIDEOS_DIR}/${flag} DESTINATION ${VIDEOS_DIR})
+FILE(GLOB LOCAL_SHADERS_LIST RELATIVE "${LOCAL_SHADERS_DIR}" "${LOCAL_SHADERS_DIR}/*")
+FOREACH(flag ${LOCAL_SHADERS_LIST})
+        INSTALL(FILES ${LOCAL_SHADERS_DIR}/${flag} DESTINATION ${SHADERS_DIR})
 ENDFOREACH(flag)
 
-GET_TREE(LOCAL_MODELS_TREE "${LOCAL_MODELS_DIR}")
-INSTALL_TREE_FILES(${LOCAL_MODELS_DIR} "${LOCAL_MODELS_TREE}" "*" ${MODELS_DIR})
-
 FILE(GLOB LOCAL_SCRIPTS_LIST RELATIVE "${LOCAL_SCRIPTS_DIR}" "${LOCAL_SCRIPTS_DIR}/*.json")
 FOREACH(flag ${LOCAL_SCRIPTS_LIST})
         INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/${flag} DESTINATION ${SCRIPTS_DIR})
 ENDFOREACH(flag)
 
-FILE(GLOB LOCAL_SHADERS_LIST RELATIVE "${LOCAL_SHADERS_DIR}" "${LOCAL_SHADERS_DIR}/*")
-FOREACH(flag ${LOCAL_SHADERS_LIST})
-        INSTALL(FILES ${LOCAL_SHADERS_DIR}/${flag} DESTINATION ${SHADERS_DIR})
+# If we try to build specific samples, we don't install some heavy things.
+IF( NOT BUILD_EXAMPLE_NAME )
+FILE(GLOB LOCAL_VIDEOS_LIST RELATIVE "${LOCAL_VIDEOS_DIR}" "${LOCAL_VIDEOS_DIR}/*")
+FOREACH(flag ${LOCAL_VIDEOS_LIST})
+        INSTALL(FILES ${LOCAL_VIDEOS_DIR}/${flag} DESTINATION ${VIDEOS_DIR})
 ENDFOREACH(flag)
 
+GET_TREE(LOCAL_MODELS_TREE "${LOCAL_MODELS_DIR}")
+INSTALL_TREE_FILES(${LOCAL_MODELS_DIR} "${LOCAL_MODELS_TREE}" "*" ${MODELS_DIR})
+
 FILE(GLOB LOCAL_GAME_LIST RELATIVE "${LOCAL_GAME_DIR}" "${LOCAL_GAME_DIR}/*.*")
 FOREACH(flag ${LOCAL_GAME_LIST})
         INSTALL(FILES ${LOCAL_GAME_DIR}/${flag} DESTINATION ${GAME_DIR})
 ENDFOREACH(flag)
+ENDIF()
 
 #Create resources location file
 CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp )
@@ -456,6 +468,14 @@ ELSE()
   SET(CURRENT_BUILD_PLATFORM "Ubuntu")
 ENDIF()
 
+# Setup CURRENT_BUILD_EXAMPLE_NAME to use at message
+IF(NOT BUILD_EXAMPLE_NAME)
+  SET(CURRENT_BUILD_EXAMPLE_NAME "ALL EXAMPLES")
+ELSE()
+  SET(CURRENT_BUILD_EXAMPLE_NAME ${BUILD_EXAMPLE_NAME})
+ENDIF()
+
+
 MESSAGE( " Folder   DEMO_IMAGE_DIR : [" ${DEMO_IMAGE_DIR} "]" )
 MESSAGE( " Folder   DEMO_STYLE_DIR : [" ${DEMO_STYLE_DIR} "]" )
 MESSAGE( " Folder  DEMO_SHADER_DIR : [" ${DEMO_SHADER_DIR} "]" )
@@ -468,4 +488,5 @@ MESSAGE( " Folder  DEMO_LOCALE_DIR : [" ${DEMO_LOCALE_DIR} "]" )
 MESSAGE( " Folder DEMO_EXAMPLE_BIN : [" ${DEMO_EXAMPLE_BIN} "]" )
 MESSAGE( " Folder        DEMO_LANG : [" ${DEMO_LANG} "]" )
 MESSAGE( " Current Build Platform  : [" ${CURRENT_BUILD_PLATFORM} "]" )
-MESSAGE( " Scene3D Enabled    : [" ${ENABLE_SCENE3D} "]" )
+MESSAGE( " Build example name      : [" ${CURRENT_BUILD_EXAMPLE_NAME} "]" )
+MESSAGE( " Scene3D Enabled         : [" ${ENABLE_SCENE3D} "]" )
index 3edebb6e50d71a56bcd12bac07ecdb9d7ae1e2e6..ad3d815e96360c7c366f6d206bdd0cf805c60af0 100644 (file)
@@ -25,7 +25,7 @@ IF( NOT SHADER_GENERATOR )
   MESSAGE( FATAL_ERROR "dali-shader-generator not found!" )
 ENDIF()
 
-FOREACH(EXAMPLE ${SUBDIRS})
+FUNCTION(INSTALL_EXAMPLES EXAMPLE)
   SET(PARENT_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../")
   FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp")
   SET(SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp")
@@ -42,10 +42,19 @@ FOREACH(EXAMPLE ${SUBDIRS})
     ADD_CUSTOM_TARGET(${EXAMPLE}-generate-shaders
                       COMMAND ${SHADER_GENERATOR} --skip ${SHADER_SOURCE_DIR} ${SHADER_GENERATED_DIR})
     SET_PROPERTY(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
-                 "${SHADER_GENERATED_DIR}")
+                "${SHADER_GENERATED_DIR}")
     ADD_DEPENDENCIES(${EXAMPLE}.example ${EXAMPLE}-generate-shaders)
   ENDIF()
 
   TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_LIBS})
   INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR})
-ENDFOREACH(EXAMPLE)
+ENDFUNCTION()
+
+IF( NOT BUILD_EXAMPLE_NAME )
+  FOREACH(EXAMPLE ${SUBDIRS})
+    INSTALL_EXAMPLES(${EXAMPLE})
+  ENDFOREACH(EXAMPLE)
+ELSE()
+  INSTALL_EXAMPLES(${BUILD_EXAMPLE_NAME})
+ENDIF()
+
index 94004a2ef780896047b75c103129593aa80a7e0f..925d1a4700bc533293d9c130f52885986bacdaa5 100755 (executable)
@@ -96,6 +96,9 @@ cmake -DDALI_APP_DIR=%{dali_app_ro_dir}/bin \
       -DLOCAL_STYLE_DIR=%{local_style_dir} \
       -DINTERNATIONALIZATION:BOOL=OFF \
       -DTIZEN:BOOL=ON \
+%if "%{?build_example_name}" != ""
+      -DBUILD_EXAMPLE_NAME=%{?build_example_name} \
+%endif
       .
 
 make %{?jobs:-j%jobs}
@@ -174,10 +177,12 @@ exit 0
 %{dali_app_exe_dir}/dali-tests
 %{dali_app_exe_dir}/*.example
 %{dali_app_exe_dir}/dali-builder
+%if "%{?build_example_name}" == ""
 %{dali_app_res_dir}/images/*
 %{dali_app_res_dir}/game/*
 %{dali_app_res_dir}/videos/*
 %{dali_app_res_dir}/models/*
+%endif
 %{dali_app_res_dir}/scripts/*
 %{dali_app_res_dir}/shaders/*
 %{dali_xml_file_dir}/%{name}.xml