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
1c1c6b98
Commit
1c1c6b98
authored
Apr 06, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#645 Added cv::getBuildInformation function (with sample) to get OpenCV build configuration
parent
89338a38
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
11 deletions
+66
-11
CMakeLists.txt
CMakeLists.txt
+5
-2
OpenCVUtils.cmake
cmake/OpenCVUtils.cmake
+15
-5
CMakeLists.txt
modules/core/CMakeLists.txt
+7
-4
core.hpp
modules/core/include/opencv2/core/core.hpp
+2
-0
system.cpp
modules/core/src/system.cpp
+8
-0
opencv_version.cpp
samples/cpp/opencv_version.cpp
+29
-0
No files found.
CMakeLists.txt
View file @
1c1c6b98
...
...
@@ -667,9 +667,12 @@ endif()
status
(
""
)
status
(
" C++:"
)
status
(
" Built as dynamic libs?:"
BUILD_SHARED_LIBS THEN YES ELSE NO
)
status
(
" C++ Compiler:"
CMAKE_COMPILER THEN
"
${
CMAKE_COMPILER
}
"
ELSE
"
${
CMAKE_CXX_COMPILER
}
"
)
status
(
" C++ Compiler:"
${
CMAKE_CXX_COMPILER
}
)
status
(
" C++ flags (Release):"
${
CMAKE_CXX_FLAGS
}
${
CMAKE_CXX_FLAGS_RELEASE
}
)
status
(
" C++ flags (Debug):"
${
CMAKE_CXX_FLAGS
}
${
CMAKE_CXX_FLAGS_DEBUG
}
)
status
(
" C Compiler:"
${
CMAKE_C_COMPILER
}
)
status
(
" C flags (Release):"
${
CMAKE_C_FLAGS
}
${
CMAKE_C_FLAGS_RELEASE
}
)
status
(
" C flags (Debug):"
${
CMAKE_C_FLAGS
}
${
CMAKE_C_FLAGS_DEBUG
}
)
if
(
WIN32
)
status
(
" Linker flags (Release):"
${
CMAKE_EXE_LINKER_FLAGS
}
${
CMAKE_EXE_LINKER_FLAGS_RELEASE
}
)
status
(
" Linker flags (Debug):"
${
CMAKE_EXE_LINKER_FLAGS
}
${
CMAKE_EXE_LINKER_FLAGS_DEBUG
}
)
...
...
@@ -770,7 +773,7 @@ else()
status
(
" JPEG 2000:"
"NO"
)
endif
()
status
(
" OpenEXR:"
WITH_OPENEXR AND OPENEXR_FOUND THEN
YES
ELSE NO
)
status
(
" OpenEXR:"
WITH_OPENEXR AND OPENEXR_FOUND THEN
${
OPENEXR_LIBRARIES
}
ELSE NO
)
status
(
" OpenNI:"
HAVE_OPENNI THEN YES ELSE NO
)
status
(
" OpenNI PrimeSensor Modules:"
HAVE_OPENNI_PRIME_SENSOR_MODULE THEN YES ELSE NO
)
...
...
cmake/OpenCVUtils.cmake
View file @
1c1c6b98
...
...
@@ -104,6 +104,16 @@ macro(CHECK_MODULE module_name define)
endmacro
()
set
(
OPENCV_BUILD_INFO_FILE
"
${
OpenCV_BINARY_DIR
}
/version_string.tmp"
)
file
(
REMOVE
"
${
OPENCV_BUILD_INFO_FILE
}
"
)
function
(
ocv_output_status msg
)
message
(
STATUS
"
${
msg
}
"
)
if
(
msg MATCHES
"
\"
"
)
string
(
REPLACE
"
\"
"
"
\\\"
"
msg
"
${
msg
}
"
)
endif
()
file
(
APPEND
"
${
OPENCV_BUILD_INFO_FILE
}
"
"
\"
${
msg
}
\\
n
\"\n
"
)
endfunction
()
# Status report function.
# Automatically align right column and selects text based on condition.
# Usage:
...
...
@@ -133,7 +143,7 @@ function(status text)
if
(
status_text_length LESS status_placeholder_length
)
string
(
SUBSTRING
"
${
text
}${
status_placeholder
}
"
0
${
status_placeholder_length
}
status_text
)
elseif
(
DEFINED status_then OR DEFINED status_else
)
message
(
STATUS
"
${
text
}
"
)
ocv_output_status
(
"
${
text
}
"
)
set
(
status_text
"
${
status_placeholder
}
"
)
else
()
set
(
status_text
"
${
text
}
"
)
...
...
@@ -142,17 +152,17 @@ function(status text)
if
(
DEFINED status_then OR DEFINED status_else
)
if
(
${
status_cond
}
)
string
(
REPLACE
";"
" "
status_then
"
${
status_then
}
"
)
message
(
STATUS
"
${
status_text
}
"
"
${
status_then
}
"
)
ocv_output_status
(
"
${
status_text
}
${
status_then
}
"
)
else
()
string
(
REPLACE
";"
" "
status_else
"
${
status_else
}
"
)
message
(
STATUS
"
${
status_text
}
"
"
${
status_else
}
"
)
ocv_output_status
(
"
${
status_text
}
${
status_else
}
"
)
endif
()
else
()
string
(
REPLACE
";"
" "
status_cond
"
${
status_cond
}
"
)
message
(
STATUS
"
${
status_text
}
"
"
${
status_cond
}
"
)
ocv_output_status
(
"
${
status_text
}
${
status_cond
}
"
)
endif
()
else
()
message
(
STATUS
"
${
text
}
"
)
ocv_output_status
(
"
${
text
}
"
)
endif
()
endfunction
()
...
...
modules/core/CMakeLists.txt
View file @
1c1c6b98
...
...
@@ -16,7 +16,13 @@ else()
set
(
cuda_link_libs
""
)
endif
()
ocv_glob_module_sources
(
SOURCES
${
lib_cuda
}
${
cuda_objs
}
)
set
(
OPENCV_VERSION_FILE
"
${
opencv_core_BINARY_DIR
}
/version_string.inc"
)
add_custom_command
(
OUTPUT
"
${
OPENCV_VERSION_FILE
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
${
OPENCV_BUILD_INFO_FILE
}
"
"
${
OPENCV_VERSION_FILE
}
"
MAIN_DEPENDENCY
"
${
OPENCV_BUILD_INFO_FILE
}
"
COMMENT
""
)
ocv_glob_module_sources
(
SOURCES
${
lib_cuda
}
${
cuda_objs
}
"
${
OPENCV_VERSION_FILE
}
"
)
ocv_create_module
(
${
cuda_link_libs
}
)
ocv_add_precompiled_headers
(
${
the_module
}
)
...
...
@@ -24,6 +30,3 @@ ocv_add_precompiled_headers(${the_module})
ocv_add_accuracy_tests
()
ocv_add_perf_tests
()
modules/core/include/opencv2/core/core.hpp
View file @
1c1c6b98
...
...
@@ -218,6 +218,8 @@ CV_EXPORTS void setNumThreads(int nthreads);
CV_EXPORTS
int
getNumThreads
();
CV_EXPORTS
int
getThreadNum
();
CV_EXPORTS_W
const
std
::
string
&
getBuildInformation
();
//! Returns the number of ticks.
/*!
...
...
modules/core/src/system.cpp
View file @
1c1c6b98
...
...
@@ -410,6 +410,14 @@ int getNumberOfCPUs(void)
#endif
}
const
std
::
string
&
getBuildInformation
()
{
static
std
::
string
build_info
=
#include "version_string.inc"
;
return
build_info
;
}
string
format
(
const
char
*
fmt
,
...
)
{
char
buf
[
1
<<
16
];
...
...
samples/cpp/opencv_version.cpp
0 → 100644
View file @
1c1c6b98
#include "opencv2/core/core.hpp"
#include <iostream>
const
char
*
keys
=
{
"{ b |build |false | print complete build info }"
"{ h |help |false | print this help }"
};
int
main
(
int
argc
,
const
char
*
argv
[])
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
keys
);
if
(
parser
.
get
<
bool
>
(
"help"
))
{
parser
.
printParams
();
}
else
if
(
parser
.
get
<
bool
>
(
"build"
))
{
std
::
cout
<<
cv
::
getBuildInformation
()
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"OpenCV "
<<
CV_VERSION
<<
std
::
endl
;
}
return
0
;
}
\ No newline at end of file
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