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
ef93aea0
Commit
ef93aea0
authored
Feb 11, 2020
by
Alexander Alekhin
Committed by
Alexander Alekhin
Feb 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: update handling of MSVC /MP flag
parent
d4422e47
Hide 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 @
ef93aea0
...
...
@@ -64,12 +64,3 @@ else()
endif
()
endforeach
(
flag_var
)
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 @
ef93aea0
...
...
@@ -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)"
)
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