Install: added prebuilt samples installation

This commit is contained in:
Maksim Shabunin 2020-09-08 20:22:26 +03:00
parent 6b674709b8
commit 2dff2f36bf
3 changed files with 9 additions and 4 deletions

View File

@ -463,6 +463,7 @@ OCV_OPTION(BUILD_JAVA "Enable Java support"
# OpenCV installation options # OpenCV installation options
# =================================================== # ===================================================
OCV_OPTION(INSTALL_CREATE_DISTRIB "Change install rules to build the distribution package" OFF ) OCV_OPTION(INSTALL_CREATE_DISTRIB "Change install rules to build the distribution package" OFF )
OCV_OPTION(INSTALL_BIN_EXAMPLES "Install prebuilt examples" WIN32 IF BUILD_EXAMPLES)
OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF ) OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF )
OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF ) OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID ) OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )

View File

@ -1337,8 +1337,8 @@ function(ocv_add_samples)
endif() endif()
add_dependencies(${parent_target} ${the_target}) add_dependencies(${parent_target} ${the_target})
if(WIN32) if(INSTALL_BIN_EXAMPLES)
install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${module_id}" COMPONENT samples) install(TARGETS ${the_target} RUNTIME DESTINATION "${OPENCV_SAMPLES_BIN_INSTALL_PATH}/${module_id}" COMPONENT samples)
endif() endif()
endforeach() endforeach()
endif() endif()

View File

@ -15,8 +15,12 @@ function(ocv_define_sample out_target source sub)
if(WIN32 AND MSVC AND NOT BUILD_SHARED_LIBS) if(WIN32 AND MSVC AND NOT BUILD_SHARED_LIBS)
set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
endif() endif()
if(WIN32) # Should be usable in stand-alone build scenario
install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${sub}" COMPONENT samples) if((NOT DEFINED INSTALL_BIN_EXAMPLES AND WIN32) OR INSTALL_BIN_EXAMPLES)
if(NOT DEFINED OPENCV_SAMPLES_BIN_INSTALL_PATH)
set(OPENCV_SAMPLES_BIN_INSTALL_PATH "samples")
endif()
install(TARGETS ${the_target} RUNTIME DESTINATION "${OPENCV_SAMPLES_BIN_INSTALL_PATH}/${sub}" COMPONENT samples)
endif() endif()
# Add single target to build all samples in the group: 'make opencv_samples_cpp' # Add single target to build all samples in the group: 'make opencv_samples_cpp'
set(parent_target opencv_samples_${sub}) set(parent_target opencv_samples_${sub})