Remove CMAKE_SOURCE_DIR in cmake script (#5576)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 8 Jul 2019 08:18:37 +0000 (17:18 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 8 Jul 2019 08:18:37 +0000 (17:18 +0900)
- Change CMAKE_SOURCE_DIR/externals to NNFW_EXTERNALS_DIR
- Remove some target_include_directories using CMAKE_SOURCE_DIR: because of linked libraries already include with PUBLIC

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
cmake/modules/ExternalSourceTools.cmake
cmake/packages/ARMComputeConfig.cmake
cmake/packages/TensorflowConfig.cmake
contrib/labs/opencl_test/CMakeLists.txt
contrib/labs/opencl_test/src/opencl_test.cc
contrib/tflite_loader/tools/CMakeLists.txt
libs/ARMComputeEx/CMakeLists.txt
runtimes/neurun/frontend/nnapi/CMakeLists.txt
tools/opencl_tool/CMakeLists.txt

index ee3c64a..01a0c4d 100644 (file)
@@ -68,7 +68,7 @@ function(ExternalSource_Download PREFIX URL)
 endfunction(ExternalSource_Download)
 
 function(ExternalSource_Get PREFIX DOWNLOAD_FLAG URL)
-  set(CACHE_DIR "${CMAKE_SOURCE_DIR}/externals")
+  set(CACHE_DIR "${NNFW_EXTERNALS_DIR}")
   set(OUT_DIR "${CACHE_DIR}/${PREFIX}")
   set(STAMP_PATH "${CACHE_DIR}/${PREFIX}.stamp")
 
index 264182e..ccf9669 100644 (file)
@@ -15,7 +15,7 @@ function(_ARMCompute_Import)
       set(ARMCompute_FOUND FALSE PARENT_SCOPE)
       return()
     endif()
-    set(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/externals/acl ${CMAKE_SOURCE_DIR}/externals/acl/include)
+    set(INCLUDE_DIR ${NNFW_EXTERNALS_DIR}/acl ${NNFW_EXTERNALS_DIR}/acl/include)
   endif(NOT INCLUDE_DIR)
 
   # NOTE '${CMAKE_INSTALL_PREFIX}/lib' should be searched as CI server places
index ab4e271..30afb99 100644 (file)
@@ -1,6 +1,6 @@
 function(_Tensorflow_Import)
   if(NOT DEFINED TENSORFLOW_DIR)
-    set(TENSORFLOW_DIR ${CMAKE_SOURCE_DIR}/externals/tensorflow)
+    set(TENSORFLOW_DIR ${NNFW_EXTERNALS_DIR}/tensorflow)
   endif(NOT DEFINED TENSORFLOW_DIR)
 
   if(NOT DEFINED NSYNC_ARCH)
index 5e99fa0..dc8f5f6 100644 (file)
@@ -4,9 +4,8 @@ endif(NOT ${TARGET_ARCH_BASE} STREQUAL "arm")
 
 list(APPEND OPENCL_INFO_SOURCE "src/opencl_test.cc")
 
+nnfw_find_package(ARMCompute REQUIRED)
+
 add_executable(opencl_test ${OPENCL_INFO_SOURCE})
-target_include_directories(opencl_test PUBLIC ${CMAKE_SOURCE_DIR}/externals/acl)
-target_include_directories(opencl_test PUBLIC ${CMAKE_SOURCE_DIR}/externals/acl/include)
-target_include_directories(opencl_test PUBLIC ${CMAKE_SOURCE_DIR}/libs/ARMComputeEx)
 target_link_libraries(opencl_test arm_compute)
 target_link_libraries(opencl_test arm_compute_ex)
index 78a20bb..1faa914 100644 (file)
@@ -38,7 +38,6 @@
  ******************************************************************************/
 
 #include "arm_compute/core/CL/OpenCL.h"
-#include "arm_compute/core/CL/OpenCLEx.h"
 
 #include <iostream>
 #include <vector>
index 336c33a..b8021ab 100644 (file)
@@ -10,10 +10,9 @@ nnfw_find_package(Boost REQUIRED)
 
 add_executable(tflite_loader_test_tool ${SOURCES})
 target_include_directories(tflite_loader_test_tool PRIVATE ${Boost_INCLUDE_DIRS})
-target_include_directories(tflite_loader_test_tool PRIVATE ${CMAKE_SOURCE_DIR}/contrib/tflite_loader)
 
 target_link_libraries(tflite_loader_test_tool neurun-core neurun tflite_loader)
 target_link_libraries(tflite_loader_test_tool nnfw_lib_tflite tensorflow-lite ${LIB_PTHREAD} dl nnfw_lib_misc)
 target_link_libraries(tflite_loader_test_tool boost_program_options boost_system boost_filesystem)
 
-install(TARGETS tflite_loader_test_tool DESTINATION bin) 
+install(TARGETS tflite_loader_test_tool DESTINATION bin)
index b53adb0..513baf8 100644 (file)
@@ -4,19 +4,19 @@ endif()
 
 nnfw_find_package(ARMCompute REQUIRED)
 
-set(ACL_EX_BASE ${CMAKE_SOURCE_DIR}/libs/ARMComputeEx)
+set(ACL_EX_BASE ${CMAKE_CURRENT_SOURCE_DIR})
 
 file(GLOB_RECURSE ACL_EX_SRCS "${ACL_EX_BASE}/*.cpp")
 
 # generate embeded cl_kernel
 execute_process (
-    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/libs/ARMComputeEx"
+    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
     COMMAND bash -c "python resolve_includes.py"
 )
 
 add_library(arm_compute_ex SHARED ${ACL_EX_SRCS})
 set_target_properties(arm_compute_ex PROPERTIES COMPILE_FLAGS "-DEMBEDDED_KERNELS=1")
-target_include_directories(arm_compute_ex PUBLIC ${CMAKE_SOURCE_DIR}/libs/ARMComputeEx)
+target_include_directories(arm_compute_ex PUBLIC ${ACL_EX_BASE})
 target_link_libraries(arm_compute_ex arm_compute_core)
 target_compile_options(arm_compute_ex PRIVATE -Wall -Wextra -Werror)
 # Defines to enable validate check in debug build
index fac3d8d..5c4dbfb 100644 (file)
@@ -1,7 +1,6 @@
 file(GLOB_RECURSE SOURCES_FRONTEND "*.cc")
 
 add_library(${LIB_NEURUN} SHARED ${SOURCES_FRONTEND})
-target_include_directories(${LIB_NEURUN} PUBLIC ${CMAKE_SOURCE_DIR}/externals/tensorflow)
 target_link_libraries(${LIB_NEURUN} nnapi-header)
 target_link_libraries(${LIB_NEURUN} neurun-core)
 
index 66b9285..f1fcc87 100644 (file)
@@ -4,9 +4,9 @@ endif(NOT ${TARGET_ARCH_BASE} STREQUAL "arm")
 
 list(APPEND OPENCL_INFO_SOURCE "src/opencl_info.cc")
 
+nnfw_find_package(ARMCompute REQUIRED)
+
 add_executable(opencl_info ${OPENCL_INFO_SOURCE})
-target_include_directories(opencl_info PUBLIC ${CMAKE_SOURCE_DIR}/externals/acl)
-target_include_directories(opencl_info PUBLIC ${CMAKE_SOURCE_DIR}/externals/acl/include)
 target_link_libraries(opencl_info arm_compute)
 
 install(TARGETS opencl_info DESTINATION bin)