toolchain.lua 43 KB

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