src/platform/wii/CMakeToolchain.txt (view raw)
1if(DEFINED ENV{DEVKITPRO})
2 set(DEVKITPRO $ENV{DEVKITPRO})
3else()
4 message(FATAL_ERROR "Could not find DEVKITPRO in environment")
5endif()
6
7if(DEFINED ENV{DEVKITPPC})
8 set(DEVKITPPC $ENV{DEVKITPPC})
9else()
10 set(DEVKITPPC ${DEVKITPRO}/devkitPPC)
11endif()
12
13set(extension)
14if (CMAKE_HOST_WIN32)
15 set(extension .exe)
16endif()
17
18set(CMAKE_PROGRAM_PATH ${DEVKITPPC}/bin)
19set(cross_prefix ${CMAKE_PROGRAM_PATH}/powerpc-eabi-)
20set(arch_flags "-mrvl -mcpu=750 -meabi -mhard-float -g")
21set(inc_flags "-I${DEVKITPRO}/libogc/include ${arch_flags}")
22set(link_flags "-L${DEVKITPRO}/libogc/lib/wii ${arch_flags}")
23
24set(CMAKE_SYSTEM_NAME Generic CACHE INTERNAL "system name")
25set(CMAKE_SYSTEM_PROCESSOR powerpc CACHE INTERNAL "processor")
26set(CMAKE_LIBRARY_ARCHITECTURE powerpc-none-eabi CACHE INTERNAL "abi")
27
28set(CMAKE_AR ${cross_prefix}gcc-ar${extension} CACHE INTERNAL "archiver")
29set(CMAKE_RANLIB ${cross_prefix}gcc-ranlib${extension} CACHE INTERNAL "archiver")
30set(CMAKE_C_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "c compiler")
31set(CMAKE_CXX_COMPILER ${cross_prefix}g++${extension} CACHE INTERNAL "cxx compiler")
32set(CMAKE_ASM_COMPILER ${cross_prefix}gcc${extension} CACHE INTERNAL "assembler")
33set(CMAKE_C_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
34set(CMAKE_ASM_FLAGS ${inc_flags} CACHE INTERNAL "c compiler flags")
35set(CMAKE_CXX_FLAGS ${inc_flags} CACHE INTERNAL "cxx compiler flags")
36set(CMAKE_LINKER ${cross_prefix}ld CACHE INTERNAL "linker")
37
38set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")
39set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")
40set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags")
41
42set(CMAKE_FIND_ROOT_PATH ${DEVKITPPC}/powerpc-eabi)
43set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE INTERNAL "")
44set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
45set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")
46set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE)
47
48set(WII ON)
49add_definitions(-DGEKKO)