Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
1e1dc142
Commit
1e1dc142
authored
Mar 27, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6321 from mshabunin:hal_cmake
parents
481473eb
79ffaa8c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
31 deletions
+32
-31
CMakeLists.txt
CMakeLists.txt
+13
-17
README.md
samples/hal/README.md
+1
-2
CMakeLists.txt
samples/hal/c_hal/CMakeLists.txt
+4
-6
config.cmake
samples/hal/c_hal/config.cmake
+5
-0
CMakeLists.txt
samples/hal/slow_hal/CMakeLists.txt
+4
-6
config.cmake
samples/hal/slow_hal/config.cmake
+5
-0
No files found.
CMakeLists.txt
View file @
1e1dc142
...
...
@@ -603,27 +603,23 @@ endif()
include
(
cmake/OpenCVDetectVTK.cmake
)
# -- Custom HAL replacement --
# Package config in: OpenCV_HALConfig.cmake or opencv_hal-config.cmake
# Use variables: OpenCV_HAL_LIBRARIES, OpenCV_HAL_HEADERS and OpenCV_HAL_INCLUDE_DIRS variables
find_package
(
OpenCV_HAL CONFIG QUIET
)
set
(
_includes
""
)
# assuming OPENCV_HAL_HEADERS and OPENCV_HAL_LIBS are lists of files:
# option example: -DOPENCV_HAL_HEADERS="<some-path>/header1.h;<some-path>/header2.h"
if
(
OPENCV_HAL_HEADERS AND OPENCV_HAL_LIBS
)
foreach
(
h
${
OPENCV_HAL_HEADERS
}
)
get_filename_component
(
h
"
${
h
}
"
ABSOLUTE
)
set
(
_includes
"
${
_includes
}
\n
#include
\"
${
h
}
\"
"
)
endforeach
()
foreach
(
l
${
OPENCV_HAL_LIBS
}
)
if
(
OpenCV_HAL_FOUND
)
# 1. libraries
foreach
(
l
${
OpenCV_HAL_LIBRARIES
}
)
get_filename_component
(
l
"
${
l
}
"
ABSOLUTE
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
l
}
)
# TODO: install?
# ocv_install_target(${l} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
endforeach
()
else
()
set
(
_includes
"// using default HAL"
)
unset
(
OPENCV_HAL_HEADERS CACHE
)
unset
(
OPENCV_HAL_LIBS CACHE
)
# 2. headers
foreach
(
h
${
OpenCV_HAL_HEADERS
}
)
set
(
_includes
"
${
_includes
}
\n
#include
\"
${
h
}
\"
"
)
endforeach
()
# 3. include paths
ocv_include_directories
(
${
OpenCV_HAL_INCLUDE_DIRS
}
)
endif
()
set
(
OPENCV_HAL_HEADERS
"
${
OPENCV_HAL_HEADERS
}
"
CACHE STRING
"Headers with custom HAL implementation"
)
set
(
OPENCV_HAL_LIBS
"
${
OPENCV_HAL_LIBS
}
"
CACHE STRING
"Libraries with custom HAL implementation"
)
configure_file
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/templates/custom_hal.hpp.in"
"
${
CMAKE_BINARY_DIR
}
/custom_hal.hpp"
@ONLY
)
unset
(
_includes
)
...
...
@@ -1164,7 +1160,7 @@ endif(DEFINED WITH_VA_INTEL)
status
(
" Use Eigen:"
HAVE_EIGEN THEN
"YES (ver
${
EIGEN_WORLD_VERSION
}
.
${
EIGEN_MAJOR_VERSION
}
.
${
EIGEN_MINOR_VERSION
}
)"
ELSE NO
)
status
(
" Use Cuda:"
HAVE_CUDA THEN
"YES (ver
${
CUDA_VERSION_STRING
}
)"
ELSE NO
)
status
(
" Use OpenCL:"
HAVE_OPENCL THEN YES ELSE NO
)
status
(
" Use custom HAL:"
O
PENCV_HAL_HEADERS AND OPENCV_HAL_LIBS THEN
"YES (
${
OPENCV_HAL_HEADERS
}
;
${
OPENCV_HAL_LIBS
}
)"
ELSE
"NO"
)
status
(
" Use custom HAL:"
O
penCV_HAL_FOUND THEN
"YES (ver
${
OpenCV_HAL_VERSION
}
,
${
OpenCV_HAL_CONFIG
}
)"
ELSE
"NO"
)
if
(
HAVE_CUDA
)
status
(
""
)
...
...
samples/hal/README.md
View file @
1e1dc142
...
...
@@ -23,8 +23,7 @@ Build OpenCV with HAL replacement
2.
Go to the created folder and run cmake:
```
cmake
\
-DOPENCV_HAL_HEADERS="
<opencv-src>
/samples/hal/slow_hal/impl.hpp"
\
-DOPENCV_HAL_LIBS="
<home-dir>
/my-hal-build/libslow_hal.a"
\
-DOpenCV_HAL_DIR="
<home-dir>
/my-hal-build/"
\
<opencv-src>
```
3. Run make (or `make opencv_perf_core` to build the demonstration test executable only)
...
...
samples/hal/c_hal/CMakeLists.txt
View file @
1e1dc142
cmake_minimum_required
(
VERSION 2.8.8 FATAL_ERROR
)
if
(
UNIX
)
if
(
CMAKE_COMPILER_IS_GNUC OR CV_ICC
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fPIC"
)
endif
()
endif
()
add_library
(
c_hal impl.c
)
set_target_properties
(
c_hal PROPERTIES POSITION_INDEPENDENT_CODE TRUE
)
set
(
OPENCV_SRC_DIR
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../.."
)
target_include_directories
(
c_hal PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
${
OPENCV_SRC_DIR
}
/modules/core/include
)
configure_file
(
"impl.h"
"
${
CMAKE_BINARY_DIR
}
/impl.h"
COPYONLY
)
configure_file
(
"config.cmake"
"
${
CMAKE_BINARY_DIR
}
/OpenCV_HALConfig.cmake"
COPYONLY
)
samples/hal/c_hal/config.cmake
0 → 100644
View file @
1e1dc142
set
(
OpenCV_HAL_FOUND TRUE
)
set
(
OpenCV_HAL_VERSION
"0.0.1"
)
set
(
OpenCV_HAL_LIBRARIES
"
${
CMAKE_CURRENT_LIST_DIR
}
/libc_hal.a"
)
set
(
OpenCV_HAL_HEADERS
"impl.h"
)
set
(
OpenCV_HAL_INCLUDE_DIRS
"
${
CMAKE_CURRENT_LIST_DIR
}
"
)
samples/hal/slow_hal/CMakeLists.txt
View file @
1e1dc142
cmake_minimum_required
(
VERSION 2.8.8 FATAL_ERROR
)
if
(
UNIX
)
if
(
CMAKE_COMPILER_IS_GNUCXX OR CV_ICC
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fPIC"
)
endif
()
endif
()
add_library
(
slow_hal impl.cpp
)
set_target_properties
(
slow_hal PROPERTIES POSITION_INDEPENDENT_CODE TRUE
)
set
(
OPENCV_SRC_DIR
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../.."
)
target_include_directories
(
slow_hal PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
${
OPENCV_SRC_DIR
}
/modules/core/include
)
configure_file
(
"impl.hpp"
"
${
CMAKE_BINARY_DIR
}
/impl.hpp"
COPYONLY
)
configure_file
(
"config.cmake"
"
${
CMAKE_BINARY_DIR
}
/OpenCV_HALConfig.cmake"
COPYONLY
)
samples/hal/slow_hal/config.cmake
0 → 100644
View file @
1e1dc142
set
(
OpenCV_HAL_FOUND TRUE
)
set
(
OpenCV_HAL_VERSION
"0.0.1"
)
set
(
OpenCV_HAL_LIBRARIES
"
${
CMAKE_CURRENT_LIST_DIR
}
/libslow_hal.a"
)
set
(
OpenCV_HAL_HEADERS
"impl.hpp"
)
set
(
OpenCV_HAL_INCLUDE_DIRS
"
${
CMAKE_CURRENT_LIST_DIR
}
"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment