toolchain.lua 41 KB

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