[LLVMdev] Host target triple on Windows

Hans Wennborg hans at chromium.org
Wed Jul 30 15:23:50 PDT 2014


I'm using 2.8.12.2, but I never looked at CMAKE_CL_64 or
GetHostTriple() internally, just at the printouts and noticed that "--
Target triple" seemed to work.

On Wed, Jul 30, 2014 at 2:43 PM, Zachary Turner <zturner at google.com> wrote:
> What version of CMake are you using?  If it's 3.0, then it's possible that
> they've gotten smarter.  I'm using 2.8, and I confirmed that even with an
> empty directory, CMAKE_CL_64 in GetHostTriple() is never set regardless of
> which toolchain is in use.
>
>
> On Wed, Jul 30, 2014 at 10:22 AM, Hans Wennborg <hans at chromium.org> wrote:
>>
>> On Tue, Jul 29, 2014 at 5:38 PM, Zachary Turner <zturner at google.com>
>> wrote:
>> > I'm trying to figure out how to get, from CMake, the architecture of the
>> > platform that I'm compiling LLVM for.  If I'm building LLVM on x86, I
>> > want
>> > x86.  On x64 I want x86_64.  On arm arm.  etc.
>> >
>> > The best I can figure out so far is that I should use LLVM_HOST_TRIPLE,
>> > and
>> > extract the first component of this.  At least if my understanding is
>> > correct, I should have the following behavior:
>> >
>> > Compiling using 32-bit toolchain on Windows: LLVM_HOST_TRIPLE =
>> > i686-pc-win32
>> > Compiling using 64-bit toolchain on Windows: LLVM_HOST_TRIPLE =
>> > x86_64-pc-win32
>> >
>> > This doesn't currently seem to work.  See, for example, the following
>> > output
>> > from when I run CMake twice from the command line, once with an x86
>> > toolchain and once with an x64 toolchain:
>> >
>> > D:\src\llvm\build\ninja>"c:\Program Files (x86)\Microsoft Visual Studio
>> > 12.0\VC\vcvarsall.bat" x86
>> >
>> > D:\src\llvm\build\ninja>where cl
>> > C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe
>> > C:\Program Files (x86)\Microsoft Visual Studio
>> > 12.0\VC\bin\x86_amd64\cl.exe
>> >
>> > D:\src\llvm\build\ninja>cmake ..\..
>> > -- Target triple: i686-pc-win32
>> > -- Native target architecture is X86
>> >
>> > D:\src\llvm\build\ninja>"c:\Program Files (x86)\Microsoft Visual Studio
>> > 12.0\VC\vcvarsall.bat" x86_amd64
>> >
>> > D:\src\llvm\build\ninja>where cl
>> > C:\Program Files (x86)\Microsoft Visual Studio
>> > 12.0\VC\bin\x86_amd64\cl.exe
>> > C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe
>> >
>> > D:\src\llvm\build\ninja>cmake ..\..
>> > -- Target triple: i686-pc-win32
>> > -- Native target architecture is X86
>>
>> Could this be due to CMake caching (and not updating that cache) the
>> compiler it uses? If I run cmake in an empty directory, it seems to
>> get the Target triple right:
>>
>> D:\src>mkdir build.x86 && cd build.x86
>> D:\src\build.x86>"c:\Program Files (x86)\Microsoft Visual Studio
>> 12.0\VC\vcvarsall.bat" x86
>> D:\src\build.x86>cmake -GNinja ..\llvm
>> [...]
>> -- Target triple: i686-pc-win32
>> -- Native target architecture is X86
>>
>> D:\src\build.x86>cd .. && mkdir build.amd64 && cd build.amd64
>> D:\src\build.amd64>"c:\Program Files (x86)\Microsoft Visual Studio
>> 12.0\VC\vcvarsall.bat" x86_amd64
>> D:\src\build.amd64>cmake -GNinja ..\llvm
>> [...]
>> -- Target triple: x86_64-pc-win32
>> -- Native target architecture is X86
>
>



More information about the llvm-dev mailing list