Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support of openmp for visual studio with clang toolset. #2023

Merged
merged 1 commit into from
Apr 16, 2023

Conversation

Jarod42
Copy link
Contributor

@Jarod42 Jarod42 commented Jan 17, 2023

What does this PR do?

Fix support of openmp for visual studio with clang toolset.

How does this PR change Premake's behavior?

only visual generator are impacted

Anything else we should know?

Also tested with my testing repo
especially action https://github.com/Jarod42/premake-sample-projects/actions/runs/3941604370

Did you check all the boxes?

  • Focus on a single fix or feature; remove any unrelated formatting or code changes
  • Add unit tests showing fix or feature works; all tests pass
  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)
  • Follow our coding conventions
  • Minimize the number of commits
  • Align documentation to your changes

Comment on lines 1648 to 1651
if cfg.openmp == "On" then
table.insert(opts, 1, '-openmp')
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this use the same as the above two lines and use the MSC toolset value? It looks like Clang is fine with /J, so it might be fine with /openmp and /openmp-? It looks like the "real" Clang flag is -fopenmp based on this.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to '/openmp' which works too. (-fopenmp doesn't work IIRC, msvc translates option to clang).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what I meant is could this be written like the above lines which don't duplicate the flag but instead get it out of MSC? So, instead of:

table.insert(opts, 1, '/openmp')

it would be:

table.insert(opts, 1, p.tools.msc.shared.openmp[cfg.openmp])

I'm just not sure if it would accept /openmp- (from openmp "Off") as a valid flag?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jarod42 to clarify, that's not me requesting this change but asking if you think it's worth it?

@Jarod42 Jarod42 force-pushed the openmp_msvc_with_clang branch from d3d7fb0 to cbf4513 Compare April 16, 2023 09:05
@Jarod42
Copy link
Contributor Author

Jarod42 commented Apr 16, 2023

Tests actually fail as master fails.

@Jarod42 Jarod42 force-pushed the openmp_msvc_with_clang branch from cbf4513 to dba322b Compare April 16, 2023 09:52
@samsinsane samsinsane merged commit 7ddf533 into premake:master Apr 16, 2023
@Jarod42 Jarod42 deleted the openmp_msvc_with_clang branch April 16, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants