Merge pull request #1712 from T-rvw/master

This commit is contained in:
starkos 2021-09-17 13:58:32 -04:00
commit f815c012c9
8 changed files with 88 additions and 3 deletions

View File

@ -38,4 +38,31 @@
<Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode>
]]
end
end
--
-- Check ClCompile for OpenMPSupport
--
function suite.openmpOn()
openmp "On"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<OpenMPSupport>true</OpenMPSupport>
]]
end
function suite.openmpOff()
openmp "Off"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<OpenMPSupport>false</OpenMPSupport>
]]
end

View File

@ -370,6 +370,7 @@
m.functionLevelLinking,
m.intrinsicFunctions,
m.justMyCodeDebugging,
m.supportOpenMP,
m.minimalRebuild,
m.omitFramePointers,
m.stringPooling,
@ -2163,6 +2164,14 @@
end
end
function m.supportOpenMP(cfg)
if cfg.openmp == "On" then
m.element("OpenMPSupport", nil, "true")
elseif cfg.openmp == "Off" then
m.element("OpenMPSupport", nil, "false")
end
end
function m.keyword(prj)
-- try to determine what kind of targets we're building here
local isWin, isManaged, isMakefile

View File

@ -1449,6 +1449,16 @@
}
}
api.register {
name = "openmp",
scope = "project",
kind = "string",
allowed = {
"On",
"Off"
}
}
-----------------------------------------------------------------------------
--
-- Field name aliases for backward compatibility

View File

@ -118,6 +118,10 @@
},
justmycode = {
Off = "false"
},
openmp = {
On = "/openmp",
Off = "/openmp-"
}
}

34
website/docs/openmp.md Normal file
View File

@ -0,0 +1,34 @@
Enable or disable [OpenMP](https://en.wikipedia.org/wiki/OpenMP).
```lua
openmp "value"
```
If no value is set for a configuration, the toolset's default OpenMP option (usually Off) will be performed.
### Parameters ###
`value` is one of:
| Value | Description |
|---------|---------------------------------------------------|
| On | Turn on OpenMP. |
| Off | Turn off OpenMP. |
### Applies To ###
Project configurations.
### Availability ###
Premake 5.0-beta1 or later. Currently only implemented for Visual Studio 2010+. As a workaround for other toolsets, you can use [buildoptions](buildoptions.md) like this:
```lua
filter "toolset:not msc*"
buildoptions "-fopenmp"
```
## Examples ##
```lua
openmp "On"
```

View File

@ -4,7 +4,7 @@ The **optimize** function specifies the level and type of optimization used whil
optimize "value"
```
If no value is set for a configuration, the toolsets default optimization (usually none) will be performed.
If no value is set for a configuration, the toolset's default optimization (usually none) will be performed.
### Parameters ###

View File

@ -4,7 +4,7 @@ Sets the level of allowed pointer aliasing.
strictaliasing "value"
```
If no value is set for a configuration, the toolsets settings will be used.
If no value is set for a configuration, the toolset's settings will be used.
### Parameters ###

View File

@ -176,6 +176,7 @@ module.exports = {
'nuget',
'nugetsource',
'objdir',
'openmp',
'optimize',
'pchheader',
'pchsource',