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
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
78 deletions
+32
-78
OpenCVModule.cmake
OpenCVModule.cmake
+27
-30
OpenCVPCHSupport.cmake
OpenCVPCHSupport.cmake
+0
-0
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
This diff is collapsed.
Click to expand it.
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