include(${CMAKE_CURRENT_LIST_DIR}/../cmake/devkitPro.cmake)

if(DEFINED ENV{CTRULIB})
	set(CTRULIB $ENV{CTRULIB})
else()
	set(CTRULIB ${DEVKITPRO}/libctru)
endif()

set(cross_prefix arm-none-eabi-)
set(arch_flags "-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -ffunction-sections")
set(inc_flags "-I${CTRULIB}/include ${arch_flags} -mword-relocations")
set(link_flags "-L${CTRULIB}/lib -lctru -specs=3dsx.specs ${arch_flags} -Wl,--gc-sections")

set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi")

set(3DS ON)
add_definitions(-D__3DS__)

create_devkit(ARM)

set(CMAKE_FIND_ROOT_PATH ${DEVKITARM}/${CMAKE_LIBRARY_ARCHITECTURE} ${DEVKITPRO}/portlibs/3ds)
