2018-05-22 23:08:13 +01:00
|
|
|
cmake_minimum_required(VERSION 3.2)
|
|
|
|
|
|
|
|
set(CMAKE_SYSTEM_NAME Generic)
|
|
|
|
set(CMAKE_SYSTEM_VERSION 1)
|
2018-06-04 18:09:49 +01:00
|
|
|
set(CMAKE_SYSTEM_PROCESSOR "ppc")
|
|
|
|
set(CMAKE_CROSSCOMPILING 1)
|
2018-05-22 23:08:13 +01:00
|
|
|
|
2019-01-18 16:04:32 +00:00
|
|
|
# Find DEVKITPRO
|
|
|
|
if(NOT DEFINED ENV{DEVKITPRO})
|
|
|
|
message(FATAL_ERROR "You must have defined DEVKITPRO before calling cmake.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(DEVKITPRO $ENV{DEVKITPRO})
|
|
|
|
|
2019-04-04 02:01:17 +01:00
|
|
|
if(NOT DEFINED ENV{DEVKITPPC})
|
|
|
|
set(DEVKITPPC $ENV{DEVKITPRO}/devkitPPC)
|
2019-01-10 09:55:19 +00:00
|
|
|
else()
|
|
|
|
set(DEVKITPPC $ENV{DEVKITPPC})
|
2018-05-22 23:08:13 +01:00
|
|
|
endif()
|
|
|
|
|
2018-06-14 11:44:23 +01:00
|
|
|
if(NOT DEFINED ENV{WUT_ROOT})
|
2019-04-04 02:01:17 +01:00
|
|
|
set(WUT_ROOT $ENV{DEVKITPRO}/wut)
|
|
|
|
else()
|
|
|
|
set(WUT_ROOT $ENV{WUT_ROOT})
|
2018-05-22 23:08:13 +01:00
|
|
|
endif()
|
|
|
|
|
2019-01-18 16:04:32 +00:00
|
|
|
# Find elf2rpl
|
|
|
|
find_program(ELF2RPL_BIN
|
|
|
|
NAMES elf2rpl
|
2019-04-04 02:01:17 +01:00
|
|
|
)
|
|
|
|
|
2019-01-18 16:04:32 +00:00
|
|
|
if(NOT ELF2RPL_BIN)
|
|
|
|
message(FATAL_ERROR "Could not find elf2rpl")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Find rplexportgen
|
|
|
|
find_program(RPLEXPORTGEN_BIN
|
|
|
|
NAMES rplexportgen
|
2019-04-04 02:01:17 +01:00
|
|
|
)
|
|
|
|
|
2019-01-18 16:04:32 +00:00
|
|
|
if(NOT RPLEXPORTGEN_BIN)
|
|
|
|
message(FATAL_ERROR "Could not find rplexportgen")
|
|
|
|
endif()
|
|
|
|
|
2019-04-04 02:01:17 +01:00
|
|
|
set(CMAKE_ASM_COMPILER "powerpc-eabi-gcc" CACHE PATH "")
|
|
|
|
set(CMAKE_C_COMPILER "powerpc-eabi-gcc" CACHE PATH "")
|
|
|
|
set(CMAKE_CXX_COMPILER "powerpc-eabi-g++" CACHE PATH "")
|
|
|
|
set(CMAKE_LINKER "powerpc-eabi-ld" CACHE PATH "")
|
|
|
|
set(CMAKE_AR "powerpc-eabi-ar" CACHE PATH "")
|
|
|
|
set(CMAKE_STRIP "powerpc-eabi-strip" CACHE PATH "")
|
2018-05-22 23:08:13 +01:00
|
|
|
|
2019-03-18 19:01:58 +11:00
|
|
|
set(WUT_C_FLAGS "-mcpu=750 -meabi -mhard-float -Wl,-q -D__WIIU__ -D__WUT__ -isystem \"${WUT_ROOT}/include\"")
|
2018-05-22 23:08:13 +01:00
|
|
|
set(CMAKE_C_FLAGS "${WUT_C_FLAGS}" CACHE STRING "")
|
|
|
|
set(CMAKE_CXX_FLAGS "${WUT_C_FLAGS}" CACHE STRING "")
|
|
|
|
set(CMAKE_ASM_FLAGS "${WUT_C_FLAGS}" CACHE STRING "")
|
2018-05-28 11:39:54 +01:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,nocopyreloc -T \"${WUT_ROOT}/share/wut.ld\" \"-L${WUT_ROOT}/lib\"" CACHE STRING "")
|
2018-05-22 23:08:13 +01:00
|
|
|
|
|
|
|
# Setup root to exclude host system headers + libraries
|
2019-04-04 02:01:17 +01:00
|
|
|
set(CMAKE_FIND_ROOT_PATH "${DEVKITPPC}" "${DEVKITPRO}/tools" "${DEVKITPRO}/portlibs/wiiu" "${DEVKITPRO}/portlibs/ppc" "${WUT_ROOT}/share")
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
2018-05-22 23:08:13 +01:00
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
|
|
|
|
|
|
# Tools
|
2019-01-18 16:04:32 +00:00
|
|
|
set(WUT_ELF2RPL "${ELF2RPL_BIN}" CACHE PATH "")
|
|
|
|
set(WUT_RPLEXPORTGEN "${RPLEXPORTGEN_BIN}" CACHE PATH "")
|
2018-05-22 23:08:13 +01:00
|
|
|
|
|
|
|
# Flags
|
|
|
|
set(WUT TRUE)
|
2018-06-04 18:09:10 +01:00
|
|
|
set(WIIU TRUE)
|
|
|
|
|
|
|
|
# There is no shared lib support in devkitPPC
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Shared libs not available")
|