From c49dc37761cc8edc4f52071d3c5a1ed68e136219 Mon Sep 17 00:00:00 2001 From: Anatoly Baksheev Date: Wed, 11 May 2011 13:37:20 +0000 Subject: [PATCH] [+] added use_folders cmake feature if cmake version is greater then 2.8.0 [~] fixed warning in featuers2d under windows (can't generate assignment operator) --- 3rdparty/libjasper/CMakeLists.txt | 4 + 3rdparty/libjpeg/CMakeLists.txt | 4 + 3rdparty/libpng/CMakeLists.txt | 4 + 3rdparty/libtiff/CMakeLists.txt | 4 + 3rdparty/zlib/CMakeLists.txt | 4 + CMakeLists.txt | 10 + OpenCVModule.cmake | 7 + .../include/opencv2/features2d/features2d.hpp | 3 + modules/ffmpeg/CMakeLists.txt | 4 + modules/gpu/CMakeLists.txt | 17 +- modules/gpu/CMakeLists.txt_cuda32 | 233 +++++++++++++++++++++ modules/gpu/CMakeLists.txt_cuda4.0 | 20 +- modules/haartraining/CMakeLists.txt | 7 + modules/highgui/CMakeLists.txt | 5 + modules/stitching/CMakeLists.txt | 4 + modules/traincascade/CMakeLists.txt | 4 + samples/c/CMakeLists.txt | 4 + samples/cpp/CMakeLists.txt | 4 + samples/gpu/CMakeLists.txt | 4 + samples/gpu/performance/CMakeLists.txt | 4 + 20 files changed, 338 insertions(+), 12 deletions(-) create mode 100644 modules/gpu/CMakeLists.txt_cuda32 diff --git a/3rdparty/libjasper/CMakeLists.txt b/3rdparty/libjasper/CMakeLists.txt index fd2d774..0fed785 100644 --- a/3rdparty/libjasper/CMakeLists.txt +++ b/3rdparty/libjasper/CMakeLists.txt @@ -47,6 +47,10 @@ set_target_properties(${the_target} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib" ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") +endif() if(NOT BUILD_SHARED_LIBS) install(TARGETS ${the_target} diff --git a/3rdparty/libjpeg/CMakeLists.txt b/3rdparty/libjpeg/CMakeLists.txt index 81e8d02..8ef3463 100644 --- a/3rdparty/libjpeg/CMakeLists.txt +++ b/3rdparty/libjpeg/CMakeLists.txt @@ -39,6 +39,10 @@ set_target_properties(${the_target} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") +endif() if(NOT BUILD_SHARED_LIBS) install(TARGETS ${the_target} diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index 59c94f3..50c8a86 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -40,6 +40,10 @@ set_target_properties(${the_target} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib" ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") +endif() if(NOT BUILD_SHARED_LIBS) install(TARGETS ${the_target} diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 35ea60a..0fef3a1 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -94,6 +94,10 @@ set_target_properties(${the_target} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib/" ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") +endif() if(NOT BUILD_SHARED_LIBS) install(TARGETS ${the_target} diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index 4607c1c..4fdccd9 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -32,6 +32,10 @@ set_target_properties(${the_target} ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib" ) +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "3rdparty") +endif() + if(NOT BUILD_SHARED_LIBS) install(TARGETS ${the_target} ARCHIVE DESTINATION share/opencv/3rdparty/lib COMPONENT main) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1886a4..9c7d057 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1279,6 +1279,16 @@ endif() #----------------------------------- +# Solution folders: +#----------------------------------- + +if(${CMAKE_VERSION} VERSION_GREATER "2.8.0") + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets") + set(SOLUTION_FOLDERS_ENABLED 1) +endif() + +#----------------------------------- # Subdirectories: #----------------------------------- add_subdirectory(include) diff --git a/OpenCVModule.cmake b/OpenCVModule.cmake index c0748be..17b23f4 100644 --- a/OpenCVModule.cmake +++ b/OpenCVModule.cmake @@ -37,6 +37,9 @@ macro(define_opencv_module name) SOVERSION ${OPENCV_SOVERSION} OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}" ) + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "modules") + endif() if (OPENCV_BUILD_SHARED_LIB) #add_definitions(-DCVAPI_EXPORTS) @@ -132,6 +135,10 @@ macro(define_opencv_module name) DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" ) + + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "tests") + endif() add_dependencies(${the_target} ${test_deps}) diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index a9e9739..201d658 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -1543,6 +1543,9 @@ protected: virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; private: + DynamicAdaptedFeatureDetector& operator=(const DynamicAdaptedFeatureDetector&); + DynamicAdaptedFeatureDetector(const DynamicAdaptedFeatureDetector&); + int escape_iters_; int min_features_, max_features_; const Ptr adjuster_; diff --git a/modules/ffmpeg/CMakeLists.txt b/modules/ffmpeg/CMakeLists.txt index 32ff25b..8f57c09 100644 --- a/modules/ffmpeg/CMakeLists.txt +++ b/modules/ffmpeg/CMakeLists.txt @@ -46,6 +46,10 @@ set_target_properties(${the_target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "modules") +endif() if (MSVC) set_target_properties(${the_target} PROPERTIES diff --git a/modules/gpu/CMakeLists.txt b/modules/gpu/CMakeLists.txt index 27da6a7..1a587c9 100644 --- a/modules/gpu/CMakeLists.txt +++ b/modules/gpu/CMakeLists.txt @@ -103,6 +103,10 @@ set_target_properties(${the_target} PROPERTIES SOVERSION ${OPENCV_SOVERSION} OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}" ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "modules") +endif() if (OPENCV_BUILD_SHARED_LIB) #add_definitions(-DCVAPI_EXPORTS) @@ -127,13 +131,10 @@ endif() if(MSVC) if(CMAKE_CROSSCOMPILING) - set_target_properties(${the_target} PROPERTIES - LINK_FLAGS "/NODEFAULTLIB:secchk" - ) + set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk") endif() - set_target_properties(${the_target} PROPERTIES - LINK_FLAGS "/NODEFAULTLIB:libc" - ) + + set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc") endif() # Dependencies of this target: @@ -212,6 +213,10 @@ if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" ) + + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_test_target} PROPERTIES FOLDER "tests") + endif() add_dependencies(${the_test_target} ${test_deps}) diff --git a/modules/gpu/CMakeLists.txt_cuda32 b/modules/gpu/CMakeLists.txt_cuda32 new file mode 100644 index 0000000..1a587c9 --- /dev/null +++ b/modules/gpu/CMakeLists.txt_cuda32 @@ -0,0 +1,233 @@ +set(name "gpu") + +set(the_target "opencv_${name}") +project(${the_target}) + +set(DEPS "opencv_core" "opencv_imgproc" "opencv_objdetect" "opencv_features2d" "opencv_flann" "opencv_calib3d") #"opencv_features2d" "opencv_flann" "opencv_objdetect" - only headers needed +set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_gpu) + +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" + "${CMAKE_CURRENT_SOURCE_DIR}/src/cuda" + "${CMAKE_CURRENT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_BINARY_DIR}") + +file(GLOB lib_srcs "src/*.cpp") +file(GLOB lib_int_hdrs "src/*.h*") +file(GLOB lib_cuda "src/cuda/*.cu*") +file(GLOB lib_cuda_hdrs "src/cuda/*.h*") +source_group("Src\\Host" FILES ${lib_srcs} ${lib_int_hdrs}) +source_group("Src\\Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs}) + +file(GLOB lib_hdrs "include/opencv2/${name}/*.h*") +source_group("Include" FILES ${lib_hdrs}) + +#file(GLOB lib_device_hdrs "include/opencv2/${name}/device/*.h*") +file(GLOB lib_device_hdrs "src/opencv2/gpu/device/*.h*") +source_group("Device" FILES ${lib_device_hdrs}) + +if (HAVE_CUDA) + file(GLOB_RECURSE ncv_srcs "src/nvidia/*.cpp") + file(GLOB_RECURSE ncv_cuda "src/nvidia/*.cu") + file(GLOB_RECURSE ncv_hdrs "src/nvidia/*.hpp" "src/nvidia/*.h") + + source_group("Src\\NVidia" FILES ${ncv_srcs} ${ncv_hdrs} ${ncv_cuda}) + include_directories("src/nvidia/core" "src/nvidia/NPP_staging") +endif() + +if (HAVE_CUDA) + get_filename_component(_path_to_findnpp "${CMAKE_CURRENT_LIST_FILE}" PATH) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_path_to_findnpp}) + find_package(NPP 3.2.16 REQUIRED) + message(STATUS "NPP detected: " ${NPP_VERSION}) + + include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_NPP_INCLUDES}) + + if (UNIX OR APPLE) + set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "-fPIC") + endif() + + #set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep") + #set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;") + + string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + + if(MSVC) + #string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + #string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + #string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4211 /wd4201 /wd4100 /wd4505 /wd4408") + + string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") + string(REPLACE "/EHsc-" "/EHs" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") + string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + endif() + + if (OPENCV_BUILD_SHARED_LIB) + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-DCVAPI_EXPORTS") + endif() + + CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda}) + #CUDA_BUILD_CLEAN_TARGET() +endif() + +foreach(d ${DEPS}) + if(${d} MATCHES "opencv_") + string(REPLACE "opencv_" "${CMAKE_CURRENT_SOURCE_DIR}/../" d_dir ${d}) + include_directories("${d_dir}/include") + endif() +endforeach() + +add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${lib_cuda_hdrs} ${lib_device_hdrs} ${ncv_srcs} ${ncv_hdrs} ${ncv_cuda} ${cuda_objs}) + +if(PCHSupport_FOUND) + set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.hpp) + if(${CMAKE_GENERATOR} MATCHES "Visual*" OR ${CMAKE_GENERATOR} MATCHES "Xcode*") + if(${CMAKE_GENERATOR} MATCHES "Visual*") + set(${the_target}_pch "src/precomp.cpp") + endif() + add_native_precompiled_header(${the_target} ${pch_header}) + elseif(CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_GENERATOR} MATCHES ".*Makefiles") + add_precompiled_header(${the_target} ${pch_header}) + endif() +endif() + +# For dynamic link numbering convenions +set_target_properties(${the_target} PROPERTIES + VERSION ${OPENCV_VERSION} + SOVERSION ${OPENCV_SOVERSION} + OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}" + ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "modules") +endif() + +if (OPENCV_BUILD_SHARED_LIB) + #add_definitions(-DCVAPI_EXPORTS) + set_target_properties(${the_target} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) +endif() + +# Additional target properties +set_target_properties(${the_target} PROPERTIES + DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" + INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" + ) + +# Add the required libraries for linking: +target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${DEPS} ) + +if (HAVE_CUDA) + target_link_libraries(${the_target} ${CUDA_LIBRARIES} ${CUDA_NPP_LIBRARIES}) + CUDA_ADD_CUFFT_TO_TARGET(${the_target}) +endif() + +if(MSVC) + if(CMAKE_CROSSCOMPILING) + set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk") + endif() + + set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc") +endif() + +# Dependencies of this target: +add_dependencies(${the_target} ${DEPS}) + +install(TARGETS ${the_target} + RUNTIME DESTINATION bin COMPONENT main + LIBRARY DESTINATION lib COMPONENT main + ARCHIVE DESTINATION lib COMPONENT main) + +install(FILES ${lib_hdrs} + DESTINATION include/opencv2/${name} + COMPONENT main) + +install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp + DESTINATION include/opencv2/${name} + COMPONENT main) + +#install(FILES ${lib_device_hdrs} +# DESTINATION include/opencv2/${name}/device +# COMPONENT main) + + +################################################################################################################ +################################ GPU Module Tests ##################################################### +################################################################################################################ + +# Test files processing is in the separated directory to avoid 'Src' source +# filter creation in Visual Studio +if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) + set(the_test_target "opencv_test_${name}") + + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" + "${CMAKE_CURRENT_SOURCE_DIR}/test" + "${CMAKE_CURRENT_BINARY_DIR}") + + set(test_deps opencv_${name} opencv_ts opencv_highgui opencv_calib3d ${DEPS}) + foreach(d ${test_deps}) + if(${d} MATCHES "opencv_") + if(${d} MATCHES "opencv_lapack") + else() + string(REPLACE "opencv_" "${CMAKE_CURRENT_SOURCE_DIR}/../" d_dir ${d}) + include_directories("${d_dir}/include") + endif() + endif() + endforeach() + + file(GLOB test_srcs "test/*.cpp") + file(GLOB test_hdrs "test/*.h*") + + source_group("Src" FILES ${test_hdrs} ${test_srcs}) + if(HAVE_CUDA) + include_directories(${CUDA_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/modules/gpu/src/nvidia ${CMAKE_SOURCE_DIR}/modules/gpu/src/nvidia/core ${CMAKE_SOURCE_DIR}/modules/gpu/src/nvidia/NPP_staging) + + file(GLOB nvidia "test/nvidia/*.cpp" "test/nvidia/*.h*") + source_group("Src\\NVidia" FILES ${nvidia}) + endif() + + + add_executable(${the_test_target} ${test_srcs} ${test_hdrs} ${nvidia}) + + if(PCHSupport_FOUND) + set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/test/test_precomp.hpp) + if(${CMAKE_GENERATOR} MATCHES "Visual*" OR ${CMAKE_GENERATOR} MATCHES "Xcode*") + if(${CMAKE_GENERATOR} MATCHES "Visual*") + set(${the_test_target}_pch "test/test_precomp.cpp") + endif() + add_native_precompiled_header(${the_test_target} ${pch_header}) + elseif(CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_GENERATOR} MATCHES ".*Makefiles") + add_precompiled_header(${the_test_target} ${pch_header}) + endif() + endif() + + # Additional target properties + set_target_properties(${the_test_target} PROPERTIES + DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" + ) + + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_test_target} PROPERTIES FOLDER "tests") + endif() + + add_dependencies(${the_test_target} ${test_deps}) + + # Add the required libraries for linking: + target_link_libraries(${the_test_target} ${OPENCV_LINKER_LIBS} ${test_deps}) + + enable_testing() + get_target_property(LOC ${the_test_target} LOCATION) + add_test(${the_test_target} "${LOC}") + + if(WIN32) + install(TARGETS ${the_test_target} RUNTIME DESTINATION bin COMPONENT main) + endif() +endif() diff --git a/modules/gpu/CMakeLists.txt_cuda4.0 b/modules/gpu/CMakeLists.txt_cuda4.0 index 26d42bc..c8e3383 100644 --- a/modules/gpu/CMakeLists.txt_cuda4.0 +++ b/modules/gpu/CMakeLists.txt_cuda4.0 @@ -40,7 +40,7 @@ if (HAVE_CUDA) #find_package(NPP 3.2.16 REQUIRED) #message(STATUS "NPP detected: " ${NPP_VERSION}) - include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_NPP_INCLUDES}) + include_directories(${CUDA_INCLUDE_DIRS}) if (UNIX OR APPLE) set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;") @@ -67,11 +67,11 @@ if (HAVE_CUDA) string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "/EHsc-" "/EHs" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") endif() - + if (OPENCV_BUILD_SHARED_LIB) set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-DCVAPI_EXPORTS") endif() - + CUDA_COMPILE(cuda_objs ${lib_cuda} ${ncv_cuda}) #CUDA_BUILD_CLEAN_TARGET() endif() @@ -103,6 +103,10 @@ set_target_properties(${the_target} PROPERTIES SOVERSION ${OPENCV_SOVERSION} OUTPUT_NAME "${the_target}${OPENCV_DLLVERSION}" ) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "modules") +endif() if (OPENCV_BUILD_SHARED_LIB) #add_definitions(-DCVAPI_EXPORTS) @@ -114,7 +118,7 @@ set_target_properties(${the_target} PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" - INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" + INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" ) # Add the required libraries for linking: @@ -123,7 +127,7 @@ target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${DEPS} ) if (HAVE_CUDA) target_link_libraries(${the_target} ${CUDA_LIBRARIES}) CUDA_ADD_CUFFT_TO_TARGET(${the_target}) - + unset(CUDA_npp_LIBRARY CACHE) find_cuda_helper_libs(npp) target_link_libraries(${the_target} ${CUDA_npp_LIBRARY}) @@ -164,7 +168,7 @@ install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp # Test files processing is in the separated directory to avoid 'Src' source # filter creation in Visual Studio -if(BUILD_TESTS AND NOT ANDROID AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) +if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) set(the_test_target "opencv_test_${name}") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" @@ -213,6 +217,10 @@ if(BUILD_TESTS AND NOT ANDROID AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test) DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" ) + + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_test_target} PROPERTIES FOLDER "tests") + endif() add_dependencies(${the_test_target} ${test_deps}) diff --git a/modules/haartraining/CMakeLists.txt b/modules/haartraining/CMakeLists.txt index 047c377..65a32ea 100644 --- a/modules/haartraining/CMakeLists.txt +++ b/modules/haartraining/CMakeLists.txt @@ -83,3 +83,10 @@ install(TARGETS opencv_haartraining RUNTIME DESTINATION bin COMPONENT main) install(TARGETS opencv_createsamples RUNTIME DESTINATION bin COMPONENT main) install(TARGETS opencv_performance RUNTIME DESTINATION bin COMPONENT main) endif() + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(opencv_performance PROPERTIES FOLDER "applications") + set_target_properties(opencv_createsamples PROPERTIES FOLDER "applications") + set_target_properties(opencv_haartraining PROPERTIES FOLDER "applications") + set_target_properties(opencv_haartraining_engine PROPERTIES FOLDER "applications") +endif() diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index c83613d..501814e 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -288,6 +288,11 @@ set_target_properties(${the_target} PROPERTIES LINK_INTERFACE_LIBRARIES "" ) +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "modules") +endif() + + if(MSVC) set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") endif(MSVC) diff --git a/modules/stitching/CMakeLists.txt b/modules/stitching/CMakeLists.txt index 3196ef2..6ff7e60 100644 --- a/modules/stitching/CMakeLists.txt +++ b/modules/stitching/CMakeLists.txt @@ -30,6 +30,10 @@ set_target_properties(${the_target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" OUTPUT_NAME "opencv_stitching") + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "applications") +endif() target_link_libraries(${the_target} ${stitching_libs}) diff --git a/modules/traincascade/CMakeLists.txt b/modules/traincascade/CMakeLists.txt index 382ff1f..5a530a7 100644 --- a/modules/traincascade/CMakeLists.txt +++ b/modules/traincascade/CMakeLists.txt @@ -34,6 +34,10 @@ set_target_properties(${the_target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" OUTPUT_NAME "opencv_traincascade") + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "applications") +endif() target_link_libraries(${the_target} ${traincascade_libs}) diff --git a/samples/c/CMakeLists.txt b/samples/c/CMakeLists.txt index 958275d..3b3fa10 100644 --- a/samples/c/CMakeLists.txt +++ b/samples/c/CMakeLists.txt @@ -39,6 +39,10 @@ if (BUILD_EXAMPLES) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_features2d opencv_calib3d opencv_legacy opencv_contrib) + + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "samples//c") + endif() if(WIN32) install(TARGETS ${the_target} diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index 4054a0f..e54fb96 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -39,6 +39,10 @@ if (BUILD_EXAMPLES) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_features2d opencv_calib3d opencv_legacy opencv_contrib) + + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "samples//cpp") + endif() if(WIN32) install(TARGETS ${the_target} diff --git a/samples/gpu/CMakeLists.txt b/samples/gpu/CMakeLists.txt index 7b39e6e..a1a16bf 100644 --- a/samples/gpu/CMakeLists.txt +++ b/samples/gpu/CMakeLists.txt @@ -41,6 +41,10 @@ if (BUILD_EXAMPLES) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_gpu) + + if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "samples//gpu") + endif() if(WIN32) install(TARGETS ${the_target} diff --git a/samples/gpu/performance/CMakeLists.txt b/samples/gpu/performance/CMakeLists.txt index 3a17b28..731ab29 100644 --- a/samples/gpu/performance/CMakeLists.txt +++ b/samples/gpu/performance/CMakeLists.txt @@ -16,6 +16,10 @@ add_dependencies(${the_target} opencv_core opencv_flann opencv_imgproc opencv_hi target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_features2d opencv_calib3d opencv_legacy opencv_contrib opencv_gpu) + +if(SOLUTION_FOLDERS_ENABLED) + set_target_properties(${the_target} PROPERTIES FOLDER "samples//gpu") +endif() if(WIN32) install(TARGETS ${the_target} RUNTIME DESTINATION "samples/gpu" COMPONENT main) -- 2.7.4