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
3aea74d4
Commit
3aea74d4
authored
Jul 24, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed precompiled headers support (fixed formatting, fixed dependencies generation)
parent
22142246
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
153 deletions
+89
-153
OpenCVModule.cmake
OpenCVModule.cmake
+27
-30
OpenCVPCHSupport.cmake
OpenCVPCHSupport.cmake
+57
-75
CMakeLists.txt
modules/gpu/CMakeLists.txt
+3
-26
CMakeLists.txt
modules/highgui/CMakeLists.txt
+2
-22
No files found.
OpenCVModule.cmake
View file @
3aea74d4
#opencv precompiled headers macro (can add pch to modules and tests)
#this macro must be called after any "add_definitions" commands, otherwise precompiled headers will not work
macro
(
add_opencv_precompiled_headers the_target
)
if
(
the_target MATCHES opencv_test_
)
SET
(
pch_name
"test/test_precomp"
)
else
()
SET
(
pch_name
"src/precomp"
)
endif
()
set
(
pch_header
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
pch_name
}
.hpp"
)
if
(
PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS AND EXISTS
"
${
pch_header
}
"
)
if
(
CMAKE_GENERATOR MATCHES Visual
)
set
(
${
the_target
}
_pch
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
pch_name
}
.cpp"
)
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_GENERATOR MATCHES Xcode
)
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES Makefiles
)
add_precompiled_header
(
${
the_target
}
${
pch_header
}
)
endif
()
endif
()
endmacro
()
# this is template for a OpenCV module
macro
(
define_opencv_module name
)
...
...
@@ -8,20 +29,19 @@ macro(define_opencv_module name)
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
)
foreach
(
d
${
ARGN
}
)
if
(
${
d
}
MATCHES
"opencv_"
)
if
(
${
d
}
MATCHES
"opencv_lapack"
)
else
()
if
(
d MATCHES
"opencv_"
)
string
(
REPLACE
"opencv_"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../"
d_dir
${
d
}
)
include_directories
(
"
${
d_dir
}
/include"
)
endif
()
endif
()
endforeach
()
file
(
GLOB lib_srcs
"src/*.cpp"
)
file
(
GLOB lib_int_hdrs
"src/*.h*"
)
if
(
COMMAND get_module_external_sources
)
get_module_external_sources
(
${
name
}
)
endif
()
source_group
(
"Src"
FILES
${
lib_srcs
}
${
lib_int_hdrs
}
)
file
(
GLOB lib_hdrs
"include/opencv2/
${
name
}
/*.h*"
)
...
...
@@ -66,17 +86,7 @@ macro(define_opencv_module name)
INSTALL_NAME_DIR lib
)
if
(
PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS
)
set
(
pch_header
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/precomp.hpp
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
OR
${
CMAKE_GENERATOR
}
MATCHES
"Xcode*"
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
)
set
(
${
the_target
}
_pch
"src/precomp.cpp"
)
endif
()
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND
${
CMAKE_GENERATOR
}
MATCHES
".*Makefiles"
)
add_precompiled_header
(
${
the_target
}
${
pch_header
}
)
endif
()
endif
()
add_opencv_precompiled_headers
(
${
the_target
}
)
# Add the required libraries for linking:
target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
IPP_LIBS
}
${
ARGN
}
)
...
...
@@ -111,13 +121,10 @@ macro(define_opencv_module name)
set
(
test_deps opencv_
${
name
}
${
ARGN
}
opencv_ts opencv_highgui
${
EXTRA_
${
the_target
}
_DEPS
}
)
foreach
(
d
${
test_deps
}
)
if
(
${
d
}
MATCHES
"opencv_"
)
if
(
${
d
}
MATCHES
"opencv_lapack"
)
else
()
if
(
d MATCHES
"opencv_"
)
string
(
REPLACE
"opencv_"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../"
d_dir
${
d
}
)
include_directories
(
"
${
d_dir
}
/include"
)
endif
()
endif
()
endforeach
()
file
(
GLOB test_srcs
"test/*.cpp"
)
...
...
@@ -130,17 +137,7 @@ macro(define_opencv_module name)
add_executable
(
${
the_target
}
${
test_srcs
}
${
test_hdrs
}
)
if
(
PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS
)
set
(
pch_header
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/test_precomp.hpp
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
OR
${
CMAKE_GENERATOR
}
MATCHES
"Xcode*"
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
)
set
(
${
the_target
}
_pch
"test/test_precomp.cpp"
)
endif
()
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND
${
CMAKE_GENERATOR
}
MATCHES
".*Makefiles"
)
add_precompiled_header
(
${
the_target
}
${
pch_header
}
)
endif
()
endif
()
add_opencv_precompiled_headers
(
${
the_target
}
)
# Additional target properties
set_target_properties
(
${
the_target
}
PROPERTIES
...
...
OpenCVPCHSupport.cmake
View file @
3aea74d4
...
...
@@ -25,18 +25,15 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
SET
(
_PCH_include_prefix
"-I"
)
ELSE
()
IF
(
WIN32
)
ELSEIF
(
WIN32
)
SET
(
PCHSupport_FOUND TRUE
)
# for experimental msvc support
SET
(
_PCH_include_prefix
"/I"
)
ELSE
()
ELSE
()
SET
(
PCHSupport_FOUND FALSE
)
ENDIF
()
ENDIF
(
CMAKE_COMPILER_IS_GNUCXX
)
ENDIF
()
MACRO
(
_PCH_GET_COMPILE_FLAGS _out_compile_flags
)
STRING
(
TOUPPER
"CMAKE_CXX_FLAGS_
${
CMAKE_BUILD_TYPE
}
"
_flags_var_name
)
SET
(
${
_out_compile_flags
}
${${
_flags_var_name
}}
)
...
...
@@ -44,7 +41,7 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
GET_TARGET_PROPERTY
(
_targetType
${
_PCH_current_target
}
TYPE
)
IF
(
${
_targetType
}
STREQUAL SHARED_LIBRARY AND NOT WIN32
)
LIST
(
APPEND
${
_out_compile_flags
}
"
${${
_out_compile_flags
}}
-fPIC"
)
LIST
(
APPEND
${
_out_compile_flags
}
"
-fPIC"
)
ENDIF
()
ELSE
()
...
...
@@ -61,7 +58,7 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
#MESSAGE("_directory_flags ${_directory_flags} ${_global_definitions}" )
LIST
(
APPEND
${
_out_compile_flags
}
${
_directory_flags
}
)
LIST
(
APPEND
${
_out_compile_flags
}
${
_global_definitions
}
)
LIST
(
APPEND
${
_out_compile_flags
}
${
CMAKE_CXX_FLAGS
}
)
LIST
(
APPEND
${
_out_compile_flags
}
${
CMAKE_CXX_FLAGS
}
)
SEPARATE_ARGUMENTS
(
${
_out_compile_flags
}
)
...
...
@@ -71,13 +68,14 @@ ENDMACRO(_PCH_GET_COMPILE_FLAGS)
MACRO
(
_PCH_WRITE_PCHDEP_CXX _targetName _include_file _dephelp
)
SET
(
${
_dephelp
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_targetName
}
_pch_dephelp.cxx
)
FILE
(
WRITE
${${
_dephelp
}}
"#include
\"
${
_include_file
}
\"
int testfunction()
{
return 0;
}
"
ADD_CUSTOM_COMMAND
(
OUTPUT
"
${${
_dephelp
}}
"
COMMAND
${
CMAKE_COMMAND
}
-E echo
"#include
\\\"
${
_include_file
}
\\\"
"
>
"
${${
_dephelp
}}
"
COMMAND
${
CMAKE_COMMAND
}
-E echo
"int testfunction()"
>>
"
${${
_dephelp
}}
"
COMMAND
${
CMAKE_COMMAND
}
-E echo
"{"
>>
"
${${
_dephelp
}}
"
COMMAND
${
CMAKE_COMMAND
}
-E echo
" return 0;"
>>
"
${${
_dephelp
}}
"
COMMAND
${
CMAKE_COMMAND
}
-E echo
"}"
>>
"
${${
_dephelp
}}
"
DEPENDS
"
${
_include_file
}
"
)
ENDMACRO
(
_PCH_WRITE_PCHDEP_CXX
)
...
...
@@ -87,7 +85,6 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output)
FILE
(
TO_NATIVE_PATH
${
_input
}
_native_input
)
FILE
(
TO_NATIVE_PATH
${
_output
}
_native_output
)
IF
(
CMAKE_COMPILER_IS_GNUCXX
)
IF
(
CMAKE_CXX_COMPILER_ARG1
)
# remove leading space in compiler argument
...
...
@@ -116,7 +113,6 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output)
ENDMACRO
(
_PCH_GET_COMPILE_COMMAND
)
MACRO
(
_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn
)
FILE
(
TO_NATIVE_PATH
${
_pch_path
}
_native_pch_path
)
...
...
@@ -133,6 +129,7 @@ MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn )
ELSE
(
_dowarn
)
SET
(
${
_cflags
}
"
${
PCH_ADDITIONAL_COMPILER_FLAGS
}
-include
\"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_header_name
}
\"
"
)
ENDIF
(
_dowarn
)
ELSE
(
CMAKE_COMPILER_IS_GNUCXX
)
set
(
${
_cflags
}
"/Fp
${
_native_pch_path
}
/Yu
${
_header_name
}
"
)
...
...
@@ -141,10 +138,13 @@ MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn )
ENDMACRO
(
_PCH_GET_TARGET_COMPILE_FLAGS
)
MACRO
(
GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output
)
GET_FILENAME_COMPONENT
(
_name
${
_input
}
NAME
)
GET_FILENAME_COMPONENT
(
_path
${
_input
}
PATH
)
SET
(
_output
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
.gch/
${
_targetName
}
_
${
CMAKE_BUILD_TYPE
}
.gch"
)
SET
(
${
_output
}
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
.gch/
${
_targetName
}
_
${
CMAKE_BUILD_TYPE
}
.gch"
)
ENDMACRO
(
GET_PRECOMPILED_HEADER_OUTPUT _targetName _input
)
...
...
@@ -154,15 +154,14 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
# and _pch_output_to_use
GET_FILENAME_COMPONENT
(
_name
${
_input
}
NAME
)
IF
(
"
${
ARGN
}
"
STREQUAL
"0"
)
IF
(
ARGN
STREQUAL
"0"
)
SET
(
_dowarn 0
)
ELSE
(
"
${
ARGN
}
"
STREQUAL
"0"
)
ELSE
(
)
SET
(
_dowarn 1
)
ENDIF
(
"
${
ARGN
}
"
STREQUAL
"0"
)
ENDIF
()
_PCH_GET_TARGET_COMPILE_FLAGS
(
_target_cflags
${
_name
}
${
_pch_output_to_use
}
${
_dowarn
}
)
#
MESSAGE("Add flags ${_target_cflags} to ${_targetName} " )
#
MESSAGE("Add flags ${_target_cflags} to ${_targetName} " )
SET_TARGET_PROPERTIES
(
${
_targetName
}
PROPERTIES
COMPILE_FLAGS
${
_target_cflags
}
...
...
@@ -185,64 +184,53 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
"This is the ADD_PRECOMPILED_HEADER macro. "
"You must set CMAKE_BUILD_TYPE!"
)
ENDIF
(
NOT CMAKE_BUILD_TYPE
)
ENDIF
(
)
IF
(
"
${
ARGN
}
"
STREQUAL
"0"
)
IF
(
ARGN
STREQUAL
"0"
)
SET
(
_dowarn 0
)
ELSE
(
"
${
ARGN
}
"
STREQUAL
"0"
)
ELSE
(
)
SET
(
_dowarn 1
)
ENDIF
(
"
${
ARGN
}
"
STREQUAL
"0"
)
ENDIF
()
GET_FILENAME_COMPONENT
(
_name
${
_input
}
NAME
)
GET_FILENAME_COMPONENT
(
_path
${
_input
}
PATH
)
GET_PRECOMPILED_HEADER_OUTPUT
(
${
_targetName
}
${
_input
}
_output
)
GET_FILENAME_COMPONENT
(
_outdir
${
_output
}
PATH
)
GET_TARGET_PROPERTY
(
_targetType
${
_PCH_current_target
}
TYPE
)
_PCH_WRITE_PCHDEP_CXX
(
${
_targetName
}
${
_input
}
_pch_dephelp_cxx
)
_PCH_WRITE_PCHDEP_CXX
(
${
_targetName
}
"
${
_input
}
"
_pch_dephelp_cxx
)
IF
(
${
_targetType
}
STREQUAL SHARED_LIBRARY
)
ADD_LIBRARY
(
${
_targetName
}
_pch_dephelp STATIC
${
_pch_dephelp_cxx
}
)
ELSE
(
${
_targetType
}
STREQUAL SHARED_LIBRARY
)
ADD_LIBRARY
(
${
_targetName
}
_pch_dephelp STATIC
${
_pch_dephelp_cxx
}
)
ENDIF
(
${
_targetType
}
STREQUAL SHARED_LIBRARY
)
ADD_LIBRARY
(
${
_targetName
}
_pch_dephelp STATIC
"
${
_pch_dephelp_cxx
}
"
"
${
_input
}
"
)
set_target_properties
(
${
_targetName
}
_pch_dephelp PROPERTIES
DEBUG_POSTFIX
"
${
OPENCV_DEBUG_POSTFIX
}
"
ARCHIVE_OUTPUT_DIRECTORY
"
${
CMAKE_BINARY_DIR
}
/lib/
"
ARCHIVE_OUTPUT_DIRECTORY
"
${
LIBRARY_OUTPUT_PATH
}
"
)
FILE
(
MAKE_DIRECTORY
${
_outdir
}
)
_PCH_GET_COMPILE_FLAGS
(
_compile_FLAGS
)
#MESSAGE("_compile_FLAGS: ${_compile_FLAGS}")
#message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}")
SET_SOURCE_FILES_PROPERTIES
(
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
PROPERTIES GENERATED 1
)
ADD_CUSTOM_COMMAND
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
COMMAND
${
CMAKE_COMMAND
}
-E copy
${
_input
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
# ensure same directory! Required by gcc
DEPENDS
${
_input
}
OUTPUT
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
_input
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
"
# ensure same directory! Required by gcc
DEPENDS
"
${
_input
}
"
)
#message("_command ${_input} ${_output}")
_PCH_GET_COMPILE_COMMAND
(
_command
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
${
_output
}
)
#message(${_input} )
#message("_output ${_output}")
GET_FILENAME_COMPONENT
(
_outdir
${
_output
}
PATH
)
ADD_CUSTOM_COMMAND
(
OUTPUT
${
_output
}
OUTPUT
"
${
_output
}
"
COMMAND
${
CMAKE_COMMAND
}
-E make_directory
"
${
_outdir
}
"
COMMAND
${
_command
}
DEPENDS
${
_input
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
${
_targetName
}
_pch_dephelp
DEPENDS
"
${
_input
}
"
DEPENDS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_name
}
"
DEPENDS
${
_targetName
}
_pch_dephelp
)
ADD_PRECOMPILED_HEADER_TO_TARGET
(
${
_targetName
}
${
_input
}
${
_output
}
${
_dowarn
}
)
ENDMACRO
(
ADD_PRECOMPILED_HEADER
)
...
...
@@ -253,42 +241,42 @@ ENDMACRO(ADD_PRECOMPILED_HEADER)
MACRO
(
GET_NATIVE_PRECOMPILED_HEADER _targetName _input
)
if
(
CMAKE_GENERATOR MATCHES Visual*
)
if
(
CMAKE_GENERATOR MATCHES
"^Visual.*$"
)
SET
(
_dummy_str
"#include
\"
${
_input
}
\"\n
"
"// This is required to suppress LNK4221. Very annoying.
\n
"
"void *g_
${
_targetName
}
Dummy = 0
\;\n
"
)
"// This is required to suppress LNK4221. Very annoying.
\n
"
"void *g_
${
_targetName
}
Dummy = 0
\;\n
"
)
# Use of cxx extension for generated files (as Qt does)
SET
(
${
_targetName
}
_pch
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_targetName
}
_pch.cxx
)
if
(
EXISTS
${${
_targetName
}
_pch
}
)
# Check if contents is the same, if not rewrite
# todo
else
(
EXISTS
${${
_targetName
}
_pch
}
)
else
(
)
FILE
(
WRITE
${${
_targetName
}
_pch
}
${
_dummy_str
}
)
endif
(
EXISTS
${${
_targetName
}
_pch
}
)
endif
(
CMAKE_GENERATOR MATCHES Visual*
)
endif
(
)
endif
(
)
ENDMACRO
(
GET_NATIVE_PRECOMPILED_HEADER
)
MACRO
(
ADD_NATIVE_PRECOMPILED_HEADER _targetName _input
)
IF
(
"
${
ARGN
}
"
STREQUAL
"0"
)
IF
(
ARGN
STREQUAL
"0"
)
SET
(
_dowarn 0
)
ELSE
(
"
${
ARGN
}
"
STREQUAL
"0"
)
ELSE
(
)
SET
(
_dowarn 1
)
ENDIF
(
"
${
ARGN
}
"
STREQUAL
"0"
)
ENDIF
()
if
(
CMAKE_GENERATOR MATCHES
"^Visual.*$"
)
if
(
CMAKE_GENERATOR MATCHES Visual*
)
# Auto include the precompile (useful for moc processing, since the use of
# precompiled is specified at the target level
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
GET_TARGET_PROPERTY
(
oldProps
${
_targetName
}
COMPILE_FLAGS
)
if
(
${
oldProps
}
MATCHES NOTFOUND
)
if
(
oldProps
MATCHES NOTFOUND
)
SET
(
oldProps
""
)
endif
(
${
oldProps
}
MATCHES NOTFOUND
)
endif
(
)
SET
(
newProperties
"
${
oldProps
}
/Yu
\"
${
_input
}
\"
/FI
\"
${
_input
}
\"
"
)
SET_TARGET_PROPERTIES
(
${
_targetName
}
PROPERTIES COMPILE_FLAGS
"
${
newProperties
}
"
)
...
...
@@ -296,17 +284,11 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
#also inlude ${oldProps} to have the same compile options
SET_SOURCE_FILES_PROPERTIES
(
${${
_targetName
}
_pch
}
PROPERTIES COMPILE_FLAGS
"
${
oldProps
}
/Yc
\"
${
_input
}
\"
"
)
else
(
CMAKE_GENERATOR MATCHES Visual*
)
elseif
(
CMAKE_GENERATOR MATCHES Xcode
)
if
(
CMAKE_GENERATOR MATCHES Xcode
)
# For Xcode, cmake needs my patch to process
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
GET_TARGET_PROPERTY
(
oldProps
${
_targetName
}
COMPILE_FLAGS
)
if
(
${
oldProps
}
MATCHES NOTFOUND
)
SET
(
oldProps
""
)
endif
(
${
oldProps
}
MATCHES NOTFOUND
)
# When buiding out of the tree, precompiled may not be located
# Use full path instead.
GET_FILENAME_COMPONENT
(
fullPath
${
_input
}
ABSOLUTE
)
...
...
@@ -314,11 +296,11 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
SET_TARGET_PROPERTIES
(
${
_targetName
}
PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER
"
${
fullPath
}
"
)
SET_TARGET_PROPERTIES
(
${
_targetName
}
PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER
"YES"
)
else
(
CMAKE_GENERATOR MATCHES Xcode
)
else
(
)
#Fallback to the "old" precompiled suppport
#ADD_PRECOMPILED_HEADER(${_targetName} ${_input} ${_dowarn})
endif
(
CMAKE_GENERATOR MATCHES Xcode
)
endif
(
CMAKE_GENERATOR MATCHES Visual*
)
endif
(
)
ENDMACRO
(
ADD_NATIVE_PRECOMPILED_HEADER
)
modules/gpu/CMakeLists.txt
View file @
3aea74d4
...
...
@@ -85,18 +85,6 @@ endforeach()
add_library
(
${
the_target
}
${
lib_srcs
}
${
lib_hdrs
}
${
lib_int_hdrs
}
${
lib_cuda
}
${
lib_cuda_hdrs
}
${
lib_device_hdrs
}
${
ncv_srcs
}
${
ncv_hdrs
}
${
ncv_cuda
}
${
cuda_objs
}
)
if
(
PCHSupport_FOUND
)
set
(
pch_header
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/precomp.hpp
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
OR
${
CMAKE_GENERATOR
}
MATCHES
"Xcode*"
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
)
set
(
${
the_target
}
_pch
"src/precomp.cpp"
)
endif
()
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND
${
CMAKE_GENERATOR
}
MATCHES
".*Makefiles"
)
add_precompiled_header
(
${
the_target
}
${
pch_header
}
)
endif
()
endif
()
# For dynamic link numbering convenions
set_target_properties
(
${
the_target
}
PROPERTIES
VERSION
${
OPENCV_VERSION
}
...
...
@@ -116,6 +104,8 @@ if (BUILD_SHARED_LIBS)
endif
()
endif
()
add_opencv_precompiled_headers
(
${
the_target
}
)
# Additional target properties
set_target_properties
(
${
the_target
}
PROPERTIES
DEBUG_POSTFIX
"
${
OPENCV_DEBUG_POSTFIX
}
"
...
...
@@ -181,12 +171,9 @@ if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test)
set
(
test_deps opencv_
${
name
}
opencv_ts opencv_highgui opencv_calib3d
${
DEPS
}
)
foreach
(
d
${
test_deps
}
)
if
(
${
d
}
MATCHES
"opencv_"
)
if
(
${
d
}
MATCHES
"opencv_lapack"
)
else
()
string
(
REPLACE
"opencv_"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../"
d_dir
${
d
}
)
include_directories
(
"
${
d_dir
}
/include"
)
endif
()
endif
()
endforeach
()
file
(
GLOB test_srcs
"test/*.cpp"
)
...
...
@@ -203,17 +190,7 @@ if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test)
add_executable
(
${
the_test_target
}
${
test_srcs
}
${
test_hdrs
}
${
nvidia
}
)
if
(
PCHSupport_FOUND
)
set
(
pch_header
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/test_precomp.hpp
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
OR
${
CMAKE_GENERATOR
}
MATCHES
"Xcode*"
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
)
set
(
${
the_test_target
}
_pch
"test/test_precomp.cpp"
)
endif
()
add_native_precompiled_header
(
${
the_test_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND
${
CMAKE_GENERATOR
}
MATCHES
".*Makefiles"
)
add_precompiled_header
(
${
the_test_target
}
${
pch_header
}
)
endif
()
endif
()
add_opencv_precompiled_headers
(
${
the_test_target
}
)
# Additional target properties
set_target_properties
(
${
the_test_target
}
PROPERTIES
...
...
modules/highgui/CMakeLists.txt
View file @
3aea74d4
...
...
@@ -267,17 +267,7 @@ if (BUILD_SHARED_LIBS)
endif
()
endif
()
if
(
PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS
)
set
(
pch_header
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/precomp.hpp
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
OR
${
CMAKE_GENERATOR
}
MATCHES
"Xcode*"
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
)
set
(
${
the_target
}
_pch
"src/precomp.cpp"
)
endif
()
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND
${
CMAKE_GENERATOR
}
MATCHES
".*Makefiles"
)
add_precompiled_header
(
${
the_target
}
${
pch_header
}
)
endif
()
endif
()
add_opencv_precompiled_headers
(
${
the_target
}
)
# For dynamic link numbering convenions
if
(
NOT ANDROID
)
...
...
@@ -398,17 +388,7 @@ if(BUILD_TESTS)
add_executable
(
${
the_target
}
${
test_srcs
}
${
test_hdrs
}
)
if
(
PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS
)
set
(
pch_header
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/test_precomp.hpp
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
OR
${
CMAKE_GENERATOR
}
MATCHES
"Xcode*"
)
if
(
${
CMAKE_GENERATOR
}
MATCHES
"Visual*"
)
set
(
${
the_target
}
_pch
"test/test_precomp.cpp"
)
endif
()
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND
${
CMAKE_GENERATOR
}
MATCHES
".*Makefiles"
)
add_precompiled_header
(
${
the_target
}
${
pch_header
}
)
endif
()
endif
()
add_opencv_precompiled_headers
(
${
the_target
}
)
# Additional target properties
set_target_properties
(
${
the_target
}
PROPERTIES
...
...
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