all repos — mgba @ 9a538f872a78f7964d808d5a042474d563b4eb71

mGBA Game Boy Advance Emulator

3DS, PSP2, Wii: Clean up CMake toolchain/list separation
Jeffrey Pfau jeffrey@endrift.com
Sun, 20 Sep 2015 00:48:03 -0700
commit

9a538f872a78f7964d808d5a042474d563b4eb71

parent

465dc2b40048e70380ed26a7451d208f4e643d6c

M src/platform/3ds/CMakeLists.txtsrc/platform/3ds/CMakeLists.txt

@@ -1,6 +1,14 @@

set(USE_VFS_3DS ON CACNE BOOL "Use 3DS-specific file support") mark_as_advanced(USE_VFS_3DS) +find_program(3DSLINK 3dslink) +find_program(3DSXTOOL 3dsxtool) +find_program(BANNERTOOL bannertool) +find_program(MAKEROM makerom) +find_program(PICASSO picasso) +find_program(RAW2C raw2c) +find_program(STRIP ${cross_prefix}strip) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format" PARENT_SCOPE) set(OS_DEFINES COLOR_16_BIT COLOR_5_6_5)
M src/platform/3ds/CMakeToolchain.txtsrc/platform/3ds/CMakeToolchain.txt

@@ -9,7 +9,6 @@ set(DEVKITARM $ENV{DEVKITARM})

else() set(DEVKITARM ${DEVKITPRO}/devkitARM) endif() -set(toolchain_bin_dir ${DEVKITARM}/bin) if(DEFINED ENV{CTRULIB}) set(CTRULIB $ENV{CTRULIB})

@@ -17,43 +16,34 @@ else()

set(CTRULIB ${DEVKITPRO}/libctru) endif() -if(DEFINED ENV{PICASSO}) - set(PICASSO $ENV{PICASSO}) -else() - set(PICASSO ${toolchain_bin_dir}/picasso) +set(extension) +if (CMAKE_HOST_WIN32) + set(extension .exe) endif() -set(cross_prefix ${toolchain_bin_dir}/arm-none-eabi-) -set(inc_flags -I${CTRULIB}/include) +set(CMAKE_PROGRAM_PATH ${DEVKITARM}/bin) +set(cross_prefix ${CMAKE_PROGRAM_PATH}/arm-none-eabi-) set(arch_flags "-march=armv6k -mtune=mpcore -mfpu=vfp -mfloat-abi=hard") -set(link_flags "-L${CTRULIB}/lib -lctru -lm -specs=3dsx.specs ${arch_flags}") +set(inc_flags "-I${CTRULIB}/include ${arch_flags} -mword-relocations") +set(link_flags "-L${CTRULIB}/lib -lctru -specs=3dsx.specs ${arch_flags}") set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name") set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor") set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi") -set(CMAKE_AR ${cross_prefix}gcc-ar CACHE INTERNAL "archiver") -set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib CACHE INTERNAL "ranlib") -set(CMAKE_C_COMPILER ${cross_prefix}gcc CACHE INTERNAL "c compiler") -set(CMAKE_CXX_COMPILER ${cross_prefix}g++ CACHE INTERNAL "cxx compiler") -set(CMAKE_ASM_COMPILER ${cross_prefix}gcc CACHE INTERNAL "assembler") -set(common_flags "${arch_flags} -mword-relocations ${inc_flags}") -set(CMAKE_C_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") -set(CMAKE_C_FLAGS_RELEASE -Ofast CACHE INTERNAL "c compiler flags (release)") -set(CMAKE_ASM_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") -set(CMAKE_CXX_FLAGS ${common_flags} CACHE INTERNAL "cxx compiler flags") + +set(CMAKE_AR ${cross_prefix}gcc-ar${extension} CACHE INTERNAL "archiver") +set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension} CACHE INTERNAL "archiver") +set(CMAKE_C_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "c compiler") +set(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension} CACHE INTERNAL "cxx compiler") +set(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "assembler") +set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags") set(CMAKE_LINKER ${cross_prefix}ld CACHE INTERNAL "linker") set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags") set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags") set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags") - -set(3DSLINK ${toolchain_bin_dir}/3dslink) -set(3DSXTOOL ${toolchain_bin_dir}/3dsxtool) -set(BANNERTOOL ${toolchain_bin_dir}/bannertool) -set(MAKEROM ${toolchain_bin_dir}/makerom) -set(RAW2C ${toolchain_bin_dir}/raw2c) -set(SMDHTOOL ${toolchain_bin_dir}/smdhtool) -set(STRIP ${cross_prefix}strip) set(3DS ON) add_definitions(-D_3DS -DARM11)
M src/platform/psp2/CMakeLists.txtsrc/platform/psp2/CMakeLists.txt

@@ -1,3 +1,8 @@

+find_program(FIXUP vita-elf-create) +find_program(OBJCOPY ${cross_prefix}objcopy) +find_file(NIDDB db.json PATHS ${VITASDK}) +find_program(STRIP ${cross_prefix}strip) + file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/psp2/psp2-*.c) set(OS_SRC ${OS_SRC} PARENT_SCOPE) source_group("PS Vita-specific code" FILES ${OS_SRC})
M src/platform/psp2/CMakeToolchain.vitasdksrc/platform/psp2/CMakeToolchain.vitasdk

@@ -4,24 +4,30 @@ else()

