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
d068ec3a
Commit
d068ec3a
authored
Jun 09, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11734 from alalek:opencv_version_win32
parents
8221f57c
95360a55
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
25 deletions
+58
-25
CMakeLists.txt
apps/version/CMakeLists.txt
+25
-8
opencv_version.cpp
apps/version/opencv_version.cpp
+33
-17
No files found.
apps/version/CMakeLists.txt
View file @
d068ec3a
SET
(
OPENCV_APPLICATION_DEPS opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio
)
set
(
OPENCV_APPLICATION_DEPS opencv_core
)
ocv_check_dependencies
(
${
OPENCV_APPLICATION_DEPS
}
)
if
(
NOT OCV_DEPENDENCIES_FOUND
)
return
()
endif
()
project
(
opencv_version
)
set
(
the_target opencv_version
)
ocv_target_include_directories
(
${
the_target
}
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"
${
OpenCV_SOURCE_DIR
}
/include/opencv"
)
ocv_target_include_modules_recurse
(
${
the_target
}
${
OPENCV_APPLICATION_DEPS
}
)
file
(
GLOB SRCS *.cpp
)
ocv_add_executable
(
${
the_target
}
${
SRCS
}
)
ocv_add_executable
(
${
the_target
}
opencv_version.cpp
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_APPLICATION_DEPS
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
...
...
@@ -30,3 +24,26 @@ if(INSTALL_CREATE_DISTRIB)
else
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
${
OPENCV_BIN_INSTALL_PATH
}
COMPONENT libs
)
endif
()
if
(
WIN32
)
project
(
opencv_version_win32
)
set
(
the_target opencv_version_win32
)
ocv_target_include_modules_recurse
(
${
the_target
}
${
OPENCV_APPLICATION_DEPS
}
)
ocv_add_executable
(
${
the_target
}
opencv_version.cpp
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_APPLICATION_DEPS
}
)
target_compile_definitions
(
${
the_target
}
PRIVATE
"OPENCV_WIN32_API=1"
)
set_target_properties
(
${
the_target
}
PROPERTIES
DEBUG_POSTFIX
"
${
OPENCV_DEBUG_POSTFIX
}
"
RUNTIME_OUTPUT_DIRECTORY
${
EXECUTABLE_OUTPUT_PATH
}
OUTPUT_NAME
"opencv_version_win32"
)
set_target_properties
(
${
the_target
}
PROPERTIES FOLDER
"applications"
)
if
(
INSTALL_CREATE_DISTRIB
)
if
(
BUILD_SHARED_LIBS
)
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
${
OPENCV_BIN_INSTALL_PATH
}
CONFIGURATIONS Release COMPONENT libs
)
endif
()
else
()
install
(
TARGETS
${
the_target
}
RUNTIME DESTINATION
${
OPENCV_BIN_INSTALL_PATH
}
COMPONENT libs
)
endif
()
endif
()
apps/version/opencv_version.cpp
View file @
d068ec3a
...
...
@@ -9,6 +9,31 @@
#include <opencv2/core/opencl/opencl_info.hpp>
#ifdef OPENCV_WIN32_API
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
static
void
dumpHWFeatures
(
bool
showAll
=
false
)
{
std
::
cout
<<
"OpenCV's HW features list:"
<<
std
::
endl
;
int
count
=
0
;
for
(
int
i
=
0
;
i
<
CV_HARDWARE_MAX_FEATURE
;
i
++
)
{
cv
::
String
name
=
cv
::
getHardwareFeatureName
(
i
);
if
(
name
.
empty
())
continue
;
bool
enabled
=
cv
::
checkHardwareSupport
(
i
);
if
(
enabled
)
count
++
;
if
(
enabled
||
showAll
)
{
printf
(
" ID=%3d (%s) -> %s
\n
"
,
i
,
name
.
c_str
(),
enabled
?
"ON"
:
"N/A"
);
}
}
std
::
cout
<<
"Total available: "
<<
count
<<
std
::
endl
;
}
int
main
(
int
argc
,
const
char
**
argv
)
{
CV_TRACE_FUNCTION
();
...
...
@@ -16,6 +41,7 @@ int main(int argc, const char** argv)
CV_TRACE_ARG_VALUE
(
argv0
,
"argv0"
,
argv
[
0
]);
CV_TRACE_ARG_VALUE
(
argv1
,
"argv1"
,
argv
[
1
]);
#ifndef OPENCV_WIN32_API
cv
::
CommandLineParser
parser
(
argc
,
argv
,
"{ help h usage ? | | show this help message }"
"{ verbose v | | show build configuration log }"
...
...
@@ -45,24 +71,14 @@ int main(int argc, const char** argv)
if
(
parser
.
has
(
"hw"
))
{
bool
showAll
=
parser
.
get
<
bool
>
(
"hw"
);
std
::
cout
<<
"OpenCV's HW features list:"
<<
std
::
endl
;
int
count
=
0
;
for
(
int
i
=
0
;
i
<
CV_HARDWARE_MAX_FEATURE
;
i
++
)
{
cv
::
String
name
=
cv
::
getHardwareFeatureName
(
i
);
if
(
name
.
empty
())
continue
;
bool
enabled
=
cv
::
checkHardwareSupport
(
i
);
if
(
enabled
)
count
++
;
if
(
enabled
||
showAll
)
{
printf
(
" ID=%3d (%s) -> %s
\n
"
,
i
,
name
.
c_str
(),
enabled
?
"ON"
:
"N/A"
);
}
}
std
::
cout
<<
"Total available: "
<<
count
<<
std
::
endl
;
dumpHWFeatures
(
parser
.
get
<
bool
>
(
"hw"
));
}
#else
std
::
cout
<<
cv
::
getBuildInformation
().
c_str
()
<<
std
::
endl
;
cv
::
dumpOpenCLInformation
();
dumpHWFeatures
();
MessageBoxA
(
NULL
,
"Check console window output"
,
"OpenCV("
CV_VERSION
")"
,
MB_ICONINFORMATION
|
MB_OK
);
#endif
return
0
;
}
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