diff --git a/CMake/cotire.cmake b/CMake/cotire.cmake index 7d6f6e4..02c5ce0 100644 --- a/CMake/cotire.cmake +++ b/CMake/cotire.cmake @@ -36,7 +36,7 @@ set(__COTIRE_INCLUDED TRUE) cmake_minimum_required(VERSION 2.8.5) set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}") -set (COTIRE_CMAKE_MODULE_VERSION "1.0.5") +set (COTIRE_CMAKE_MODULE_VERSION "1.0.6") include(CMakeParseArguments) @@ -409,7 +409,7 @@ function (cotire_get_target_compile_definitions _config _language _directory _ta string (TOUPPER "${_config}" _config) set (_configDefinitions "") # CMAKE_INTDIR for multi-configuration build systems - if (CMAKE_CONFIGURATION_TYPES) + if (NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") list (APPEND _configDefinitions "CMAKE_INTDIR=\"${_config}\"") endif() # target export define symbol @@ -1398,7 +1398,6 @@ function (cotire_generate_target_script _language _configurations _target _targe cotire_get_unity_source_dependencies(${_language} ${_target} COTIRE_TARGET_UNITY_DEPENDS) # set up variables to be configured set (COTIRE_TARGET_LANGUAGE "${_language}") - set (COTIRE_TARGET_CONFIGURATIONS "${_configurations}") cotire_determine_compiler_version("${COTIRE_TARGET_LANGUAGE}" COTIRE_${_language}_COMPILER) get_target_property(COTIRE_TARGET_IGNORE_PATH ${_target} COTIRE_PREFIX_HEADER_IGNORE_PATH) get_target_property(COTIRE_TARGET_INCLUDE_PATH ${_target} COTIRE_PREFIX_HEADER_INCLUDE_PATH) @@ -1436,7 +1435,8 @@ function (cotire_generate_target_script _language _configurations _target _targe list (REMOVE_ITEM _matchVars COTIRE_VERBOSE) set (_contents "") foreach (_var IN LISTS _matchVars ITEMS - MSVC CMAKE_GENERATOR CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER CMAKE_${_language}_SOURCE_FILE_EXTENSIONS) + MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES + CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER CMAKE_${_language}_SOURCE_FILE_EXTENSIONS) if (DEFINED ${_var}) string (REPLACE "\"" "\\\"" _value "${${_var}}") set (_contents "${_contents}set (${_var} \"${_value}\")\n") @@ -2214,8 +2214,12 @@ if (CMAKE_SCRIPT_MODE_FILE) set (_includeDirs ${COTIRE_TARGET_INCLUDE_DIRECTORIES_${COTIRE_BUILD_TYPE}}) set (_compileDefinitions ${COTIRE_TARGET_COMPILE_DEFINITIONS_${COTIRE_BUILD_TYPE}}) set (_compileFlags ${COTIRE_TARGET_COMPILE_FLAGS_${COTIRE_BUILD_TYPE}}) + if (NOT COTIRE_BUILD_TYPE) + # init COTIRE_BUILD_TYPE to first configuration type if not set explicitly + list (GET CMAKE_CONFIGURATION_TYPES 0 COTIRE_BUILD_TYPE) + endif() # check if target has been cotired for actual build type COTIRE_BUILD_TYPE - list (FIND COTIRE_TARGET_CONFIGURATIONS "${COTIRE_BUILD_TYPE}" _index) + list (FIND COTIRE_TARGET_CONFIGURATION_TYPES "${COTIRE_BUILD_TYPE}" _index) if (_index GREATER -1) set (_sources ${COTIRE_TARGET_SOURCES}) set (_sourcesDefinitions ${COTIRE_TARGET_SOURCES_COMPILE_DEFINITIONS_${COTIRE_BUILD_TYPE}}) diff --git a/HISTORY.md b/HISTORY.md index 1eef952..be36b83 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## 1.0.6 (2012-04-01) + +* correctly handle builds where both `CMAKE_BUILD_TYPE` and `CMAKE_CONFIGURATION_TYPES` are set. + ## 1.0.5 (2012-03-26) * fix Visual Studio C++ 2010 compilation of example project. diff --git a/Patches/OpenCV-2.3.1.patch b/Patches/OpenCV-2.3.1.patch new file mode 100644 index 0000000..43fc141 --- /dev/null +++ b/Patches/OpenCV-2.3.1.patch @@ -0,0 +1,299 @@ +diff -rupN OpenCV-2.3.1/3rdparty/libjasper/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libjasper/CMakeLists.txt +--- OpenCV-2.3.1/3rdparty/libjasper/CMakeLists.txt 2011-09-12 20:39:55.000000000 +0200 ++++ OpenCV-2.3.1.cotire/3rdparty/libjasper/CMakeLists.txt 2012-04-01 11:23:04.000000000 +0200 +@@ -56,3 +56,7 @@ if(NOT BUILD_SHARED_LIBS) + install(TARGETS ${the_target} + ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + endif() ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/3rdparty/libjpeg/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libjpeg/CMakeLists.txt +--- OpenCV-2.3.1/3rdparty/libjpeg/CMakeLists.txt 2011-09-12 20:40:15.000000000 +0200 ++++ OpenCV-2.3.1.cotire/3rdparty/libjpeg/CMakeLists.txt 2012-04-01 11:23:10.000000000 +0200 +@@ -48,3 +48,7 @@ if(NOT BUILD_SHARED_LIBS) + install(TARGETS ${the_target} + ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + endif() ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/3rdparty/libpng/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libpng/CMakeLists.txt +--- OpenCV-2.3.1/3rdparty/libpng/CMakeLists.txt 2011-09-12 20:40:02.000000000 +0200 ++++ OpenCV-2.3.1.cotire/3rdparty/libpng/CMakeLists.txt 2012-04-01 11:23:17.000000000 +0200 +@@ -49,3 +49,7 @@ if(NOT BUILD_SHARED_LIBS) + install(TARGETS ${the_target} + ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + endif() ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/3rdparty/libtiff/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libtiff/CMakeLists.txt +--- OpenCV-2.3.1/3rdparty/libtiff/CMakeLists.txt 2011-09-12 20:29:15.000000000 +0200 ++++ OpenCV-2.3.1.cotire/3rdparty/libtiff/CMakeLists.txt 2012-04-01 11:23:23.000000000 +0200 +@@ -103,3 +103,7 @@ if(NOT BUILD_SHARED_LIBS) + install(TARGETS ${the_target} + ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + endif() ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/3rdparty/zlib/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/zlib/CMakeLists.txt +--- OpenCV-2.3.1/3rdparty/zlib/CMakeLists.txt 2011-09-12 20:29:21.000000000 +0200 ++++ OpenCV-2.3.1.cotire/3rdparty/zlib/CMakeLists.txt 2012-04-01 11:24:36.000000000 +0200 +@@ -40,3 +40,7 @@ if(NOT BUILD_SHARED_LIBS) + install(TARGETS ${the_target} + ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + endif() ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/CMakeLists.txt OpenCV-2.3.1.cotire/CMakeLists.txt +--- OpenCV-2.3.1/CMakeLists.txt 2011-09-12 20:45:38.000000000 +0200 ++++ OpenCV-2.3.1.cotire/CMakeLists.txt 2012-04-01 14:34:56.000000000 +0200 +@@ -39,6 +39,8 @@ endif(NOT CMAKE_TOOLCHAIN_FILE) + cmake_minimum_required(VERSION 2.4) + project(OpenCV) + ++include("${CMAKE_SOURCE_DIR}/cotire.cmake") ++ + set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) + if(DEFINED CMAKE_BUILD_TYPE) + set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) +diff -rupN OpenCV-2.3.1/OpenCVModule.cmake OpenCV-2.3.1.cotire/OpenCVModule.cmake +--- OpenCV-2.3.1/OpenCVModule.cmake 2011-09-12 20:45:38.000000000 +0200 ++++ OpenCV-2.3.1.cotire/OpenCVModule.cmake 2012-04-01 11:26:16.000000000 +0200 +@@ -86,7 +86,7 @@ macro(define_opencv_module name) + INSTALL_NAME_DIR lib + ) + +- add_opencv_precompiled_headers(${the_target}) ++# add_opencv_precompiled_headers(${the_target}) + + # Add the required libraries for linking: + target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) +@@ -102,6 +102,10 @@ macro(define_opencv_module name) + ) + endif() + ++ if (COMMAND cotire) ++ cotire(${the_target}) ++ endif() ++ + # Dependencies of this target: + add_dependencies(${the_target} ${ARGN}) + +@@ -137,7 +141,7 @@ macro(define_opencv_module name) + + add_executable(${the_target} ${test_srcs} ${test_hdrs}) + +- add_opencv_precompiled_headers(${the_target}) ++# add_opencv_precompiled_headers(${the_target}) + + # Additional target properties + set_target_properties(${the_target} PROPERTIES +@@ -149,6 +153,10 @@ macro(define_opencv_module name) + set_target_properties(${the_target} PROPERTIES FOLDER "tests") + endif() + ++ if (COMMAND cotire) ++ cotire(${the_target}) ++ endif() ++ + add_dependencies(${the_target} ${test_deps}) + + # Add the required libraries for linking: +diff -rupN OpenCV-2.3.1/modules/androidcamera/CMakeLists.txt OpenCV-2.3.1.cotire/modules/androidcamera/CMakeLists.txt +--- OpenCV-2.3.1/modules/androidcamera/CMakeLists.txt 2011-09-12 20:42:03.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/androidcamera/CMakeLists.txt 2012-04-01 11:28:54.000000000 +0200 +@@ -52,3 +52,7 @@ if (NOT BUILD_ANDROID_CAMERA_WRAPPER) + COMPONENT main) + endforeach() + endif() ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/modules/androidcamera/camera_wrapper/CMakeLists.txt OpenCV-2.3.1.cotire/modules/androidcamera/camera_wrapper/CMakeLists.txt +--- OpenCV-2.3.1/modules/androidcamera/camera_wrapper/CMakeLists.txt 2011-09-12 20:42:03.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/androidcamera/camera_wrapper/CMakeLists.txt 2012-04-01 11:20:26.000000000 +0200 +@@ -34,3 +34,7 @@ SET_TARGET_PROPERTIES(${the_target} PROP + ) + + install(TARGETS ${the_target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main) ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/modules/gpu/CMakeLists.txt OpenCV-2.3.1.cotire/modules/gpu/CMakeLists.txt +--- OpenCV-2.3.1/modules/gpu/CMakeLists.txt 2011-09-12 20:42:20.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/gpu/CMakeLists.txt 2012-04-01 11:41:04.000000000 +0200 +@@ -106,7 +106,7 @@ if (BUILD_SHARED_LIBS) + endif() + endif() + +-add_opencv_precompiled_headers(${the_target}) ++#add_opencv_precompiled_headers(${the_target}) + + # Additional target properties + set_target_properties(${the_target} PROPERTIES +@@ -156,6 +156,9 @@ install(FILES src/nvidia/NPP_staging/NPP + # DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name}/device + # COMPONENT main) + ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() + + ################################################################################################################ + ################################ GPU Module Tests ##################################################### +@@ -192,14 +195,17 @@ if(BUILD_TESTS AND EXISTS ${CMAKE_CURREN + + add_executable(${the_test_target} ${test_srcs} ${test_hdrs} ${nvidia}) + +- add_opencv_precompiled_headers(${the_test_target}) ++# add_opencv_precompiled_headers(${the_test_target}) + + # Additional target properties + set_target_properties(${the_test_target} PROPERTIES + DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" + RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}" + ) +- ++ if (COMMAND cotire) ++ cotire(${the_test_target}) ++ endif() ++ + if(ENABLE_SOLUTION_FOLDERS) + set_target_properties(${the_test_target} PROPERTIES FOLDER "tests") + endif() +diff -rupN OpenCV-2.3.1/modules/haartraining/CMakeLists.txt OpenCV-2.3.1.cotire/modules/haartraining/CMakeLists.txt +--- OpenCV-2.3.1/modules/haartraining/CMakeLists.txt 2011-09-12 20:43:56.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/haartraining/CMakeLists.txt 2012-04-01 11:21:27.000000000 +0200 +@@ -45,6 +45,10 @@ set_target_properties(opencv_haartrainin + INSTALL_NAME_DIR lib + ) + ++if (COMMAND cotire) ++cotire(opencv_haartraining_engine) ++endif() ++ + if(NOT ANDROID) + # ----------------------------------------------------------- + # haartraining +diff -rupN OpenCV-2.3.1/modules/highgui/CMakeLists.txt OpenCV-2.3.1.cotire/modules/highgui/CMakeLists.txt +--- OpenCV-2.3.1/modules/highgui/CMakeLists.txt 2011-09-12 20:41:29.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/highgui/CMakeLists.txt 2012-04-01 12:17:12.000000000 +0200 +@@ -77,6 +77,10 @@ file(GLOB grfmt_srcs src/grfmt*.cpp) + set(grfmt_hdrs src/bitstrm.hpp ${grfmt_hdrs}) + set(grfmt_srcs src/bitstrm.cpp ${grfmt_srcs}) + ++if (COMMAND cotire) ++ set_source_files_properties (${grfmt_srcs} PROPERTIES COTIRE_EXCLUDED TRUE) ++endif() ++ + source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs}) + + set(highgui_srcs +@@ -209,6 +213,9 @@ if(APPLE) + else() + set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm) + endif() ++ if (COMMAND cotire) ++ set_source_files_properties (src/window_cocoa.mm src/cap_qtkit.mm PROPERTIES COTIRE_EXCLUDED TRUE) ++ endif() + endif(APPLE) + + if(WITH_ANDROID_CAMERA) +@@ -276,7 +283,7 @@ if (BUILD_SHARED_LIBS) + endif() + endif() + +-add_opencv_precompiled_headers(${the_target}) ++#add_opencv_precompiled_headers(${the_target}) + + # For dynamic link numbering convenions + if(NOT ANDROID) +@@ -307,6 +314,10 @@ if(MSVC) + set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") + endif(MSVC) + ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() ++ + # Dependencies of this target: + add_dependencies(${the_target} opencv_core opencv_imgproc) + +@@ -397,7 +408,7 @@ if(BUILD_TESTS) + + add_executable(${the_target} ${test_srcs} ${test_hdrs}) + +- add_opencv_precompiled_headers(${the_target}) ++# add_opencv_precompiled_headers(${the_target}) + + # Additional target properties + set_target_properties(${the_target} PROPERTIES +@@ -409,6 +420,10 @@ if(BUILD_TESTS) + set_target_properties(${the_target} PROPERTIES FOLDER "tests") + endif() + ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() ++ + add_dependencies(${the_target} ${test_deps}) + + # Add the required libraries for linking: +diff -rupN OpenCV-2.3.1/modules/java/CMakeLists.txt OpenCV-2.3.1.cotire/modules/java/CMakeLists.txt +--- OpenCV-2.3.1/modules/java/CMakeLists.txt 2011-09-12 20:40:26.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/java/CMakeLists.txt 2012-04-01 11:22:49.000000000 +0200 +@@ -163,6 +163,10 @@ set_target_properties(${target} PROPERTI + + install(TARGETS ${target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + ++if (COMMAND cotire) ++cotire(${target}) ++endif() ++ + if(ANDROID) + target_link_libraries(${target} jnigraphics) + +diff -rupN OpenCV-2.3.1/modules/python/CMakeLists.txt OpenCV-2.3.1.cotire/modules/python/CMakeLists.txt +--- OpenCV-2.3.1/modules/python/CMakeLists.txt 2011-09-12 20:40:30.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/python/CMakeLists.txt 2012-04-01 11:23:51.000000000 +0200 +@@ -92,3 +92,7 @@ install(TARGETS ${cvpymodules} + ARCHIVE DESTINATION ${CVPY_PATH} COMPONENT main + ) + install(FILES src2/cv.py DESTINATION ${CVPY_PATH} COMPONENT main) ++ ++if (COMMAND cotire) ++cotire(${cv2_target}) ++endif() +diff -rupN OpenCV-2.3.1/modules/stitching/CMakeLists.txt OpenCV-2.3.1.cotire/modules/stitching/CMakeLists.txt +--- OpenCV-2.3.1/modules/stitching/CMakeLists.txt 2011-09-12 20:42:22.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/stitching/CMakeLists.txt 2012-04-01 11:24:09.000000000 +0200 +@@ -38,3 +38,7 @@ endif() + target_link_libraries(${the_target} ${stitching_libs}) + + install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif() +diff -rupN OpenCV-2.3.1/modules/traincascade/CMakeLists.txt OpenCV-2.3.1.cotire/modules/traincascade/CMakeLists.txt +--- OpenCV-2.3.1/modules/traincascade/CMakeLists.txt 2011-09-12 20:40:17.000000000 +0200 ++++ OpenCV-2.3.1.cotire/modules/traincascade/CMakeLists.txt 2012-04-01 11:24:25.000000000 +0200 +@@ -44,3 +44,7 @@ target_link_libraries(${the_target} ${tr + if(NOT ANDROID) + install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) + endif() ++ ++if (COMMAND cotire) ++cotire(${the_target}) ++endif()