portal64-still-alive/cmake/toolchain_libultra.cmake
Matt Penny 51e7e001a5 Link to libultra for CMake builds
Libultra include directory and library path are now found dynamically and
saved in a CMake cache variable so they can be overridden by users.

The game now links to libultra. Most linker errors are now due to lack of
integration with generated code dependencies.
2024-09-26 00:36:44 -04:00

32 lines
685 B
CMake

include("${CMAKE_CURRENT_LIST_DIR}/toolchain_n64.cmake")
set(USING_LIBULTRA TRUE)
find_path(LIBULTRA_INCLUDE_DIR ultra64.h
PATHS
"${N64_TOOLCHAIN_PREFIX}/usr/include/n64"
DOC
"Libultra include directory"
REQUIRED
)
set(LIBULTRA_INCLUDE_DIRS
"${LIBULTRA_INCLUDE_DIR}"
"${LIBULTRA_INCLUDE_DIR}/PR"
)
find_library(LIBULTRA_LIB libultra_rom
PATHS
"${N64_TOOLCHAIN_PREFIX}/usr/lib/n64"
DOC
"Libultra library file"
REQUIRED
)
add_library(libultra STATIC IMPORTED)
set_target_properties(libultra PROPERTIES
IMPORTED_LOCATION ${LIBULTRA_LIB}
)
target_include_directories(libultra
INTERFACE ${LIBULTRA_INCLUDE_DIRS}
)