[LLVMdev] How to determine the architecture that clang/llvm will compile in CMake.

1,493 views
Skip to first unread message

Peyton, Jonathan L

unread,
May 22, 2015, 2:38:14 PM5/22/15
to llv...@cs.uiuc.edu

I’ve been working on getting the LLVM OpenMP library to build smoothly alongside llvm/clang using CMake, but one problem I’m having is determining exactly which CMake option designates the architecture the compiler will compile.  I see LLVM_TARGET_ARCH, LLVM_TARGETS_TO_BUILD, LLVM_DEFAULT_TARGET_TRIPLE, etc.

 

I thought I should just ask which one designates the architecture the compiler will build, but I wouldn’t mind an explanation for all of them J

 

And yes, I’ve looked at http://llvm.org/docs/CMake.html, but am still confused.

 

Any help is greatly appreciated!

-- Johnny

 

Daniel Sanders

unread,
May 26, 2015, 6:17:30 AM5/26/15
to Peyton, Jonathan L, llv...@cs.uiuc.edu

Hi,

 

The default CMake options produce a compiler that is capable of targeting all the architectures that were present in the source tree. The list of supported architectures can be reduced using LLVM_TARGETS_TO_BUILD in case you want to save disk-space, compilation-time, etc.. The default architecture targeted by the resulting compiler is specified by LLVM_TARGET_ARCH and LLVM_DEFAULT_TARGET_TRIPLE.

 

Hope that helps.

Peyton, Jonathan L

unread,
May 26, 2015, 11:19:08 AM5/26/15
to Daniel Sanders, llv...@cs.uiuc.edu

Thank you. It does help!

 

-- Johnny

Jonathan Roelofs

unread,
May 26, 2015, 11:25:36 AM5/26/15
to Peyton, Jonathan L, Daniel Sanders, llv...@cs.uiuc.edu


On 5/26/15 9:01 AM, Peyton, Jonathan L wrote:
> Thank you. It does help!

Another suggestion: You should model this after the equivalent support
in compiler-rt as it has to solve the same problem.

Be especially mindful of the distinction between the just-built clang,
and the host compiler being used to build clang. The cmake flag
`LLVM_BUILD_EXTERNAL_COMPILER_RT` is used to make sure that compiler-rt
is built using the just-built clang. See clang/runtime/CMakeLists.txt.


Jon

>
> -- Johnny
>
> *From:* Daniel Sanders [mailto:Daniel....@imgtec.com]
> *Sent:* Tuesday, May 26, 2015 5:14 AM
> *To:* Peyton, Jonathan L; llv...@cs.uiuc.edu
> *Subject:* RE: [LLVMdev] How to determine the architecture that
> clang/llvm will compile in CMake.
>
> Hi,
>
> The default CMake options produce a compiler that is capable of
> targeting all the architectures that were present in the source tree.
> The list of supported architectures can be reduced using
> LLVM_TARGETS_TO_BUILD in case you want to save disk-space,
> compilation-time, etc.. The default architecture targeted by the
> resulting compiler is specified by LLVM_TARGET_ARCH and
> LLVM_DEFAULT_TARGET_TRIPLE.
>
> Hope that helps.
>
> *From:*llvmdev...@cs.uiuc.edu <mailto:llvmdev...@cs.uiuc.edu>
> [mailto:llvmdev...@cs.uiuc.edu] *On Behalf Of *Peyton, Jonathan L
> *Sent:* 22 May 2015 19:12
> *To:* llv...@cs.uiuc.edu <mailto:llv...@cs.uiuc.edu>
> *Subject:* [LLVMdev] How to determine the architecture that clang/llvm
> will compile in CMake.
>
> I’ve been working on getting the LLVM OpenMP library to build smoothly
> alongside llvm/clang using CMake, but one problem I’m having is
> determining exactly which CMake option designates the architecture the
> compiler will compile. I see LLVM_TARGET_ARCH, LLVM_TARGETS_TO_BUILD,
> LLVM_DEFAULT_TARGET_TRIPLE, etc.
>
> I thought I should just ask which one designates the architecture the
> compiler will build, but I wouldn’t mind an explanation for all of them J
>
> And yes, I’ve looked at http://llvm.org/docs/CMake.html
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_CMake.html&d=AwMFAg&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=y71jwqIExOpM3n490cz13SVJmybYCml5fWmWLCtYDQc&s=ufiTk8h8xDI8qA2S1uu1O39smCzzKWdbMH3ys2M-Cdw&e=>,
> but am still confused.
>
> Any help is greatly appreciated!
>
> -- Johnny
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

--
Jon Roelofs
jona...@codesourcery.com
CodeSourcery / Mentor Embedded

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply all
Reply to author
Forward
0 new messages