cmake
Posted: Wed Mar 17, 2010 3:26 pm
Hi everybody.
Here are some cmake scripts for devkitPro development. If you don't know, cmake is cross compiler build system much easier to use than make or auto-tools.
Here you can download simple Nintendo ds cmake project http://rghost.net/1182556
Just extract it somewhere.
Install latest cmake for your system from http://www.cmake.org/cmake/resources/software.html direct link for win32 installer http://www.cmake.org/files/v2.8/cmake-2 ... 32-x86.exe
than open command line in projects root and run
if everything is right you should see following output
resulting rom file is generated in build.Nitro.Debug\nitro.nds
You can use prepare.bat [Nitro|PSP] [Debug|Release] to prepare build directory. It should be run only once. Next you can just run make in build directory. All CMakeLists.txt should be updated automatically.
Features: =)
1) Now only arm9 build is supported.
2) binary resources linkage is supported. (but no grit yet.)
3) devkitPSP is also supported.
CMakeLists.txt - is main cmake project file.
everything else should be obvious.
think it would be useful.
comments are welcome.
PS. cmake output is colored =)))
PPS. I'd like to mention Richard Quirks article http://quirkygba.blogspot.com/2008/09/a ... art-1.html which inspired my work.
Here are some cmake scripts for devkitPro development. If you don't know, cmake is cross compiler build system much easier to use than make or auto-tools.
Here you can download simple Nintendo ds cmake project http://rghost.net/1182556
Just extract it somewhere.
Install latest cmake for your system from http://www.cmake.org/cmake/resources/software.html direct link for win32 installer http://www.cmake.org/files/v2.8/cmake-2 ... 32-x86.exe
than open command line in projects root and run
Code: Select all
#>prepare.bat Nitro Debug
#>cd build.Nitro.Debug
#>make
Code: Select all
#>prepare.bat Nitro Debug
C:\devkitPro\projects\nitro>mkdir build.Nitro.Debug
C:\devkitPro\projects\nitro>cd build.Nitro.Debug
C:\devkitPro\projects\nitro\build.Nitro.Debug>cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../cmake/Modules/Toolchain/Nitro.cmake -DCMAKE_BUILD_TYPE=Debug ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Looking for arm-eabi-as
-- Looking for arm-eabi-as -- C:/devkitPro/devkitARM/bin/arm-eabi-as.exe
-- Looking for bin2s
-- Looking for bin2s -- C:/devkitPro/devkitARM/bin/bin2s.exe
-- Looking for arm-eabi-objcopy
-- Looking for arm-eabi-objcopy -- C:/devkitPro/devkitARM/bin/arm-eabi-objcopy.exe
-- Looking for ndstool
-- Looking for ndstool -- C:/devkitPro/devkitARM/bin/ndstool.exe
-- Check for working C compiler: c:/devkitPro/devkitARM/bin/arm-eabi-gcc.exe
-- Check for working C compiler: c:/devkitPro/devkitARM/bin/arm-eabi-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: c:/devkitPro/devkitARM/bin/arm-eabi-g++.exe
-- Check for working CXX compiler: c:/devkitPro/devkitARM/bin/arm-eabi-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/devkitPro/projects/nitro/build.Nitro.Debug
#>cd build.Nitro.Debug
#>make
[ 20%] Generating drunkenlogo_pcx.h
[ 40%] Generating drunkenlogo_pcx.o
Scanning dependencies of target nitro-arm9-data
Linking C static library libnitro-arm9-data.a
[ 40%] Built target nitro-arm9-data
Scanning dependencies of target nitro-arm9
[ 60%] Building CXX object CMakeFiles/nitro-arm9.dir/source/nehe6.cpp.obj
Linking CXX executable nitro-arm9
[ 60%] Built target nitro-arm9
Scanning dependencies of target nitro-nds
[ 60%] Generating nitro-arm9.o
[ 60%] Generating nitro.nds
Nintendo DS rom tool 1.47 - Feb 21 2010
by Rafael Vuijk, Dave Murphy, Alexei Karpenko
[100%] Built target nitro-nds
You can use prepare.bat [Nitro|PSP] [Debug|Release] to prepare build directory. It should be run only once. Next you can just run make in build directory. All CMakeLists.txt should be updated automatically.
Features: =)
1) Now only arm9 build is supported.
2) binary resources linkage is supported. (but no grit yet.)
3) devkitPSP is also supported.
CMakeLists.txt - is main cmake project file.
Code: Select all
cmake_minimum_required(VERSION 2.6)
# must be here so custom cmake scripts should be available.
set(SANDBOX_MODULE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${SANDBOX_MODULE_DIR}")
# must be here for generated resource .h files will be visible.
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# project name.
project(nitro)
# generated rom name
set(ROM_NAME nitro)
# data files
set(DATA
data/drunkenlogo.pcx
)
#common source files
set(SOURCES
source/nehe6.cpp
)
#nitro source files
set(NITRO_SOURCES
)
#psp source files
set(PSP_SOURCES
)
if (${CMAKE_SYSTEM_NAME} STREQUAL Nitro) # could be used to determin Nitro build
# compiles arm9 core binary
nitro_add_executable(${ROM_NAME}-arm9 ${SOURCES} ${NITRO_SOURCES})
# compiles arm9 library
#nitro_add_library(${ROM_NAME}-arm9 STATIC ${SOURCES} ${NITRO_SOURCES})
# link your libraries here - before nitro libraries
target_link_libraries(${ROM_NAME}-arm9 nds9)
nitro_build_rom(${ROM_NAME} ${ROM_NAME}-arm9 ${DATA})
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL PSP) # could be used to determin PSP build
# compiles psp binary
psp_add_executable(${ROM_NAME}-psp ${SOURCES} ${PSP_SOURCES})
# compiles psp library
#psp_add_library(${ROM_NAME}-psp STATIC ${SOURCES} ${PSP_SOURCES})
# link your libraries here - before psp libraries
target_link_psp_libraries(${ROM_NAME}-psp)
psp_build_rom(${ROM_NAME} ${ROM_NAME}-psp ${DATA})
endif()
think it would be useful.
comments are welcome.
PS. cmake output is colored =)))
PPS. I'd like to mention Richard Quirks article http://quirkygba.blogspot.com/2008/09/a ... art-1.html which inspired my work.