From d9adfdc9c802fdb880fb658085854384f90a88c2 Mon Sep 17 00:00:00 2001 From: Anuj Mittal Date: Thu, 11 Jun 2020 14:24:04 +0800 Subject: [PATCH] cmake installation fixes Make sure that libraries/samples/binaries are installed correctly. Signed-off-by: Anuj Mittal --- CMakeLists.txt | 14 -------------- cmake/developer_package.cmake | 10 ++++++---- .../ie_bridges/c/samples/common/CMakeLists.txt | 2 ++ inference-engine/samples/CMakeLists.txt | 9 +++------ .../samples/common/format_reader/CMakeLists.txt | 2 ++ .../src/inference_engine/CMakeLists.txt | 4 ++-- .../src/vpu/myriad_plugin/CMakeLists.txt | 2 +- inference-engine/tests/unit/cpu/CMakeLists.txt | 4 +++- .../tests/unit/inference_engine/CMakeLists.txt | 2 ++ inference-engine/tests/unit/vpu/CMakeLists.txt | 4 +++- 10 files changed, 24 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f981ed25..2c014ca27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,12 +121,8 @@ add_subdirectory(docs) # install setupvars -ie_cpack_add_component(setupvars REQUIRED) if(UNIX) - install(PROGRAMS scripts/setupvars/setupvars.sh - DESTINATION bin - COMPONENT setupvars) elseif(WIN32) install(PROGRAMS scripts/setupvars/setupvars.bat DESTINATION bin @@ -136,22 +132,12 @@ endif() # install install_dependencies if(UNIX) - ie_cpack_add_component(install_dependencies REQUIRED) - install(DIRECTORY scripts/install_dependencies/ - DESTINATION install_dependencies - COMPONENT install_dependencies) endif() # install files for demo -ie_cpack_add_component(demo_scripts REQUIRED DEPENDS core) if(UNIX) - install(DIRECTORY scripts/demo/ - DESTINATION deployment_tools/demo - COMPONENT demo_scripts - USE_SOURCE_PERMISSIONS - PATTERN *.bat EXCLUDE) elseif(WIN32) install(DIRECTORY scripts/demo/ DESTINATION deployment_tools/demo diff --git a/cmake/developer_package.cmake b/cmake/developer_package.cmake index 5e022244b..6e2cbf44e 100644 --- a/cmake/developer_package.cmake +++ b/cmake/developer_package.cmake @@ -10,7 +10,9 @@ list(APPEND CMAKE_MODULE_PATH include(CPackComponent) unset(IE_CPACK_COMPONENTS_ALL CACHE) -set(IE_CPACK_IE_DIR deployment_tools/inference_engine) +if (NOT DEFINED IE_CPACK_IE_DIR) + set(IE_CPACK_IE_DIR deployment_tools/inference_engine) +endif() # Search packages for the host system instead of packages for the target system # in case of cross compilation these macros should be defined by the toolchain file @@ -43,8 +45,8 @@ function(ie_cpack_set_library_dir) set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/bin/${ARCH}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) else() - set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH} PARENT_SCOPE) - set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH} PARENT_SCOPE) + set(IE_CPACK_LIBRARY_PATH ${CMAKE_INSTALL_LIBDIR} PARENT_SCOPE) + set(IE_CPACK_RUNTIME_PATH ${CMAKE_INSTALL_BINDIR} PARENT_SCOPE) set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH} PARENT_SCOPE) endif() endfunction() @@ -147,7 +149,7 @@ endif() # allow to override default OUTPUT_ROOT root if(NOT DEFINED OUTPUT_ROOT) - set(OUTPUT_ROOT ${OpenVINO_MAIN_SOURCE_DIR}) + set(OUTPUT_ROOT ${CMAKE_CURRENT_BINARY_DIR}) endif() # Enable postfixes for Debug/Release builds diff --git a/inference-engine/ie_bridges/c/samples/common/CMakeLists.txt b/inference-engine/ie_bridges/c/samples/common/CMakeLists.txt index b8d5ddf62..d086478f6 100644 --- a/inference-engine/ie_bridges/c/samples/common/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/samples/common/CMakeLists.txt @@ -29,3 +29,5 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER c_samples) if(COMMAND add_cpplint_target) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) endif() + +install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt index 594e581b1..4e95a7808 100644 --- a/inference-engine/samples/CMakeLists.txt +++ b/inference-engine/samples/CMakeLists.txt @@ -34,7 +34,7 @@ endif() if(IE_MAIN_SOURCE_DIR) # in case if samples are built from IE repo - set(IE_MAIN_SAMPLES_DIR ${OpenVINO_MAIN_SOURCE_DIR}) + set(IE_MAIN_SAMPLES_DIR ${CMAKE_BINARY_DIR}) # hint for find_package(InferenceEngine in the samples folder) set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}") # hint for find_package(ngraph in the samples folder) @@ -118,11 +118,6 @@ set (HAVE_INTTYPES_H 1) set (INTTYPES_FORMAT C99) set (BUILD_TESTING OFF) -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags") - add_subdirectory(thirdparty/gflags) - set_target_properties(gflags_nothreads_static PROPERTIES FOLDER thirdparty) -endif() - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif() @@ -239,6 +234,8 @@ macro(ie_add_sample) add_cpplint_target(${IE_SAMPLE_NAME}_cpplint FOR_TARGETS ${IE_SAMPLE_NAME} CUSTOM_FILTERS ${custom_filters}) endif() + + install(TARGETS ${IE_SAMPLE_NAME} DESTINATION bin) endmacro() # collect all samples subdirectories diff --git a/inference-engine/samples/common/format_reader/CMakeLists.txt b/inference-engine/samples/common/format_reader/CMakeLists.txt index 48dbed9f2..76532fd04 100644 --- a/inference-engine/samples/common/format_reader/CMakeLists.txt +++ b/inference-engine/samples/common/format_reader/CMakeLists.txt @@ -41,3 +41,5 @@ target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME} FOLDER cpp_samples) + +install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 4ae0d5607..b9ee12498 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -265,8 +265,8 @@ install(TARGETS ${TARGET_NAME} install(FILES "${OpenVINO_BINARY_DIR}/share/ie_parallel.cmake" "${OpenVINO_BINARY_DIR}/share/InferenceEngineConfig.cmake" "${OpenVINO_BINARY_DIR}/share/InferenceEngineConfig-version.cmake" - DESTINATION ${IE_CPACK_IE_DIR}/share + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/InferenceEngine COMPONENT core) install(FILES $/plugins.xml - DESTINATION ${IE_CPACK_RUNTIME_PATH} + DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT core) diff --git a/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt b/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt index bf30d127c..6ed8c4081 100644 --- a/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt +++ b/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt @@ -48,5 +48,5 @@ target_link_libraries(${TARGET_NAME} # install install(FILES ${IE_MAIN_SOURCE_DIR}/thirdparty/movidius/mvnc/src/97-myriad-usbboot.rules - DESTINATION ${IE_CPACK_IE_DIR}/external + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/udev/rules.d COMPONENT myriad) diff --git a/inference-engine/tests/unit/cpu/CMakeLists.txt b/inference-engine/tests/unit/cpu/CMakeLists.txt index 9ec5ad025..45c62571a 100644 --- a/inference-engine/tests/unit/cpu/CMakeLists.txt +++ b/inference-engine/tests/unit/cpu/CMakeLists.txt @@ -22,4 +22,6 @@ addIeTargetTest( ADD_CPPLINT LABELS CPU -) \ No newline at end of file +) + +install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/inference-engine/tests/unit/inference_engine/CMakeLists.txt b/inference-engine/tests/unit/inference_engine/CMakeLists.txt index 3eb21a434..09ba9225a 100644 --- a/inference-engine/tests/unit/inference_engine/CMakeLists.txt +++ b/inference-engine/tests/unit/inference_engine/CMakeLists.txt @@ -15,3 +15,5 @@ addIeTargetTest( LABELS IE ) + +install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/inference-engine/tests/unit/vpu/CMakeLists.txt b/inference-engine/tests/unit/vpu/CMakeLists.txt index 072103292..117cc9ee1 100644 --- a/inference-engine/tests/unit/vpu/CMakeLists.txt +++ b/inference-engine/tests/unit/vpu/CMakeLists.txt @@ -26,4 +26,6 @@ addIeTargetTest( LABELS VPU MYRIAD -) \ No newline at end of file +) + +install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) -- 2.26.2