toolchain.lua 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404
  1. --
  2. -- Copyright 2010-2017 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 { "Debug" }
  433. targetsuffix "Debug"
  434. defines {
  435. "_DEBUG",
  436. }
  437. configuration { "Release" }
  438. flags {
  439. "NoBufferSecurityCheck",
  440. "OptimizeSpeed",
  441. }
  442. defines {
  443. "NDEBUG",
  444. }
  445. targetsuffix "Release"
  446. configuration { "qbs" }
  447. flags {
  448. "ExtraWarnings",
  449. }
  450. configuration { "vs*", "x32" }
  451. flags {
  452. "EnableSSE2",
  453. }
  454. configuration { "vs*", "not orbis" }
  455. includedirs { path.join(bxDir, "include/compat/msvc") }
  456. defines {
  457. "WIN32",
  458. "_WIN32",
  459. "_HAS_EXCEPTIONS=0",
  460. "_HAS_ITERATOR_DEBUGGING=0",
  461. "_SCL_SECURE=0",
  462. "_SECURE_SCL=0",
  463. "_SCL_SECURE_NO_WARNINGS",
  464. "_CRT_SECURE_NO_WARNINGS",
  465. "_CRT_SECURE_NO_DEPRECATE",
  466. }
  467. buildoptions {
  468. "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union
  469. "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier
  470. "/Ob2", -- The Inline Function Expansion
  471. }
  472. linkoptions {
  473. "/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
  474. }
  475. configuration { "vs2008" }
  476. includedirs { path.join(bxDir, "include/compat/msvc/pre1600") }
  477. configuration { "x32", "vs*" }
  478. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  479. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  480. libdirs {
  481. path.join(_libDir, "lib/win32_" .. _ACTION),
  482. }
  483. configuration { "x64", "vs*" }
  484. defines { "_WIN64" }
  485. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  486. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  487. libdirs {
  488. path.join(_libDir, "lib/win64_" .. _ACTION),
  489. }
  490. configuration { "x32", "vs2017" }
  491. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  492. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  493. libdirs {
  494. path.join(_libDir, "lib/win32_" .. _ACTION),
  495. }
  496. configuration { "x64", "vs2017" }
  497. defines { "_WIN64" }
  498. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  499. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  500. libdirs {
  501. path.join(_libDir, "lib/win64_" .. _ACTION),
  502. }
  503. configuration { "ARM", "vs*" }
  504. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  505. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  506. configuration { "vs*-clang" }
  507. buildoptions {
  508. "-Qunused-arguments",
  509. }
  510. configuration { "x32", "vs*-clang" }
  511. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  512. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  513. configuration { "x64", "vs*-clang" }
  514. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  515. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  516. configuration { "winphone8* or winstore8*" }
  517. removeflags {
  518. "StaticRuntime",
  519. "NoExceptions",
  520. }
  521. configuration { "*-gcc* or osx" }
  522. buildoptions {
  523. "-Wshadow",
  524. }
  525. configuration { "mingw-*" }
  526. defines { "WIN32" }
  527. includedirs { path.join(bxDir, "include/compat/mingw") }
  528. defines {
  529. "MINGW_HAS_SECURE_API=1",
  530. }
  531. buildoptions {
  532. "-Wunused-value",
  533. "-fdata-sections",
  534. "-ffunction-sections",
  535. "-msse2",
  536. "-Wunused-value",
  537. "-Wundef",
  538. }
  539. buildoptions_cpp {
  540. "-std=c++11",
  541. }
  542. linkoptions {
  543. "-Wl,--gc-sections",
  544. "-static",
  545. "-static-libgcc",
  546. "-static-libstdc++",
  547. }
  548. configuration { "x32", "mingw-gcc" }
  549. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  550. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  551. libdirs {
  552. path.join(_libDir, "lib/win32_mingw-gcc"),
  553. }
  554. buildoptions {
  555. "-m32",
  556. "-mstackrealign",
  557. }
  558. configuration { "x64", "mingw-gcc" }
  559. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  560. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  561. libdirs {
  562. path.join(_libDir, "lib/win64_mingw-gcc"),
  563. }
  564. buildoptions { "-m64" }
  565. configuration { "mingw-clang" }
  566. buildoptions {
  567. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  568. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  569. "-isystem$(MINGW)/x86_64-w64-mingw32/include",
  570. }
  571. linkoptions {
  572. "-Qunused-arguments",
  573. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  574. }
  575. configuration { "x32", "mingw-clang" }
  576. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  577. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  578. libdirs {
  579. path.join(_libDir, "lib/win32_mingw-clang"),
  580. }
  581. buildoptions { "-m32" }
  582. configuration { "x64", "mingw-clang" }
  583. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  584. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  585. libdirs {
  586. path.join(_libDir, "lib/win64_mingw-clang"),
  587. }
  588. buildoptions { "-m64" }
  589. configuration { "linux-clang" }
  590. configuration { "linux-gcc-6" }
  591. buildoptions {
  592. -- "-fno-omit-frame-pointer",
  593. -- "-fsanitize=address",
  594. -- "-fsanitize=undefined",
  595. -- "-fsanitize=float-divide-by-zero",
  596. -- "-fsanitize=float-cast-overflow",
  597. }
  598. links {
  599. -- "asan",
  600. -- "ubsan",
  601. }
  602. configuration { "linux-gcc" }
  603. buildoptions {
  604. "-mfpmath=sse",
  605. }
  606. configuration { "linux-gcc* or linux-clang*" }
  607. buildoptions {
  608. "-msse2",
  609. "-Wunused-value",
  610. "-Wundef",
  611. }
  612. buildoptions_cpp {
  613. "-std=c++11",
  614. }
  615. links {
  616. "rt",
  617. "dl",
  618. }
  619. linkoptions {
  620. "-Wl,--gc-sections",
  621. "-Wl,--as-needed",
  622. }
  623. configuration { "linux-gcc*", "x32" }
  624. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  625. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  626. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  627. buildoptions {
  628. "-m32",
  629. }
  630. configuration { "linux-gcc*", "x64" }
  631. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  632. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  633. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  634. buildoptions {
  635. "-m64",
  636. }
  637. configuration { "linux-clang*", "x32" }
  638. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  639. objdir (path.join(_buildDir, "linux32_clang/obj"))
  640. libdirs { path.join(_libDir, "lib/linux32_clang") }
  641. buildoptions {
  642. "-m32",
  643. }
  644. configuration { "linux-clang*", "x64" }
  645. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  646. objdir (path.join(_buildDir, "linux64_clang/obj"))
  647. libdirs { path.join(_libDir, "lib/linux64_clang") }
  648. buildoptions {
  649. "-m64",
  650. }
  651. configuration { "linux-mips-gcc" }
  652. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  653. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  654. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  655. buildoptions {
  656. "-Wunused-value",
  657. "-Wundef",
  658. }
  659. buildoptions_cpp {
  660. "-std=c++11",
  661. }
  662. links {
  663. "rt",
  664. "dl",
  665. }
  666. linkoptions {
  667. "-Wl,--gc-sections",
  668. }
  669. configuration { "linux-arm-gcc" }
  670. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  671. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  672. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  673. buildoptions {
  674. "-Wunused-value",
  675. "-Wundef",
  676. }
  677. buildoptions_cpp {
  678. "-std=c++11",
  679. }
  680. links {
  681. "rt",
  682. "dl",
  683. }
  684. linkoptions {
  685. "-Wl,--gc-sections",
  686. }
  687. configuration { "android-*" }
  688. targetprefix ("lib")
  689. flags {
  690. "NoImportLib",
  691. }
  692. includedirs {
  693. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  694. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  695. }
  696. linkoptions {
  697. "-nostdlib",
  698. }
  699. links {
  700. "c",
  701. "dl",
  702. "m",
  703. "android",
  704. "log",
  705. "c++",
  706. "gcc",
  707. }
  708. buildoptions {
  709. "-fPIC",
  710. "-no-canonical-prefixes",
  711. "-Wa,--noexecstack",
  712. "-fstack-protector-strong",
  713. "-ffunction-sections",
  714. "-Wunused-value",
  715. "-Wundef",
  716. }
  717. buildoptions_cpp {
  718. "-std=c++11",
  719. }
  720. linkoptions {
  721. "-no-canonical-prefixes",
  722. "-Wl,--no-undefined",
  723. "-Wl,-z,noexecstack",
  724. "-Wl,-z,relro",
  725. "-Wl,-z,now",
  726. }
  727. configuration { "linux-steamlink" }
  728. targetdir (path.join(_buildDir, "steamlink/bin"))
  729. objdir (path.join(_buildDir, "steamlink/obj"))
  730. libdirs { path.join(_libDir, "lib/steamlink") }
  731. includedirs { path.join(bxDir, "include/compat/linux") }
  732. defines {
  733. "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
  734. }
  735. buildoptions {
  736. "-std=c++11",
  737. "-Wfatal-errors",
  738. "-Wunused-value",
  739. "-Wundef",
  740. "-pthread",
  741. "-marm",
  742. "-mfloat-abi=hard",
  743. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  744. }
  745. linkoptions {
  746. "-static-libgcc",
  747. "-static-libstdc++",
  748. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  749. }
  750. configuration { "android-arm" }
  751. targetdir (path.join(_buildDir, "android-arm/bin"))
  752. objdir (path.join(_buildDir, "android-arm/obj"))
  753. libdirs {
  754. path.join(_libDir, "lib/android-arm"),
  755. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
  756. }
  757. includedirs {
  758. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/include",
  759. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  760. }
  761. buildoptions {
  762. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  763. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  764. "-target armv7-none-linux-androideabi",
  765. "-mthumb",
  766. "-march=armv7-a",
  767. "-mfloat-abi=softfp",
  768. "-mfpu=neon",
  769. "-Wunused-value",
  770. "-Wundef",
  771. }
  772. linkoptions {
  773. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  774. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  775. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  776. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  777. "-target armv7-none-linux-androideabi",
  778. "-march=armv7-a",
  779. "-Wl,--fix-cortex-a8",
  780. }
  781. configuration { "android-mips" }
  782. targetdir (path.join(_buildDir, "android-mips/bin"))
  783. objdir (path.join(_buildDir, "android-mips/obj"))
  784. libdirs {
  785. path.join(_libDir, "lib/android-mips"),
  786. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips",
  787. }
  788. includedirs {
  789. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips/include",
  790. }
  791. buildoptions {
  792. "-gcc-toolchain $(ANDROID_NDK_MIPS)",
  793. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  794. "-target mipsel-none-linux-android",
  795. "-mips32",
  796. "-Wunused-value",
  797. "-Wundef",
  798. }
  799. linkoptions {
  800. "-gcc-toolchain $(ANDROID_NDK_MIPS)",
  801. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  802. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"),
  803. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"),
  804. "-target mipsel-none-linux-android",
  805. "-mips32",
  806. }
  807. configuration { "android-x86" }
  808. targetdir (path.join(_buildDir, "android-x86/bin"))
  809. objdir (path.join(_buildDir, "android-x86/obj"))
  810. libdirs {
  811. path.join(_libDir, "lib/android-x86"),
  812. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
  813. }
  814. includedirs {
  815. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86/include",
  816. }
  817. buildoptions {
  818. "-gcc-toolchain $(ANDROID_NDK_X86)",
  819. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  820. "-target i686-none-linux-android",
  821. "-march=i686",
  822. "-mtune=atom",
  823. "-mstackrealign",
  824. "-msse3",
  825. "-mfpmath=sse",
  826. "-Wunused-value",
  827. "-Wundef",
  828. }
  829. linkoptions {
  830. "-gcc-toolchain $(ANDROID_NDK_X86)",
  831. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  832. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  833. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  834. "-target i686-none-linux-android",
  835. }
  836. configuration { "asmjs" }
  837. targetdir (path.join(_buildDir, "asmjs/bin"))
  838. objdir (path.join(_buildDir, "asmjs/obj"))
  839. libdirs { path.join(_libDir, "lib/asmjs") }
  840. buildoptions {
  841. "-i\"system$(EMSCRIPTEN)/system/include\"",
  842. "-i\"system$(EMSCRIPTEN)/system/include/libc\"",
  843. "-Wunused-value",
  844. "-Wundef",
  845. }
  846. configuration { "freebsd" }
  847. targetdir (path.join(_buildDir, "freebsd/bin"))
  848. objdir (path.join(_buildDir, "freebsd/obj"))
  849. libdirs { path.join(_libDir, "lib/freebsd") }
  850. includedirs {
  851. path.join(bxDir, "include/compat/freebsd"),
  852. }
  853. configuration { "nacl or nacl-arm or pnacl" }
  854. buildoptions {
  855. "-U__STRICT_ANSI__", -- strcasecmp, setenv, unsetenv,...
  856. "-fno-stack-protector",
  857. "-fdiagnostics-show-option",
  858. "-fdata-sections",
  859. "-ffunction-sections",
  860. "-Wunused-value",
  861. "-Wundef",
  862. }
  863. buildoptions_cpp {
  864. "-std=c++11",
  865. }
  866. includedirs {
  867. "$(NACL_SDK_ROOT)/include",
  868. path.join(bxDir, "include/compat/nacl"),
  869. }
  870. configuration { "nacl" }
  871. buildoptions {
  872. "-pthread",
  873. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  874. "-msse2",
  875. }
  876. linkoptions {
  877. "-Wl,--gc-sections",
  878. }
  879. configuration { "x32", "nacl" }
  880. targetdir (path.join(_buildDir, "nacl-x86/bin"))
  881. objdir (path.join(_buildDir, "nacl-x86/obj"))
  882. libdirs { path.join(_libDir, "lib/nacl-x86") }
  883. linkoptions { "-melf32_nacl" }
  884. configuration { "x32", "nacl", "Debug" }
  885. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Debug" }
  886. configuration { "x32", "nacl", "Release" }
  887. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Release" }
  888. configuration { "x64", "nacl" }
  889. targetdir (path.join(_buildDir, "nacl-x64/bin"))
  890. objdir (path.join(_buildDir, "nacl-x64/obj"))
  891. libdirs { path.join(_libDir, "lib/nacl-x64") }
  892. linkoptions { "-melf64_nacl" }
  893. configuration { "x64", "nacl", "Debug" }
  894. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Debug" }
  895. configuration { "x64", "nacl", "Release" }
  896. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Release" }
  897. configuration { "nacl-arm" }
  898. buildoptions {
  899. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  900. }
  901. targetdir (path.join(_buildDir, "nacl-arm/bin"))
  902. objdir (path.join(_buildDir, "nacl-arm/obj"))
  903. libdirs { path.join(_libDir, "lib/nacl-arm") }
  904. configuration { "nacl-arm", "Debug" }
  905. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Debug" }
  906. configuration { "nacl-arm", "Release" }
  907. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Release" }
  908. configuration { "pnacl" }
  909. targetdir (path.join(_buildDir, "pnacl/bin"))
  910. objdir (path.join(_buildDir, "pnacl/obj"))
  911. libdirs { path.join(_libDir, "lib/pnacl") }
  912. configuration { "pnacl", "Debug" }
  913. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  914. configuration { "pnacl", "Release" }
  915. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  916. configuration { "xbox360" }
  917. targetdir (path.join(_buildDir, "xbox360/bin"))
  918. objdir (path.join(_buildDir, "xbox360/obj"))
  919. includedirs { path.join(bxDir, "include/compat/msvc") }
  920. libdirs { path.join(_libDir, "lib/xbox360") }
  921. defines {
  922. "NOMINMAX",
  923. }
  924. configuration { "durango" }
  925. targetdir (path.join(_buildDir, "durango/bin"))
  926. objdir (path.join(_buildDir, "durango/obj"))
  927. includedirs { path.join(bxDir, "include/compat/msvc") }
  928. libdirs { path.join(_libDir, "lib/durango") }
  929. removeflags { "StaticRuntime" }
  930. defines {
  931. "NOMINMAX",
  932. }
  933. configuration { "netbsd" }
  934. targetdir (path.join(_buildDir, "netbsd/bin"))
  935. objdir (path.join(_buildDir, "netbsd/obj"))
  936. libdirs { path.join(_libDir, "lib/netbsd") }
  937. includedirs {
  938. path.join(bxDir, "include/compat/freebsd"),
  939. }
  940. configuration { "osx", "x32" }
  941. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  942. objdir (path.join(_buildDir, "osx32_clang/obj"))
  943. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  944. buildoptions {
  945. "-m32",
  946. }
  947. configuration { "osx", "x64" }
  948. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  949. objdir (path.join(_buildDir, "osx64_clang/obj"))
  950. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  951. buildoptions {
  952. "-m64",
  953. }
  954. configuration { "osx", "Universal" }
  955. targetdir (path.join(_buildDir, "osx_universal/bin"))
  956. objdir (path.join(_buildDir, "osx_universal/bin"))
  957. configuration { "osx" }
  958. buildoptions_cpp {
  959. "-std=c++11",
  960. }
  961. buildoptions {
  962. "-Wfatal-errors",
  963. "-msse2",
  964. "-Wunused-value",
  965. "-Wundef",
  966. }
  967. includedirs { path.join(bxDir, "include/compat/osx") }
  968. configuration { "ios*" }
  969. linkoptions {
  970. "-lc++",
  971. }
  972. buildoptions_cpp {
  973. "-std=c++11",
  974. }
  975. buildoptions {
  976. "-Wfatal-errors",
  977. "-Wunused-value",
  978. "-Wundef",
  979. }
  980. includedirs { path.join(bxDir, "include/compat/ios") }
  981. configuration { "xcode4", "ios*" }
  982. targetdir (path.join(_buildDir, "ios-arm/bin"))
  983. objdir (path.join(_buildDir, "ios-arm/obj"))
  984. configuration { "ios-arm" }
  985. targetdir (path.join(_buildDir, "ios-arm/bin"))
  986. objdir (path.join(_buildDir, "ios-arm/obj"))
  987. libdirs { path.join(_libDir, "lib/ios-arm") }
  988. linkoptions {
  989. "-arch armv7",
  990. }
  991. buildoptions {
  992. "-arch armv7",
  993. }
  994. configuration { "ios-arm64" }
  995. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  996. objdir (path.join(_buildDir, "ios-arm64/obj"))
  997. libdirs { path.join(_libDir, "lib/ios-arm64") }
  998. linkoptions {
  999. "-arch arm64",
  1000. }
  1001. buildoptions {
  1002. "-arch arm64",
  1003. }
  1004. configuration { "ios-arm*" }
  1005. linkoptions {
  1006. "-miphoneos-version-min=7.0",
  1007. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  1008. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  1009. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  1010. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1011. }
  1012. buildoptions {
  1013. "-miphoneos-version-min=7.0",
  1014. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  1015. }
  1016. configuration { "ios-simulator" }
  1017. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  1018. objdir (path.join(_buildDir, "ios-simulator/obj"))
  1019. libdirs { path.join(_libDir, "lib/ios-simulator") }
  1020. linkoptions {
  1021. "-mios-simulator-version-min=7.0",
  1022. "-arch i386",
  1023. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  1024. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  1025. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  1026. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1027. }
  1028. buildoptions {
  1029. "-mios-simulator-version-min=7.0",
  1030. "-arch i386",
  1031. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  1032. }
  1033. configuration { "tvos*" }
  1034. linkoptions {
  1035. "-lc++",
  1036. }
  1037. buildoptions {
  1038. "-Wfatal-errors",
  1039. "-Wunused-value",
  1040. "-Wundef",
  1041. }
  1042. includedirs { path.join(bxDir, "include/compat/ios") }
  1043. configuration { "xcode4", "tvos*" }
  1044. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  1045. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  1046. configuration { "tvos-arm64" }
  1047. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  1048. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  1049. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  1050. linkoptions {
  1051. "-mtvos-version-min=9.0",
  1052. "-arch arm64",
  1053. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  1054. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  1055. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  1056. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1057. }
  1058. buildoptions {
  1059. "-mtvos-version-min=9.0",
  1060. "-arch arm64",
  1061. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  1062. }
  1063. configuration { "tvos-simulator" }
  1064. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  1065. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  1066. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  1067. linkoptions {
  1068. "-mtvos-simulator-version-min=9.0",
  1069. "-arch i386",
  1070. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1071. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  1072. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  1073. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1074. }
  1075. buildoptions {
  1076. "-mtvos-simulator-version-min=9.0",
  1077. "-arch i386",
  1078. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1079. }
  1080. configuration { "orbis" }
  1081. targetdir (path.join(_buildDir, "orbis/bin"))
  1082. objdir (path.join(_buildDir, "orbis/obj"))
  1083. libdirs { path.join(_libDir, "lib/orbis") }
  1084. includedirs {
  1085. path.join(bxDir, "include/compat/freebsd"),
  1086. "$(SCE_ORBIS_SDK_DIR)/target/include",
  1087. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  1088. }
  1089. buildoptions {
  1090. }
  1091. buildoptions_cpp {
  1092. "-std=c++11",
  1093. }
  1094. linkoptions {
  1095. }
  1096. configuration { "qnx-arm" }
  1097. targetdir (path.join(_buildDir, "qnx-arm/bin"))
  1098. objdir (path.join(_buildDir, "qnx-arm/obj"))
  1099. libdirs { path.join(_libDir, "lib/qnx-arm") }
  1100. -- includedirs { path.join(bxDir, "include/compat/qnx") }
  1101. buildoptions {
  1102. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  1103. "-Wunused-value",
  1104. "-Wundef",
  1105. }
  1106. buildoptions_cpp {
  1107. "-std=c++11",
  1108. }
  1109. configuration { "rpi" }
  1110. targetdir (path.join(_buildDir, "rpi/bin"))
  1111. objdir (path.join(_buildDir, "rpi/obj"))
  1112. libdirs {
  1113. path.join(_libDir, "lib/rpi"),
  1114. "/opt/vc/lib",
  1115. }
  1116. defines {
  1117. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  1118. "__STDC_VERSION__=199901L",
  1119. }
  1120. buildoptions {
  1121. "-Wunused-value",
  1122. "-Wundef",
  1123. }
  1124. buildoptions_cpp {
  1125. "-std=c++11",
  1126. }
  1127. includedirs {
  1128. "/opt/vc/include",
  1129. "/opt/vc/include/interface/vcos/pthreads",
  1130. "/opt/vc/include/interface/vmcs_host/linux",
  1131. }
  1132. links {
  1133. "rt",
  1134. }
  1135. linkoptions {
  1136. "-Wl,--gc-sections",
  1137. }
  1138. configuration { "riscv" }
  1139. targetdir (path.join(_buildDir, "riscv/bin"))
  1140. objdir (path.join(_buildDir, "riscv/obj"))
  1141. defines {
  1142. "__BSD_VISIBLE",
  1143. "__MISC_VISIBLE",
  1144. }
  1145. includedirs {
  1146. "$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf/include",
  1147. path.join(bxDir, "include/compat/riscv"),
  1148. }
  1149. buildoptions {
  1150. "-Wunused-value",
  1151. "-Wundef",
  1152. "--sysroot=$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf",
  1153. }
  1154. buildoptions_cpp {
  1155. "-std=c++11",
  1156. }
  1157. configuration {} -- reset configuration
  1158. return true
  1159. end
  1160. function strip()
  1161. configuration { "android-arm", "Release" }
  1162. postbuildcommands {
  1163. "$(SILENT) echo Stripping symbols.",
  1164. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  1165. }
  1166. configuration { "android-mips", "Release" }
  1167. postbuildcommands {
  1168. "$(SILENT) echo Stripping symbols.",
  1169. "$(SILENT) $(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  1170. }
  1171. configuration { "android-x86", "Release" }
  1172. postbuildcommands {
  1173. "$(SILENT) echo Stripping symbols.",
  1174. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  1175. }
  1176. configuration { "linux-steamlink", "Release" }
  1177. postbuildcommands {
  1178. "$(SILENT) echo Stripping symbols.",
  1179. "$(SILENT) $(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-strip -s \"$(TARGET)\""
  1180. }
  1181. configuration { "linux-* or rpi", "not linux-steamlink", "Release" }
  1182. postbuildcommands {
  1183. "$(SILENT) echo Stripping symbols.",
  1184. "$(SILENT) strip -s \"$(TARGET)\""
  1185. }
  1186. configuration { "mingw*", "Release" }
  1187. postbuildcommands {
  1188. "$(SILENT) echo Stripping symbols.",
  1189. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1190. }
  1191. configuration { "pnacl" }
  1192. postbuildcommands {
  1193. "$(SILENT) echo Running pnacl-finalize.",
  1194. "$(SILENT) " .. naclToolchain .. "finalize \"$(TARGET)\""
  1195. }
  1196. configuration { "*nacl*", "Release" }
  1197. postbuildcommands {
  1198. "$(SILENT) echo Stripping symbols.",
  1199. "$(SILENT) " .. naclToolchain .. "strip -s \"$(TARGET)\""
  1200. }
  1201. configuration { "asmjs" }
  1202. postbuildcommands {
  1203. "$(SILENT) echo Running asmjs finalize.",
  1204. "$(SILENT) \"$(EMSCRIPTEN)/emcc\" -O2 "
  1205. -- .. "-s EMTERPRETIFY=1 "
  1206. -- .. "-s EMTERPRETIFY_ASYNC=1 "
  1207. .. "-s TOTAL_MEMORY=268435456 "
  1208. -- .. "-s ALLOW_MEMORY_GROWTH=1 "
  1209. -- .. "-s USE_WEBGL2=1 "
  1210. .. "--memory-init-file 1 "
  1211. .. "\"$(TARGET)\" -o \"$(TARGET)\".html "
  1212. -- .. "--preload-file ../../../examples/runtime@/"
  1213. }
  1214. configuration {} -- reset configuration
  1215. end