From 701bea0ab3949fd6c1ba772c46998b9ddec4f2fe Mon Sep 17 00:00:00 2001 From: "Javier J. Salmeron Garcia" Date: Wed, 8 Jul 2015 23:15:08 +0200 Subject: [PATCH] Added FindGBA cmake module --- cmake/FindGBA.cmake | 25 ++++++++++++ CMakeLists.txt => qtcreator/CMakeLists.txt | 0 main.c => qtcreator/main.c | 0 mgba.png => qtcreator/mgba.png | Bin qtcreator/wizard.xml | 20 ++++++++++ wizard.xml | 43 --------------------- 6 files changed, 45 insertions(+), 43 deletions(-) create mode 100644 cmake/FindGBA.cmake rename CMakeLists.txt => qtcreator/CMakeLists.txt (100%) rename main.c => qtcreator/main.c (100%) rename mgba.png => qtcreator/mgba.png (100%) create mode 100644 qtcreator/wizard.xml delete mode 100644 wizard.xml diff --git a/cmake/FindGBA.cmake b/cmake/FindGBA.cmake new file mode 100644 index 0000000..818a8f8 --- /dev/null +++ b/cmake/FindGBA.cmake @@ -0,0 +1,25 @@ +set(CMAKE_SYSTEM_NAME Generic) +set(cmake_system_processor arm) +set(cmake_crosscompiling 1) +set(DEVKITARM $ENV{DEVKITARM}) +set(DEVKITPRO $ENV{DEVKITPRO}) + +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") +set(CMAKE_C_COMPILER ${DEVKITARM}/bin/arm-none-eabi-gcc) +set(CMAKE_C_FLAGS "-mthumb-interwork -mthumb -O2 -Wall -fno-strict-aliasing -specs=gba.specs") +set(CMAKE_CXX_COMPILER ${DEVKITARM}/bin/arm-none-eabi-gcc) +set(CMAKE_CXX_FLAGS "-mthumb-interwork -mthumb -O2 -Wall -fno-strict-aliasing -specs=gba.specs") + +function(add_gba_rom ROMNAME) + set(ROM_SRC ${ARGV}) + list(REMOVE_AT ROM_SRC 0) + add_executable(${ROMNAME}.elf ${ROM_SRC}) + add_custom_target(${ROMNAME}.gba ALL + COMMAND ${DEVKITARM}/bin/arm-none-eabi-objcopy -v -O binary ${ROMNAME}.elf ${ROMNAME}.gba + COMMAND ${DEVKITARM}/bin/gbafix ${ROMNAME}.gba + DEPENDS ${ROMNAME}.elf + COMMENT "Creating GBA ROM ${ROMNAME}.gba") + add_dependencies(${ROMNAME}.gba ${ROMNAME}.elf) + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${ROMNAME}.gba) +endfunction(add_gba_rom) \ No newline at end of file diff --git a/CMakeLists.txt b/qtcreator/CMakeLists.txt similarity index 100% rename from CMakeLists.txt rename to qtcreator/CMakeLists.txt diff --git a/main.c b/qtcreator/main.c similarity index 100% rename from main.c rename to qtcreator/main.c diff --git a/mgba.png b/qtcreator/mgba.png similarity index 100% rename from mgba.png rename to qtcreator/mgba.png diff --git a/qtcreator/wizard.xml b/qtcreator/wizard.xml new file mode 100644 index 0000000..bfa932c --- /dev/null +++ b/qtcreator/wizard.xml @@ -0,0 +1,20 @@ + + + + mgba.png + Game Boy Advance ROM using CMake. Devkitarm required. + Game Boy Advance (CMake); + Homebrew Development + + + + + diff --git a/wizard.xml b/wizard.xml deleted file mode 100644 index 90810a1..0000000 --- a/wizard.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - mgba.png - Game Boy Advance ROM using CMake. Devkitarm required. - Game Boy Advance (CMake); - Homebrew Development - - - - -