toolchain.lua 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. --
  2. -- Copyright 2010-2015 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
  4. --
  5. local bxDir = path.getabsolute("..")
  6. local naclToolchain = ""
  7. function toolchain(_buildDir, _libDir)
  8. newoption {
  9. trigger = "gcc",
  10. value = "GCC",
  11. description = "Choose GCC flavor",
  12. allowed = {
  13. { "android-arm", "Android - ARM" },
  14. { "android-mips", "Android - MIPS" },
  15. { "android-x86", "Android - x86" },
  16. { "asmjs", "Emscripten/asm.js" },
  17. { "freebsd", "FreeBSD" },
  18. { "linux-gcc", "Linux (GCC compiler)" },
  19. { "linux-gcc-5", "Linux (GCC-5 compiler)" },
  20. { "linux-clang", "Linux (Clang compiler)" },
  21. { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" },
  22. { "linux-arm-gcc", "Linux (ARM, GCC compiler)" },
  23. { "ios-arm", "iOS - ARM" },
  24. { "ios-simulator", "iOS - Simulator" },
  25. { "tvos-arm64", "tvOS - ARM64" },
  26. { "tvos-simulator", "tvOS - Simulator" },
  27. { "mingw-gcc", "MinGW" },
  28. { "mingw-clang", "MinGW (clang compiler)" },
  29. { "nacl", "Native Client" },
  30. { "nacl-arm", "Native Client - ARM" },
  31. { "osx", "OSX" },
  32. { "pnacl", "Native Client - PNaCl" },
  33. { "ps4", "PS4" },
  34. { "qnx-arm", "QNX/Blackberry - ARM" },
  35. { "rpi", "RaspberryPi" },
  36. },
  37. }
  38. newoption {
  39. trigger = "vs",
  40. value = "toolset",
  41. description = "Choose VS toolset",
  42. allowed = {
  43. { "vs2012-clang", "Clang 3.6" },
  44. { "vs2013-clang", "Clang 3.6" },
  45. { "vs2012-xp", "Visual Studio 2012 targeting XP" },
  46. { "vs2013-xp", "Visual Studio 2013 targeting XP" },
  47. { "vs2015-xp", "Visual Studio 2015 targeting XP" },
  48. { "winphone8", "Windows Phone 8.0" },
  49. { "winphone81", "Windows Phone 8.1" },
  50. { "winstore81", "Windows Store 8.1" },
  51. { "winstore82", "Universal Windows App" },
  52. },
  53. }
  54. newoption {
  55. trigger = "xcode",
  56. value = "xcode_target",
  57. description = "Choose XCode target",
  58. allowed = {
  59. { "osx", "OSX" },
  60. { "ios", "iOS" },
  61. { "tvos", "tvOS" },
  62. }
  63. }
  64. newoption {
  65. trigger = "with-android",
  66. value = "#",
  67. description = "Set Android platform version (default: android-14).",
  68. }
  69. newoption {
  70. trigger = "with-ios",
  71. value = "#",
  72. description = "Set iOS target version (default: 8.0).",
  73. }
  74. newoption {
  75. trigger = "with-tvos",
  76. value = "#",
  77. description = "Set tvOS target version (default: 9.0).",
  78. }
  79. -- Avoid error when invoking genie --help.
  80. if (_ACTION == nil) then return false end
  81. location (path.join(_buildDir, "projects", _ACTION))
  82. if _ACTION == "clean" then
  83. os.rmdir(BUILD_DIR)
  84. end
  85. local androidPlatform = "android-14"
  86. if _OPTIONS["with-android"] then
  87. androidPlatform = "android-" .. _OPTIONS["with-android"]
  88. end
  89. local iosPlatform = ""
  90. if _OPTIONS["with-ios"] then
  91. iosPlatform = _OPTIONS["with-ios"]
  92. end
  93. local tvosPlatform = ""
  94. if _OPTIONS["with-tvos"] then
  95. tvosPlatform = _OPTIONS["with-tvos"]
  96. end
  97. if _ACTION == "gmake" then
  98. if nil == _OPTIONS["gcc"] then
  99. print("GCC flavor must be specified!")
  100. os.exit(1)
  101. end
  102. flags {
  103. "ExtraWarnings",
  104. }
  105. if "android-arm" == _OPTIONS["gcc"] then
  106. if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_ROOT") then
  107. print("Set ANDROID_NDK_ARM and ANDROID_NDK_ROOT envrionment variables.")
  108. end
  109. premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
  110. premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
  111. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  112. location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
  113. elseif "android-mips" == _OPTIONS["gcc"] then
  114. if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then
  115. print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
  116. end
  117. premake.gcc.cc = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc"
  118. premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
  119. premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
  120. location (path.join(_buildDir, "projects", _ACTION .. "-android-mips"))
  121. elseif "android-x86" == _OPTIONS["gcc"] then
  122. if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then
  123. print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
  124. end
  125. premake.gcc.cc = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc"
  126. premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
  127. premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
  128. location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
  129. elseif "asmjs" == _OPTIONS["gcc"] then
  130. if not os.getenv("EMSCRIPTEN") then
  131. print("Set EMSCRIPTEN enviroment variables.")
  132. end
  133. premake.gcc.cc = "$(EMSCRIPTEN)/emcc"
  134. premake.gcc.cxx = "$(EMSCRIPTEN)/em++"
  135. premake.gcc.ar = "$(EMSCRIPTEN)/emar"
  136. premake.gcc.llvm = true
  137. location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
  138. elseif "freebsd" == _OPTIONS["gcc"] then
  139. location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
  140. elseif "ios-arm" == _OPTIONS["gcc"] then
  141. premake.gcc.cc = "clang"
  142. premake.gcc.cxx = "clang++"
  143. premake.gcc.ar = "ar"
  144. location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm"))
  145. elseif "ios-simulator" == _OPTIONS["gcc"] then
  146. premake.gcc.cc = "clang"
  147. premake.gcc.cxx = "clang++"
  148. premake.gcc.ar = "ar"
  149. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  150. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  151. premake.gcc.cc = "clang"
  152. premake.gcc.cxx = "clang++"
  153. premake.gcc.ar = "ar"
  154. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  155. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  156. premake.gcc.cc = "clang"
  157. premake.gcc.cxx = "clang++"
  158. premake.gcc.ar = "ar"
  159. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  160. elseif "linux-gcc" == _OPTIONS["gcc"] then
  161. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  162. elseif "linux-gcc-5" == _OPTIONS["gcc"] then
  163. premake.gcc.cc = "gcc-5"
  164. premake.gcc.cxx = "g++-5"
  165. premake.gcc.ar = "ar"
  166. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  167. elseif "linux-clang" == _OPTIONS["gcc"] then
  168. premake.gcc.cc = "clang"
  169. premake.gcc.cxx = "clang++"
  170. premake.gcc.ar = "ar"
  171. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  172. elseif "linux-mips-gcc" == _OPTIONS["gcc"] then
  173. location (path.join(_buildDir, "projects", _ACTION .. "-linux-mips-gcc"))
  174. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  175. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  176. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  177. premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
  178. premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
  179. premake.gcc.ar = "$(MINGW)/bin/ar"
  180. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  181. elseif "mingw-clang" == _OPTIONS["gcc"] then
  182. premake.gcc.cc = "$(CLANG)/bin/clang"
  183. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  184. premake.gcc.ar = "$(MINGW)/bin/ar"
  185. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  186. -- premake.gcc.llvm = true
  187. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  188. elseif "nacl" == _OPTIONS["gcc"] then
  189. if not os.getenv("NACL_SDK_ROOT") then
  190. print("Set NACL_SDK_ROOT enviroment variables.")
  191. end
  192. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-"
  193. if os.is("macosx") then
  194. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_newlib/bin/x86_64-nacl-"
  195. elseif os.is("linux") then
  196. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/x86_64-nacl-"
  197. end
  198. premake.gcc.cc = naclToolchain .. "gcc"
  199. premake.gcc.cxx = naclToolchain .. "g++"
  200. premake.gcc.ar = naclToolchain .. "ar"
  201. location (path.join(_buildDir, "projects", _ACTION .. "-nacl"))
  202. elseif "nacl-arm" == _OPTIONS["gcc"] then
  203. if not os.getenv("NACL_SDK_ROOT") then
  204. print("Set NACL_SDK_ROOT enviroment variables.")
  205. end
  206. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-"
  207. if os.is("macosx") then
  208. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_newlib/bin/arm-nacl-"
  209. elseif os.is("linux") then
  210. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_newlib/bin/arm-nacl-"
  211. end
  212. premake.gcc.cc = naclToolchain .. "gcc"
  213. premake.gcc.cxx = naclToolchain .. "g++"
  214. premake.gcc.ar = naclToolchain .. "ar"
  215. location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm"))
  216. elseif "osx" == _OPTIONS["gcc"] then
  217. if os.is("linux") then
  218. local osxToolchain = "x86_64-apple-darwin13-"
  219. premake.gcc.cc = osxToolchain .. "clang"
  220. premake.gcc.cxx = osxToolchain .. "clang++"
  221. premake.gcc.ar = osxToolchain .. "ar"
  222. end
  223. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  224. elseif "pnacl" == _OPTIONS["gcc"] then
  225. if not os.getenv("NACL_SDK_ROOT") then
  226. print("Set NACL_SDK_ROOT enviroment variables.")
  227. end
  228. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-"
  229. if os.is("macosx") then
  230. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_pnacl/bin/pnacl-"
  231. elseif os.is("linux") then
  232. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-"
  233. end
  234. premake.gcc.cc = naclToolchain .. "clang"
  235. premake.gcc.cxx = naclToolchain .. "clang++"
  236. premake.gcc.ar = naclToolchain .. "ar"
  237. location (path.join(_buildDir, "projects", _ACTION .. "-pnacl"))
  238. elseif "ps4" == _OPTIONS["gcc"] then
  239. if not os.getenv("PS4_SDK_ROOT") then
  240. print("Set PS4_SDK_ROOT enviroment variables.")
  241. end
  242. ps4Toolchain = "$(PS4_SDK_ROOT)/host_tools/bin/orbis-"
  243. premake.gcc.cc = ps4Toolchain .. "clang"
  244. premake.gcc.cxx = ps4Toolchain .. "clang++"
  245. premake.gcc.ar = ps4Toolchain .. "ar"
  246. location (path.join(_buildDir, "projects", _ACTION .. "-ps4"))
  247. elseif "qnx-arm" == _OPTIONS["gcc"] then
  248. if not os.getenv("QNX_HOST") then
  249. print("Set QNX_HOST enviroment variables.")
  250. end
  251. premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc"
  252. premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
  253. premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
  254. location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm"))
  255. elseif "rpi" == _OPTIONS["gcc"] then
  256. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  257. end
  258. elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then
  259. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  260. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  261. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  262. elseif "winphone8" == _OPTIONS["vs"] then
  263. premake.vstudio.toolset = "v110_wp80"
  264. location (path.join(_buildDir, "projects", _ACTION .. "-winphone8"))
  265. elseif "winphone81" == _OPTIONS["vs"] then
  266. premake.vstudio.toolset = "v120_wp81"
  267. premake.vstudio.storeapp = "8.1"
  268. platforms { "ARM" }
  269. location (path.join(_buildDir, "projects", _ACTION .. "-winphone81"))
  270. elseif "winstore81" == _OPTIONS["vs"] then
  271. premake.vstudio.toolset = "v120"
  272. premake.vstudio.storeapp = "8.1"
  273. platforms { "ARM" }
  274. location (path.join(_buildDir, "projects", _ACTION .. "-winstore81"))
  275. elseif "winstore82" == _OPTIONS["vs"] then
  276. premake.vstudio.toolset = "v140"
  277. premake.vstudio.storeapp = "8.2"
  278. platforms { "ARM" }
  279. location (path.join(_buildDir, "projects", _ACTION .. "-winstore82"))
  280. elseif ("vs2012-xp") == _OPTIONS["vs"] then
  281. premake.vstudio.toolset = ("v110_xp")
  282. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  283. elseif ("vs2013-xp") == _OPTIONS["vs"] then
  284. premake.vstudio.toolset = ("v120_xp")
  285. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  286. elseif ("vs2015-xp") == _OPTIONS["vs"] then
  287. premake.vstudio.toolset = ("v140_xp")
  288. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  289. end
  290. elseif _ACTION == "xcode4" then
  291. if "osx" == _OPTIONS["xcode"] then
  292. premake.xcode.toolset = "macosx"
  293. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  294. elseif "ios" == _OPTIONS["xcode"] then
  295. premake.xcode.toolset = "iphoneos"
  296. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  297. elseif "tvos" == _OPTIONS["xcode"] then
  298. premake.xcode.toolset = "appletvos"
  299. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  300. end
  301. end
  302. flags {
  303. "StaticRuntime",
  304. "NoPCH",
  305. "NativeWChar",
  306. "NoRTTI",
  307. "NoExceptions",
  308. "NoEditAndContinue",
  309. "Symbols",
  310. }
  311. defines {
  312. "__STDC_LIMIT_MACROS",
  313. "__STDC_FORMAT_MACROS",
  314. "__STDC_CONSTANT_MACROS",
  315. }
  316. configuration { "Debug" }
  317. targetsuffix "Debug"
  318. configuration { "Release" }
  319. flags {
  320. "OptimizeSpeed",
  321. }
  322. targetsuffix "Release"
  323. configuration { "vs*", "x32" }
  324. flags {
  325. "EnableSSE2",
  326. }
  327. configuration { "vs*" }
  328. includedirs { path.join(bxDir, "include/compat/msvc") }
  329. defines {
  330. "WIN32",
  331. "_WIN32",
  332. "_HAS_EXCEPTIONS=0",
  333. "_HAS_ITERATOR_DEBUGGING=0",
  334. "_SCL_SECURE=0",
  335. "_SECURE_SCL=0",
  336. "_SCL_SECURE_NO_WARNINGS",
  337. "_CRT_SECURE_NO_WARNINGS",
  338. "_CRT_SECURE_NO_DEPRECATE",
  339. }
  340. buildoptions {
  341. "/Oy-", -- Suppresses creation of frame pointers on the call stack.
  342. "/Ob2", -- The Inline Function Expansion
  343. }
  344. linkoptions {
  345. "/ignore:4221", -- LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
  346. }
  347. configuration { "vs2008" }
  348. includedirs { path.join(bxDir, "include/compat/msvc/pre1600") }
  349. configuration { "x32", "vs*" }
  350. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  351. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  352. libdirs {
  353. path.join(_libDir, "lib/win32_" .. _ACTION),
  354. }
  355. configuration { "x64", "vs*" }
  356. defines { "_WIN64" }
  357. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  358. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  359. libdirs {
  360. path.join(_libDir, "lib/win64_" .. _ACTION),
  361. }
  362. configuration { "ARM", "vs*" }
  363. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  364. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  365. configuration { "vs*-clang" }
  366. buildoptions {
  367. "-Qunused-arguments",
  368. }
  369. configuration { "x32", "vs*-clang" }
  370. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  371. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  372. configuration { "x64", "vs*-clang" }
  373. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  374. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  375. configuration { "winphone8* or winstore8*" }
  376. removeflags {
  377. "StaticRuntime",
  378. "NoExceptions",
  379. }
  380. configuration { "*-gcc* or osx" }
  381. buildoptions {
  382. "-Wshadow",
  383. }
  384. configuration { "mingw-*" }
  385. defines { "WIN32" }
  386. includedirs { path.join(bxDir, "include/compat/mingw") }
  387. buildoptions {
  388. "-Wunused-value",
  389. "-fdata-sections",
  390. "-ffunction-sections",
  391. "-msse2",
  392. "-Wunused-value",
  393. "-Wundef",
  394. }
  395. buildoptions_cpp {
  396. "-std=c++0x",
  397. }
  398. linkoptions {
  399. "-Wl,--gc-sections",
  400. "-static-libgcc",
  401. "-static-libstdc++",
  402. }
  403. configuration { "x32", "mingw-gcc" }
  404. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  405. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  406. libdirs {
  407. path.join(_libDir, "lib/win32_mingw-gcc"),
  408. }
  409. buildoptions { "-m32" }
  410. configuration { "x64", "mingw-gcc" }
  411. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  412. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  413. libdirs {
  414. path.join(_libDir, "lib/win64_mingw-gcc"),
  415. }
  416. buildoptions { "-m64" }
  417. configuration { "mingw-clang" }
  418. buildoptions {
  419. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  420. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  421. "-isystem$(MINGW)/x86_64-w64-mingw32/include",
  422. }
  423. linkoptions {
  424. "-Qunused-arguments",
  425. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  426. }
  427. configuration { "x32", "mingw-clang" }
  428. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  429. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  430. libdirs {
  431. path.join(_libDir, "lib/win32_mingw-clang"),
  432. }
  433. buildoptions { "-m32" }
  434. configuration { "x64", "mingw-clang" }
  435. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  436. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  437. libdirs {
  438. path.join(_libDir, "lib/win64_mingw-clang"),
  439. }
  440. buildoptions { "-m64" }
  441. configuration { "linux-clang" }
  442. configuration { "linux-gcc-5" }
  443. buildoptions {
  444. -- "-fno-omit-frame-pointer",
  445. -- "-fsanitize=address",
  446. -- "-fsanitize=undefined",
  447. -- "-fsanitize=float-divide-by-zero",
  448. -- "-fsanitize=float-cast-overflow",
  449. }
  450. links {
  451. -- "asan",
  452. -- "ubsan",
  453. }
  454. configuration { "linux-gcc" }
  455. buildoptions {
  456. "-mfpmath=sse",
  457. }
  458. configuration { "linux-gcc or linux-clang" }
  459. buildoptions {
  460. "-msse2",
  461. "-Wunused-value",
  462. "-Wundef",
  463. }
  464. buildoptions_cpp {
  465. "-std=c++0x",
  466. }
  467. links {
  468. "rt",
  469. "dl",
  470. }
  471. linkoptions {
  472. "-Wl,--gc-sections",
  473. }
  474. configuration { "linux-gcc*", "x32" }
  475. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  476. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  477. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  478. buildoptions {
  479. "-m32",
  480. }
  481. configuration { "linux-gcc*", "x64" }
  482. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  483. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  484. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  485. buildoptions {
  486. "-m64",
  487. }
  488. configuration { "linux-clang", "x32" }
  489. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  490. objdir (path.join(_buildDir, "linux32_clang/obj"))
  491. libdirs { path.join(_libDir, "lib/linux32_clang") }
  492. buildoptions {
  493. "-m32",
  494. }
  495. configuration { "linux-clang", "x64" }
  496. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  497. objdir (path.join(_buildDir, "linux64_clang/obj"))
  498. libdirs { path.join(_libDir, "lib/linux64_clang") }
  499. buildoptions {
  500. "-m64",
  501. }
  502. configuration { "linux-mips-gcc" }
  503. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  504. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  505. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  506. buildoptions {
  507. "-Wunused-value",
  508. "-Wundef",
  509. }
  510. buildoptions_cpp {
  511. "-std=c++0x",
  512. }
  513. links {
  514. "rt",
  515. "dl",
  516. }
  517. linkoptions {
  518. "-Wl,--gc-sections",
  519. }
  520. configuration { "linux-arm-gcc" }
  521. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  522. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  523. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  524. buildoptions {
  525. "-Wunused-value",
  526. "-Wundef",
  527. }
  528. buildoptions_cpp {
  529. "-std=c++0x",
  530. }
  531. links {
  532. "rt",
  533. "dl",
  534. }
  535. linkoptions {
  536. "-Wl,--gc-sections",
  537. }
  538. configuration { "android-*" }
  539. flags {
  540. "NoImportLib",
  541. }
  542. includedirs {
  543. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/include",
  544. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  545. }
  546. linkoptions {
  547. "-nostdlib",
  548. "-static-libgcc",
  549. }
  550. links {
  551. "c",
  552. "dl",
  553. "m",
  554. "android",
  555. "log",
  556. "gnustl_static",
  557. "gcc",
  558. }
  559. buildoptions {
  560. "-fPIC",
  561. "-no-canonical-prefixes",
  562. "-Wa,--noexecstack",
  563. "-fstack-protector",
  564. "-ffunction-sections",
  565. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  566. "-Wunused-value",
  567. "-Wundef",
  568. }
  569. buildoptions_cpp {
  570. "-std=c++0x",
  571. }
  572. linkoptions {
  573. "-no-canonical-prefixes",
  574. "-Wl,--no-undefined",
  575. "-Wl,-z,noexecstack",
  576. "-Wl,-z,relro",
  577. "-Wl,-z,now",
  578. }
  579. configuration { "android-arm" }
  580. targetdir (path.join(_buildDir, "android-arm/bin"))
  581. objdir (path.join(_buildDir, "android-arm/obj"))
  582. libdirs {
  583. path.join(_libDir, "lib/android-arm"),
  584. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
  585. }
  586. includedirs {
  587. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
  588. }
  589. buildoptions {
  590. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  591. "-mthumb",
  592. "-march=armv7-a",
  593. "-mfloat-abi=softfp",
  594. "-mfpu=neon",
  595. "-Wunused-value",
  596. "-Wundef",
  597. }
  598. linkoptions {
  599. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  600. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  601. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  602. "-march=armv7-a",
  603. "-Wl,--fix-cortex-a8",
  604. }
  605. configuration { "android-mips" }
  606. targetdir (path.join(_buildDir, "android-mips/bin"))
  607. objdir (path.join(_buildDir, "android-mips/obj"))
  608. libdirs {
  609. path.join(_libDir, "lib/android-mips"),
  610. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips",
  611. }
  612. includedirs {
  613. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include",
  614. }
  615. buildoptions {
  616. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  617. "-Wunused-value",
  618. "-Wundef",
  619. }
  620. linkoptions {
  621. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  622. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"),
  623. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"),
  624. }
  625. configuration { "android-x86" }
  626. targetdir (path.join(_buildDir, "android-x86/bin"))
  627. objdir (path.join(_buildDir, "android-x86/obj"))
  628. libdirs {
  629. path.join(_libDir, "lib/android-x86"),
  630. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86",
  631. }
  632. includedirs {
  633. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include",
  634. }
  635. buildoptions {
  636. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  637. "-march=i686",
  638. "-mtune=atom",
  639. "-mstackrealign",
  640. "-msse3",
  641. "-mfpmath=sse",
  642. "-Wunused-value",
  643. "-Wundef",
  644. }
  645. linkoptions {
  646. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  647. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  648. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "/arch-x86/usr/lib/crtend_so.o"),
  649. }
  650. configuration { "asmjs" }
  651. targetdir (path.join(_buildDir, "asmjs/bin"))
  652. objdir (path.join(_buildDir, "asmjs/obj"))
  653. libdirs { path.join(_libDir, "lib/asmjs") }
  654. buildoptions {
  655. "-isystem$(EMSCRIPTEN)/system/include",
  656. "-isystem$(EMSCRIPTEN)/system/include/libc",
  657. "-Wunused-value",
  658. "-Wundef",
  659. }
  660. configuration { "freebsd" }
  661. targetdir (path.join(_buildDir, "freebsd/bin"))
  662. objdir (path.join(_buildDir, "freebsd/obj"))
  663. libdirs { path.join(_libDir, "lib/freebsd") }
  664. includedirs {
  665. path.join(bxDir, "include/compat/freebsd"),
  666. }
  667. configuration { "nacl or nacl-arm or pnacl" }
  668. buildoptions {
  669. "-U__STRICT_ANSI__", -- strcasecmp, setenv, unsetenv,...
  670. "-fno-stack-protector",
  671. "-fdiagnostics-show-option",
  672. "-fdata-sections",
  673. "-ffunction-sections",
  674. "-Wunused-value",
  675. "-Wundef",
  676. }
  677. buildoptions_cpp {
  678. "-std=c++0x",
  679. }
  680. includedirs {
  681. "$(NACL_SDK_ROOT)/include",
  682. path.join(bxDir, "include/compat/nacl"),
  683. }
  684. configuration { "nacl" }
  685. buildoptions {
  686. "-pthread",
  687. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  688. "-msse2",
  689. }
  690. linkoptions {
  691. "-Wl,--gc-sections",
  692. }
  693. configuration { "x32", "nacl" }
  694. targetdir (path.join(_buildDir, "nacl-x86/bin"))
  695. objdir (path.join(_buildDir, "nacl-x86/obj"))
  696. libdirs { path.join(_libDir, "lib/nacl-x86") }
  697. linkoptions { "-melf32_nacl" }
  698. configuration { "x32", "nacl", "Debug" }
  699. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
  700. configuration { "x32", "nacl", "Release" }
  701. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
  702. configuration { "x64", "nacl" }
  703. targetdir (path.join(_buildDir, "nacl-x64/bin"))
  704. objdir (path.join(_buildDir, "nacl-x64/obj"))
  705. libdirs { path.join(_libDir, "lib/nacl-x64") }
  706. linkoptions { "-melf64_nacl" }
  707. configuration { "x64", "nacl", "Debug" }
  708. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
  709. configuration { "x64", "nacl", "Release" }
  710. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
  711. configuration { "nacl-arm" }
  712. buildoptions {
  713. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  714. }
  715. targetdir (path.join(_buildDir, "nacl-arm/bin"))
  716. objdir (path.join(_buildDir, "nacl-arm/obj"))
  717. libdirs { path.join(_libDir, "lib/nacl-arm") }
  718. configuration { "nacl-arm", "Debug" }
  719. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
  720. configuration { "nacl-arm", "Release" }
  721. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
  722. configuration { "pnacl" }
  723. targetdir (path.join(_buildDir, "pnacl/bin"))
  724. objdir (path.join(_buildDir, "pnacl/obj"))
  725. libdirs { path.join(_libDir, "lib/pnacl") }
  726. configuration { "pnacl", "Debug" }
  727. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  728. configuration { "pnacl", "Release" }
  729. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  730. configuration { "Xbox360" }
  731. targetdir (path.join(_buildDir, "xbox360/bin"))
  732. objdir (path.join(_buildDir, "xbox360/obj"))
  733. includedirs { path.join(bxDir, "include/compat/msvc") }
  734. libdirs { path.join(_libDir, "lib/xbox360") }
  735. defines {
  736. "NOMINMAX",
  737. "_XBOX",
  738. }
  739. configuration { "osx", "x32" }
  740. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  741. objdir (path.join(_buildDir, "osx32_clang/obj"))
  742. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  743. buildoptions {
  744. "-m32",
  745. }
  746. configuration { "osx", "x64" }
  747. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  748. objdir (path.join(_buildDir, "osx64_clang/obj"))
  749. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  750. buildoptions {
  751. "-m64",
  752. }
  753. configuration { "osx", "Universal" }
  754. targetdir (path.join(_buildDir, "osx_universal/bin"))
  755. objdir (path.join(_buildDir, "osx_universal/bin"))
  756. configuration { "osx" }
  757. buildoptions {
  758. "-Wfatal-errors",
  759. "-msse2",
  760. "-Wunused-value",
  761. "-Wundef",
  762. }
  763. includedirs { path.join(bxDir, "include/compat/osx") }
  764. configuration { "ios*" }
  765. linkoptions {
  766. "-lc++",
  767. }
  768. buildoptions {
  769. "-Wfatal-errors",
  770. "-Wunused-value",
  771. "-Wundef",
  772. }
  773. includedirs { path.join(bxDir, "include/compat/ios") }
  774. configuration { "xcode4", "ios*" }
  775. targetdir (path.join(_buildDir, "ios-arm/bin"))
  776. objdir (path.join(_buildDir, "ios-arm/obj"))
  777. configuration { "ios-arm" }
  778. targetdir (path.join(_buildDir, "ios-arm/bin"))
  779. objdir (path.join(_buildDir, "ios-arm/obj"))
  780. libdirs { path.join(_libDir, "lib/ios-arm") }
  781. linkoptions {
  782. "-miphoneos-version-min=7.0",
  783. "-arch armv7",
  784. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  785. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  786. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  787. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  788. }
  789. buildoptions {
  790. "-miphoneos-version-min=7.0",
  791. "-arch armv7",
  792. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  793. }
  794. configuration { "ios-simulator" }
  795. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  796. objdir (path.join(_buildDir, "ios-simulator/obj"))
  797. libdirs { path.join(_libDir, "lib/ios-simulator") }
  798. linkoptions {
  799. "-mios-simulator-version-min=7.0",
  800. "-arch i386",
  801. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  802. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  803. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  804. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  805. }
  806. buildoptions {
  807. "-mios-simulator-version-min=7.0",
  808. "-arch i386",
  809. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  810. }
  811. configuration { "tvos*" }
  812. linkoptions {
  813. "-lc++",
  814. }
  815. buildoptions {
  816. "-Wfatal-errors",
  817. "-Wunused-value",
  818. "-Wundef",
  819. }
  820. includedirs { path.join(bxDir, "include/compat/ios") }
  821. configuration { "xcode4", "tvos*" }
  822. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  823. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  824. configuration { "tvos-arm64" }
  825. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  826. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  827. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  828. linkoptions {
  829. "-mtvos-version-min=9.0",
  830. "-arch arm64",
  831. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  832. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  833. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  834. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  835. }
  836. buildoptions {
  837. "-mtvos-version-min=9.0",
  838. "-arch arm64",
  839. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  840. }
  841. configuration { "tvos-simulator" }
  842. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  843. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  844. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  845. linkoptions {
  846. "-mtvos-simulator-version-min=9.0",
  847. "-arch i386",
  848. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  849. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  850. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  851. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  852. }
  853. buildoptions {
  854. "-mtvos-simulator-version-min=9.0",
  855. "-arch i386",
  856. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  857. }
  858. configuration { "ps4" }
  859. targetdir (path.join(_buildDir, "ps4/bin"))
  860. objdir (path.join(_buildDir, "ps4/obj"))
  861. libdirs { path.join(_libDir, "lib/ps4") }
  862. includedirs {
  863. path.join(bxDir, "include/compat/freebsd"),
  864. "$(PS4_SDK_ROOT)/target/include",
  865. "$(PS4_SDK_ROOT)/target/include_common",
  866. }
  867. buildoptions {
  868. }
  869. buildoptions_cpp {
  870. "-std=c++0x",
  871. }
  872. linkoptions {
  873. }
  874. configuration { "qnx-arm" }
  875. targetdir (path.join(_buildDir, "qnx-arm/bin"))
  876. objdir (path.join(_buildDir, "qnx-arm/obj"))
  877. libdirs { path.join(_libDir, "lib/qnx-arm") }
  878. -- includedirs { path.join(bxDir, "include/compat/qnx") }
  879. buildoptions {
  880. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  881. "-Wunused-value",
  882. "-Wundef",
  883. }
  884. buildoptions_cpp {
  885. "-std=c++0x",
  886. }
  887. configuration { "rpi" }
  888. targetdir (path.join(_buildDir, "rpi/bin"))
  889. objdir (path.join(_buildDir, "rpi/obj"))
  890. libdirs {
  891. path.join(_libDir, "lib/rpi"),
  892. "/opt/vc/lib",
  893. }
  894. defines {
  895. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  896. "__STDC_VERSION__=199901L",
  897. }
  898. buildoptions {
  899. "-Wunused-value",
  900. "-Wundef",
  901. }
  902. buildoptions_cpp {
  903. "-std=c++0x",
  904. }
  905. includedirs {
  906. "/opt/vc/include",
  907. "/opt/vc/include/interface/vcos/pthreads",
  908. "/opt/vc/include/interface/vmcs_host/linux",
  909. }
  910. links {
  911. "rt",
  912. }
  913. linkoptions {
  914. "-Wl,--gc-sections",
  915. }
  916. configuration {} -- reset configuration
  917. return true
  918. end
  919. function strip()
  920. configuration { "android-arm", "Release" }
  921. postbuildcommands {
  922. "$(SILENT) echo Stripping symbols.",
  923. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  924. }
  925. configuration { "android-mips", "Release" }
  926. postbuildcommands {
  927. "$(SILENT) echo Stripping symbols.",
  928. "$(SILENT) $(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  929. }
  930. configuration { "android-x86", "Release" }
  931. postbuildcommands {
  932. "$(SILENT) echo Stripping symbols.",
  933. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  934. }
  935. configuration { "linux-* or rpi", "Release" }
  936. postbuildcommands {
  937. "$(SILENT) echo Stripping symbols.",
  938. "$(SILENT) strip -s \"$(TARGET)\""
  939. }
  940. configuration { "mingw*", "Release" }
  941. postbuildcommands {
  942. "$(SILENT) echo Stripping symbols.",
  943. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  944. }
  945. configuration { "pnacl" }
  946. postbuildcommands {
  947. "$(SILENT) echo Running pnacl-finalize.",
  948. "$(SILENT) " .. naclToolchain .. "finalize \"$(TARGET)\""
  949. }
  950. configuration { "*nacl*", "Release" }
  951. postbuildcommands {
  952. "$(SILENT) echo Stripping symbols.",
  953. "$(SILENT) " .. naclToolchain .. "strip -s \"$(TARGET)\""
  954. }
  955. configuration { "asmjs" }
  956. postbuildcommands {
  957. "$(SILENT) echo Running asmjs finalize.",
  958. "$(SILENT) $(EMSCRIPTEN)/emcc -O2 "
  959. -- .. "-s EMTERPRETIFY=1 "
  960. -- .. "-s EMTERPRETIFY_ASYNC=1 "
  961. .. "-s TOTAL_MEMORY=268435456 "
  962. -- .. "-s ALLOW_MEMORY_GROWTH=1 "
  963. .. "--memory-init-file 1 "
  964. .. "\"$(TARGET)\" -o \"$(TARGET)\".html "
  965. -- .. "--preload-file ../../../examples/runtime@/"
  966. }
  967. configuration {} -- reset configuration
  968. end