Strip hack was remove by mistake, bringing it back !
[qt:android-lighthouse.git] / mkspecs / android-g++ / qmake.conf
1 #
2 # qmake configuration for building with android-g++
3 #
4
5 include(../common/linux.conf)
6 include(../common/gcc-base-unix.conf)
7 include(../common/qws.conf)
8 CONFIG      = qt warn_on release link_prl ashmem android android_install
9 QT          = android core gui
10
11 # Passing in -win32 to qmake (from NQTC) causes this condition to pass, however
12 # qmake complains that -win32 is deprecated; should find another way, Q_OS_WIN
13 # should really be all QMAKE_HOST.os needs to depend on?
14 contains(QMAKE_HOST.os,Windows) {
15     # Not having sh.exe in your path causes this condition to pass
16     # To build Android Qt on Windows, this block must not be evaluated.
17     isEmpty(QMAKE_SH) {
18         QMAKE_COPY           = copy /y
19         QMAKE_COPY_DIR       = xcopy /s /q /y /i
20         QMAKE_MOVE           = move
21         QMAKE_DEL_FILE       = del /q 2> NUL
22         QMAKE_MKDIR          = mkdir
23         QMAKE_DEL_DIR        = rmdir
24         QMAKE_DEL_TREE       = rmdir /s /q
25         QMAKE_CHK_DIR_EXISTS = if not exist
26         QMAKE_INSTALL_FILE    = copy /y
27         QMAKE_INSTALL_PROGRAM = copy /y
28     }
29 }
30
31 NDK_ROOT = $$(ANDROID_NDK_ROOT)
32 isEmpty( NDK_ROOT ) : NDK_ROOT = $$(HOME)/necessitas/android-ndk
33
34 NDK_HOST = $$(ANDROID_NDK_HOST)
35 isEmpty( NDK_HOST ) : NDK_HOST = linux-x86
36
37 ANDROID_PLATFORM = $$(ANDROID_NDK_PLATFORM)
38 isEmpty( ANDROID_PLATFORM ) : ANDROID_PLATFORM = android-5
39
40 ANDROID_TARGET_ARCH = $$(ANDROID_TARGET_ARCH)
41 isEmpty( ANDROID_TARGET_ARCH ) : ANDROID_TARGET_ARCH = armeabi   # armeabi     - arm v5 cpu architecture
42                                                                  # armeabi-v7a - arm v7 cpu architecture
43                                                                  # x86         - i686 cpu architecture
44
45 NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX)
46 isEmpty( NDK_TOOLCHAIN_PREFIX ) {
47 contains(ANDROID_TARGET_ARCH, x86) : NDK_TOOLCHAIN_PREFIX = x86
48                               else : NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
49 }
50
51 NDK_TOOLS_PREFIX = $$(ANDROID_NDK_TOOLS_PREFIX)
52 isEmpty( NDK_TOOLS_PREFIX ) {
53 contains(ANDROID_TARGET_ARCH, x86) : NDK_TOOLS_PREFIX = i686-android-linux
54                               else : NDK_TOOLS_PREFIX = arm-linux-androideabi
55 }
56
57
58 NDK_TOOLCHAIN_VERSION = $$(ANDROID_NDK_TOOLCHAIN_VERSION)
59 isEmpty( NDK_TOOLCHAIN_VERSION ) : NDK_TOOLCHAIN_VERSION = 4.6
60
61 contains(ANDROID_TARGET_ARCH, x86) : ANDROID_ARCHITECTURE = x86
62                               else : ANDROID_ARCHITECTURE = arm
63
64 !contains(NDK_TOOLCHAIN_VERSION, 4.4.3) : ANDROID_CXXSTL_SUFFIX = -$$NDK_TOOLCHAIN_VERSION
65
66 NDK_TOOLCHAIN = $$NDK_TOOLCHAIN_PREFIX-$$NDK_TOOLCHAIN_VERSION
67 NDK_TOOLCHAIN_PATH=$$NDK_ROOT/toolchains/$$NDK_TOOLCHAIN/prebuilt/$$NDK_HOST
68
69 CONFIG += $$ANDROID_PLATFORM $$ANDROID_TARGET_ARCH
70 ANDROID_PLATFORM_ROOT_PATH  = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/
71 ANDROID_PLATFORM_PATH  = $$ANDROID_PLATFORM_ROOT_PATH/usr
72
73 # used to compile platform plugins for android-4 and android-5
74 QMAKE_ANDROID_PLATFORM_INCDIR = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/usr/include
75 QMAKE_ANDROID_PLATFORM_LIBDIR = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/usr/lib
76
77 ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH
78 ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include $$ANDROID_SOURCES_CXX_STL_LIBDIR/include
79
80 # modifications to g++.conf
81 QMAKE_CC                = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
82
83 contains(ANDROID_TARGET_ARCH, armeabi-v7a): QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
84 contains(ANDROID_TARGET_ARCH, armeabi)    : QMAKE_CFLAGS = -Wno-psabi -march=armv5te -mtune=xscale -msoft-float   -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
85 contains(ANDROID_TARGET_ARCH, x86)        : QMAKE_CFLAGS = -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID  -Wa,--noexecstack
86
87 QMAKE_CFLAGS_WARN_ON    = -Wall -Wno-psabi -W
88 QMAKE_CFLAGS_WARN_OFF   = -Wno-psabi
89 contains(ANDROID_TARGET_ARCH, x86) {
90                                     QMAKE_CFLAGS_RELEASE    = -g -O2
91                                     QMAKE_CFLAGS_DEBUG      = -g
92 }else {
93                                     QMAKE_CFLAGS_RELEASE    = -g -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
94                                     QMAKE_CFLAGS_DEBUG      = -g -marm -O0 -fno-omit-frame-pointer
95 }
96
97 QMAKE_CFLAGS_SHLIB      = -fPIC
98 QMAKE_CFLAGS_YACC       = -Wno-unused -Wno-parentheses
99 QMAKE_CFLAGS_THREAD     = -D_REENTRANT
100 QMAKE_CFLAGS_HIDESYMS   = -fvisibility=hidden
101
102 QMAKE_CXX               = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++
103 QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED
104 QMAKE_CXXFLAGS_WARN_ON  = $$QMAKE_CFLAGS_WARN_ON
105 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
106 QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
107 QMAKE_CXXFLAGS_DEBUG   += $$QMAKE_CFLAGS_DEBUG
108 QMAKE_CXXFLAGS_SHLIB    = $$QMAKE_CFLAGS_SHLIB
109 QMAKE_CXXFLAGS_YACC     = $$QMAKE_CFLAGS_YACC
110 QMAKE_CXXFLAGS_THREAD   = $$QMAKE_CFLAGS_THREAD
111 QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
112
113 QMAKE_LINK              = $$QMAKE_CXX
114 QMAKE_LINK_SHLIB        = $$QMAKE_LINK
115
116 # modifications to linux.conf
117 QMAKE_AR                = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ar cqs
118 QMAKE_OBJCOPY           = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-objcopy
119
120 QMAKE_STRIP=
121 # QMAKE_STRIP             = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-strip
122
123 QMAKE_RANLIB            = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
124
125 QMAKE_INCDIR            = $$ANDROID_SOURCES_CXX_STL_INCDIR $$ANDROID_PLATFORM_PATH/include
126 QMAKE_LIBDIR            = $$ANDROID_PLATFORM_PATH/lib
127 QMAKE_INCDIR_X11        =
128 QMAKE_LIBDIR_X11        =
129 QMAKE_INCDIR_QT         = $$[QT_INSTALL_HEADERS]
130 QMAKE_LIBDIR_QT         = $$[QT_INSTALL_LIBS]
131 QMAKE_INCDIR_OPENGL     = $$ANDROID_PLATFORM_PATH/include
132 QMAKE_LIBDIR_OPENGL     = $$ANDROID_PLATFORM_PATH/lib
133 QMAKE_INCDIR_QTOPIA     =
134 QMAKE_LIBDIR_QTOPIA     =
135
136 contains(ANDROID_TARGET_ARCH, x86): LIBGCC_PATH_FULL     = $$system($$QMAKE_CC -print-libgcc-file-name)
137                              else : LIBGCC_PATH_FULL     = $$system($$QMAKE_CC -mthumb-interwork -print-libgcc-file-name)
138
139 LIBGCC_PATH          = $$dirname(LIBGCC_PATH_FULL)
140
141 QMAKE_LINK              = $$QMAKE_CXX
142 QMAKE_LINK_SHLIB        = $$QMAKE_CXX
143 QMAKE_LFLAGS            = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH -L$$LIBGCC_PATH -Wl,-rpath-link=$$ANDROID_PLATFORM_PATH/lib
144 QMAKE_LFLAGS_APP        =
145 QMAKE_LFLAGS_SHLIB      = -Wl,--no-undefined -Wl,-z,noexecstack -shared
146
147 contains(NDK_ROOT, ".*r6")|contains(NDK_ROOT, ".*r5.*")|contains(NDK_ROOT, ".*r5") {
148     !contains(ANDROID_PLATFORM, android-4): !contains(ANDROID_PLATFORM, android-5): !contains(ANDROID_PLATFORM, android-8) {
149         message("Your NDK-version is out-dated. A work-around is enabled. Consider updating your NDK (workarounds are required until r6(a))")
150         QMAKE_LFLAGS_SHLIB += $$ANDROID_PLATFORM_PATH/lib/crtbegin_so.o $$ANDROID_PLATFORM_PATH/lib/crtend_so.o
151     }
152 }
153
154 QMAKE_LFLAGS_PLUGIN     = $$QMAKE_LFLAGS_SHLIB
155 QMAKE_LFLAGS_SONAME     =
156 #-Wl,-soname,
157 #QMAKE_LFLAGS_THREAD     =
158 QMAKE_LFLAGS_NOUNDEF    =  -Wl,--no-undefined
159 QMAKE_LFLAGS_RPATH      =  -Wl,-rpath=
160
161
162 QMAKE_LIBS              = -llog -lz -lm -ldl -lc -lgcc
163 QMAKE_LIBS_X11          =
164 QMAKE_LIBS_X11SM        =
165 QMAKE_LIBS_QT_THREAD    =
166 QMAKE_LIBS_QT_OPENGL    =
167 QMAKE_LIBS_QTOPIA       =
168 QMAKE_LIBS_THREAD       =
169 QMAKE_LIBS_EGL          =
170 QMAKE_LIBS_OPENGL       =
171 QMAKE_LIBS_OPENGL_QT    =
172 QMAKE_LIBS_OPENGL_ES1   = -lGLESv1_CM
173 QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 $$QMAKE_LIBS
174
175 load(qt_config)