Add initial armv7 support

This commit is contained in:
Danny Robson 2020-10-26 12:28:35 +10:00
parent 3e96dea278
commit 9b17736d76
3 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,20 @@
set(CMAKE_SYSTEM_NAME Linux)
set(TOOLCHAIN_PREFIX armv7a-unknown-linux-gnueabihf)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN_PREFIX};/usr/lib/gcc/${TOOLCHAIN_PREFIX}/;${CMAKE_CURRENT_BINARY_DIR}/deps")
# modify default behavior of FIND_XXX() commands to
# search for headers/libs in the target environment and
# search for programs in the build host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Export the chosen compiler via CXX and CC, because it's entirely possible
# one of child build scripts will call out to something that relies on these
# to discover the compiler (or will otherwise choose the wrong one).
set ($ENV{CXX} "${CMAKE_CXX_COMPILER}")
set ($ENV{CC} "${CMAKE_C_COMPILER}")

View File

@ -0,0 +1,23 @@
toolchain=/usr/armv7a-unknown-linux-gnueabihf
target_host=armv7a-unknown-linux-gnueabihf
cc_compiler=gcc
cxx_compiler=g++
[env]
CONAN_CMAKE_FIND_ROOT_PATH=$toolchain
CHOST=$target_host
AR=$target_host-ar
AS=$target_host-as
RANLIB=$target_host-ranlib
CC=$target_host-$cc_compiler
CXX=$target_host-$cxx_compiler
STRIP=$target_host-strip
[settings]
os=Linux
arch=armv7
compiler=gcc
compiler.version=10.2
compiler.libcxx=libstdc++11
build_type=Release

16
init.py
View File

@ -152,6 +152,20 @@ OPTIONS['mingw'] = Option(
) )
# -----------------------------------------------------------------------------
OPTIONS['pi3'] = Option(
vars={
'CMAKE_TOOLCHAIN_FILE': os.path.join(
os.path.dirname(__file__),
'cmake', 'toolchain', 'armv7a-gcc'
)
},
arch="armv7",
compiler='gcc',
platform='linux',
)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
DEFAULT_OPTION = Option( DEFAULT_OPTION = Option(
vars={ vars={
@ -213,6 +227,7 @@ if __name__ == '__main__':
accumulated = [f'"-D{key}={val}"' for key, val in accum.vars.items()] + accum.args accumulated = [f'"-D{key}={val}"' for key, val in accum.vars.items()] + accum.args
conan_build_profile = 'x86_64-gcc-linux-release'
conan_host_profile = '-'.join([ conan_host_profile = '-'.join([
accum.arch, accum.arch,
accum.compiler, accum.compiler,
@ -220,7 +235,6 @@ if __name__ == '__main__':
accum.config, accum.config,
]) ])
conan_build_profile = conan_host_profile
if accum.platform == 'mingw': if accum.platform == 'mingw':
conan_build_profile = f'x86_64-gcc-linux-{accum.config}' conan_build_profile = f'x86_64-gcc-linux-{accum.config}'