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
c41f50f5
Commit
c41f50f5
authored
Feb 13, 2020
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16559 from alalek:cmake_msvc_mp_customize
parents
e48ae883
ef93aea0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
9 deletions
+35
-9
OpenCVCRTLinkage.cmake
cmake/OpenCVCRTLinkage.cmake
+0
-9
OpenCVCompilerOptions.cmake
cmake/OpenCVCompilerOptions.cmake
+35
-0
No files found.
cmake/OpenCVCRTLinkage.cmake
View file @
c41f50f5
...
@@ -64,12 +64,3 @@ else()
...
@@ -64,12 +64,3 @@ else()
endif
()
endif
()
endforeach
(
flag_var
)
endforeach
(
flag_var
)
endif
()
endif
()
if
(
CMAKE_VERSION VERSION_GREATER
"2.8.6"
)
include
(
ProcessorCount
)
ProcessorCount
(
N
)
if
(
NOT N EQUAL 0
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
/MP
${
N
}
"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/MP
${
N
}
"
)
endif
()
endif
()
cmake/OpenCVCompilerOptions.cmake
View file @
c41f50f5
...
@@ -442,3 +442,38 @@ if(OPENCV_EXTRA_RPATH_LINK_PATH)
...
@@ -442,3 +442,38 @@ if(OPENCV_EXTRA_RPATH_LINK_PATH)
message
(
WARNING
"OPENCV_EXTRA_RPATH_LINK_PATH may not work properly because CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG is not defined (not supported)"
)
message
(
WARNING
"OPENCV_EXTRA_RPATH_LINK_PATH may not work properly because CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG is not defined (not supported)"
)
endif
()
endif
()
endif
()
endif
()
# Control MSVC /MP flag
# Input variables: OPENCV_MSVC_PARALLEL (ON,1,2,3,...) + OPENCV_SKIP_MSVC_PARALLEL
# Details:
# - https://docs.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes
# - https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables
# - https://gitlab.kitware.com/cmake/cmake/merge_requests/1718/diffs
if
(
CMAKE_GENERATOR MATCHES
"Visual Studio"
AND CMAKE_CXX_COMPILER_ID MATCHES
"MSVC|Intel"
)
ocv_check_environment_variables
(
OPENCV_SKIP_MSVC_PARALLEL
)
if
(
OPENCV_SKIP_MSVC_PARALLEL
)
# nothing
elseif
(
"
${
CMAKE_CXX_FLAGS
}
"
MATCHES
"/MP"
)
# nothing, already defined in compiler flags
elseif
(
DEFINED ENV{CL} AND
" $ENV{CL}"
MATCHES
"/MP"
)
# nothing, compiler will use CL environment variable
elseif
(
DEFINED ENV{_CL_} AND
" $ENV{_CL_}"
MATCHES
"/MP"
)
# nothing, compiler will use _CL_ environment variable
else
()
ocv_check_environment_variables
(
OPENCV_MSVC_PARALLEL
)
set
(
_mp_value
"ON"
)
if
(
DEFINED OPENCV_MSVC_PARALLEL
)
set
(
_mp_value
"
${
OPENCV_MSVC_PARALLEL
}
"
)
endif
()
set
(
OPENCV_MSVC_PARALLEL
"
${
_mp_value
}
"
CACHE STRING
"Control MSVC /MP flag"
)
if
(
_mp_value
)
if
(
_mp_value GREATER 0
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
/MP
${
_mp_value
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/MP
${
_mp_value
}
"
)
else
()
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
/MP"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/MP"
)
endif
()
endif
()
endif
()
endif
()
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