toolchain.lua 42 KB

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