toolchain.lua 40 KB

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