toolchain.lua 40 KB

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