toolchain.lua 43 KB

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