Add barebones N64 CMake toolchain files

Just focus on compilation for now
This commit is contained in:
Matt Penny 2024-09-24 01:01:57 -04:00
parent fa0940fe90
commit a67288f62e
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,9 @@
include("${CMAKE_CURRENT_LIST_DIR}/toolchain_n64.cmake")
set(LIBULTRA TRUE)
set(LIBULTRA_INCLUDE_DIRS
"${N64_TOOLCHAIN_PREFIX}/usr/include/n64"
"${N64_TOOLCHAIN_PREFIX}/usr/include/n64/PR"
)
# TODO: libs

21
cmake/toolchain_n64.cmake Normal file
View file

@ -0,0 +1,21 @@
set(CMAKE_SYSTEM_NAME Generic)
set(N64_TOOLCHAIN_PREFIX "" CACHE PATH "Root directory of N64 toolchain")
set(N64_BIN_DIR "${N64_TOOLCHAIN_PREFIX}/bin")
# Search for programs in the host environment
# Search for headers and libraries in the target environment
set(CMAKE_FIND_ROOT_PATH "${N64_TOOLCHAIN_PREFIX}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Ensure CMake can find toolchain during compiler tests
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES N64_TOOLCHAIN_PREFIX)
# Don't try to dynamically link during compiler tests
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
# TODO: find assembler, linker, etc.
# TODO: set flags
find_program(CMAKE_C_COMPILER mips64-elf-gcc PATHS ${N64_BIN_DIR} REQUIRED)