toolchain.lua 38 KB

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