2016-03-26 15:49:05 -05:00
|
|
|
set(CMAKE_SYSTEM_NAME "Generic")
|
|
|
|
set(DEVKITARM $ENV{DEVKITARM})
|
|
|
|
|
|
|
|
if(NOT DEVKITARM)
|
|
|
|
message(FATAL_ERROR "DEVKITARM environment variable not set")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_C_COMPILER ${DEVKITARM}/bin/arm-none-eabi-gcc)
|
|
|
|
set(CMAKE_CXX_COMPILER ${DEVKITARM}/bin/arm-none-eabi-g++)
|
|
|
|
set(CMAKE_OBJCOPY ${DEVKITARM}/bin/arm-none-eabi-objcopy)
|
2017-04-07 18:49:41 -05:00
|
|
|
set(CMAKE_PADBIN ${DEVKITARM}/bin/padbin)
|
|
|
|
set(CMAKE_GBAFIX ${DEVKITARM}/bin/gbafix)
|
2016-03-26 15:49:05 -05:00
|
|
|
set(CMAKE_FIND_ROOT_PATH ${DEVKITARM})
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
|
|
|
|
|
set(CMAKE_FIND_LIBRARY_PREFIXES lib)
|
|
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
|
|
|
|
|
|
|
set(LINKER_FLAGS "-specs=gba.specs")
|
2018-04-13 19:30:13 -05:00
|
|
|
add_definitions(-DARM7)
|
2016-03-26 15:49:05 -05:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
|
|
|
|
macro(OBJCOPY_FILE EXE_NAME)
|
2023-07-01 16:19:29 -05:00
|
|
|
set(FO ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${EXE_NAME}.bin)
|
|
|
|
set(FI ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${EXE_NAME})
|
2016-03-26 15:49:05 -05:00
|
|
|
message(STATUS ${FO})
|
2017-04-07 18:49:41 -05:00
|
|
|
|
|
|
|
# run objcopy
|
2016-03-26 15:49:05 -05:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${FO}"
|
|
|
|
COMMAND ${CMAKE_OBJCOPY}
|
|
|
|
ARGS -O binary ${FI} ${FO}
|
2017-04-07 18:49:41 -05:00
|
|
|
DEPENDS "${FI}"
|
2016-03-26 15:49:05 -05:00
|
|
|
)
|
2017-04-07 18:49:41 -05:00
|
|
|
|
2016-03-26 15:49:05 -05:00
|
|
|
get_filename_component(TGT "${EXE_NAME}" NAME)
|
|
|
|
add_custom_target("TargetObjCopy_${TGT}" ALL DEPENDS ${FO} VERBATIM)
|
|
|
|
get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
|
|
|
|
set_directory_properties(
|
|
|
|
PROPERTIES
|
2017-04-07 18:49:41 -05:00
|
|
|
ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${FO};"
|
2016-03-26 15:49:05 -05:00
|
|
|
)
|
|
|
|
set_source_files_properties("${FO}" PROPERTIES GENERATED TRUE)
|
|
|
|
endmacro(OBJCOPY_FILE)
|