From: 이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Thu, 31 May 2018 01:05:56 +0000 (+0900) Subject: Use submodule on tizen cross build (#1437) X-Git-Tag: 0.2~773 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e4805776fdb10be4d5bee345a13e9675fd46fd9;p=platform%2Fcore%2Fml%2Fnnfw.git Use submodule on tizen cross build (#1437) * Use submodule on tizen cross build 1. Let OBS_BUILD have ON/OFF 2. Use submodule on tizen cross build In summary, tizen cross build works in the same way of arm cross build. * Change submodule during tizen cross build Signed-off-by: Chunseok Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c4d7ec6..89b959f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ set(NNFW_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include) set(NNFW_EXTERNALS_DIR ${CMAKE_SOURCE_DIR}/externals) set(TFLITE_DEPEND_DIR ${NNFW_EXTERNALS_DIR}/tensorflow/tensorflow/contrib/lite/downloads) -if(NOT "${TARGET_OS}" STREQUAL "tizen" AND NOT "${TARGET_OS}" STREQUAL "android") +if(NOT OBS_BUILD AND NOT "${TARGET_OS}" STREQUAL "android") set(NNFW_ACL_FOLDER ${NNFW_EXTERNALS_DIR}/acl) set(NNFW_ACL_INCLUDES ${NNFW_ACL_FOLDER} ${NNFW_ACL_FOLDER}/include) @@ -125,7 +125,7 @@ link_directories(${CMAKE_INSTALL_PREFIX}/lib) # # GTest support # -if("${TARGET_OS}" STREQUAL "tizen" AND NOT "${TARGET_OS}" STREQUAL "android") +if(OBS_BUILD) enable_testing() find_package(GTest REQUIRED) include_directories(${GTEST_INCLUDE_DIR}) @@ -180,7 +180,7 @@ else("${TARGET_OS}" STREQUAL "android") # General case (non-android build) # TODO Fix indentation -if (NOT ${TARGET_OS} STREQUAL "tizen") +if (NOT OBS_BUILD) add_subdirectory(externals) endif() add_subdirectory(libs) diff --git a/Makefile b/Makefile index 391f4c4..b7337a8 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ HOST_OS?=linux TARGET_OS?=linux NPROCS:=1 PARALLEL_BUILD?=1 -OBS_BUILD?=0 +## TODO: fix obs build break +OBS_BUILD?=OFF COVERAGE_BUILD?=0 BENCHMARK_ACL_BUILD?=0 OPTIONS?= @@ -97,7 +98,7 @@ else ACL_COMMAND+=build_dir=release ACL_FOLDER_BUILD=$(ACL_FOLDER)/build/release endif -ifeq ($(TARGET_OS),tizen) +ifeq ($(OBS_BUILD),ON) UPDATE_MODULE=0 endif @@ -139,6 +140,7 @@ endif -DCMAKE_BUILD_TYPE=$(BUILD_TYPE_LC) -DTARGET_ARCH=$(TARGET_ARCH_LC) \ -DHOST_OS=$(HOST_OS) \ -DTARGET_OS=$(TARGET_OS) \ + -DOBS_BUILD=$(OBS_BUILD) \ $(OPTION_TOOLCHAIN) \ $(OPTIONS) touch $(TIMESTAMP_CONFIGURE) diff --git a/libs/kernel/acl/CMakeLists.txt b/libs/kernel/acl/CMakeLists.txt index 063bb79..5b64ca4 100644 --- a/libs/kernel/acl/CMakeLists.txt +++ b/libs/kernel/acl/CMakeLists.txt @@ -84,7 +84,7 @@ target_include_directories(${LIB_KERNELACL_TEST} PUBLIC ${NNFW_INCLUDE_DIR} ${RUNTIME_INCLUDES} ) -if (NOT ${TARGET_OS} STREQUAL "tizen") +if (NOT OBS_BUILD) add_dependencies(${LIB_KERNELACL_TEST} googletest) endif() target_link_libraries(${LIB_KERNELACL_TEST} diff --git a/runtimes/tests/neural_networks_test/CMakeLists.txt b/runtimes/tests/neural_networks_test/CMakeLists.txt index 0750fa4..ea9ea6b 100644 --- a/runtimes/tests/neural_networks_test/CMakeLists.txt +++ b/runtimes/tests/neural_networks_test/CMakeLists.txt @@ -10,13 +10,13 @@ if (CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.3) endif() # Both gbs and cross for tizen support building generated test -if (${TARGET_OS} STREQUAL "tizen") +if (OBS_BUILD) set(RUNTIME_ANDROID_NN_TEST_SRC ${RUNTIME_ANDROID_NN_TEST_SRC} TestGenerated.cpp) endif() add_executable(${RUNTIME_ANDROID_NN_TEST} ${RUNTIME_ANDROID_NN_TEST_SRC}) -if (NOT ${TARGET_OS} STREQUAL "tizen") +if (NOT OBS_BUILD) add_dependencies(${RUNTIME_ANDROID_NN_TEST} googletest) endif() diff --git a/scripts/command/docker_build_tizen_cross.sh b/scripts/command/docker_build_tizen_cross.sh index 3a45cfd..7165e93 100755 --- a/scripts/command/docker_build_tizen_cross.sh +++ b/scripts/command/docker_build_tizen_cross.sh @@ -27,6 +27,10 @@ DOCKER_VOLUMES+=" -v $ROOTFS_DIR/:/opt/rootfs" CMD="make && make install && make build_test_suite" +# Change .gitmodules to work around the permission issue +CMD_SUBMODULE="./scripts/command/change_gitmodule.sh" +docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME sh -c "$CMD_SUBMODULE" + docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME sh -c "$CMD" BUILD_RESULT=$? diff --git a/tools/tflite_run/CMakeLists.txt b/tools/tflite_run/CMakeLists.txt index 1d1b23b..78f5b8f 100644 --- a/tools/tflite_run/CMakeLists.txt +++ b/tools/tflite_run/CMakeLists.txt @@ -19,7 +19,7 @@ if (DEFINED googletest) ## Add test cpp file add_executable(tflite_test src/tflite_test.cc) - if (NOT ${TARGET_OS} STREQUAL "tizen") + if (NOT OBS_BUILD) add_dependencies(tflite_test googletest) endif()