toolchain.lua 44 KB

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