toolchain.lua 43 KB

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