2
0

toolchain.lua 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314
  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 envrionment 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 envrionment 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 envrionment 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 enviroment 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 enviroment 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 enviroment 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 enviroment 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 enviroment 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 enviroment 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 enviroment variable.")
  371. end
  372. platforms { "Orbis" }
  373. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  374. end
  375. elseif ("vs2012-xp") == _OPTIONS["vs"] then
  376. premake.vstudio.toolset = ("v110_xp")
  377. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  378. elseif "vs2013-xp" == _OPTIONS["vs"] then
  379. premake.vstudio.toolset = ("v120_xp")
  380. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  381. elseif "vs2015-xp" == _OPTIONS["vs"] then
  382. premake.vstudio.toolset = ("v140_xp")
  383. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  384. elseif "vs2015-xp" == _OPTIONS["vs"] then
  385. premake.vstudio.toolset = ("v141_xp")
  386. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  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. "-Wunused-value",
  600. "-Wundef",
  601. "-Wno-strict-overflow",
  602. }
  603. buildoptions_cpp {
  604. "-std=c++11",
  605. }
  606. links {
  607. "rt",
  608. "dl",
  609. }
  610. linkoptions {
  611. "-Wl,--gc-sections",
  612. "-Wl,--as-needed",
  613. }
  614. configuration { "linux-gcc*", "x32" }
  615. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  616. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  617. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  618. buildoptions {
  619. "-m32",
  620. }
  621. configuration { "linux-gcc*", "x64" }
  622. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  623. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  624. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  625. buildoptions {
  626. "-m64",
  627. }
  628. configuration { "linux-clang*", "x32" }
  629. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  630. objdir (path.join(_buildDir, "linux32_clang/obj"))
  631. libdirs { path.join(_libDir, "lib/linux32_clang") }
  632. buildoptions {
  633. "-m32",
  634. }
  635. configuration { "linux-clang*", "x64" }
  636. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  637. objdir (path.join(_buildDir, "linux64_clang/obj"))
  638. libdirs { path.join(_libDir, "lib/linux64_clang") }
  639. buildoptions {
  640. "-m64",
  641. }
  642. configuration { "linux-mips-gcc" }
  643. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  644. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  645. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  646. buildoptions {
  647. "-Wunused-value",
  648. "-Wundef",
  649. }
  650. buildoptions_cpp {
  651. "-std=c++11",
  652. }
  653. links {
  654. "rt",
  655. "dl",
  656. }
  657. linkoptions {
  658. "-Wl,--gc-sections",
  659. }
  660. configuration { "linux-arm-gcc" }
  661. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  662. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  663. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  664. buildoptions {
  665. "-Wunused-value",
  666. "-Wundef",
  667. }
  668. buildoptions_cpp {
  669. "-std=c++11",
  670. }
  671. links {
  672. "rt",
  673. "dl",
  674. }
  675. linkoptions {
  676. "-Wl,--gc-sections",
  677. }
  678. configuration { "android-*" }
  679. targetprefix ("lib")
  680. flags {
  681. "NoImportLib",
  682. }
  683. includedirs {
  684. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  685. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  686. }
  687. linkoptions {
  688. "-nostdlib",
  689. }
  690. links {
  691. "c",
  692. "dl",
  693. "m",
  694. "android",
  695. "log",
  696. "c++",
  697. "gcc",
  698. }
  699. buildoptions {
  700. "-fPIC",
  701. "-no-canonical-prefixes",
  702. "-Wa,--noexecstack",
  703. "-fstack-protector-strong",
  704. "-ffunction-sections",
  705. "-Wunused-value",
  706. "-Wundef",
  707. }
  708. buildoptions_cpp {
  709. "-std=c++11",
  710. }
  711. linkoptions {
  712. "-no-canonical-prefixes",
  713. "-Wl,--no-undefined",
  714. "-Wl,-z,noexecstack",
  715. "-Wl,-z,relro",
  716. "-Wl,-z,now",
  717. }
  718. configuration { "linux-steamlink" }
  719. targetdir (path.join(_buildDir, "steamlink/bin"))
  720. objdir (path.join(_buildDir, "steamlink/obj"))
  721. libdirs { path.join(_libDir, "lib/steamlink") }
  722. includedirs { path.join(bxDir, "include/compat/linux") }
  723. defines {
  724. "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
  725. }
  726. buildoptions {
  727. "-std=c++11",
  728. "-Wfatal-errors",
  729. "-Wunused-value",
  730. "-Wundef",
  731. "-pthread",
  732. "-marm",
  733. "-mfloat-abi=hard",
  734. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  735. }
  736. linkoptions {
  737. "-static-libgcc",
  738. "-static-libstdc++",
  739. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  740. }
  741. configuration { "android-arm" }
  742. targetdir (path.join(_buildDir, "android-arm/bin"))
  743. objdir (path.join(_buildDir, "android-arm/obj"))
  744. libdirs {
  745. path.join(_libDir, "lib/android-arm"),
  746. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
  747. }
  748. includedirs {
  749. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/include",
  750. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  751. }
  752. buildoptions {
  753. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  754. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  755. "-target armv7-none-linux-androideabi",
  756. "-mthumb",
  757. "-march=armv7-a",
  758. "-mfloat-abi=softfp",
  759. "-mfpu=neon",
  760. "-Wunused-value",
  761. "-Wundef",
  762. }
  763. linkoptions {
  764. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  765. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  766. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  767. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  768. "-target armv7-none-linux-androideabi",
  769. "-march=armv7-a",
  770. "-Wl,--fix-cortex-a8",
  771. }
  772. configuration { "android-mips" }
  773. targetdir (path.join(_buildDir, "android-mips/bin"))
  774. objdir (path.join(_buildDir, "android-mips/obj"))
  775. libdirs {
  776. path.join(_libDir, "lib/android-mips"),
  777. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips",
  778. }
  779. includedirs {
  780. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips/include",
  781. }
  782. buildoptions {
  783. "-gcc-toolchain $(ANDROID_NDK_MIPS)",
  784. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  785. "-target mipsel-none-linux-android",
  786. "-mips32",
  787. "-Wunused-value",
  788. "-Wundef",
  789. }
  790. linkoptions {
  791. "-gcc-toolchain $(ANDROID_NDK_MIPS)",
  792. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  793. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"),
  794. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"),
  795. "-target mipsel-none-linux-android",
  796. "-mips32",
  797. }
  798. configuration { "android-x86" }
  799. targetdir (path.join(_buildDir, "android-x86/bin"))
  800. objdir (path.join(_buildDir, "android-x86/obj"))
  801. libdirs {
  802. path.join(_libDir, "lib/android-x86"),
  803. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
  804. }
  805. includedirs {
  806. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86/include",
  807. }
  808. buildoptions {
  809. "-gcc-toolchain $(ANDROID_NDK_X86)",
  810. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  811. "-target i686-none-linux-android",
  812. "-march=i686",
  813. "-mtune=atom",
  814. "-mstackrealign",
  815. "-msse3",
  816. "-mfpmath=sse",
  817. "-Wunused-value",
  818. "-Wundef",
  819. }
  820. linkoptions {
  821. "-gcc-toolchain $(ANDROID_NDK_X86)",
  822. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  823. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  824. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  825. "-target i686-none-linux-android",
  826. }
  827. configuration { "asmjs" }
  828. targetdir (path.join(_buildDir, "asmjs/bin"))
  829. objdir (path.join(_buildDir, "asmjs/obj"))
  830. libdirs { path.join(_libDir, "lib/asmjs") }
  831. buildoptions {
  832. "-i\"system$(EMSCRIPTEN)/system/include\"",
  833. "-i\"system$(EMSCRIPTEN)/system/include/libcxx\"",
  834. "-i\"system$(EMSCRIPTEN)/system/include/libc\"",
  835. "-Wunused-value",
  836. "-Wundef",
  837. }
  838. configuration { "freebsd" }
  839. targetdir (path.join(_buildDir, "freebsd/bin"))
  840. objdir (path.join(_buildDir, "freebsd/obj"))
  841. libdirs { path.join(_libDir, "lib/freebsd") }
  842. includedirs {
  843. path.join(bxDir, "include/compat/freebsd"),
  844. }
  845. configuration { "xbox360" }
  846. targetdir (path.join(_buildDir, "xbox360/bin"))
  847. objdir (path.join(_buildDir, "xbox360/obj"))
  848. includedirs { path.join(bxDir, "include/compat/msvc") }
  849. libdirs { path.join(_libDir, "lib/xbox360") }
  850. defines {
  851. "NOMINMAX",
  852. }
  853. configuration { "durango" }
  854. targetdir (path.join(_buildDir, "durango/bin"))
  855. objdir (path.join(_buildDir, "durango/obj"))
  856. includedirs { path.join(bxDir, "include/compat/msvc") }
  857. libdirs { path.join(_libDir, "lib/durango") }
  858. removeflags { "StaticRuntime" }
  859. defines {
  860. "NOMINMAX",
  861. }
  862. configuration { "netbsd" }
  863. targetdir (path.join(_buildDir, "netbsd/bin"))
  864. objdir (path.join(_buildDir, "netbsd/obj"))
  865. libdirs { path.join(_libDir, "lib/netbsd") }
  866. includedirs {
  867. path.join(bxDir, "include/compat/freebsd"),
  868. }
  869. configuration { "osx", "x32" }
  870. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  871. objdir (path.join(_buildDir, "osx32_clang/obj"))
  872. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  873. buildoptions {
  874. "-m32",
  875. }
  876. configuration { "osx", "x64" }
  877. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  878. objdir (path.join(_buildDir, "osx64_clang/obj"))
  879. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  880. buildoptions {
  881. "-m64",
  882. }
  883. configuration { "osx", "Universal" }
  884. targetdir (path.join(_buildDir, "osx_universal/bin"))
  885. objdir (path.join(_buildDir, "osx_universal/bin"))
  886. configuration { "osx" }
  887. buildoptions_cpp {
  888. "-std=c++11",
  889. }
  890. buildoptions {
  891. "-Wfatal-errors",
  892. "-msse2",
  893. "-Wunused-value",
  894. "-Wundef",
  895. }
  896. includedirs { path.join(bxDir, "include/compat/osx") }
  897. configuration { "ios*" }
  898. linkoptions {
  899. "-lc++",
  900. }
  901. buildoptions_cpp {
  902. "-std=c++11",
  903. }
  904. buildoptions {
  905. "-Wfatal-errors",
  906. "-Wunused-value",
  907. "-Wundef",
  908. }
  909. includedirs { path.join(bxDir, "include/compat/ios") }
  910. configuration { "xcode4", "ios*" }
  911. targetdir (path.join(_buildDir, "ios-arm/bin"))
  912. objdir (path.join(_buildDir, "ios-arm/obj"))
  913. configuration { "ios-arm" }
  914. targetdir (path.join(_buildDir, "ios-arm/bin"))
  915. objdir (path.join(_buildDir, "ios-arm/obj"))
  916. libdirs { path.join(_libDir, "lib/ios-arm") }
  917. linkoptions {
  918. "-arch armv7",
  919. }
  920. buildoptions {
  921. "-arch armv7",
  922. }
  923. configuration { "ios-arm64" }
  924. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  925. objdir (path.join(_buildDir, "ios-arm64/obj"))
  926. libdirs { path.join(_libDir, "lib/ios-arm64") }
  927. linkoptions {
  928. "-arch arm64",
  929. }
  930. buildoptions {
  931. "-arch arm64",
  932. }
  933. configuration { "ios-arm*" }
  934. linkoptions {
  935. "-miphoneos-version-min=7.0",
  936. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  937. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  938. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  939. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  940. }
  941. buildoptions {
  942. "-miphoneos-version-min=7.0",
  943. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  944. }
  945. configuration { "ios-simulator" }
  946. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  947. objdir (path.join(_buildDir, "ios-simulator/obj"))
  948. libdirs { path.join(_libDir, "lib/ios-simulator") }
  949. linkoptions {
  950. "-mios-simulator-version-min=7.0",
  951. "-arch i386",
  952. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  953. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  954. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  955. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  956. }
  957. buildoptions {
  958. "-mios-simulator-version-min=7.0",
  959. "-arch i386",
  960. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  961. }
  962. configuration { "tvos*" }
  963. linkoptions {
  964. "-lc++",
  965. }
  966. buildoptions {
  967. "-Wfatal-errors",
  968. "-Wunused-value",
  969. "-Wundef",
  970. }
  971. includedirs { path.join(bxDir, "include/compat/ios") }
  972. configuration { "xcode4", "tvos*" }
  973. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  974. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  975. configuration { "tvos-arm64" }
  976. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  977. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  978. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  979. linkoptions {
  980. "-mtvos-version-min=9.0",
  981. "-arch arm64",
  982. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  983. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  984. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  985. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  986. }
  987. buildoptions {
  988. "-mtvos-version-min=9.0",
  989. "-arch arm64",
  990. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  991. }
  992. configuration { "tvos-simulator" }
  993. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  994. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  995. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  996. linkoptions {
  997. "-mtvos-simulator-version-min=9.0",
  998. "-arch i386",
  999. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1000. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  1001. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  1002. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1003. }
  1004. buildoptions {
  1005. "-mtvos-simulator-version-min=9.0",
  1006. "-arch i386",
  1007. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1008. }
  1009. configuration { "orbis" }
  1010. targetdir (path.join(_buildDir, "orbis/bin"))
  1011. objdir (path.join(_buildDir, "orbis/obj"))
  1012. libdirs { path.join(_libDir, "lib/orbis") }
  1013. includedirs {
  1014. path.join(bxDir, "include/compat/freebsd"),
  1015. "$(SCE_ORBIS_SDK_DIR)/target/include",
  1016. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  1017. }
  1018. buildoptions {
  1019. }
  1020. buildoptions_cpp {
  1021. "-std=c++11",
  1022. }
  1023. linkoptions {
  1024. }
  1025. configuration { "qnx-arm" }
  1026. targetdir (path.join(_buildDir, "qnx-arm/bin"))
  1027. objdir (path.join(_buildDir, "qnx-arm/obj"))
  1028. libdirs { path.join(_libDir, "lib/qnx-arm") }
  1029. -- includedirs { path.join(bxDir, "include/compat/qnx") }
  1030. buildoptions {
  1031. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  1032. "-Wunused-value",
  1033. "-Wundef",
  1034. }
  1035. buildoptions_cpp {
  1036. "-std=c++11",
  1037. }
  1038. configuration { "rpi" }
  1039. targetdir (path.join(_buildDir, "rpi/bin"))
  1040. objdir (path.join(_buildDir, "rpi/obj"))
  1041. libdirs {
  1042. path.join(_libDir, "lib/rpi"),
  1043. "/opt/vc/lib",
  1044. }
  1045. defines {
  1046. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  1047. "__STDC_VERSION__=199901L",
  1048. }
  1049. buildoptions {
  1050. "-Wunused-value",
  1051. "-Wundef",
  1052. }
  1053. buildoptions_cpp {
  1054. "-std=c++11",
  1055. }
  1056. includedirs {
  1057. "/opt/vc/include",
  1058. "/opt/vc/include/interface/vcos/pthreads",
  1059. "/opt/vc/include/interface/vmcs_host/linux",
  1060. }
  1061. links {
  1062. "rt",
  1063. "dl",
  1064. }
  1065. linkoptions {
  1066. "-Wl,--gc-sections",
  1067. }
  1068. configuration { "riscv" }
  1069. targetdir (path.join(_buildDir, "riscv/bin"))
  1070. objdir (path.join(_buildDir, "riscv/obj"))
  1071. defines {
  1072. "__BSD_VISIBLE",
  1073. "__MISC_VISIBLE",
  1074. }
  1075. includedirs {
  1076. "$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf/include",
  1077. path.join(bxDir, "include/compat/riscv"),
  1078. }
  1079. buildoptions {
  1080. "-Wunused-value",
  1081. "-Wundef",
  1082. "--sysroot=$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf",
  1083. }
  1084. buildoptions_cpp {
  1085. "-std=c++11",
  1086. }
  1087. configuration {} -- reset configuration
  1088. return true
  1089. end
  1090. function strip()
  1091. configuration { "android-arm", "Release" }
  1092. postbuildcommands {
  1093. "$(SILENT) echo Stripping symbols.",
  1094. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  1095. }
  1096. configuration { "android-mips", "Release" }
  1097. postbuildcommands {
  1098. "$(SILENT) echo Stripping symbols.",
  1099. "$(SILENT) $(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  1100. }
  1101. configuration { "android-x86", "Release" }
  1102. postbuildcommands {
  1103. "$(SILENT) echo Stripping symbols.",
  1104. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  1105. }
  1106. configuration { "linux-steamlink", "Release" }
  1107. postbuildcommands {
  1108. "$(SILENT) echo Stripping symbols.",
  1109. "$(SILENT) $(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-strip -s \"$(TARGET)\""
  1110. }
  1111. configuration { "linux-* or rpi", "not linux-steamlink", "Release" }
  1112. postbuildcommands {
  1113. "$(SILENT) echo Stripping symbols.",
  1114. "$(SILENT) strip -s \"$(TARGET)\""
  1115. }
  1116. configuration { "mingw*", "Release" }
  1117. postbuildcommands {
  1118. "$(SILENT) echo Stripping symbols.",
  1119. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1120. }
  1121. configuration { "asmjs" }
  1122. postbuildcommands {
  1123. "$(SILENT) echo Running asmjs finalize.",
  1124. "$(SILENT) \"$(EMSCRIPTEN)/emcc\" -O2 "
  1125. -- .. "-s EMTERPRETIFY=1 "
  1126. -- .. "-s EMTERPRETIFY_ASYNC=1 "
  1127. .. "-s TOTAL_MEMORY=268435456 "
  1128. -- .. "-s ALLOW_MEMORY_GROWTH=1 "
  1129. -- .. "-s USE_WEBGL2=1 "
  1130. .. "--memory-init-file 1 "
  1131. .. "\"$(TARGET)\" -o \"$(TARGET)\".html "
  1132. -- .. "--preload-file ../../../examples/runtime@/ "
  1133. .. "-s PRECISE_F32=1"
  1134. }
  1135. configuration { "riscv" }
  1136. postbuildcommands {
  1137. "$(SILENT) echo Stripping symbols.",
  1138. "$(SILENT) $(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-strip -s \"$(TARGET)\""
  1139. }
  1140. configuration {} -- reset configuration
  1141. end