toolchain.lua 40 KB

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