This commit is contained in:
TheBrokenRail 2021-11-11 21:37:29 -05:00
parent 2e9ee42d75
commit 6a7d881258
2 changed files with 21 additions and 22 deletions

View File

@ -1,6 +1,20 @@
# Sanity Check Return
function(sanity_check_return ret)
if(NOT ret EQUAL "0")
message(FATAL_ERROR "Process Failed")
endif()
endfunction()
# Get Host Architecture # Get Host Architecture
find_program(UNAME uname /bin /usr/bin /usr/local/bin REQUIRED) find_program(UNAME uname /bin /usr/bin /usr/local/bin REQUIRED)
execute_process(COMMAND "${UNAME}" "-m" OUTPUT_VARIABLE HOST_ARCHITECTURE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(
COMMAND "${UNAME}" "-m"
OUTPUT_VARIABLE HOST_ARCHITECTURE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE ret
)
sanity_check_return("${ret}")
# Get Include Directories # Get Include Directories
function(get_include_dirs target compiler result) function(get_include_dirs target compiler result)
@ -16,7 +30,9 @@ function(get_include_dirs target compiler result)
ERROR_QUIET ERROR_QUIET
OUTPUT_VARIABLE tool OUTPUT_VARIABLE tool
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE ret
) )
sanity_check_return("${ret}")
# Run Tool To Get Include Path # Run Tool To Get Include Path
set(tool_output "") set(tool_output "")
@ -26,7 +42,9 @@ function(get_include_dirs target compiler result)
ERROR_VARIABLE tool_output ERROR_VARIABLE tool_output
ERROR_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE
INPUT_FILE "/dev/null" INPUT_FILE "/dev/null"
RESULT_VARIABLE ret
) )
sanity_check_return("${ret}")
string(REPLACE "\n" ";" tool_output "${tool_output}") string(REPLACE "\n" ";" tool_output "${tool_output}")
# Loop # Loop
@ -61,30 +79,10 @@ function(get_include_dirs target compiler result)
set("${result}" "${${result}}" PARENT_SCOPE) set("${result}" "${${result}}" PARENT_SCOPE)
endfunction() endfunction()
# Get GCC Prefix
function(get_gcc_prefix target result)
# Get Default Target
set("${result}" "" PARENT_SCOPE)
set(output "")
execute_process(
COMMAND "gcc" "-dumpmachine"
ERROR_QUIET
OUTPUT_VARIABLE output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Check
if(NOT output STREQUAL target)
set("${result}" "${target}-" PARENT_SCOPE)
endif()
endfunction()
# Setup Include Directories # Setup Include Directories
function(setup_include_dirs compiler target result) function(setup_include_dirs compiler target result)
# Get Full Compiler # Get Full Compiler
set(prefix "") set(full_compiler "${target}-${compiler}")
get_gcc_prefix("${target}" prefix)
set(full_compiler "${prefix}${compiler}")
# Get Include Directories # Get Include Directories
set(include_dirs "") set(include_dirs "")

View File

@ -31,6 +31,7 @@ sudo apt-get install --no-install-recommends -y \
libfreeimage3 libfreeimage-dev \ libfreeimage3 libfreeimage-dev \
crossbuild-essential-armhf \ crossbuild-essential-armhf \
crossbuild-essential-arm64 \ crossbuild-essential-arm64 \
gcc \
libopenal-dev \ libopenal-dev \
qemu-user-static qemu-user-static