toolchain.lua 40 KB

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