message(FATAL_ERROR "Could not find VITASDK in environment") endif() +set(extension) +if (CMAKE_HOST_WIN32) + set(extension .exe) +endif() + set(toolchain_dir ${VITASDK}) -set(toolchain_bin_dir ${toolchain_dir}/bin) -set(cross_prefix ${toolchain_bin_dir}/arm-vita-eabi-) +set(CMAKE_PROGRAM_PATH ${toolchain_dir}/bin) + +set(cross_prefix ${CMAKE_PROGRAM_PATH}/arm-vita-eabi-) set(inc_flags -I${toolchain_dir}/include) set(link_flags "-L${toolchain_dir}/lib -Wl,-q") set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name") set(CMAKE_SYSTEM_PROCESSOR armv7-a CACHE INTERNAL "processor") set(CMAKE_LIBRARY_ARCHITECTURE arm-vita-eabi CACHE INTERNAL "abi") -set(CMAKE_AR ${cross_prefix}gcc-ar CACHE INTERNAL "archiver") -set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib CACHE INTERNAL "ranlib") -set(CMAKE_C_COMPILER ${cross_prefix}gcc CACHE INTERNAL "c compiler") -set(CMAKE_CXX_COMPILER ${cross_prefix}g++ CACHE INTERNAL "cxx compiler") -set(CMAKE_ASM_COMPILER ${cross_prefix}gcc CACHE INTERNAL "assembler") -set(common_flags "${inc_flags}") -set(CMAKE_C_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") -set(CMAKE_ASM_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") -set(CMAKE_CXX_FLAGS ${common_flags} CACHE INTERNAL "cxx compiler flags") + +set(CMAKE_AR ${cross_prefix}gcc-ar${extension} CACHE INTERNAL "archiver") +set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension} CACHE INTERNAL "archiver") +set(CMAKE_C_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "c compiler") +set(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension} CACHE INTERNAL "cxx compiler") +set(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "assembler") +set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags") set(CMAKE_LINKER ${cross_prefix}ld CACHE INTERNAL "linker") set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")

@@ -29,11 +35,6 @@ set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")

set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags") set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE) - -set(FIXUP ${toolchain_bin_dir}/vita-elf-create) -set(OBJCOPY ${cross_prefix}objcopy) -set(NIDDB ${VITASDK}/db.json) -set(STRIP ${cross_prefix}strip) set(PSP2 ON) add_definitions(-DPSP2)
M src/platform/wii/CMakeLists.txtsrc/platform/wii/CMakeLists.txt

@@ -1,3 +1,8 @@

+find_program(ELF2DOL elf2dol) +find_program(GXTEXCONV gxtexconv) +find_program(RAW2C raw2c) +find_program(WIILOAD wiiload) + set(OS_DEFINES COLOR_16_BIT COLOR_5_6_5 USE_VFS_FILE) list(APPEND VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-file.c ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-dirent.c)
M src/platform/wii/CMakeToolchain.txtsrc/platform/wii/CMakeToolchain.txt

@@ -10,34 +10,34 @@ else()

set(DEVKITPPC ${DEVKITPRO}/devkitPPC) endif() -set(toolchain_bin_dir ${DEVKITPPC}/bin) -set(cross_prefix ${toolchain_bin_dir}/powerpc-eabi-) -set(inc_flags -I${DEVKITPRO}/libogc/include) +set(extension) +if (CMAKE_HOST_WIN32) + set(extension .exe) +endif() + +set(CMAKE_PROGRAM_PATH ${DEVKITPPC}/bin) +set(cross_prefix ${CMAKE_PROGRAM_PATH}/powerpc-eabi-) set(arch_flags "-mrvl -mcpu=750 -meabi -mhard-float -g") +set(inc_flags "-I${DEVKITPRO}/libogc/include ${arch_flags}") set(link_flags "-L${DEVKITPRO}/libogc/lib/wii ${arch_flags}") set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name") -set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor") +set(CMAKE_SYSTEM_PROCESSOR powerpc CACHE INTERNAL "processor") set(CMAKE_LIBRARY_ARCHITECTURE powerpc-none-eabi CACHE INTERNAL "abi") -set(CMAKE_AR ${cross_prefix}gcc-ar CACHE INTERNAL "archiver") -set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib CACHE INTERNAL "archiver") -set(CMAKE_C_COMPILER ${cross_prefix}gcc CACHE INTERNAL "c compiler") -set(CMAKE_CXX_COMPILER ${cross_prefix}g++ CACHE INTERNAL "cxx compiler") -set(CMAKE_ASM_COMPILER ${cross_prefix}gcc CACHE INTERNAL "assembler") -set(common_flags "${arch_flags} ${inc_flags}") -set(CMAKE_C_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") -set(CMAKE_ASM_FLAGS ${common_flags} CACHE INTERNAL "c compiler flags") -set(CMAKE_CXX_FLAGS ${common_flags} CACHE INTERNAL "cxx compiler flags") + +set(CMAKE_AR ${cross_prefix}gcc-ar${extension} CACHE INTERNAL "archiver") +set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension} CACHE INTERNAL "archiver") +set(CMAKE_C_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "c compiler") +set(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension} CACHE INTERNAL "cxx compiler") +set(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "assembler") +set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags") +set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags") set(CMAKE_LINKER ${cross_prefix}ld CACHE INTERNAL "linker") set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags") set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags") set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags") - -set(ELF2DOL ${toolchain_bin_dir}/elf2dol) -set(GXTEXCONV ${toolchain_bin_dir}/gxtexconv) -set(RAW2C ${toolchain_bin_dir}/raw2c) -set(WIILOAD ${toolchain_bin_dir}/wiiload) set(WII ON) add_definitions(-DGEKKO)