Config.Android.pp 13 KB

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