@ -9,20 +9,32 @@ set(CMAKE_SYSTEM_NAME "Linux")
set ( CMAKE_SYSTEM_PROCESSOR "arm" )
unset ( CMAKE_TOOLCHAIN_FILE CACHE )
# D o w n l o a d I f N e e d e d
if ( NOT EXISTS "${CMAKE_C_COMPILER}" )
# P i c k U R L
execute_process ( COMMAND uname -m OUTPUT_VARIABLE arch OUTPUT_STRIP_TRAILING_WHITESPACE )
if ( arch STREQUAL "x86_64" )
set ( toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.xz" )
set ( toolchain_sha256 "aa074fa8371a4f73fecbd16bd62c8b1945f23289e26414794f130d6ccdf8e39c" )
elseif ( arch STREQUAL "aarch64" OR arch STREQUAL "armv8b" OR arch STREQUAL "armv8l" )
set ( toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-arm-none-linux-gnueabihf.tar.xz" )
set ( toolchain_sha256 "fccd7af76988da2b077f939eb2a78baa9935810918d2bf3f837bc74f52efa825" )
else ( )
message ( FATAL_ERROR "Unable To Download Prebuilt ARMHF Toolchain" )
# P i c k U R L
execute_process ( COMMAND uname -m OUTPUT_VARIABLE arch OUTPUT_STRIP_TRAILING_WHITESPACE )
if ( arch STREQUAL "x86_64" )
set ( toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf.tar.xz" )
set ( toolchain_sha256 "aa074fa8371a4f73fecbd16bd62c8b1945f23289e26414794f130d6ccdf8e39c" )
elseif ( arch STREQUAL "aarch64" OR arch STREQUAL "armv8b" OR arch STREQUAL "armv8l" )
set ( toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-arm-none-linux-gnueabihf.tar.xz" )
set ( toolchain_sha256 "fccd7af76988da2b077f939eb2a78baa9935810918d2bf3f837bc74f52efa825" )
else ( )
message ( FATAL_ERROR "Unable To Download Prebuilt ARMHF Toolchain" )
endif ( )
# C h e c k T o o l c h a i n
set ( toolchain_valid FALSE )
if ( EXISTS "${toolchain_dir}/.last_sha256" )
file ( STRINGS "${toolchain_dir}/.last_sha256" toolchain_last_sha256 )
if ( toolchain_last_sha256 STREQUAL toolchain_sha256 )
set ( toolchain_valid TRUE )
endif ( )
endif ( )
if ( NOT toolchain_valid )
file ( REMOVE_RECURSE "${toolchain_dir}" )
endif ( )
# D o w n l o a d I f N e e d e d
if ( NOT EXISTS "${CMAKE_C_COMPILER}" )
# D o w n l o a d
message ( STATUS "Downloading Prebuilt ARMHF Toolchain..." )
file ( REMOVE_RECURSE "${toolchain_dir}" )
@ -36,6 +48,12 @@ if(NOT EXISTS "${CMAKE_C_COMPILER}")
)
FetchContent_Populate ( prebuilt-armhf-toolchain )
# W r i t e L a s t S H A 2 5 6
file ( WRITE "${toolchain_dir}/.last_sha256" "${toolchain_sha256}" )
# W r i t e . g i t i g n o r e
file ( WRITE "${toolchain_dir}/.gitignore" "/*\n" )
# F o r c e S y s r o o t R e b u i l d
file ( REMOVE_RECURSE "${sysroot_dir}" )
endif ( )