Home Compiling with QtSDK, Madde and MinGW Makefiles
Post
Cancel

Compiling with QtSDK, Madde and MinGW Makefiles

I received N950 from Nokia this monday, and I started porting the antsnes to Meego right away.
I decided to compile my emulators for Meego in the same way as I did for Symbian. I’m creating a static lib from the emulator core, and then I’m linking into that static lib from my UI code. The idea in here is that, I can make all kinds of special tricks when compiling the emulator core, and then use the standard Qt’s pro-file to compile the UI part. To accomplis this, I made a similar MinGW makefile for Madde, as I used with Symbian.

INSTALLATION

Here are the instructions to use this environment.

  1. Install MSYS
  2. Set environment variable MADDE_PATH to point into your Madde installation. It should point into it in msys format, for example /e/QtSDK/Madde

BUILDING WITH THE MAKEFILE

You’ll need two files: Makefile and config.mk inmyapp/gms path. You should also make folders myapp/gms/dist/gcce andmyapp/gms/obj/gcce .
After all these done, you could change your working directory into the build home by “cd /c/myapp/gms“. Then use the following commands to build. - “make debug” will do the debug build,

  • “make release” will do the release build
  • “make clean” will do the clean

A sample of config.mk is shown on below. The syntax is pretty easy to undertand, no big suprises in here

1
2
3
4
5
6
7
8
9
10
11
PROJECT_NAME = myproject
USERINCLUDE = ../inc
CXXSRCS = \
 myapp.cpp \
 $(NULL)
CSRCS = \
 main.c \
 $(NULL)
ASRCS = \
 my_asm_optimized_source.S \
 $(NULL)

And here’s a sample of a Makefile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
MADDE_GCC_INSTALL_PATH =$(MADDE_PATH)/toolchains/arm-2009q3-67-arm-none-linux-gnueabi-i586-mingw32msvc/arm-2009q3-67/bin
MADDE_INCLUDE = $(MADDE_PATH)/sysroots/harmattan-nokia-meego-arm-sysroot-1122-slim/usr/include
PATH := $(MADDE_GCC_INSTALL_PATH):$(PATH)
SYSINCLUDE = $(MADDE_PATH)/sysroots/harmattan-nokia-meego-arm-sysroot-1122-slim/usr/lib/gcc/arm-linux-gnueabi/4.4/include \
$(MADDE_INCLUDE)
#Macros for compilation process
GCC_MACRO = -D__GCCE__ -D__MARM__ -D__MARM_ARMV5__ -D__EABI__
CPP_MACRO = -D__SUPPORT_CPP_EXCEPTIONS__
EXE_MACRO = -D__EXE__
REL_MACRO = -DNDEBUG
DEB_MACRO = -D_DEBUG
UNICODE_MACRO = -D_UNICODE
GCC_WARNING_FLAGS = -Wall -Wno-unknown-pragmas
CPP_ARGS = -undef -M -nostdinc
# paths
SRC_PATH = ../
OBJ_BASE = obj
DIST_BASE = dist
include config.mk
check:
	@echo 'MADDE_PATH is' $(MADDE_PATH)
	@echo 'MADDE_INCLUDE is ' $(MADDE_INCLUDE)
	@echo 'MADDE_GCC_INSTALL_PATH is ' $(MADDE_GCC_INSTALL_PATH)
	@echo 'PATH is ' $(PATH)
	@echo '==============================================================='
preGCC:
  CC = arm-none-linux-gnueabi-gcc
  CXX = arm-none-linux-gnueabi-g++
  LD = arm-none-linux-gnueabi-ld
  AS = arm-none-linux-gnueabi-as
  AR = arm-none-linux-gnueabi-ar
  DIST_PATH = $(DIST_BASE)/gcce
  OBJ_PATH = $(OBJ_BASE)/gcce
  TARGET_MACRO = $(GCC_MACRO) $(GCC_WARNING_FLAGS)
preDEBUG:
   COMPFLAGS = -march=armv7-a -O0 -mapcs -pipe -nostdinc -c -g \
   -MD $(DEB_MACRO)
preREL:
   COMPFLAGS = -march=armv7-a -O2 -mapcs -pipe -nostdinc -c \
   -MD $(REL_MACRO) -include $(EPOCROOT2)/include/gcce/gcce.h
preALL:
  CFLAGS += $(COMPFLAGS) $(UNICODE_MACRO) $(TARGET_MACRO) \
	$(EXE_MACRO) $(addprefix -D ,$(PRJ_MACRO)) \
  -I $(SRC_PATH) $(addprefix -I ,$(USERINCLUDE)) $(addprefix -I ,$(SYSINCLUDE))
  CXXFLAGS = $(CFLAGS) -Wno-ctor-dtor-privacy -x c++ $(CPP_MACRO)
  C_OBJS = $(patsubst %.c,$(OBJ_PATH)/%.o,$(CSRCS))
  CXX_OBJS = $(patsubst %.cpp,$(OBJ_PATH)/%.o,$(CXXSRCS))
  A_OBJS =  $(patsubst %.S,$(OBJ_PATH)/%.o,$(ASRCS))
  BIN_TARGET = $(DIST_PATH)/$(PROJECT_NAME).a
  ASFLAGS = -mfloat-abi=soft
  COPYLIB = cp $(DIST_PATH)/$(PROJECT_NAME).a ../$(PROJECT_NAME).a
$(CXX_OBJS): $(OBJ_PATH)/%.o : $(SRC_PATH)/%.cpp
	$(CXX) $(CXXFLAGS) -o $@ $<
$(C_OBJS): $(OBJ_PATH)/%.o : $(SRC_PATH)/%.c
	$(CC) $(CFLAGS) -o $@ $<
$(A_OBJS): $(OBJ_PATH)/%.o : $(SRC_PATH)/%.S
	$(CC) -c -o $@ $^
$(BIN_TARGET): $(C_OBJS) $(CXX_OBJS) $(A_OBJS)
	$(AR) rsc $(BIN_TARGET) $(C_OBJS) $(CXX_OBJS) $(A_OBJS)
	$(COPYLIB)
cleang: check preGCC preALL
	rm -rf $(C_OBJS) $(CXX_OBJS) $(A_OBJS)
	rm -rf $(BIN_TARGET)
cleanw: check
buildw: check
clean: cleang
debug: check preGCC preDEBUG preALL $(BIN_TARGET)
release: check preGCC preREL preALL $(BIN_TARGET)

DEBUGGING

The QtCreator seems to be able to find the code without any help, so no special tricks required in here.

This post is licensed under CC BY 4.0 by the author.

Playing NES ROMs with gpSP

Disabling Swipe from a Fullscreen Game

Comments powered by Disqus.