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
6d7f29a0
Commit
6d7f29a0
authored
Aug 08, 2013
by
Roman Donchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made it so that a dummy .cpp is actually created when compiling with VC++.
parent
d9f71b76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
OpenCVModule.cmake
cmake/OpenCVModule.cmake
+15
-3
OpenCVPCHSupport.cmake
cmake/OpenCVPCHSupport.cmake
+3
-10
No files found.
cmake/OpenCVModule.cmake
View file @
6d7f29a0
...
...
@@ -470,8 +470,16 @@ endmacro()
# ocv_create_module(<extra link dependencies>)
# ocv_create_module(SKIP_LINK)
macro
(
ocv_create_module
)
# The condition we ought to be testing here is whether ocv_add_precompiled_headers will
# be called at some point in the future. We can't look into the future, though,
# so this will have to do.
if
(
EXISTS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/precomp.hpp"
)
get_native_precompiled_header
(
${
the_module
}
precomp.hpp
)
endif
()
add_library
(
${
the_module
}
${
OPENCV_MODULE_TYPE
}
${
OPENCV_MODULE_
${
the_module
}
_HEADERS
}
${
OPENCV_MODULE_
${
the_module
}
_SOURCES
}
"
${
OPENCV_CONFIG_FILE_INCLUDE_DIR
}
/cvconfig.h"
"
${
OPENCV_CONFIG_FILE_INCLUDE_DIR
}
/opencv2/opencv_modules.hpp"
)
"
${
OPENCV_CONFIG_FILE_INCLUDE_DIR
}
/cvconfig.h"
"
${
OPENCV_CONFIG_FILE_INCLUDE_DIR
}
/opencv2/opencv_modules.hpp"
${${
the_module
}
_pch
}
)
if
(
NOT
"
${
ARGN
}
"
STREQUAL
"SKIP_LINK"
)
target_link_libraries
(
${
the_module
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS_EXT
}
${
OPENCV_LINKER_LIBS
}
${
IPP_LIBS
}
${
ARGN
}
)
...
...
@@ -637,7 +645,9 @@ function(ocv_add_perf_tests)
set
(
OPENCV_PERF_
${
the_module
}
_SOURCES
${
perf_srcs
}
${
perf_hdrs
}
)
endif
()
add_executable
(
${
the_target
}
${
OPENCV_PERF_
${
the_module
}
_SOURCES
}
)
get_native_precompiled_header
(
${
the_target
}
test_precomp.hpp
)
add_executable
(
${
the_target
}
${
OPENCV_PERF_
${
the_module
}
_SOURCES
}
${${
the_target
}
_pch
}
)
target_link_libraries
(
${
the_target
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
perf_deps
}
${
OPENCV_LINKER_LIBS
}
)
add_dependencies
(
opencv_perf_tests
${
the_target
}
)
...
...
@@ -685,7 +695,9 @@ function(ocv_add_accuracy_tests)
set
(
OPENCV_TEST_
${
the_module
}
_SOURCES
${
test_srcs
}
${
test_hdrs
}
)
endif
()
add_executable
(
${
the_target
}
${
OPENCV_TEST_
${
the_module
}
_SOURCES
}
)
get_native_precompiled_header
(
${
the_target
}
test_precomp.hpp
)
add_executable
(
${
the_target
}
${
OPENCV_TEST_
${
the_module
}
_SOURCES
}
${${
the_target
}
_pch
}
)
target_link_libraries
(
${
the_target
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
test_deps
}
${
OPENCV_LINKER_LIBS
}
)
add_dependencies
(
opencv_tests
${
the_target
}
)
...
...
cmake/OpenCVPCHSupport.cmake
View file @
6d7f29a0
...
...
@@ -272,12 +272,9 @@ ENDMACRO(ADD_PRECOMPILED_HEADER)
MACRO
(
GET_NATIVE_PRECOMPILED_HEADER _targetName _input
)
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
"
)
set
(
_dummy_str
"#include
\"
${
_input
}
\"\n
"
)
# Use of cxx extension for generated files (as Qt does)
SET
(
${
_targetName
}
_pch
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_targetName
}
_pch.cxx
)
set
(
${
_targetName
}
_pch
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
_targetName
}
_pch.cpp
)
if
(
EXISTS
${${
_targetName
}
_pch
}
)
# Check if contents is the same, if not rewrite
# todo
...
...
@@ -337,11 +334,7 @@ ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
macro
(
ocv_add_precompiled_header_to_target the_target pch_header
)
if
(
PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS
"
${
pch_header
}
"
)
if
(
CMAKE_GENERATOR MATCHES Visual
)
string
(
REGEX REPLACE
"hpp$"
"cpp"
${
the_target
}
_pch
"
${
pch_header
}
"
)
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
unset
(
${
the_target
}
_pch
)
elseif
(
CMAKE_GENERATOR MATCHES Xcode
)
if
(
CMAKE_GENERATOR MATCHES
"^Visual"
OR CMAKE_GENERATOR MATCHES Xcode
)
add_native_precompiled_header
(
${
the_target
}
${
pch_header
}
)
elseif
(
CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES
"Makefiles|Ninja"
)
add_precompiled_header
(
${
the_target
}
${
pch_header
}
)
...
...
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