toolchain.lua 39 KB

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