Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to compile port wii?
#1
Hello, I'm trying to compile wii port of mGBA in Windows with Devkitpro PPC,
I've added a Makefile to project, here it's the code
Code:
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

include $(DEVKITPPC)/wii_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET    := mGBA-wii
BUILD     := build_wii
SOURCES := src/platform/wii src/arm src/gba src/gba/cheats src/gba/rr \
src/gba/supervisor src/util src/util/*.[cSs] src/util/gui src/gba/renderers \
src/gba/sio/lockstep.c src/third-party/inih src/platform/commandline.c \
       src/util/vfs/vfs-mem.c src/util/vfs/vfs-file.c src/util/vfs/vfs-dirent.c
       
INCLUDES := src src/arm src/util src/util/gui src/arm src/gba src/gba/cheats src/gba/rr \
src/gba/supervisor src/gba/renderers src/third-party/inih src/platform/wii \
       src/util/vfs


#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O3 -mrvl -Wall -Wextra -std=c99 -DCOLOR_16_BIT -DCOLOR_5_6_5 -DUSE_VFS_FILE \
           $(INCLUDE) $(MACHDEP) $(DEFS)

CXXFLAGS = $(CFLAGS)
LDFLAGS = $(MACHDEP) -g -mrvl -Wl,-Map,$(notdir $@).map -s

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lfat -logc
#-lbte -lwiiuse

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR := $(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))


#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif

export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) \
-I$(LIBOGC_INC) -I$(PORTLIBS)/include/freetype2

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB)

export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@[ -d $(TARGETDIR) ] || mkdir -p $(TARGETDIR)
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol

#---------------------------------------------------------------------------------
run:
wiiload $(OUTPUT).dol

#---------------------------------------------------------------------------------
reload:
wiiload -r $(OUTPUT).dol


#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

#---------------------------------------------------------------------------------
# This rule links in binary data with these extensions: ttf lang png ogg pcm
#---------------------------------------------------------------------------------

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

But I get a lot of errors, statring with gui-font.h and memcpy undefined, even if I add <malloc.h>,
maybe it's for my makefile, I'm a total noob on makefiling, just for checking other examples.
After, that a lot of undefinded references errors.

Any help please?
Reply

#2
mGBA doesn't use Makefiles the way many other projects do--instead it uses CMake. If you have CMake installed, you'll need to do something like this (starting from the root):

Code:
mkdir wii && cd wii
cmake .. -DCMAKE_TOOLCHAIN_FILE=../src/platform/wii/CMakeToolchain.txt -G "Unix Makefiles"
make

But this may vary a bit since I don't know what the devKitPro environment on Windows looks like.
Reply

#3
I'm also trying to compile for Wii, but I get an error saying the path is not full:
[Image: gInwQXV.png]
Reply

#4
I've added a Makefile for devkitppc for windows, it's not the best or elegant way, but it helps me, you can check it on github:

https://github.com/askotx/mgba/commit/0d...e6690c2671

You must run make-wii.sh, to compile everything, I hope this can help you, took me a long time to do it.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 Melroy van den Berg.