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})
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)
status(" Video I/O: AVFoundation")
endif()
elseif(WIN32)
- status(" Video I/O:" HAVE_VIDEOINPUT THEN DirectShow ELSE NO)
+ status(" Video I/O:" HAVE_VIDEOINPUT THEN DirectShow ELSE NO)
endif()
# Other third-party libraries
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:
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}")
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()
set(${VAR} ${__tmp})
unset(__tmp)
endif()
-endmacro()
\ No newline at end of file
+endmacro()
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})
ocv_add_accuracy_tests()
ocv_add_perf_tests()
-
-
-
CV_EXPORTS int getNumThreads();
CV_EXPORTS int getThreadNum();
+CV_EXPORTS_W const std::string& getBuildInformation();
+
//! Returns the number of ticks.
/*!
#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];
--- /dev/null
+#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