Config.Android.pp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. //
  2. // Config.Android.pp
  3. //
  4. // This file defines some custom config variables for the Android
  5. // platform. It makes some initial guesses about compiler features,
  6. // etc.
  7. //
  8. // *******************************************************************
  9. // NOTE: you should not attempt to copy this file verbatim as your own
  10. // personal Config.pp file. Instead, you should start with an empty
  11. // Config.pp file, and add lines to it when you wish to override
  12. // settings given in here. In the normal ppremake system, this file
  13. // will always be read first, and then your personal Config.pp file
  14. // will be read later, which gives you a chance to override the
  15. // default settings found in this file. However, if you start by
  16. // copying the entire file, it will be difficult to tell which
  17. // settings you have customized, and it will be difficult to upgrade
  18. // to a subsequent version of Panda.
  19. // *******************************************************************
  20. // Android is a Linux distribution.
  21. #define IS_LINUX 1
  22. // These libraries are provided by the Android NDK.
  23. #define ZLIB_IPATH
  24. #define ZLIB_LPATH
  25. #define ZLIB_LIBS z
  26. #define HAVE_ZLIB 1
  27. #define GLES_IPATH
  28. #define GLES_LPATH
  29. #define GLES_LIBS GLESv1_CM
  30. #define HAVE_GLES 1
  31. #define GLES2_IPATH
  32. #define GLES2_LPATH
  33. #define GLES2_LIBS GLESv2
  34. #define HAVE_GLES2 1
  35. #define EGL_IPATH
  36. #define EGL_LPATH
  37. #define EGL_LIBS EGL
  38. #define HAVE_EGL 1
  39. // We don't have these, of course, so let's disable
  40. // them for convenience in case they were autodetected.
  41. #define HAVE_DX8
  42. #define HAVE_DX9
  43. #define HAVE_CG
  44. // Compiler flags
  45. #defer TOOLCHAIN_PATH $[ANDROID_NDK_HOME]/toolchains/$[ANDROID_TOOLCHAIN]/prebuilt/windows/bin
  46. #defer TOOLCHAIN_PREFIX $[if $[eq $[ANDROID_ABI],x86],i686-linux-android,$[ANDROID_ABI]]
  47. #defer CC $[TOOLCHAIN_PATH]/$[TOOLCHAIN_PREFIX]-gcc
  48. #defer CXX $[TOOLCHAIN_PATH]/$[TOOLCHAIN_PREFIX]-g++
  49. #defer AR $[TOOLCHAIN_PATH]/$[TOOLCHAIN_PREFIX]-ar
  50. #define C++FLAGS_GEN -fno-exceptions -fno-rtti
  51. #defer SYSROOT $[ANDROID_NDK_HOME]/platforms/$[ANDROID_PLATFORM]/arch-$[ANDROID_ARCH]
  52. #defer SYSROOT_FLAGS --sysroot=$[subst \,/,$[osfilename $[SYSROOT]]]
  53. #defer EXTRA_IPATH $[ANDROID_NDK_HOME]/sources/android/native_app_glue $[SYSROOT]/usr/include
  54. #defer EXTRA_LPATH $[SYSROOT]/usr/lib
  55. #defer EXTRA_LIBS $[if $[eq $[BUILD_TYPE],android],,c m]
  56. // Define the CFLAGS and LDFLAGS settings for the various architectures.
  57. #defer ANDROID_arm_CFLAGS\
  58. -fpic\
  59. -ffunction-sections\
  60. -funwind-tables\
  61. -fstack-protector\
  62. -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__\
  63. -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__\
  64. $[if $[eq $[ANDROID_ABI],armeabi-v7a],-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16,-march=armv5te -mtune=xscale -msoft-float]
  65. #defer ANDROID_arm_LDFLAGS -march=armv7-a -Wl,--fix-cortex-a8
  66. #define ANDROID_mips_CFLAGS\
  67. -fpic\
  68. -fno-strict-aliasing\
  69. -finline-functions\
  70. -ffunction-sections\
  71. -funwind-tables\
  72. -fmessage-length=0\
  73. -fno-inline-functions-called-once\
  74. -fgcse-after-reload\
  75. -frerun-cse-after-loop\
  76. -frename-registers
  77. #define ANDROID_mips_LDFLAGS
  78. #define ANDROID_x86_CFLAGS\
  79. -ffunction-sections\
  80. -funwind-tables\
  81. -fstack-protector
  82. #define ANDROID_x86_LDFLAGS
  83. // Select the flags for our architecture and add some common ones.
  84. #defer ANDROID_CFLAGS $[ANDROID_$[ANDROID_ARCH]_CFLAGS] -DANDROID -Wa,$[if $[ANDROID_DISABLE_NX],--execstack,--noexecstack]
  85. #defer ANDROID_LDFLAGS -Wl,--no-undefined\
  86. -Wl,-z,$[if $[ANDROID_DISABLE_NX],execstack,noexecstack]\
  87. -Wl,-z,$[if $[ANDROID_DISABLE_RELRO],norelro,relro]\
  88. -Wl,-z,$[if $[ANDROID_DISABLE_RELRO],lazy,now]
  89. // How to compile a C or C++ file into a .o file. $[target] is the
  90. // name of the .o file, $[source] is the name of the source file,
  91. // $[ipath] is a space-separated list of directories to search for
  92. // include files, and $[flags] is a list of additional flags to pass
  93. // to the compiler.
  94. #defer os_ipath $[subst \,/,$[osfilename $[ipath]]]
  95. #defer COMPILE_C $[CC] $[SYSROOT_FLAGS] $[ANDROID_CFLAGS] $[CFLAGS_GEN] $[flags] $[os_ipath:%=-I%] -c $[source] -o $[target]
  96. #defer COMPILE_C++ $[CXX] $[SYSROOT_FLAGS] $[ANDROID_CFLAGS] $[C++FLAGS_GEN] $[flags] $[os_ipath:%=-I%] -c $[source] -o $[target]
  97. // What flags should be passed to both C and C++ compilers to enable
  98. // debug symbols? This will be supplied when OPTIMIZE (above) is set
  99. // to 1, 2, or 3.
  100. #defer DEBUGFLAGS -g
  101. // What flags should be passed to both C and C++ compilers to enable
  102. // compiler optimizations? This will be supplied when OPTIMIZE
  103. // (above) is set to 2, 3, or 4.
  104. #defer OPTFLAGS -O2
  105. // By convention, any source file that contains the string _no_opt_ in
  106. // its filename won't have the above compiler optimizations run for it.
  107. #defer no_opt $[findstring _no_opt_,$[source]]
  108. // What define variables should be passed to the compilers for each
  109. // value of OPTIMIZE? We separate this so we can pass these same
  110. // options to interrogate, guaranteeing that the correct interfaces
  111. // are generated. Do not include -D here; that will be supplied
  112. // automatically.
  113. #defer CDEFINES_OPT1 $[EXTRA_CDEFS]
  114. #defer CDEFINES_OPT2 $[EXTRA_CDEFS]
  115. #defer CDEFINES_OPT3 $[EXTRA_CDEFS]
  116. #defer CDEFINES_OPT4 $[EXTRA_CDEFS]
  117. // What additional flags should be passed for each value of OPTIMIZE
  118. // (above)? We separate out the compiler-optimization flags, above,
  119. // so we can compile certain files that give optimizers trouble (like
  120. // the output of lex and yacc) without them, but with all the other
  121. // relevant flags.
  122. #define ANDROID_DEBUG_CFLAGS -fno-omit-frame-pointer -fno-strict-aliasing
  123. #define ANDROID_RELEASE_CFLAGS -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300
  124. #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] -Wall $[DEBUGFLAGS] $[ANDROID_DEBUG_FLAGS]
  125. #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] -Wall $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] $[ANDROID_DEBUG_FLAGS]
  126. #defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] $[ANDROID_RELEASE_FLAGS]
  127. #defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[if $[no_opt],,$[OPTFLAGS]] $[ANDROID_RELEASE_FLAGS]
  128. // What additional flags should be passed to both compilers when
  129. // building shared (relocatable) sources? Some architectures require
  130. // special support for this.
  131. #defer CFLAGS_SHARED -fPIC
  132. // How to generate a C or C++ executable from a collection of .o
  133. // files. $[target] is the name of the binary to generate, and
  134. // $[sources] is the list of .o files. $[libs] is a space-separated
  135. // list of dependent libraries, and $[lpath] is a space-separated list
  136. // of directories in which those libraries can be found.
  137. #defer os_lpath $[subst \,/,$[osfilename $[lpath]]]
  138. #defer LINK_BIN_C $[LINK_BIN_C++]
  139. #defer LINK_BIN_C++ $[cxx_ld]\
  140. -Wl,--gc-sections\
  141. -Wl,-z,nocopyreloc\
  142. $[SYSROOT_FLAGS]\
  143. $[sources]\
  144. $[flags]\
  145. $[os_lpath:%=-L%] $[libs:%=-l%]\
  146. -o $[target]
  147. // How to generate a static C or C++ library. $[target] is the
  148. // name of the library to generate, and $[sources] is the list of .o
  149. // files that will go into the library.
  150. #defer STATIC_LIB_C $[AR] cru $[target] $[sources]
  151. #defer STATIC_LIB_C++ $[AR] cru $[target] $[sources]
  152. // How to run ranlib, if necessary, after generating a static library.
  153. // $[target] is the name of the library. Set this to the empty string
  154. // if ranlib is not necessary on your platform.
  155. #defer RANLIB ranlib $[target]
  156. // Where to put the so_locations file, used by an Irix MIPSPro
  157. // compiler, to generate a map of shared library memory locations.
  158. #defer SO_LOCATIONS $[DTOOL_INSTALL]/etc/so_locations
  159. // How to generate a shared C or C++ library. $[source] and $[target]
  160. // as above, and $[libs] is a space-separated list of dependent
  161. // libraries, and $[lpath] is a space-separated list of directories in
  162. // which those libraries can be found.
  163. #defer SHARED_LIB_C $[SHARED_LIB_C++]
  164. #defer SHARED_LIB_C++ $[cxx_ld]\
  165. -Wl,-soname,$[notdir $[target]]\
  166. -shared\
  167. $[SYSROOT_FLAGS]\
  168. $[sources]\
  169. $[flags]\
  170. $[os_lpath:%=-L%] $[libs:%=-l%]\
  171. -o $[target]
  172. #define BUNDLE_LIB_C++
  173. // How to install a data file or executable file. $[local] is the
  174. // local name of the file to install, and $[dest] is the name of the
  175. // directory to put it in.
  176. // On Unix systems, we strongly prefer using the install program to
  177. // install files. This has nice features like automatically setting
  178. // the permissions bits, and also is usually clever enough to install
  179. // a running program without crashing the running instance. However,
  180. // it doesn't understanding installing a program from a subdirectory,
  181. // so we have to cd into the source directory first.
  182. #defer install_dash_p $[if $[KEEP_TIMESTAMPS],-p,]
  183. #defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_DATA] $[install_dash_p] $[notdir $[local]] $[dest]/
  184. #defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_PROG] $[install_dash_p] $[notdir $[local]] $[dest]/
  185. #define SYSTEM_IGATE_FLAGS -D__const=const -Dvolatile -Dmutable
  186. // Posix thread support is provided by the Android NDK.
  187. #define HAVE_POSIX_THREADS 1
  188. #define THREADS_LIBS
  189. // Is the platform big-endian (like an SGI workstation) or
  190. // little-endian (like a PC)? Define this to the empty string to
  191. // indicate little-endian, or nonempty to indicate big-endian.
  192. #define WORDS_BIGENDIAN
  193. // Does the C++ compiler support namespaces?
  194. #define HAVE_NAMESPACE 1
  195. // Does the C++ compiler support ios::binary?
  196. #define HAVE_IOS_BINARY 1
  197. // How about the typename keyword?
  198. #define HAVE_TYPENAME 1
  199. // Will the compiler avoid inserting extra bytes in structs between a
  200. // base struct and its derived structs? It is safe to define this
  201. // false if you don't know, but if you know that you can get away with
  202. // this you may gain a tiny performance gain by defining this true.
  203. // If you define this true incorrectly, you will get lots of
  204. // assertion failures on execution.
  205. #define SIMPLE_STRUCT_POINTERS
  206. // Does gettimeofday() take only one parameter?
  207. #define GETTIMEOFDAY_ONE_PARAM
  208. // Do we have getopt() and/or getopt_long_only() built into the
  209. // system?
  210. #define HAVE_GETOPT 1
  211. #define HAVE_GETOPT_LONG_ONLY 1
  212. // Are the above getopt() functions defined in getopt.h, or somewhere else?
  213. #define PHAVE_GETOPT_H 1
  214. // Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call?
  215. #define IOCTL_TERMINAL_WIDTH 1
  216. // Do the system headers define a "streamsize" typedef? How about the
  217. // ios::binary enumerated value? And other ios typedef symbols like
  218. // ios::openmode and ios::fmtflags?
  219. #define HAVE_STREAMSIZE 1
  220. #define HAVE_IOS_BINARY 1
  221. #define HAVE_IOS_TYPEDEFS 1
  222. // Can we safely call getenv() at static init time?
  223. #define STATIC_INIT_GETENV 1
  224. // Can we read the files /proc/self/* to determine our
  225. // environment variables at static init time?
  226. #define HAVE_PROC_SELF_EXE 1
  227. #define HAVE_PROC_SELF_MAPS 1
  228. #define HAVE_PROC_SELF_ENVIRON 1
  229. #define HAVE_PROC_SELF_CMDLINE 1
  230. // Do we have a global pair of argc/argv variables that we can read at
  231. // static init time? Should we prototype them? What are they called?
  232. #define HAVE_GLOBAL_ARGV
  233. #define PROTOTYPE_GLOBAL_ARGV
  234. #define GLOBAL_ARGV
  235. #define GLOBAL_ARGC
  236. // Should we include <iostream> or <iostream.h>? Define PHAVE_IOSTREAM
  237. // to nonempty if we should use <iostream>, or empty if we should use
  238. // <iostream.h>.
  239. #define PHAVE_IOSTREAM 1
  240. // Do we have a true stringstream class defined in <sstream>?
  241. #define PHAVE_SSTREAM 1
  242. // Does fstream::open() require a third parameter, specifying the
  243. // umask? Versions of gcc prior to 3.2 had this.
  244. #define HAVE_OPEN_MASK
  245. // Do we have the lockf() function available?
  246. #define HAVE_LOCKF
  247. // Do the compiler or system libraries define wchar_t for you?
  248. #define HAVE_WCHAR_T 1
  249. // Does <string> define the typedef wstring? Most do, but for some
  250. // reason, versions of gcc before 3.0 didn't do this.
  251. #define HAVE_WSTRING 1
  252. // Do we have <new>?
  253. #define PHAVE_NEW 1
  254. // Do we have <io.h>?
  255. #define PHAVE_IO_H
  256. // Do we have <malloc.h>?
  257. #define PHAVE_MALLOC_H 1
  258. // Do we have <alloca.h>?
  259. #define PHAVE_ALLOCA_H 1
  260. // Do we have <locale.h>?
  261. #define PHAVE_LOCALE_H 1
  262. // Do we have <string.h>?
  263. #define PHAVE_STRING_H 1
  264. // Do we have <stdlib.h>?
  265. #define PHAVE_STDLIB_H 1
  266. // Do we have <limits.h>?
  267. #define PHAVE_LIMITS_H 1
  268. // Do we have <minmax.h>?
  269. #define PHAVE_MINMAX_H
  270. // Do we have <sys/types.h>?
  271. #define PHAVE_SYS_TYPES_H 1
  272. #define PHAVE_SYS_TIME_H 1
  273. // Do we have <unistd.h>?
  274. #define PHAVE_UNISTD_H 1
  275. // Do we have <utime.h>?
  276. #define PHAVE_UTIME_H 1
  277. // Do we have <dirent.h>?
  278. #define PHAVE_DIRENT_H 1
  279. // Do we have <glob.h> (and do we want to use it instead of dirent.h)?
  280. #define PHAVE_GLOB_H
  281. // Do we have <sys/soundcard.h> (and presumably a Linux-style audio
  282. // interface)?
  283. #define PHAVE_SYS_SOUNDCARD_H 1
  284. // Do we have <ucontext.h> (and therefore makecontext() / swapcontext())?
  285. #define PHAVE_UCONTEXT_H 1
  286. // Do we have <linux/input.h> ? This enables us to use raw mouse input.
  287. #define PHAVE_LINUX_INPUT_H 1
  288. // Do we have RTTI (and <typeinfo>)?
  289. // Technically, Android has RTTI support now,
  290. // but we keep it disabled for performance reasons.
  291. #define HAVE_RTTI
  292. // Do we have <stdint.h>?
  293. #define PHAVE_STDINT_H 1
  294. // We need 64-bit file i/o
  295. #define __USE_LARGEFILE64 1
  296. // The dynamic library file extension (usually .so .dll or .dylib):
  297. #define DYNAMIC_LIB_EXT .so
  298. #define STATIC_LIB_EXT .a
  299. #define BUNDLE_EXT