Skip to content

Commit

Permalink
GHI #20 Fix clang target in toolchain file for i686
Browse files Browse the repository at this point in the history
  • Loading branch information
doodspav committed Nov 29, 2023
1 parent 55772d3 commit bd9ef37
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ci/toolchain-qemu-ubuntu-cross.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ set(CMAKE_SYSTEM_PROCESSOR "${architecture}")

# use sysroot at compile time and pass to QEMU when executing target binaries
set(qemu_command "qemu-${architecture}")
if(architecture MATCHES "^(i386|i486|i686|x86)$")
if(architecture STREQUAL "i686")
set(qemu_command "qemu-x86_64")
endif()
set(CMAKE_SYSROOT "$ENV{HOME}/sysroot")
set(CMAKE_CROSSCOMPILING_EMULATOR "${qemu_command};-L;${CMAKE_SYSROOT}")

# set the appropriate cross compilers and archiver
# value of ${compiler} is checked at start when obtained from environment variable
if(compiler MATCHES "clang")
if(compiler STREQUAL "clang")
set(CMAKE_C_COMPILER "clang-${version}")
set(CMAKE_CXX_COMPILER "clang++-${version}")
set(CMAKE_AR "llvm-ar-${version}")
elseif(compiler MATCHES "gcc")
elseif(compiler STREQUAL "gcc")
set(CMAKE_C_COMPILER "${triple}-gcc-${version}")
set(CMAKE_CXX_COMPILER "${triple}-g++-${version}")
set(CMAKE_AR "${triple}-ar")
Expand All @@ -54,6 +54,10 @@ endif()
# set the target triple matching the cross compilers above
set(CMAKE_C_COMPILER_TARGET "${triple}")
set(CMAKE_CXX_COMPILER_TARGET "${triple}")
if(compiler STREQUAL "clang" AND architecture STREQUAL "i686")
set(CMAKE_C_COMPILER_TARGET "x86")
set(CMAKE_CXX_COMPILER_TARGET "x86")
endif()

# search for programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand Down

0 comments on commit bd9ef37

Please sign in to comment.