Simplify CMake

This commit is contained in:
TheBrokenRail 2024-05-09 01:38:57 -04:00
parent d519142a8a
commit 592d6c4e63
4 changed files with 6 additions and 11 deletions

View File

@ -120,7 +120,7 @@ if(BUILD_NATIVE_COMPONENTS)
endif() endif()
# Install Prebuilt ARMHF Toolchain Sysroot # Install Prebuilt ARMHF Toolchain Sysroot
if(BUILD_ARM_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN) if(BUILD_NATIVE_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
install_arm_sysroot() install_arm_sysroot()
endif() endif()
@ -158,7 +158,7 @@ if(BUILD_NATIVE_COMPONENTS)
list(APPEND ARM_OPTIONS "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}") list(APPEND ARM_OPTIONS "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}")
endif() endif()
else() else()
list(APPEND ARM_OPTIONS "-DMCPI_USE_PREBUILT_ARMHF_TOOLCHAIN:BOOL=TRUE") list(APPEND ARM_OPTIONS "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${MCPI_CMAKE_TOOLCHAIN_FILE}")
endif() endif()
list(APPEND ARM_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}") list(APPEND ARM_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}")
# Build # Build

View File

@ -19,11 +19,3 @@ function(mcpi_option name description type default)
list(APPEND MCPI_OPTIONS "-D${full_name}:${type}=${${full_name}}") list(APPEND MCPI_OPTIONS "-D${full_name}:${type}=${${full_name}}")
set(MCPI_OPTIONS "${MCPI_OPTIONS}" PARENT_SCOPE) set(MCPI_OPTIONS "${MCPI_OPTIONS}" PARENT_SCOPE)
endfunction() endfunction()
# Prebuilt ARMHF Toolchain
if(BUILD_ARM_COMPONENTS)
mcpi_option(USE_PREBUILT_ARMHF_TOOLCHAIN "Whether To Use A Prebuilt ARMHF Toolchain For Building ARM Components" BOOL FALSE)
if(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
include("${CMAKE_CURRENT_LIST_DIR}/prebuilt-armhf-toolchain.cmake")
endif()
endif()

View File

@ -16,6 +16,9 @@ if(BUILD_NATIVE_COMPONENTS)
if(NOT IS_ARM_TARGETING) if(NOT IS_ARM_TARGETING)
set(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN TRUE) set(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN TRUE)
endif() endif()
if(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
include("${CMAKE_CURRENT_LIST_DIR}/prebuilt-armhf-toolchain.cmake")
endif()
endif() endif()
# Media Layer # Media Layer

View File

@ -26,7 +26,7 @@ file(WRITE "${toolchain_dir}/toolchain.cmake"
"set(CMAKE_SYSTEM_PROCESSOR \"arm\")\n" "set(CMAKE_SYSTEM_PROCESSOR \"arm\")\n"
"set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n" "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n"
) )
set(CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" CACHE FILEPATH "" FORCE) set(MCPI_CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" CACHE FILEPATH "" FORCE)
# Build Sysroot # Build Sysroot
set(sysroot_dir "${CMAKE_CURRENT_BINARY_DIR}/bundled-armhf-sysroot") set(sysroot_dir "${CMAKE_CURRENT_BINARY_DIR}/bundled-armhf-sysroot")