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

Add correct archiver tool for clang on win32 #3244

Merged
merged 2 commits into from
Nov 28, 2018
Merged

Conversation

mwichmann
Copy link
Collaborator

Do some work to figure out which tool to initialize with so that StaticLibrary works out for clang.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated master/src/CHANGES.txt directory (and read the README.txt in that directory)
  • I have updated the appropriate documentation

Signed-off-by: Mats Wichmann <mats@linux.com>
@coveralls
Copy link

coveralls commented Nov 26, 2018

Coverage Status

Coverage increased (+1.7%) to 81.689% when pulling 50f4fe4 on mwichmann:clangfix into e8d4f01 on SCons:master.

foo_lib = 'foo.lib'
archiver = 'mslib'
import SCons.Tool.MSCommon as msc
if not msc.msvc_exists():
Copy link
Contributor

Choose a reason for hiding this comment

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

This test will fail if no mslib right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I assume so. Is that a problem? As it currently stands, it is failing because there is no 'ar'.

Copy link
Contributor

Choose a reason for hiding this comment

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

in that case shouldn't it skip if no msvc_exists? rather than default to ar which won't work with clang?

Copy link
Collaborator Author

@mwichmann mwichmann Nov 27, 2018

Choose a reason for hiding this comment

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

Oh, I see. Possibly: you tell me. I don't know if there's any "other path" on windows. I'm not sure how much it makes sense for msvc to have to exist either (as I said, that stanza is copied from another test)... what if people try to install clang for building instead of msvc? Unfortunately I'm just guessing here. It's not really a good place to be developing from, better if one had specific use cases and wasn't guessing what folks might do.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was my understanding that you need msvc tools to build viable dlls, libs, and exe's with clang? (doesn't it call msvc linker under the hood?)

Copy link
Collaborator Author

@mwichmann mwichmann Nov 27, 2018

Choose a reason for hiding this comment

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

If you use the choco-packaged clang, which is the llvm-built-for-the-Microsoft-way-of-doing-things model of windows. But there are other options too. See for example here: https://github.com/boostorg/hana/wiki/Setting-up-Clang-on-Windows which cites four possible combinations, two of which helpfully don't appear to work :)

This is why I mentioned use-cases: not sure if the expectation is clang will be used both msvc-style and mingw-style.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably the case that we need a separate clang-cl tools (-cl aims to process msvc style command line flags instead of "normal/posix" type compiler flags)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I saw that... maybe use the github project tab for logging those kinds of work items?

Copy link
Contributor

Choose a reason for hiding this comment

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

might be overkill. just add a tag to the issue maybe. for now until someone asks for it, there's many other issues to work on.

@@ -32,11 +34,23 @@
if not test.where_is('clang'):
test.skip_test("Could not find 'clang', skipping test.\n")

if sys.platform == 'win32':
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use:
test.IS_WINDOWS

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, no problem, but grep tells me, in test/, 200-ish direct checks for win32, two uses of IS_WINDOWS. If you want to pursue a strategy of "if you touch a test, convert it" that's fine - let's just write it down somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. If you touch it, make it better is the general policy.. improve docstrings, remove redundant code,etc..

Signed-off-by: Mats Wichmann <mats@linux.com>
@bdbaddog bdbaddog merged commit 43ed17d into SCons:master Nov 28, 2018
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.

None yet

3 participants