49 lines
2.0 KiB
CMake
49 lines
2.0 KiB
CMake
# CMake toolchain file for ARM Roku Linux cross-compilation
|
|
# Target: 32-bit ARM with soft-float ABI for compatibility
|
|
# Auto-detects Roku toolchain installation
|
|
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
|
|
|
# Set the target architecture for Roku toolchain
|
|
set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabi)
|
|
|
|
# Use toolchain from PATH environment variable
|
|
# The build script should set PATH to include the toolchain bin directory
|
|
|
|
# Find toolchain tools from PATH
|
|
find_program(CMAKE_C_COMPILER arm-roku-linux-gnueabi-gcc)
|
|
find_program(CMAKE_CXX_COMPILER arm-roku-linux-gnueabi-g++)
|
|
find_program(CMAKE_AR arm-roku-linux-gnueabi-ar)
|
|
find_program(CMAKE_STRIP arm-roku-linux-gnueabi-strip)
|
|
find_program(CMAKE_RANLIB arm-roku-linux-gnueabi-ranlib)
|
|
|
|
# Verify all tools are found
|
|
if(NOT CMAKE_C_COMPILER)
|
|
message(FATAL_ERROR "arm-roku-linux-gnueabi-gcc not found in PATH\nPlease run ./build_roku.sh to setup toolchain")
|
|
endif()
|
|
|
|
message(STATUS "Using Roku toolchain from PATH:")
|
|
message(STATUS " GCC: ${CMAKE_C_COMPILER}")
|
|
message(STATUS " G++: ${CMAKE_CXX_COMPILER}")
|
|
message(STATUS " AR: ${CMAKE_AR}")
|
|
|
|
# Compiler flags for ARM32 with soft-float ABI to ensure compatibility
|
|
set(CMAKE_C_FLAGS "-march=armv7-a -mfpu=vfp -mfloat-abi=softfp" CACHE STRING "C flags")
|
|
set(CMAKE_CXX_FLAGS "-march=armv7-a -mfpu=vfp -mfloat-abi=softfp" CACHE STRING "CXX flags")
|
|
|
|
# Linker flags
|
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--hash-style=gnu" CACHE STRING "Executable linker flags")
|
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--hash-style=gnu" CACHE STRING "Shared library linker flags")
|
|
|
|
# Search for programs in the build host directories
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
# Search for libraries and headers in the target directories
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
|
|
# Disable intrinsics and NEON for compatibility with soft-float ABI
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_NEON_INTRINSICS")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_NEON_INTRINSICS") |