toolchain.lua 41 KB

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