Merge pull request #1860 from Jarod42/openmp-gcc-clang

Add support of openmp for gcc/clang.
This commit is contained in:
Samuel Surtees 2022-04-16 15:56:45 +10:00 committed by GitHub
commit c4265c5ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 8 deletions

View File

@ -49,6 +49,7 @@
Fast = "-ffast-math",
},
strictaliasing = gcc.shared.strictaliasing,
openmp = gcc.shared.openmp,
optimize = {
Off = "-O0",
On = "-O2",

View File

@ -67,6 +67,9 @@
Level2 = { "-fstrict-aliasing", "-Wstrict-aliasing=2" },
Level3 = { "-fstrict-aliasing", "-Wstrict-aliasing=3" },
},
openmp = {
On = "-fopenmp"
},
optimize = {
Off = "-O0",
On = "-O2",

View File

@ -68,4 +68,20 @@
prepare()
test.contains({ "-miphoneos-version-min=5.0" }, clang.getcxxflags(cfg))
end
--
-- Check handling of openmp.
--
function suite.cflags_onOpenmpOn()
openmp "On"
prepare()
test.contains("-fopenmp", clang.getcflags(cfg))
end
function suite.cflags_onOpenmpOff()
openmp "Off"
prepare()
test.excludes("-fopenmp", clang.getcflags(cfg))
end

View File

@ -702,6 +702,21 @@
test.contains({ "-fstrict-aliasing", "-Wstrict-aliasing=3" }, gcc.getcflags(cfg))
end
--
-- Check handling of openmp.
--
function suite.cflags_onOpenmpOn()
openmp "On"
prepare()
test.contains("-fopenmp", gcc.getcflags(cfg))
end
function suite.cflags_onOpenmpOff()
openmp "Off"
prepare()
test.excludes("-fopenmp", gcc.getcflags(cfg))
end
--
-- Check handling of system search paths.

View File

@ -20,15 +20,11 @@ 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"
```
Premake 5.0-beta1 or later for Visual Studio 2010+ and the MSC toolset.
Premake 5.0-beta2 or later for the GCC and Clang toolsets.
## Examples ##
```lua
openmp "On"
```
```