forked from rgiduthuri/openvx_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
105 lines (99 loc) · 4.86 KB
/
CMakeLists.txt
File metadata and controls
105 lines (99 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright (c) 2016 The Khronos Group Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and/or associated documentation files (the
# "Materials"), to deal in the Materials without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Materials, and to
# permit persons to whom the Materials are furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Materials.
#
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
# Author: Radhakrishna Giduthuri (radha.giduthuri@ieee.org)
#
# Supported cmake variables and CACHE entries:
# OpenVX_SOURCE_DIR -- OpenVX open source folder with CMakeLists.txt
# OpenVX_LIBS -- list of OpenVX libraries
# OpenVX_LIBS_DIR -- path to OpenVX libraries
# OpenVX_INCLUDE_DIRS -- path to non-khronos OpenVX header files (optional)
#
# Here are few examples:
# * Build exerciese using an open source implementation without using OpenCL
# % pushd .../openvx_tutorial/tutorial_exercises
# % git clone https://github.com/GPUOpen-ProfessionalCompute-Libraries/amdovx-core
# % popd
# % cmake -DOpenVX_SOURCE_DIR=amdovx-core/openvx \
# -DCMAKE_DISABLE_FIND_PACKAGE_OpenCL=TRUE \
# .../openvx_tutorial/tutorial_exercises
# * Build exerciese using a 3rd-party OpenVX library
# % cmake -DOpenVX_LIBS_DIR=<path-to-openvx-libraries> \
# -DOpenVX_LIBS=<list-of-openvx-libraries> \
# .../openvx_tutorial/tutorial_exercises
cmake_minimum_required ( VERSION 2.8 )
project ( tutorial_exercises )
if( POLICY CMP0054 )
cmake_policy( SET CMP0054 OLD )
endif()
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" )
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE} )
else()
set ( CMAKE_MACOSX_RPATH ON )
endif()
# by default, use open-source OpenVX without OpenCL
if( NOT OpenVX_LIBS_DIR )
if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
if( ${CPUINFO} MATCHES "sse4_2" )
set(SSE4_2_FOUND true CACHE BOOL "SSE4.2 available on host")
else()
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
endif()
elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE CPUINFO)
if( ${CPUINFO} MATCHES "SSE4.2" )
set(SSE4_2_FOUND true CACHE BOOL "SSE4.2 available on host")
else()
set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
endif()
endif()
if( SSE4_2_FOUND )
set ( OpenVX_SOURCE_DIR amdovx-core/openvx CACHE INTERNAL OpenVX_SOURCE_DIR )
if( EXISTS ${CMAKE_SOURCE_DIR}/${OpenVX_SOURCE_DIR} )
set ( OpenVX_LIBS openvx CACHE INTERNAL OpenVX_LIBS )
set ( CMAKE_DISABLE_FIND_PACKAGE_OpenCL TRUE CACHE INTERNAL CMAKE_DISABLE_FIND_PACKAGE_OpenCL )
endif()
endif( SSE4_2_FOUND )
endif()
if( OpenVX_SOURCE_DIR AND EXISTS ${CMAKE_SOURCE_DIR}/${OpenVX_SOURCE_DIR} )
add_subdirectory ( ${OpenVX_SOURCE_DIR} )
if( NOT OpenVX_LIBS )
set ( OpenVX_LIBS openvx CACHE INTERNAL OpenVX_LIBS )
endif()
elseif( NOT OpenVX_LIBS_DIR )
set ( OpenVX_SAMPLE /home/openvx/openvx_sample/install/Linux/x64 )
set ( OpenVX_LIBS openvx vxu CACHE INTERNAL OpenVX_LIBS )
if( CMAKE_BUILD_TYPE MATCHES ".*Deb.*" )
set ( OpenVX_LIBS_DIR ${OpenVX_SAMPLE}/Debug/bin CACHE INTERNAL OpenVX_LIBPATH )
else( CMAKE_BUILD_TYPE MATCHES ".*Deb.*" )
set ( OpenVX_LIBS_DIR ${OpenVX_SAMPLE}/Release/bin CACHE INTERNAL OpenVX_LIBPATH )
endif( CMAKE_BUILD_TYPE MATCHES ".*Deb.*" )
endif()
add_subdirectory ( exercise1 )
add_subdirectory ( exercise2 )
add_subdirectory ( exercise2a )
add_subdirectory ( exercise3 )
add_subdirectory ( exercise4 )
add_subdirectory ( solution_exercise1 )
add_subdirectory ( solution_exercise2 )
add_subdirectory ( solution_exercise2a )
add_subdirectory ( solution_exercise3 )
add_subdirectory ( solution_exercise4 )