toolchain.lua 38 KB

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