toolchain.lua 39 KB

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