mirror of https://github.com/mgba-emu/mgba.git
3DS, Wii, Switch: Unify CMakeToolchain logic
This commit is contained in:
parent
11b18311b7
commit
e991b30926
|
@ -1,14 +1,4 @@
|
|||
if(DEFINED ENV{DEVKITPRO})
|
||||
set(DEVKITPRO $ENV{DEVKITPRO})
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find DEVKITPRO in environment")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{DEVKITARM})
|
||||
set(DEVKITARM $ENV{DEVKITARM})
|
||||
else()
|
||||
set(DEVKITARM ${DEVKITPRO}/devkitARM)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/devkitPro.cmake)
|
||||
|
||||
if(DEFINED ENV{CTRULIB})
|
||||
set(CTRULIB $ENV{CTRULIB})
|
||||
|
@ -16,40 +6,17 @@ else()
|
|||
set(CTRULIB ${DEVKITPRO}/libctru)
|
||||
endif()
|
||||
|
||||
set(extension)
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(extension .exe)
|
||||
endif()
|
||||
|
||||
set(CMAKE_PROGRAM_PATH ${DEVKITARM}/bin)
|
||||
set(cross_prefix arm-none-eabi-)
|
||||
set(arch_flags "-march=armv6k -mtune=mpcore -mfloat-abi=hard -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_NAME Generic CACHE INTERNAL "system name")
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE arm-none-eabi CACHE INTERNAL "abi")
|
||||
|
||||
find_program(CMAKE_AR ${cross_prefix}gcc-ar${extension})
|
||||
find_program(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension})
|
||||
find_program(CMAKE_C_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension})
|
||||
find_program(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_LINKER ${cross_prefix}ld${extension})
|
||||
set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
|
||||
set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "assembler flags")
|
||||
set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags")
|
||||
|
||||
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(CMAKE_FIND_ROOT_PATH ${DEVKITARM}/arm-none-eabi ${DEVKITPRO}/portlibs/3ds)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
|
||||
set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
|
||||
|
||||
set(3DS ON)
|
||||
add_definitions(-D_3DS -DARM11)
|
||||
|
||||
create_devkit(ARM)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${DEVKITARM}/${CMAKE_LIBRARY_ARCHITECTURE} ${DEVKITPRO}/portlibs/3ds)
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
if(DEFINED ENV{DEVKITPRO})
|
||||
set(DEVKITPRO $ENV{DEVKITPRO})
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find DEVKITPRO in environment")
|
||||
endif()
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name")
|
||||
|
||||
function(create_devkit DEVKIT)
|
||||
if(DEFINED ENV{DEVKIT${DEVKIT}})
|
||||
set(DEVKIT${DEVKIT} $ENV{DEVKIT${DEVKIT}} PARENT_SCOPE)
|
||||
else()
|
||||
set(DEVKIT${DEVKIT} ${DEVKITPRO}/devkit${DEVKIT} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_PROGRAM_PATH ${DEVKIT${DEVKIT}}/bin CACHE INTERNAL "program path")
|
||||
|
||||
set(extension)
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(extension .exe)
|
||||
endif()
|
||||
|
||||
find_program(CMAKE_AR ${cross_prefix}gcc-ar${extension})
|
||||
find_program(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension})
|
||||
find_program(CMAKE_C_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension})
|
||||
find_program(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_LINKER ${cross_prefix}ld${extension})
|
||||
set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
|
||||
set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "assembler flags")
|
||||
set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags")
|
||||
|
||||
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(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
|
||||
set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
|
||||
endfunction()
|
|
@ -1,14 +1,4 @@
|
|||
if(DEFINED ENV{DEVKITPRO})
|
||||
set(DEVKITPRO $ENV{DEVKITPRO})
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find DEVKITPRO in environment")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{DEVKITA64})
|
||||
set(DEVKITA64 $ENV{DEVKITA64})
|
||||
else()
|
||||
set(DEVKITA64 ${DEVKITPRO}/devkitA64)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/devkitPro.cmake)
|
||||
|
||||
if(DEFINED ENV{LIBNX})
|
||||
set(LIBNX $ENV{LIBNX})
|
||||
|
@ -16,41 +6,17 @@ else()
|
|||
set(LIBNX ${DEVKITPRO}/libnx)
|
||||
endif()
|
||||
|
||||
set(extension)
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(extension .exe)
|
||||
endif()
|
||||
|
||||
set(CMAKE_PROGRAM_PATH ${DEVKITA64}/bin)
|
||||
set(cross_prefix aarch64-none-elf-)
|
||||
set(arch_flags "-mtune=cortex-a57 -ffunction-sections -march=armv8-a -mtp=soft -fPIC -ftls-model=local-exec")
|
||||
set(inc_flags "-I${LIBNX}/include ${arch_flags}")
|
||||
set(link_flags "-L${LIBNX}/lib -lnx -specs=${LIBNX}/switch.specs ${arch_flags}")
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name")
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64 CACHE INTERNAL "processor")
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE aarch64-none-elf CACHE INTERNAL "abi")
|
||||
|
||||
find_program(CMAKE_AR ${cross_prefix}gcc-ar${extension})
|
||||
find_program(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension})
|
||||
find_program(CMAKE_C_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension})
|
||||
find_program(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_LINKER ${cross_prefix}ld${extension})
|
||||
set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
|
||||
set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "assembler flags")
|
||||
set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags")
|
||||
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
|
||||
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(CMAKE_FIND_ROOT_PATH ${DEVKITARM}/aarch64-none-elf ${DEVKITPRO}/portlibs/switch)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
|
||||
set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
|
||||
|
||||
set(SWITCH ON)
|
||||
add_definitions(-D__SWITCH__)
|
||||
|
||||
create_devkit(A64)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${DEVKITA64}/${CMAKE_LIBRARY_ARCHITECTURE} ${DEVKITPRO}/portlibs/switch)
|
||||
|
|
|
@ -1,49 +1,16 @@
|
|||
if(DEFINED ENV{DEVKITPRO})
|
||||
set(DEVKITPRO $ENV{DEVKITPRO})
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find DEVKITPRO in environment")
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/devkitPro.cmake)
|
||||
|
||||
if(DEFINED ENV{DEVKITPPC})
|
||||
set(DEVKITPPC $ENV{DEVKITPPC})
|
||||
else()
|
||||
set(DEVKITPPC ${DEVKITPRO}/devkitPPC)
|
||||
endif()
|
||||
|
||||
set(extension)
|
||||
if (CMAKE_HOST_WIN32)
|
||||
set(extension .exe)
|
||||
endif()
|
||||
|
||||
set(CMAKE_PROGRAM_PATH ${DEVKITPPC}/bin)
|
||||
set(cross_prefix 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 powerpc CACHE INTERNAL "processor")
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE powerpc-none-eabi CACHE INTERNAL "abi")
|
||||
|
||||
find_program(CMAKE_AR ${cross_prefix}gcc-ar${extension})
|
||||
find_program(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension})
|
||||
find_program(CMAKE_C_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension})
|
||||
find_program(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension})
|
||||
find_program(CMAKE_LINKER ${cross_prefix}ld${extension})
|
||||
set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
|
||||
set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "assembler flags")
|
||||
set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags")
|
||||
|
||||
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(CMAKE_FIND_ROOT_PATH ${DEVKITPPC}/powerpc-eabi ${DEVKITPRO}/portlibs/ppc)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
|
||||
set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
|
||||
|
||||
set(WII ON)
|
||||
add_definitions(-DGEKKO)
|
||||
|
||||
create_devkit(PPC)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${DEVKITPPC}/powerpc-eabi ${DEVKITPRO}/portlibs/ppc)
|
||||
|
|
Loading…
Reference in New Issue