1 Star 1 Fork 0

sandman/fsrcnn_ov2021

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
CMakeLists.txt 5.44 KB
Copy Edit Raw Blame History
sandman authored 2021-01-28 16:35 . initial version
cmake_minimum_required(VERSION 2.6)
set (TARGET_NAME "ov-fsrcnn")
set( EXTRA_FILES src/kernels/vector_add_kernel.cl )
project(fsrcnn-ov2021)
if(IE_MAIN_SOURCE_DIR)
# in case if samples are built from IE repo
set(IE_MAIN_SAMPLES_DIR ${OpenVINO_MAIN_SOURCE_DIR})
# hint for find_package(InferenceEngine in the samples folder)
set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}")
else()
# in case if samples are built out of IE repo
set(IE_MAIN_SAMPLES_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
if(IE_NOT_FOUND_MESSAGE)
# the flag is used to throw a custom message in case if the IE package is not found.
find_package(InferenceEngine 2.1 QUIET)
if (NOT(InferenceEngine_FOUND))
message(FATAL_ERROR ${IE_NOT_FOUND_MESSAGE})
endif()
else()
find_package(InferenceEngine 2.1 REQUIRED)
endif()
# Find OpenCV components if exist
find_package(OpenCV COMPONENTS highgui QUIET)
if(NOT(OpenCV_FOUND))
message(WARNING "OPENCV is disabled or not found, " ${TARGET_NAME} " skipped")
return()
endif()
set( FFMPEG_INCLUDES "C:/temp_20151027/ffmpeg-4.3.1-2020-11-08-full_build-shared/include" )
set( FFMPEG_LIBRARY_PATHS "C:/temp_20151027/ffmpeg-4.3.1-2020-11-08-full_build-shared/lib" )
set( FFMPEG_LIBRARYS ${FFMPEG_LIBRARY_PATHS}/avcodec.lib ${FFMPEG_LIBRARY_PATHS}/avformat.lib ${FFMPEG_LIBRARY_PATHS}/avfilter.lib ${FFMPEG_LIBRARY_PATHS}/avutil.lib ${FFMPEG_LIBRARY_PATHS}/swscale.lib)
#message(STATUS "FFMPEG_LIB_PATH: ${FFMPEG_LIBRARYS_PATHS}")
#find_library( FFMPEG_LIBS
#NAMES avcodec avformat avutil swscale
# PATHS
# ${FFMPEG_LIBRARYS_PATHS}
#)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
# Determine machine bitness
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BITNESS 64)
else()
set(BITNESS 32)
endif()
# Find OpenCL include directories
find_path( OPENCL_INCLUDES
NAMES CL/cl.h OpenCL/cl.h
HINTS
$ENV{AMDAPPSDKROOT}/include
$ENV{INTELOCLSDKROOT}/include
$ENV{CUDA_PATH}/include
$ENV{OPENCL_ROOT}/include
PATHS
/usr/include
/usr/local/include
)
# Find OpenCL libraries
if(BITNESS EQUAL 64)
find_library( OPENCL_LIBS
NAMES OpenCL
HINTS
$ENV{AMDAPPSDKROOT}/lib
$ENV{INTELOCLSDKROOT}/lib
$ENV{CUDA_PATH}/lib
$ENV{OPENCL_ROOT}/lib
PATH_SUFFIXES x86_64 x64
PATHS
/usr/lib64
/usr/lib
/usr/local/lib
)
elseif(BITNESS EQUAL 32)
find_library( OPENCL_LIBS
NAMES OpenCL
HINTS
$ENV{AMDAPPSDKROOT}/lib
$ENV{INTELOCLSDKROOT}/lib
$ENV{CUDA_PATH}/lib
$ENV{OPENCL_ROOT}/lib
PATH_SUFFIXES x86 Win32
PATHS
/usr/lib32
/usr/lib
/usr/local/lib
)
endif()
if( (NOT OPENCL_INCLUDES) OR (NOT OPENCL_LIBS) )
message( FATAL_ERROR "Could not find OpenCL include/libs. Set OPENCL_ROOT to your OpenCL SDK. Download AMD APP SDK "
"http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ for x86/x64 "
"or pocl http://pocl.sourceforge.net/ for ARM systems" )
else()
message(STATUS "Selected OpenCL includes from ${OPENCL_INCLUDES}")
message(STATUS "Selected OpenCL lib ${OPENCL_LIBS}")
endif()
if(CMAKE_CXX_COMPILER MATCHES ".*clang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if(GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7 OR CMAKE_COMPILER_IS_CLANGXX)
add_definitions("-std=gnu++11")
elseif(GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3)
add_definitions("-std=gnu++0x")
else()
message(FATAL_ERROR "C++11 needed. Therefore a gcc compiler with a version higher than 4.3 is needed.")
endif()
add_definitions("-fPIC -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-parameter -Wno-ignored-attributes")
endif()
# override cl.hp from deps. Its buggy or not present in come systems
include_directories("deps/OpenCL-CLHPP/include/")
include_directories(${OPENCL_INCLUDES} "include" "src/kernels")
# directory of opencv headers
include_directories(${OpenCV_INCLUDE_DIRS} ${FFMPEG_INCLUDES} ${IE_INCLUDE_DIR})
set(SOURCE_FILES
src/main.cpp
)
# directory of opencv library
link_directories(${OpenCV_LIBRARY_DIRS} ${FFMPEG_LIBRARY_PATHS})
add_executable(${TARGET_NAME} ${SOURCE_FILES} ${EXTRA_FILES})
target_link_libraries(${TARGET_NAME} ${OPENCL_LIBS} ${OpenCV_LIBRARIES} ${FFMPEG_LIBRARYS} ${InferenceEngine_LIBRARIES})
#set_target_properties(${TARGET_NAME} PROPERTIES
# #VS_DEBUGGER_COMMAND "debug_command"
# VS_DEBUGGER_COMMAND_ARGUMENTS "0.mp4 1.mp4 w=3840:h=2160")
#SET(CMAKE_DEFAULT_STARTUP_PROJECT ${TARGET_NAME})
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${TARGET_NAME})
# Copy extra files to binary directory
foreach( extra_file ${EXTRA_FILES} )
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
# ${CMAKE_CURRENT_SOURCE_DIR}/${extra_file} $(OutputPath)
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${extra_file} ${PROJECT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${extra_file} $<TARGET_FILE_DIR:${TARGET_NAME}>
)
endforeach( extra_file )
# message("ISPC_FLAGS 111 = ${IMPORTED_LOCATION_RELEASE}")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/tisandman/fsrcnn_ov2021.git
git@gitee.com:tisandman/fsrcnn_ov2021.git
tisandman
fsrcnn_ov2021
fsrcnn_ov2021
master

Search