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. },
  66. }
  67. newoption {
  68. trigger = "vs",
  69. value = "toolset",
  70. description = "Choose VS toolset",
  71. allowed = {
  72. { "vs2012-clang", "Clang 3.6" },
  73. { "vs2013-clang", "Clang 3.6" },
  74. { "vs2015-clang", "Clang 3.9" },
  75. { "vs2017-clang", "Clang with MS CodeGen" },
  76. { "vs2012-xp", "Visual Studio 2012 targeting XP" },
  77. { "vs2013-xp", "Visual Studio 2013 targeting XP" },
  78. { "vs2015-xp", "Visual Studio 2015 targeting XP" },
  79. { "vs2017-xp", "Visual Studio 2017 targeting XP" },
  80. { "winstore100", "Universal Windows App 10.0" },
  81. { "durango", "Durango" },
  82. { "orbis", "Orbis" },
  83. },
  84. }
  85. newoption {
  86. trigger = "xcode",
  87. value = "xcode_target",
  88. description = "Choose XCode target",
  89. allowed = {
  90. { "osx", "OSX" },
  91. { "ios", "iOS" },
  92. { "tvos", "tvOS" },
  93. }
  94. }
  95. newoption {
  96. trigger = "with-android",
  97. value = "#",
  98. description = "Set Android platform version (default: android-14).",
  99. }
  100. newoption {
  101. trigger = "with-ios",
  102. value = "#",
  103. description = "Set iOS target version (default: 8.0).",
  104. }
  105. newoption {
  106. trigger = "with-macos",
  107. value = "#",
  108. description = "Set macOS target version (default 10.11).",
  109. }
  110. newoption {
  111. trigger = "with-tvos",
  112. value = "#",
  113. description = "Set tvOS target version (default: 9.0).",
  114. }
  115. newoption {
  116. trigger = "with-windows",
  117. value = "#",
  118. description = "Set the Windows target platform version (default: $WindowsSDKVersion or 8.1).",
  119. }
  120. newoption {
  121. trigger = "with-dynamic-runtime",
  122. description = "Dynamically link with the runtime rather than statically",
  123. }
  124. newoption {
  125. trigger = "with-32bit-compiler",
  126. description = "Use 32-bit compiler instead 64-bit.",
  127. }
  128. newoption {
  129. trigger = "with-avx",
  130. description = "Use AVX extension.",
  131. }
  132. -- Avoid error when invoking genie --help.
  133. if (_ACTION == nil) then return false end
  134. location (path.join(_buildDir, "projects", _ACTION))
  135. if _ACTION == "clean" then
  136. os.rmdir(_buildDir)
  137. os.mkdir(_buildDir)
  138. os.exit(1)
  139. end
  140. local androidPlatform = "android-24"
  141. if _OPTIONS["with-android"] then
  142. androidPlatform = "android-" .. _OPTIONS["with-android"]
  143. end
  144. local iosPlatform = ""
  145. if _OPTIONS["with-ios"] then
  146. iosPlatform = _OPTIONS["with-ios"]
  147. end
  148. local macosPlatform = ""
  149. if _OPTIONS["with-macos"] then
  150. macosPlatform = _OPTIONS["with-macos"]
  151. end
  152. local tvosPlatform = ""
  153. if _OPTIONS["with-tvos"] then
  154. tvosPlatform = _OPTIONS["with-tvos"]
  155. end
  156. local windowsPlatform = string.gsub(os.getenv("WindowsSDKVersion") or "8.1", "\\", "")
  157. if _OPTIONS["with-windows"] then
  158. windowsPlatform = _OPTIONS["with-windows"]
  159. end
  160. local compiler32bit = false
  161. if _OPTIONS["with-32bit-compiler"] then
  162. compiler32bit = true
  163. end
  164. flags {
  165. "Cpp14",
  166. "ExtraWarnings",
  167. }
  168. if _ACTION == "gmake" or _ACTION == "ninja" then
  169. if nil == _OPTIONS["gcc"] then
  170. print("GCC flavor must be specified!")
  171. os.exit(1)
  172. end
  173. if "android-arm" == _OPTIONS["gcc"] then
  174. if not os.getenv("ANDROID_NDK_ARM")
  175. or not os.getenv("ANDROID_NDK_CLANG")
  176. or not os.getenv("ANDROID_NDK_ROOT") then
  177. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.")
  178. end
  179. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  180. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  181. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  182. premake.gcc.llvm = true
  183. location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
  184. elseif "android-x86" == _OPTIONS["gcc"] then
  185. if not os.getenv("ANDROID_NDK_X86")
  186. or not os.getenv("ANDROID_NDK_CLANG")
  187. or not os.getenv("ANDROID_NDK_ROOT") then
  188. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_X86, and ANDROID_NDK_ROOT environment variables.")
  189. end
  190. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  191. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  192. premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
  193. premake.gcc.llvm = true
  194. location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
  195. elseif "asmjs" == _OPTIONS["gcc"] then
  196. if not os.getenv("EMSCRIPTEN") then
  197. print("Set EMSCRIPTEN environment variable.")
  198. end
  199. premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\""
  200. premake.gcc.cxx = "\"$(EMSCRIPTEN)/em++\""
  201. premake.gcc.ar = "\"$(EMSCRIPTEN)/emar\""
  202. premake.gcc.llvm = true
  203. location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
  204. elseif "freebsd" == _OPTIONS["gcc"] then
  205. location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
  206. elseif "ios-arm" == _OPTIONS["gcc"]
  207. or "ios-arm64" == _OPTIONS["gcc"] then
  208. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  209. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  210. premake.gcc.ar = "ar"
  211. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  212. elseif "ios-simulator" == _OPTIONS["gcc"] then
  213. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  214. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  215. premake.gcc.ar = "ar"
  216. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  217. elseif "ios-simulator64" == _OPTIONS["gcc"] then
  218. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  219. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  220. premake.gcc.ar = "ar"
  221. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator64"))
  222. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  223. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  224. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  225. premake.gcc.ar = "ar"
  226. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  227. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  228. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  229. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  230. premake.gcc.ar = "ar"
  231. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  232. elseif "linux-gcc" == _OPTIONS["gcc"] then
  233. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  234. elseif "linux-gcc-afl" == _OPTIONS["gcc"] then
  235. premake.gcc.cc = "afl-gcc"
  236. premake.gcc.cxx = "afl-g++"
  237. premake.gcc.ar = "ar"
  238. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  239. elseif "linux-gcc-6" == _OPTIONS["gcc"] then
  240. premake.gcc.cc = "gcc-6"
  241. premake.gcc.cxx = "g++-6"
  242. premake.gcc.ar = "ar"
  243. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  244. elseif "linux-clang" == _OPTIONS["gcc"] then
  245. premake.gcc.cc = "clang"
  246. premake.gcc.cxx = "clang++"
  247. premake.gcc.ar = "ar"
  248. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  249. elseif "linux-clang-afl" == _OPTIONS["gcc"] then
  250. premake.gcc.cc = "afl-clang"
  251. premake.gcc.cxx = "afl-clang++"
  252. premake.gcc.ar = "ar"
  253. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  254. elseif "linux-mips-gcc" == _OPTIONS["gcc"] then
  255. location (path.join(_buildDir, "projects", _ACTION .. "-linux-mips-gcc"))
  256. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  257. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  258. elseif "linux-steamlink" == _OPTIONS["gcc"] then
  259. if not os.getenv("MARVELL_SDK_PATH") then
  260. print("Set MARVELL_SDK_PATH environment variable.")
  261. end
  262. premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc"
  263. premake.gcc.cxx = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-g++"
  264. premake.gcc.ar = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-ar"
  265. location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink"))
  266. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  267. if not os.getenv("MINGW") then
  268. print("Set MINGW environment variable.")
  269. end
  270. local mingwToolchain = "x86_64-w64-mingw32"
  271. if compiler32bit then
  272. if os.is("linux") then
  273. mingwToolchain = "i686-w64-mingw32"
  274. else
  275. mingwToolchain = "mingw32"
  276. end
  277. end
  278. premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
  279. premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
  280. premake.gcc.ar = "$(MINGW)/bin/ar"
  281. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  282. elseif "mingw-clang" == _OPTIONS["gcc"] then
  283. premake.gcc.cc = "$(CLANG)/bin/clang"
  284. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  285. premake.gcc.ar = "$(MINGW)/bin/ar"
  286. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  287. -- premake.gcc.llvm = true
  288. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  289. elseif "netbsd" == _OPTIONS["gcc"] then
  290. location (path.join(_buildDir, "projects", _ACTION .. "-netbsd"))
  291. elseif "osx" == _OPTIONS["gcc"] then
  292. if os.is("linux") then
  293. if not os.getenv("OSXCROSS") then
  294. print("Set OSXCROSS environment variable.")
  295. end
  296. local osxToolchain = "x86_64-apple-darwin15-"
  297. premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
  298. premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
  299. premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
  300. end
  301. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  302. elseif "orbis" == _OPTIONS["gcc"] then
  303. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  304. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  305. end
  306. orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-"
  307. premake.gcc.cc = orbisToolchain .. "clang"
  308. premake.gcc.cxx = orbisToolchain .. "clang++"
  309. premake.gcc.ar = orbisToolchain .. "ar"
  310. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  311. elseif "rpi" == _OPTIONS["gcc"] then
  312. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  313. elseif "riscv" == _OPTIONS["gcc"] then
  314. premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc"
  315. premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++"
  316. premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar"
  317. location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
  318. end
  319. elseif _ACTION == "vs2012"
  320. or _ACTION == "vs2013"
  321. or _ACTION == "vs2015"
  322. or _ACTION == "vs2017"
  323. then
  324. local action = premake.action.current()
  325. action.vstudio.windowsTargetPlatformVersion = windowsPlatform
  326. action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
  327. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  328. if "vs2017-clang" == _OPTIONS["vs"] then
  329. premake.vstudio.toolset = "v141_clang_c2"
  330. elseif "vs2015-clang" == _OPTIONS["vs"] then
  331. premake.vstudio.toolset = "LLVM-vs2014"
  332. else
  333. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  334. end
  335. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  336. elseif "winstore100" == _OPTIONS["vs"] then
  337. premake.vstudio.toolset = "v141"
  338. premake.vstudio.storeapp = "10.0"
  339. platforms { "ARM" }
  340. location (path.join(_buildDir, "projects", _ACTION .. "-winstore100"))
  341. elseif "durango" == _OPTIONS["vs"] then
  342. if not os.getenv("DurangoXDK") then
  343. print("DurangoXDK not found.")
  344. end
  345. premake.vstudio.toolset = "v140"
  346. premake.vstudio.storeapp = "durango"
  347. platforms { "Durango" }
  348. location (path.join(_buildDir, "projects", _ACTION .. "-durango"))
  349. elseif "orbis" == _OPTIONS["vs"] then
  350. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  351. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  352. end
  353. platforms { "Orbis" }
  354. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  355. elseif ("vs2012-xp") == _OPTIONS["vs"] then
  356. premake.vstudio.toolset = ("v110_xp")
  357. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  358. elseif "vs2013-xp" == _OPTIONS["vs"] then
  359. premake.vstudio.toolset = ("v120_xp")
  360. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  361. elseif "vs2015-xp" == _OPTIONS["vs"] then
  362. premake.vstudio.toolset = ("v140_xp")
  363. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  364. elseif "vs2015-xp" == _OPTIONS["vs"] then
  365. premake.vstudio.toolset = ("v141_xp")
  366. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  367. end
  368. elseif _ACTION == "xcode4"
  369. or _ACTION == "xcode8"
  370. or _ACTION == "xcode9" then
  371. local action = premake.action.current()
  372. local str_or = function(str, def)
  373. return #str > 0 and str or def
  374. end
  375. if "osx" == _OPTIONS["xcode"] then
  376. action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "10.11")
  377. premake.xcode.toolset = "macosx"
  378. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  379. elseif "ios" == _OPTIONS["xcode"] then
  380. action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "8.0")
  381. premake.xcode.toolset = "iphoneos"
  382. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  383. elseif "tvos" == _OPTIONS["xcode"] then
  384. action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0")
  385. premake.xcode.toolset = "appletvos"
  386. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  387. end
  388. end
  389. if not _OPTIONS["with-dynamic-runtime"] then
  390. flags { "StaticRuntime" }
  391. end
  392. if _OPTIONS["with-avx"] then
  393. flags { "EnableAVX" }
  394. end
  395. if _OPTIONS["with-crtnone"] then
  396. crtNone()
  397. end
  398. flags {
  399. "NoPCH",
  400. "NativeWChar",
  401. "NoRTTI",
  402. "NoExceptions",
  403. "NoEditAndContinue",
  404. "NoFramePointer",
  405. "Symbols",
  406. }
  407. defines {
  408. "__STDC_LIMIT_MACROS",
  409. "__STDC_FORMAT_MACROS",
  410. "__STDC_CONSTANT_MACROS",
  411. }
  412. configuration { "Debug" }
  413. targetsuffix "Debug"
  414. defines {
  415. "_DEBUG",
  416. }
  417. configuration { "Release" }
  418. flags {
  419. "NoBufferSecurityCheck",
  420. "OptimizeSpeed",
  421. }
  422. defines {
  423. "NDEBUG",
  424. }
  425. targetsuffix "Release"
  426. configuration { "qbs" }
  427. flags {
  428. "ExtraWarnings",
  429. }
  430. configuration { "vs*", "x32" }
  431. flags {
  432. "EnableSSE2",
  433. }
  434. configuration { "vs*", "not orbis", "not NX32", "not NX64" }
  435. includedirs { path.join(bxDir, "include/compat/msvc") }
  436. defines {
  437. "WIN32",
  438. "_WIN32",
  439. "_HAS_EXCEPTIONS=0",
  440. "_HAS_ITERATOR_DEBUGGING=0",
  441. "_ITERATOR_DEBUG_LEVEL=0",
  442. "_SCL_SECURE=0",
  443. "_SECURE_SCL=0",
  444. "_SCL_SECURE_NO_WARNINGS",
  445. "_CRT_SECURE_NO_WARNINGS",
  446. "_CRT_SECURE_NO_DEPRECATE",
  447. }
  448. buildoptions {
  449. "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union
  450. "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier
  451. "/Ob2", -- The Inline Function Expansion
  452. }
  453. linkoptions {
  454. "/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
  455. }
  456. configuration { "vs2008" }
  457. includedirs { path.join(bxDir, "include/compat/msvc/pre1600") }
  458. configuration { "x32", "vs*" }
  459. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  460. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  461. libdirs {
  462. path.join(_libDir, "lib/win32_" .. _ACTION),
  463. }
  464. configuration { "x64", "vs*" }
  465. defines { "_WIN64" }
  466. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  467. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  468. libdirs {
  469. path.join(_libDir, "lib/win64_" .. _ACTION),
  470. }
  471. configuration { "x32", "vs2017" }
  472. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  473. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  474. libdirs {
  475. path.join(_libDir, "lib/win32_" .. _ACTION),
  476. }
  477. configuration { "x64", "vs2017" }
  478. defines { "_WIN64" }
  479. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  480. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  481. libdirs {
  482. path.join(_libDir, "lib/win64_" .. _ACTION),
  483. }
  484. configuration { "ARM", "vs*" }
  485. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  486. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  487. configuration { "vs*-clang" }
  488. buildoptions {
  489. "-Qunused-arguments",
  490. }
  491. configuration { "x32", "vs*-clang" }
  492. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  493. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  494. configuration { "x64", "vs*-clang" }
  495. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  496. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  497. configuration { "winstore*" }
  498. removeflags {
  499. "StaticRuntime",
  500. "NoBufferSecurityCheck",
  501. }
  502. buildoptions {
  503. "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
  504. }
  505. linkoptions {
  506. "/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
  507. }
  508. configuration { "*-gcc* or osx" }
  509. buildoptions {
  510. "-Wshadow",
  511. }
  512. configuration { "mingw-*" }
  513. defines { "WIN32" }
  514. includedirs { path.join(bxDir, "include/compat/mingw") }
  515. defines {
  516. "MINGW_HAS_SECURE_API=1",
  517. }
  518. buildoptions {
  519. "-Wunused-value",
  520. "-fdata-sections",
  521. "-ffunction-sections",
  522. "-msse2",
  523. "-Wunused-value",
  524. "-Wundef",
  525. }
  526. linkoptions {
  527. "-Wl,--gc-sections",
  528. "-static",
  529. "-static-libgcc",
  530. "-static-libstdc++",
  531. }
  532. configuration { "x32", "mingw-gcc" }
  533. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  534. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  535. libdirs {
  536. path.join(_libDir, "lib/win32_mingw-gcc"),
  537. }
  538. buildoptions {
  539. "-m32",
  540. "-mstackrealign",
  541. }
  542. configuration { "x64", "mingw-gcc" }
  543. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  544. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  545. libdirs {
  546. path.join(_libDir, "lib/win64_mingw-gcc"),
  547. }
  548. buildoptions { "-m64" }
  549. configuration { "mingw-clang" }
  550. buildoptions {
  551. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  552. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  553. "-isystem$(MINGW)/x86_64-w64-mingw32/include",
  554. }
  555. linkoptions {
  556. "-Qunused-arguments",
  557. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  558. }
  559. configuration { "x32", "mingw-clang" }
  560. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  561. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  562. libdirs {
  563. path.join(_libDir, "lib/win32_mingw-clang"),
  564. }
  565. buildoptions { "-m32" }
  566. configuration { "x64", "mingw-clang" }
  567. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  568. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  569. libdirs {
  570. path.join(_libDir, "lib/win64_mingw-clang"),
  571. }
  572. buildoptions { "-m64" }
  573. configuration { "linux-clang" }
  574. configuration { "linux-gcc-6" }
  575. buildoptions {
  576. -- "-fno-omit-frame-pointer",
  577. -- "-fsanitize=address",
  578. -- "-fsanitize=undefined",
  579. -- "-fsanitize=float-divide-by-zero",
  580. -- "-fsanitize=float-cast-overflow",
  581. }
  582. links {
  583. -- "asan",
  584. -- "ubsan",
  585. }
  586. configuration { "linux-gcc" }
  587. buildoptions {
  588. "-mfpmath=sse",
  589. }
  590. configuration { "linux-gcc* or linux-clang*" }
  591. buildoptions {
  592. "-msse2",
  593. -- "-Wdouble-promotion",
  594. -- "-Wduplicated-branches",
  595. -- "-Wduplicated-cond",
  596. -- "-Wjump-misses-init",
  597. "-Wshadow",
  598. -- "-Wnull-dereference",
  599. "-Wunused-value",
  600. "-Wundef",
  601. -- "-Wuseless-cast",
  602. }
  603. links {
  604. "rt",
  605. "dl",
  606. }
  607. linkoptions {
  608. "-Wl,--gc-sections",
  609. "-Wl,--as-needed",
  610. }
  611. configuration { "linux-gcc*" }
  612. buildoptions {
  613. "-Wlogical-op",
  614. }
  615. configuration { "linux-gcc*", "x32" }
  616. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  617. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  618. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  619. buildoptions {
  620. "-m32",
  621. }
  622. configuration { "linux-gcc*", "x64" }
  623. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  624. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  625. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  626. buildoptions {
  627. "-m64",
  628. }
  629. configuration { "linux-clang*", "x32" }
  630. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  631. objdir (path.join(_buildDir, "linux32_clang/obj"))
  632. libdirs { path.join(_libDir, "lib/linux32_clang") }
  633. buildoptions {
  634. "-m32",
  635. }
  636. configuration { "linux-clang*", "x64" }
  637. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  638. objdir (path.join(_buildDir, "linux64_clang/obj"))
  639. libdirs { path.join(_libDir, "lib/linux64_clang") }
  640. buildoptions {
  641. "-m64",
  642. }
  643. configuration { "linux-mips-gcc" }
  644. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  645. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  646. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  647. buildoptions {
  648. "-Wunused-value",
  649. "-Wundef",
  650. }
  651. links {
  652. "rt",
  653. "dl",
  654. }
  655. linkoptions {
  656. "-Wl,--gc-sections",
  657. }
  658. configuration { "linux-arm-gcc" }
  659. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  660. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  661. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  662. buildoptions {
  663. "-Wunused-value",
  664. "-Wundef",
  665. }
  666. links {
  667. "rt",
  668. "dl",
  669. }
  670. linkoptions {
  671. "-Wl,--gc-sections",
  672. }
  673. configuration { "android-*" }
  674. targetprefix ("lib")
  675. flags {
  676. "NoImportLib",
  677. }
  678. includedirs {
  679. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  680. "${ANDROID_NDK_ROOT}/sysroot/usr/include",
  681. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  682. }
  683. linkoptions {
  684. "-nostdlib",
  685. }
  686. links {
  687. "c",
  688. "dl",
  689. "m",
  690. "android",
  691. "log",
  692. "c++_shared",
  693. "gcc",
  694. }
  695. buildoptions {
  696. "-fPIC",
  697. "-no-canonical-prefixes",
  698. "-Wa,--noexecstack",
  699. "-fstack-protector-strong",
  700. "-ffunction-sections",
  701. "-Wunused-value",
  702. "-Wundef",
  703. }
  704. linkoptions {
  705. "-no-canonical-prefixes",
  706. "-Wl,--no-undefined",
  707. "-Wl,-z,noexecstack",
  708. "-Wl,-z,relro",
  709. "-Wl,-z,now",
  710. }
  711. configuration { "linux-steamlink" }
  712. targetdir (path.join(_buildDir, "steamlink/bin"))
  713. objdir (path.join(_buildDir, "steamlink/obj"))
  714. libdirs { path.join(_libDir, "lib/steamlink") }
  715. includedirs { path.join(bxDir, "include/compat/linux") }
  716. defines {
  717. "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
  718. }
  719. buildoptions {
  720. "-Wfatal-errors",
  721. "-Wunused-value",
  722. "-Wundef",
  723. "-pthread",
  724. "-marm",
  725. "-mfloat-abi=hard",
  726. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  727. }
  728. linkoptions {
  729. "-static-libgcc",
  730. "-static-libstdc++",
  731. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  732. }
  733. configuration { "android-arm" }
  734. targetdir (path.join(_buildDir, "android-arm/bin"))
  735. objdir (path.join(_buildDir, "android-arm/obj"))
  736. libdirs {
  737. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
  738. }
  739. includedirs {
  740. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi",
  741. }
  742. buildoptions {
  743. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  744. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  745. "-target armv7-none-linux-androideabi",
  746. "-mthumb",
  747. "-march=armv7-a",
  748. "-mfloat-abi=softfp",
  749. "-mfpu=neon",
  750. "-Wunused-value",
  751. "-Wundef",
  752. }
  753. linkoptions {
  754. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  755. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  756. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  757. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  758. "-target armv7-none-linux-androideabi",
  759. "-march=armv7-a",
  760. "-Wl,--fix-cortex-a8",
  761. }
  762. configuration { "android-x86" }
  763. targetdir (path.join(_buildDir, "android-x86/bin"))
  764. objdir (path.join(_buildDir, "android-x86/obj"))
  765. libdirs {
  766. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
  767. }
  768. includedirs {
  769. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android",
  770. }
  771. buildoptions {
  772. "-gcc-toolchain $(ANDROID_NDK_X86)",
  773. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  774. "-target i686-none-linux-android",
  775. "-march=i686",
  776. "-mtune=atom",
  777. "-mstackrealign",
  778. "-msse3",
  779. "-mfpmath=sse",
  780. "-Wunused-value",
  781. "-Wundef",
  782. }
  783. linkoptions {
  784. "-gcc-toolchain $(ANDROID_NDK_X86)",
  785. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  786. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  787. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  788. "-target i686-none-linux-android",
  789. }
  790. configuration { "asmjs" }
  791. targetdir (path.join(_buildDir, "asmjs/bin"))
  792. objdir (path.join(_buildDir, "asmjs/obj"))
  793. libdirs { path.join(_libDir, "lib/asmjs") }
  794. buildoptions {
  795. "-i\"system$(EMSCRIPTEN)/system/include\"",
  796. "-i\"system$(EMSCRIPTEN)/system/include/libcxx\"",
  797. "-i\"system$(EMSCRIPTEN)/system/include/libc\"",
  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) \"$(EMSCRIPTEN)/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