Include Compiler Check In SDK

This commit is contained in:
TheBrokenRail 2023-11-09 18:41:10 -05:00
parent 98db527a13
commit 1f05424651

View File

@ -108,16 +108,24 @@ project(minecraft-pi-reborn)
include(cmake/util.cmake) include(cmake/util.cmake)
# Sanity Checks # Sanity Checks
set(IS_ARM_TARGETING FALSE) string(CONCAT ARM_SANITY_CHECK
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") "set(IS_ARM_TARGETING FALSE)\n"
set(IS_ARM_TARGETING TRUE) "if(CMAKE_SYSTEM_PROCESSOR STREQUAL \"arm\" OR CMAKE_SYSTEM_PROCESSOR STREQUAL \"armv7l\")\n"
" set(IS_ARM_TARGETING TRUE)\n"
"endif()"
)
if(BUILD_ARM_COMPONENTS)
string(CONCAT ARM_SANITY_CHECK
"${ARM_SANITY_CHECK}\n"
"if(NOT IS_ARM_TARGETING)\n"
" message(FATAL_ERROR \"ARM-Targeting Compiler Required\")\n"
"endif()"
)
endif() endif()
cmake_language(EVAL CODE "${ARM_SANITY_CHECK}")
if(BUILD_NATIVE_COMPONENTS AND NOT IS_ARM_TARGETING AND NOT MCPI_IS_MIXED_BUILD) if(BUILD_NATIVE_COMPONENTS AND NOT IS_ARM_TARGETING AND NOT MCPI_IS_MIXED_BUILD)
message(FATAL_ERROR "Project is configured as a mixed-buld, but MCPI_IS_MIXED_BUILD is disabled.") message(FATAL_ERROR "Project is configured as a mixed-buld, but MCPI_IS_MIXED_BUILD is disabled.")
endif() endif()
if(BUILD_ARM_COMPONENTS AND NOT IS_ARM_TARGETING)
message(FATAL_ERROR "ARM-Targeting Compiler Required")
endif()
# Specify Default Installation Prefix # Specify Default Installation Prefix
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
@ -213,6 +221,8 @@ if(BUILD_ARM_COMPONENTS)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sdk.cmake" file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sdk.cmake"
# Compile Flags # Compile Flags
"${COMPILE_FLAGS_SETUP}\n" "${COMPILE_FLAGS_SETUP}\n"
# Snaity Check
"${ARM_SANITY_CHECK}\n"
# Log # Log
"message(STATUS \"Using Reborn SDK v${MCPI_VERSION}\")\n" "message(STATUS \"Using Reborn SDK v${MCPI_VERSION}\")\n"
# Include Targets # Include Targets