This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Add LLVM_BUILD_32_BITS to LLVMConfig.cmake
ClosedPublic

Authored by john.brawn on Jun 16 2016, 7:08 AM.

Details

Summary

Previously out-of-tree passes could detect if LLVM was built with LLVM_BUILD_32_BITS by looking for -m32 in LLVM_DEFINITIONS, but as of r271871 it no longer appears there. Resolve this by instead emitting LLVM_BUILD_32_BITS in LLVMConfig so it can be checked for directly.

Diff Detail

Repository
rL LLVM

Event Timeline

john.brawn updated this revision to Diff 60969.Jun 16 2016, 7:08 AM
john.brawn retitled this revision from to [CMake] Add LLVM_BUILD_32_BITS to LLVMConfig.cmake.
john.brawn updated this object.
john.brawn added reviewers: beanz, chapuni.
john.brawn set the repository for this revision to rL LLVM.
john.brawn added a subscriber: llvm-commits.
chapuni edited edge metadata.Jun 16 2016, 5:21 PM

I don't like this idea that exposes LLVM_BUILD_32_BITS. Didn't you inspect LLVM_C*_FLAGS?

Or, we could introduce the way to export options for code formats, for other targets.

I supposed LLVM_BUILD_32_BITS as an option for developers.

I don't like this idea that exposes LLVM_BUILD_32_BITS. Didn't you inspect LLVM_C*_FLAGS?

LLVM_C*_FLAGS don't exist in LLVMConfig.cmake. I see LLVM_BUILD_32_BITS as similar in a way to LLVM_ENABLE_EH and LLVM_ENABLE_RTTI - it's something where out-of-tree plugins need to be aware of how LLVM was built otherwise LLVM will give an error when trying to load the plugin, so it needs to be exposed somehow.

beanz accepted this revision.Jun 30 2016, 9:22 AM
beanz edited edge metadata.

This change is the best way to accomplish what needs to be done here for platforms that don't utilize fat binaries.

@chapuni, this option is only exposed to people using our shipped CMake modules, and they do need a way to know whether the modules they are importing are built for 32 or 64 bit targets.

This revision is now accepted and ready to land.Jun 30 2016, 9:22 AM

I won't object any more. Thank you.

This revision was automatically updated to reflect the committed changes.