toolchain.lua 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  1. --
  2. -- Copyright 2010-2025 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bx/blob/master/LICENSE
  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. local android = {};
  36. local function androidToolchainRoot()
  37. if android.toolchainRoot == nil then
  38. local hostTags = {
  39. windows = "windows-x86_64",
  40. linux = "linux-x86_64",
  41. macosx = "darwin-x86_64"
  42. }
  43. android.toolchainRoot = "$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/" .. hostTags[os.get()]
  44. end
  45. return android.toolchainRoot;
  46. end
  47. function toolchain(_buildDir, _libDir)
  48. newoption {
  49. trigger = "gcc",
  50. value = "GCC",
  51. description = "Choose GCC flavor",
  52. allowed = {
  53. { "android-arm", "Android - ARM" },
  54. { "android-arm64", "Android - ARM64" },
  55. { "android-x86", "Android - x86" },
  56. { "android-x86_64", "Android - x86_64" },
  57. { "wasm2js", "Emscripten/Wasm2JS" },
  58. { "wasm", "Emscripten/Wasm" },
  59. { "linux-gcc", "Linux (GCC compiler)" },
  60. { "linux-gcc-afl", "Linux (GCC + AFL fuzzer)" },
  61. { "linux-clang", "Linux (Clang compiler)" },
  62. { "linux-clang-afl", "Linux (Clang + AFL fuzzer)" },
  63. { "linux-arm-gcc", "Linux (ARM, GCC compiler)" },
  64. { "linux-ppc64le-gcc", "Linux (PPC64LE, GCC compiler)" },
  65. { "linux-ppc64le-clang", "Linux (PPC64LE, Clang compiler)" },
  66. { "linux-riscv64-gcc", "Linux (RISC-V 64, GCC compiler)" },
  67. { "ios-arm64", "iOS - ARM64" },
  68. { "ios-simulator", "iOS - Simulator" },
  69. { "tvos-arm64", "tvOS - ARM64" },
  70. { "xros-arm64", "visionOS ARM64" },
  71. { "xros-simulator", "visionOS - Simulator" },
  72. { "tvos-simulator", "tvOS - Simulator" },
  73. { "mingw-gcc", "MinGW" },
  74. { "mingw-clang", "MinGW (clang compiler)" },
  75. { "osx-x64", "OSX - x64" },
  76. { "osx-arm64", "OSX - ARM64" },
  77. { "orbis", "Orbis" },
  78. { "riscv", "RISC-V" },
  79. { "rpi", "RaspberryPi" },
  80. },
  81. }
  82. newoption {
  83. trigger = "vs",
  84. value = "toolset",
  85. description = "Choose VS toolset",
  86. allowed = {
  87. { "vs2017-clang", "Clang with MS CodeGen" },
  88. { "vs2017-xp", "Visual Studio 2017 targeting XP" },
  89. { "winstore100", "Universal Windows App 10.0" },
  90. { "durango", "Durango" },
  91. { "orbis", "Orbis" },
  92. },
  93. }
  94. newoption {
  95. trigger = "xcode",
  96. value = "target",
  97. description = "Choose XCode target; one of:",
  98. allowed = {
  99. { "osx", "macOS" },
  100. { "ios", "iOS" },
  101. { "tvos", "tvOS" },
  102. { "xros", "visionOS" },
  103. }
  104. }
  105. newoption {
  106. trigger = "with-android",
  107. value = "#",
  108. description = "Set Android platform version (default: android-24).",
  109. }
  110. newoption {
  111. trigger = "with-ios",
  112. value = "#",
  113. description = "Set iOS target version (default: 13.0).",
  114. }
  115. newoption {
  116. trigger = "with-macos",
  117. value = "#",
  118. description = "Set macOS target version (default 13.0).",
  119. }
  120. newoption {
  121. trigger = "with-tvos",
  122. value = "#",
  123. description = "Set tvOS target version (default: 13.0).",
  124. }
  125. newoption {
  126. trigger = "with-visionos",
  127. value = "#",
  128. description = "Set visionOS target version (default: 1.0).",
  129. }
  130. newoption {
  131. trigger = "with-windows",
  132. value = "#",
  133. description = "Set the Windows target platform version (default: $WindowsSDKVersion or 8.1).",
  134. }
  135. newoption {
  136. trigger = "with-dynamic-runtime",
  137. description = "Dynamically link with the runtime rather than statically",
  138. }
  139. newoption {
  140. trigger = "with-32bit-compiler",
  141. description = "Use 32-bit compiler instead 64-bit.",
  142. }
  143. newoption {
  144. trigger = "with-avx",
  145. description = "Use AVX extension.",
  146. }
  147. -- Avoid error when invoking genie --help.
  148. if (_ACTION == nil) then return false end
  149. location (path.join(_buildDir, "projects", _ACTION))
  150. if _ACTION == "clean" then
  151. os.rmdir(_buildDir)
  152. os.mkdir(_buildDir)
  153. os.exit(1)
  154. end
  155. local androidApiLevel = 24
  156. if _OPTIONS["with-android"] then
  157. androidApiLevel = _OPTIONS["with-android"]
  158. end
  159. local iosPlatform = "8.0"
  160. if _OPTIONS["with-ios"] then
  161. iosPlatform = _OPTIONS["with-ios"]
  162. elseif _ACTION == "xcode11" then
  163. iosPlatform = "8.0"
  164. elseif _ACTION == "xcode14" then
  165. iosPlatform = "11.0"
  166. elseif _ACTION == "xcode15" then
  167. iosPlatform = "12.0"
  168. end
  169. local tvosPlatform = "9.0"
  170. if _OPTIONS["with-tvos"] then
  171. tvosPlatform = _OPTIONS["with-tvos"]
  172. elseif _ACTION == "xcode11" then
  173. tvosPlatform = "9.0"
  174. elseif _ACTION == "xcode14" then
  175. tvosPlatform = "11.0"
  176. elseif _ACTION == "xcode15" then
  177. tvosPlatform = "12.0"
  178. end
  179. local macosPlatform = "10.13.6"
  180. if _OPTIONS["with-macos"] then
  181. macosPlatform = _OPTIONS["with-macos"]
  182. elseif _ACTION == "xcode11" then
  183. macosPlatform = "10.14.4"
  184. elseif _ACTION == "xcode14" then
  185. macosPlatform = "12.5"
  186. elseif _ACTION == "xcode15" then
  187. macosPlatform = "13.5"
  188. end
  189. local xrosPlatform = "1.0"
  190. if _OPTIONS["with-xros"] then
  191. xrosPlatform = _OPTIONS["with-xros"]
  192. end
  193. local windowsPlatform = nil
  194. if _OPTIONS["with-windows"] then
  195. windowsPlatform = _OPTIONS["with-windows"]
  196. elseif nil ~= os.getenv("WindowsSDKVersion") then
  197. windowsPlatform = string.gsub(os.getenv("WindowsSDKVersion"), "\\", "")
  198. end
  199. local compiler32bit = false
  200. if _OPTIONS["with-32bit-compiler"] then
  201. compiler32bit = true
  202. end
  203. flags {
  204. "Cpp20",
  205. "ExtraWarnings",
  206. "FloatFast",
  207. }
  208. if _ACTION == "gmake" or _ACTION == "ninja" then
  209. if nil == _OPTIONS["gcc"] then
  210. print("GCC flavor must be specified!")
  211. os.exit(1)
  212. end
  213. if "android-arm" == _OPTIONS["gcc"]
  214. or "android-arm64" == _OPTIONS["gcc"]
  215. or "android-x86" == _OPTIONS["gcc"]
  216. or "android-x86_64" == _OPTIONS["gcc"] then
  217. premake.gcc.cc = androidToolchainRoot() .. "/bin/clang"
  218. premake.gcc.cxx = androidToolchainRoot() .. "/bin/clang++"
  219. premake.gcc.ar = androidToolchainRoot() .. "/bin/llvm-ar"
  220. premake.gcc.llvm = true
  221. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  222. elseif "wasm2js" == _OPTIONS["gcc"] or "wasm" == _OPTIONS["gcc"] then
  223. if not os.getenv("EMSCRIPTEN") then
  224. print("Set EMSCRIPTEN environment variable to root directory of your Emscripten installation. (e.g. by entering the EMSDK command prompt)")
  225. end
  226. premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\""
  227. premake.gcc.cxx = "\"$(EMSCRIPTEN)/em++\""
  228. premake.gcc.ar = "\"$(EMSCRIPTEN)/emar\""
  229. premake.gcc.llvm = true
  230. premake.gcc.namestyle = "Emscripten"
  231. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  232. elseif "ios-arm64" == _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 .. "-" .. _OPTIONS["gcc"]))
  237. elseif "xros-arm64" == _OPTIONS["gcc"]
  238. or "xros-simulator" == _OPTIONS["gcc"] then
  239. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  240. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  241. premake.gcc.ar = "ar"
  242. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  243. elseif "ios-simulator" == _OPTIONS["gcc"] then
  244. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  245. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  246. premake.gcc.ar = "ar"
  247. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  248. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  249. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  250. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  251. premake.gcc.ar = "ar"
  252. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  253. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  254. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  255. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  256. premake.gcc.ar = "ar"
  257. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  258. elseif "linux-gcc" == _OPTIONS["gcc"] then
  259. location (path.join(_buildDir, "projects", _ACTION .. "-linux-gcc"))
  260. elseif "linux-gcc-afl" == _OPTIONS["gcc"] then
  261. premake.gcc.cc = "afl-gcc"
  262. premake.gcc.cxx = "afl-g++"
  263. premake.gcc.ar = "ar"
  264. location (path.join(_buildDir, "projects", _ACTION .. "-linux-gcc"))
  265. elseif "linux-clang" == _OPTIONS["gcc"] then
  266. premake.gcc.cc = "clang"
  267. premake.gcc.cxx = "clang++"
  268. premake.gcc.ar = "ar"
  269. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  270. elseif "linux-clang-afl" == _OPTIONS["gcc"] then
  271. premake.gcc.cc = "afl-clang"
  272. premake.gcc.cxx = "afl-clang++"
  273. premake.gcc.ar = "ar"
  274. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  275. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  276. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  277. elseif "linux-ppc64le-gcc" == _OPTIONS["gcc"] then
  278. location (path.join(_buildDir, "projects", _ACTION .. "-linux-ppc64le-gcc"))
  279. elseif "linux-ppc64le-clang" == _OPTIONS["gcc"] then
  280. premake.gcc.cc = "clang"
  281. premake.gcc.cxx = "clang++"
  282. premake.gcc.ar = "ar"
  283. premake.gcc.llvm = true
  284. location (path.join(_buildDir, "projects", _ACTION .. "-linux-ppc64le-clang"))
  285. elseif "linux-riscv64-gcc" == _OPTIONS["gcc"] then
  286. location (path.join(_buildDir, "projects", _ACTION .. "-linux-riscv64-gcc"))
  287. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  288. if not os.getenv("MINGW") then
  289. print("Set MINGW environment variable.")
  290. end
  291. local mingwToolchain = "x86_64-w64-mingw32"
  292. if compiler32bit then
  293. if os.is("linux") then
  294. mingwToolchain = "i686-w64-mingw32"
  295. else
  296. mingwToolchain = "mingw32"
  297. end
  298. end
  299. premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
  300. premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
  301. premake.gcc.ar = "$(MINGW)/bin/ar"
  302. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  303. elseif "mingw-clang" == _OPTIONS["gcc"] then
  304. if not os.getenv("MINGW") then
  305. print("Set MINGW environment variable.")
  306. end
  307. if not os.getenv("CLANG") then
  308. print("Set CLANG environment variable.")
  309. end
  310. premake.gcc.cc = "$(CLANG)/bin/clang"
  311. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  312. premake.gcc.ar = "$(MINGW)/bin/ar"
  313. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  314. -- premake.gcc.llvm = true
  315. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  316. elseif "osx-x64" == _OPTIONS["gcc"]
  317. or "osx-arm64" == _OPTIONS["gcc"] then
  318. if os.is("linux") then
  319. if not os.getenv("OSXCROSS") then
  320. print("Set OSXCROSS environment variable.")
  321. end
  322. local osxToolchain = "x86_64-apple-darwin15-"
  323. premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
  324. premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
  325. premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
  326. end
  327. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  328. elseif "orbis" == _OPTIONS["gcc"] then
  329. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  330. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  331. end
  332. orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-"
  333. premake.gcc.cc = orbisToolchain .. "clang"
  334. premake.gcc.cxx = orbisToolchain .. "clang++"
  335. premake.gcc.ar = orbisToolchain .. "ar"
  336. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  337. elseif "rpi" == _OPTIONS["gcc"] then
  338. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  339. elseif "riscv" == _OPTIONS["gcc"] then
  340. premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc"
  341. premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++"
  342. premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar"
  343. location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
  344. end
  345. elseif _ACTION == "vs2017"
  346. or _ACTION == "vs2019"
  347. or _ACTION == "vs2022"
  348. then
  349. local action = premake.action.current()
  350. if nil ~= windowsPlatform then
  351. action.vstudio.windowsTargetPlatformVersion = windowsPlatform
  352. action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
  353. end
  354. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  355. if "vs2017-clang" == _OPTIONS["vs"] then
  356. premake.vstudio.toolset = "v141_clang_c2"
  357. else
  358. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  359. end
  360. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  361. elseif "winstore100" == _OPTIONS["vs"] then
  362. premake.vstudio.toolset = "v141"
  363. premake.vstudio.storeapp = "10.0"
  364. platforms { "ARM" }
  365. location (path.join(_buildDir, "projects", _ACTION .. "-winstore100"))
  366. elseif "durango" == _OPTIONS["vs"] then
  367. if not os.getenv("DurangoXDK") then
  368. print("DurangoXDK not found.")
  369. end
  370. premake.vstudio.toolset = "v140"
  371. premake.vstudio.storeapp = "durango"
  372. platforms { "Durango" }
  373. location (path.join(_buildDir, "projects", _ACTION .. "-durango"))
  374. elseif "orbis" == _OPTIONS["vs"] then
  375. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  376. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  377. end
  378. platforms { "Orbis" }
  379. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  380. end
  381. elseif _ACTION and _ACTION:match("^xcode.+$") then
  382. local action = premake.action.current()
  383. local str_or = function(str, def)
  384. return #str > 0 and str or def
  385. end
  386. if "macos" == _OPTIONS["xcode"] then
  387. action.xcode.macOSTargetPlatformVersion = macosPlatform
  388. premake.xcode.toolset = "macosx"
  389. location (path.join(_buildDir, "projects", _ACTION .. "-macos"))
  390. elseif "ios" == _OPTIONS["xcode"] then
  391. action.xcode.iOSTargetPlatformVersion = iosPlatform
  392. premake.xcode.toolset = "iphoneos"
  393. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  394. elseif "tvos" == _OPTIONS["xcode"] then
  395. action.xcode.tvOSTargetPlatformVersion = tvosPlatform
  396. premake.xcode.toolset = "appletvos"
  397. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  398. elseif "xros" == _OPTIONS["xcode"] then
  399. action.xcode.visionOSTargetPlatformVersion = xrosPlatform
  400. premake.xcode.toolset = "xros"
  401. location (path.join(_buildDir, "projects", _ACTION .. "-xros"))
  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. targetsuffix "Release"
  434. flags {
  435. "NoBufferSecurityCheck",
  436. "OptimizeSpeed",
  437. }
  438. defines {
  439. "NDEBUG",
  440. }
  441. configuration { "*-clang" }
  442. buildoptions {
  443. "-Wno-nan-infinity-disabled",
  444. "-Wno-tautological-constant-compare",
  445. }
  446. configuration { "vs*", "not NX32", "not NX64" }
  447. flags {
  448. "EnableAVX",
  449. }
  450. configuration { "vs*", "not orbis", "not NX32", "not NX64" }
  451. includedirs { path.join(bxDir, "include/compat/msvc") }
  452. defines {
  453. "WIN32",
  454. "_WIN32",
  455. "_HAS_EXCEPTIONS=0",
  456. "_SCL_SECURE=0",
  457. "_SECURE_SCL=0",
  458. "_SCL_SECURE_NO_WARNINGS",
  459. "_CRT_SECURE_NO_WARNINGS",
  460. "_CRT_SECURE_NO_DEPRECATE",
  461. }
  462. buildoptions {
  463. "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union
  464. "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier
  465. "/Ob2", -- The Inline Function Expansion
  466. "/Zc:__cplusplus", -- Enable updated __cplusplus macro.
  467. "/Zc:preprocessor", -- Enable preprocessor conformance mode.
  468. }
  469. linkoptions {
  470. "/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
  471. }
  472. configuration { "x32", "vs*" }
  473. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  474. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  475. libdirs {
  476. path.join(_libDir, "lib/win32_" .. _ACTION),
  477. }
  478. configuration { "x64", "vs*" }
  479. defines { "_WIN64" }
  480. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  481. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  482. libdirs {
  483. path.join(_libDir, "lib/win64_" .. _ACTION),
  484. }
  485. configuration { "x32", "vs2017" }
  486. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  487. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  488. libdirs {
  489. path.join(_libDir, "lib/win32_" .. _ACTION),
  490. }
  491. configuration { "x64", "vs2017" }
  492. defines { "_WIN64" }
  493. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  494. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  495. libdirs {
  496. path.join(_libDir, "lib/win64_" .. _ACTION),
  497. }
  498. configuration { "ARM", "vs*" }
  499. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  500. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  501. configuration { "vs*-clang" }
  502. buildoptions {
  503. "-Qunused-arguments",
  504. }
  505. configuration { "x32", "vs*-clang" }
  506. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  507. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  508. configuration { "x64", "vs*-clang" }
  509. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  510. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  511. configuration { "winstore*" }
  512. removeflags {
  513. "StaticRuntime",
  514. "NoBufferSecurityCheck",
  515. }
  516. buildoptions {
  517. "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
  518. }
  519. linkoptions {
  520. "/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
  521. }
  522. configuration { "*-gcc* or osx" }
  523. buildoptions {
  524. "-Wshadow",
  525. }
  526. configuration { "mingw-*" }
  527. defines { "WIN32" }
  528. includedirs { path.join(bxDir, "include/compat/mingw") }
  529. defines {
  530. "MINGW_HAS_SECURE_API=1",
  531. }
  532. buildoptions {
  533. "-Wa,-mbig-obj",
  534. "-Wundef",
  535. "-Wunused-value",
  536. "-fdata-sections",
  537. "-ffunction-sections",
  538. "-msse4.2",
  539. }
  540. linkoptions {
  541. "-Wl,--gc-sections",
  542. "-static",
  543. "-static-libgcc",
  544. "-static-libstdc++",
  545. }
  546. configuration { "x32", "mingw-gcc" }
  547. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  548. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  549. libdirs {
  550. path.join(_libDir, "lib/win32_mingw-gcc"),
  551. }
  552. buildoptions {
  553. "-m32",
  554. "-mstackrealign",
  555. }
  556. configuration { "x64", "mingw-gcc" }
  557. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  558. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  559. libdirs {
  560. path.join(_libDir, "lib/win64_mingw-gcc"),
  561. }
  562. buildoptions { "-m64" }
  563. configuration { "mingw-clang" }
  564. buildoptions {
  565. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  566. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  567. "-isystem $(MINGW)/x86_64-w64-mingw32/include",
  568. "-Wno-nan-infinity-disabled",
  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-*" }
  589. includedirs { path.join(bxDir, "include/compat/linux") }
  590. configuration { "linux-gcc" }
  591. buildoptions {
  592. "-mfpmath=sse",
  593. }
  594. configuration { "linux-gcc* or linux-clang*" }
  595. buildoptions {
  596. "-msse4.2",
  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-arm-gcc" }
  648. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  649. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  650. libdirs { path.join(_libDir, "lib/linux32_arm_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 { "android-*" }
  663. targetprefix ("lib")
  664. flags {
  665. "NoImportLib",
  666. }
  667. links {
  668. "c",
  669. "dl",
  670. "m",
  671. "android",
  672. "log",
  673. "c++_shared",
  674. }
  675. buildoptions {
  676. "--gcc-toolchain=" .. androidToolchainRoot(),
  677. "--sysroot=" .. androidToolchainRoot() .. "/sysroot",
  678. "-DANDROID",
  679. "-fPIC",
  680. "-no-canonical-prefixes",
  681. "-Wa,--noexecstack",
  682. "-fstack-protector-strong",
  683. "-ffunction-sections",
  684. "-Wunused-value",
  685. "-Wundef",
  686. }
  687. linkoptions {
  688. "--gcc-toolchain=" .. androidToolchainRoot(),
  689. "--sysroot=" .. androidToolchainRoot() .. "/sysroot",
  690. "-no-canonical-prefixes",
  691. "-Wl,--no-undefined",
  692. "-Wl,-z,noexecstack",
  693. "-Wl,-z,relro",
  694. "-Wl,-z,now",
  695. }
  696. configuration { "android-arm" }
  697. targetdir (path.join(_buildDir, "android-arm/bin"))
  698. objdir (path.join(_buildDir, "android-arm/obj"))
  699. buildoptions {
  700. "--target=armv7-none-linux-android" .. androidApiLevel,
  701. "-mthumb",
  702. "-march=armv7-a",
  703. "-mfloat-abi=softfp",
  704. "-mfpu=neon",
  705. }
  706. linkoptions {
  707. "--target=armv7-none-linux-android" .. androidApiLevel,
  708. "-march=armv7-a",
  709. }
  710. configuration { "android-arm64" }
  711. targetdir (path.join(_buildDir, "android-arm64/bin"))
  712. objdir (path.join(_buildDir, "android-arm64/obj"))
  713. buildoptions {
  714. "--target=aarch64-none-linux-android" .. androidApiLevel,
  715. }
  716. linkoptions {
  717. "--target=aarch64-none-linux-android" .. androidApiLevel,
  718. }
  719. configuration { "android-x86" }
  720. targetdir (path.join(_buildDir, "android-x86/bin"))
  721. objdir (path.join(_buildDir, "android-x86/obj"))
  722. buildoptions {
  723. "--target=i686-none-linux-android" .. androidApiLevel,
  724. "-mtune=atom",
  725. "-mstackrealign",
  726. "-msse4.2",
  727. "-mfpmath=sse",
  728. }
  729. linkoptions {
  730. "--target=i686-none-linux-android" .. androidApiLevel,
  731. }
  732. configuration { "android-x86_64" }
  733. targetdir (path.join(_buildDir, "android-x86_64/bin"))
  734. objdir (path.join(_buildDir, "android-x86_64/obj"))
  735. buildoptions {
  736. "--target=x86_64-none-linux-android" .. androidApiLevel,
  737. }
  738. linkoptions {
  739. "--target=x86_64-none-linux-android" .. androidApiLevel,
  740. }
  741. configuration { "wasm*" }
  742. buildoptions {
  743. "-Wunused-value",
  744. "-Wundef",
  745. }
  746. linkoptions {
  747. "-s MAX_WEBGL_VERSION=2",
  748. }
  749. configuration { "linux-ppc64le*" }
  750. buildoptions {
  751. "-fsigned-char",
  752. "-Wunused-value",
  753. "-Wundef",
  754. "-mcpu=power8",
  755. }
  756. links {
  757. "rt",
  758. "dl",
  759. }
  760. linkoptions {
  761. "-Wl,--gc-sections",
  762. }
  763. configuration { "linux-riscv64*" }
  764. buildoptions {
  765. "-Wunused-value",
  766. "-Wundef",
  767. "-march=rv64g"
  768. }
  769. links {
  770. "rt",
  771. "dl",
  772. }
  773. linkoptions {
  774. "-Wl,--gc-sections",
  775. }
  776. configuration { "linux-ppc64le-gcc" }
  777. targetdir (path.join(_buildDir, "linux_ppc64le_gcc/bin"))
  778. objdir (path.join(_buildDir, "linux_ppc64le_gcc/obj"))
  779. libdirs { path.join(_libDir, "lib/linux_ppc64le_gcc") }
  780. configuration { "linux-ppc64le-clang" }
  781. targetdir (path.join(_buildDir, "linux_ppc64le_clang/bin"))
  782. objdir (path.join(_buildDir, "linux_ppc64le_clang/obj"))
  783. libdirs { path.join(_libDir, "lib/linux_ppc64le_clang") }
  784. configuration { "linux-riscv64-gcc" }
  785. targetdir (path.join(_buildDir, "linux_riscv64_gcc/bin"))
  786. objdir (path.join(_buildDir, "linux_riscv64_gcc/obj"))
  787. libdirs { path.join(_libDir, "lib/linux_riscv64_gcc") }
  788. configuration { "wasm2js" }
  789. targetdir (path.join(_buildDir, "wasm2js/bin"))
  790. objdir (path.join(_buildDir, "wasm2js/obj"))
  791. libdirs { path.join(_libDir, "lib/wasm2js") }
  792. linkoptions {
  793. "-s WASM=0",
  794. }
  795. configuration { "wasm" }
  796. targetdir (path.join(_buildDir, "wasm/bin"))
  797. objdir (path.join(_buildDir, "wasm/obj"))
  798. libdirs { path.join(_libDir, "lib/wasm") }
  799. configuration { "durango" }
  800. targetdir (path.join(_buildDir, "durango/bin"))
  801. objdir (path.join(_buildDir, "durango/obj"))
  802. includedirs { path.join(bxDir, "include/compat/msvc") }
  803. libdirs { path.join(_libDir, "lib/durango") }
  804. removeflags { "StaticRuntime" }
  805. defines {
  806. "NOMINMAX",
  807. }
  808. configuration { "osx-x64" }
  809. targetdir (path.join(_buildDir, "osx-x64/bin"))
  810. objdir (path.join(_buildDir, "osx-x64/obj"))
  811. linkoptions {
  812. "-arch x86_64",
  813. }
  814. buildoptions {
  815. "-arch x86_64",
  816. "-msse4.2",
  817. "-target x86_64-apple-macos" .. (#macosPlatform > 0 and macosPlatform or "13.0"),
  818. }
  819. configuration { "osx-arm64" }
  820. targetdir (path.join(_buildDir, "osx-arm64/bin"))
  821. objdir (path.join(_buildDir, "osx-arm64/obj"))
  822. linkoptions {
  823. "-arch arm64",
  824. }
  825. buildoptions {
  826. "-arch arm64",
  827. "-Wno-error=unused-command-line-argument",
  828. "-Wno-unused-command-line-argument",
  829. }
  830. configuration { "osx*" }
  831. buildoptions {
  832. "-Wfatal-errors",
  833. "-Wunused-value",
  834. "-Wundef",
  835. -- "-Wno-overriding-t-option",
  836. -- "-mmacosx-version-min=13.0",
  837. }
  838. includedirs { path.join(bxDir, "include/compat/osx") }
  839. configuration { "xcode*", "ios*" }
  840. targetdir (path.join(_buildDir, "ios-arm/bin"))
  841. objdir (path.join(_buildDir, "ios-arm/obj"))
  842. configuration { "ios-arm64" }
  843. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  844. objdir (path.join(_buildDir, "ios-arm64/obj"))
  845. libdirs { path.join(_libDir, "lib/ios-arm64") }
  846. includedirs { path.join(bxDir, "include/compat/ios") }
  847. buildoptions {
  848. "-arch arm64",
  849. "-mios-version-min=16.0",
  850. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  851. "-fembed-bitcode",
  852. "-Wfatal-errors",
  853. "-Wunused-value",
  854. "-Wundef",
  855. }
  856. linkoptions {
  857. "-arch arm64",
  858. "-mios-version-min=16.0",
  859. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  860. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  861. }
  862. configuration { "xros*" }
  863. linkoptions {
  864. "-lc++",
  865. }
  866. buildoptions {
  867. "-Wfatal-errors",
  868. "-Wunused-value",
  869. "-Wundef",
  870. }
  871. includedirs { path.join(bxDir, "include/compat/ios") }
  872. configuration { "xros-arm64" }
  873. targetdir (path.join(_buildDir, "xros-arm64/bin"))
  874. objdir (path.join(_buildDir, "xros-arm64/obj"))
  875. libdirs { path.join(_libDir, "lib/xros-arm64") }
  876. linkoptions {
  877. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform.. ".sdk",
  878. "-L/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/usr/lib/system",
  879. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
  880. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  881. }
  882. buildoptions {
  883. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..tvosPlatform .. ".sdk",
  884. }
  885. configuration { "xros-simulator" }
  886. targetdir (path.join(_buildDir, "xros-simulator/bin"))
  887. objdir (path.join(_buildDir, "xros-simulator/obj"))
  888. libdirs { path.join(_libDir, "lib/xros-simulator") }
  889. linkoptions {
  890. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform.. ".sdk",
  891. "-L/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/usr/lib/system",
  892. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
  893. }
  894. buildoptions {
  895. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk",
  896. }
  897. configuration { "ios-simulator" }
  898. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  899. objdir (path.join(_buildDir, "ios-simulator/obj"))
  900. libdirs { path.join(_libDir, "lib/ios-simulator") }
  901. linkoptions {
  902. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  903. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  904. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  905. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  906. }
  907. buildoptions {
  908. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  909. }
  910. configuration { "tvos*" }
  911. linkoptions {
  912. "-lc++",
  913. }
  914. buildoptions {
  915. "-Wfatal-errors",
  916. "-Wunused-value",
  917. "-Wundef",
  918. }
  919. includedirs { path.join(bxDir, "include/compat/ios") }
  920. configuration { "xcode*", "tvos*" }
  921. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  922. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  923. configuration { "tvos-arm64" }
  924. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  925. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  926. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  927. linkoptions {
  928. "-mtvos-version-min=9.0",
  929. "-arch arm64",
  930. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  931. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  932. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  933. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  934. }
  935. buildoptions {
  936. "-mtvos-version-min=9.0",
  937. "-arch arm64",
  938. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  939. }
  940. configuration { "tvos-simulator" }
  941. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  942. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  943. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  944. linkoptions {
  945. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  946. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  947. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  948. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  949. }
  950. buildoptions {
  951. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  952. }
  953. configuration { "orbis" }
  954. targetdir (path.join(_buildDir, "orbis/bin"))
  955. objdir (path.join(_buildDir, "orbis/obj"))
  956. libdirs { path.join(_libDir, "lib/orbis") }
  957. includedirs {
  958. path.join(bxDir, "include/compat/freebsd"),
  959. "$(SCE_ORBIS_SDK_DIR)/target/include",
  960. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  961. }
  962. configuration { "rpi" }
  963. targetdir (path.join(_buildDir, "rpi/bin"))
  964. objdir (path.join(_buildDir, "rpi/obj"))
  965. libdirs {
  966. path.join(_libDir, "lib/rpi"),
  967. "/opt/vc/lib",
  968. }
  969. defines {
  970. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  971. "__STDC_VERSION__=199901L",
  972. }
  973. buildoptions {
  974. "-Wunused-value",
  975. "-Wundef",
  976. }
  977. includedirs {
  978. "/opt/vc/include",
  979. "/opt/vc/include/interface/vcos/pthreads",
  980. "/opt/vc/include/interface/vmcs_host/linux",
  981. }
  982. links {
  983. "rt",
  984. "dl",
  985. }
  986. linkoptions {
  987. "-Wl,--gc-sections",
  988. }
  989. configuration { "riscv" }
  990. targetdir (path.join(_buildDir, "riscv/bin"))
  991. objdir (path.join(_buildDir, "riscv/obj"))
  992. defines {
  993. "__BSD_VISIBLE",
  994. "__MISC_VISIBLE",
  995. }
  996. includedirs {
  997. "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include",
  998. path.join(bxDir, "include/compat/riscv"),
  999. }
  1000. buildoptions {
  1001. "-Wunused-value",
  1002. "-Wundef",
  1003. "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf",
  1004. }
  1005. configuration {} -- reset configuration
  1006. return true
  1007. end
  1008. function strip()
  1009. configuration { "android-*", "Release" }
  1010. postbuildcommands {
  1011. "$(SILENT) echo Stripping symbols.",
  1012. "$(SILENT) " .. androidToolchainRoot() .. "/bin/llvm-strip -s \"$(TARGET)\""
  1013. }
  1014. configuration { "linux-* or rpi", "Release" }
  1015. postbuildcommands {
  1016. "$(SILENT) echo Stripping symbols.",
  1017. "$(SILENT) strip -s \"$(TARGET)\""
  1018. }
  1019. configuration { "mingw*", "Release" }
  1020. postbuildcommands {
  1021. "$(SILENT) echo Stripping symbols.",
  1022. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1023. }
  1024. configuration { "riscv" }
  1025. postbuildcommands {
  1026. "$(SILENT) echo Stripping symbols.",
  1027. "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\""
  1028. }
  1029. configuration {} -- reset configuration
  1030. end