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
3f224abb
Commit
3f224abb
authored
Nov 22, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7646 from alalek:cmake_ccache
parents
9638dfcd
14d2046f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
CMakeLists.txt
CMakeLists.txt
+2
-0
OpenCVCompilerOptions.cmake
cmake/OpenCVCompilerOptions.cmake
+30
-0
OpenCVDetectCXXCompiler.cmake
cmake/OpenCVDetectCXXCompiler.cmake
+0
-4
No files found.
CMakeLists.txt
View file @
3f224abb
...
...
@@ -266,6 +266,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar
# OpenCV build options
# ===================================================
OCV_OPTION
(
ENABLE_CCACHE
"Use ccache"
(
UNIX AND NOT IOS
AND
(
CMAKE_GENERATOR MATCHES
"Makefile"
OR CMAKE_GENERATOR MATCHES
"Ninja"
))
)
OCV_OPTION
(
ENABLE_PRECOMPILED_HEADERS
"Use precompiled headers"
ON
IF
(
NOT IOS AND NOT CMAKE_CROSSCOMPILING
)
)
OCV_OPTION
(
ENABLE_SOLUTION_FOLDERS
"Solution folder in Visual Studio or in other IDEs"
(
MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode
)
)
OCV_OPTION
(
ENABLE_PROFILING
"Enable profiling in the GCC compiler (Add flags: -g -pg)"
OFF IF CMAKE_COMPILER_IS_GNUCXX
)
...
...
@@ -888,6 +889,7 @@ else()
status
(
" Linker flags (Release):"
${
CMAKE_SHARED_LINKER_FLAGS
}
${
CMAKE_SHARED_LINKER_FLAGS_RELEASE
}
)
status
(
" Linker flags (Debug):"
${
CMAKE_SHARED_LINKER_FLAGS
}
${
CMAKE_SHARED_LINKER_FLAGS_DEBUG
}
)
endif
()
status
(
" ccache:"
CMAKE_COMPILER_IS_CCACHE THEN YES ELSE NO
)
status
(
" Precompiled headers:"
PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO
)
# ========================== Dependencies ============================
...
...
cmake/OpenCVCompilerOptions.cmake
View file @
3f224abb
if
(
ENABLE_CCACHE AND NOT CMAKE_COMPILER_IS_CCACHE
)
# This works fine with Unix Makefiles and Ninja generators
find_host_program
(
CCACHE_PROGRAM ccache
)
if
(
CCACHE_PROGRAM
)
message
(
STATUS
"Looking for ccache - found (
${
CCACHE_PROGRAM
}
)"
)
get_property
(
__OLD_RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE
)
if
(
__OLD_RULE_LAUNCH_COMPILE
)
message
(
STATUS
"Can't replace CMake compiler launcher"
)
else
()
set_property
(
GLOBAL PROPERTY RULE_LAUNCH_COMPILE
"
${
CCACHE_PROGRAM
}
"
)
# NOTE: Actually this check doesn't work as expected.
# "RULE_LAUNCH_COMPILE" is ignored by CMake during try_compile() step.
# ocv_check_compiler_flag(CXX "" IS_CCACHE_WORKS)
set
(
IS_CCACHE_WORKS 1
)
if
(
IS_CCACHE_WORKS
)
set
(
CMAKE_COMPILER_IS_CCACHE 1
)
else
()
message
(
STATUS
"Unable to compile program with enabled ccache, reverting..."
)
set_property
(
GLOBAL PROPERTY RULE_LAUNCH_COMPILE
"
${
__OLD_RULE_LAUNCH_COMPILE
}
"
)
endif
()
else
()
message
(
STATUS
"Looking for ccache - not found"
)
endif
()
endif
()
endif
()
if
((
CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_CCACHE
)
AND NOT CMAKE_GENERATOR MATCHES
"Xcode"
)
set
(
ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL
""
FORCE
)
endif
()
if
(
MINGW
OR
(
X86 AND UNIX AND NOT APPLE
))
# mingw compiler is known to produce unstable SSE code with -O3 hence we are trying to use -O2 instead
if
(
CMAKE_COMPILER_IS_GNUCXX
)
...
...
cmake/OpenCVDetectCXXCompiler.cmake
View file @
3f224abb
...
...
@@ -17,10 +17,6 @@ if("${CMAKE_CXX_COMPILER};${CMAKE_C_COMPILER}" MATCHES "ccache")
set
(
CMAKE_COMPILER_IS_CCACHE 1
)
endif
()
if
((
CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_CCACHE
)
AND NOT CMAKE_GENERATOR MATCHES
"Xcode"
)
set
(
ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL
""
FORCE
)
endif
()
# ----------------------------------------------------------------------------
# Detect Intel ICC compiler -- for -fPIC in 3rdparty ( UNIX ONLY ):
# see include/opencv/cxtypes.h file for related ICC & CV_ICC defines.
...
...
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