This is an archive of the discontinued LLVM Phabricator instance.

[Builtins] Fix lit test setup for Windows
Needs ReviewPublic

Authored by weimingz on Apr 6 2017, 12:04 AM.

Details

Reviewers
rnk
Summary

Use .lib suffix for Windows and .a for non-Windows

Diff Detail

Event Timeline

weimingz created this revision.Apr 6 2017, 12:04 AM

Not sure if it is the portable way to do.
I see cmake/base-config-ix.cmake has set(CMAKE_STATIC_LIBRARY_SUFFIX_C ".lib"), but I can't find where the variable is used and not sure if we can use it in test/CMakefile.

rnk added inline comments.Apr 6 2017, 5:28 PM
test/builtins/CMakeLists.txt
22

I think you want if (MSVC) here instead.

Can we just ask CMake for the filename of the target and substitute that in? CMake already knows this platform-specific logic.

If we can't do that, it's probably simplest to add is_msvc = @MSVC@ to lit.site.cfg.in and push this conditional path computation logic down into lit.cfg. We might need to pythonize the MSVC bool, though, or it'll come out as ON/OFF.

test/builtins/Unit/lit.cfg
34

The correct filename is actually clang_rt.builtins-%s.lib, without the lib prefix.

weimingz updated this revision to Diff 94466.Apr 6 2017, 6:02 PM

I tried to use the lib name from cmake/Module/AddCompilerRT.cmake : add_compiler_rt_runtime but no luck.
And I can't find where the suffix is set in compiler-rt project.

rnk added inline comments.Apr 6 2017, 6:27 PM
test/builtins/Unit/lit.site.cfg.in
7

This might become the strings "ON", "", or "OFF", I'm not sure which. I'd rather follow the example of SANITIZER_CAN_USE_CXXABI and use pythonize_bool(MSVC) in test/builtins/CMakeLists.txt and @MSVC_PYBOOL@ here.

rnk edited edge metadata.Apr 7 2017, 1:56 PM

There were enough issues with running lit tests on Windows that I went ahead and fixed them in a series of changes. We can close this.

weimingz updated this revision to Diff 94610.Apr 8 2017, 10:52 PM

Thanks for the info!

btw, should we use "--rtlib=compiler-rt" rather than passing the libname explicitly?