toolchain.lua 38 KB

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