toolchain.lua 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  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 = "xcode_target",
  97. description = "Choose XCode target",
  98. allowed = {
  99. { "osx", "OSX" },
  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 = ""
  160. if _OPTIONS["with-ios"] then
  161. iosPlatform = _OPTIONS["with-ios"]
  162. end
  163. local macosPlatform = ""
  164. if _OPTIONS["with-macos"] then
  165. macosPlatform = _OPTIONS["with-macos"]
  166. end
  167. local tvosPlatform = ""
  168. if _OPTIONS["with-tvos"] then
  169. tvosPlatform = _OPTIONS["with-tvos"]
  170. end
  171. local xrosPlatform = ""
  172. if _OPTIONS["with-xros"] then
  173. xrosPlatform = _OPTIONS["with-xros"]
  174. end
  175. local windowsPlatform = nil
  176. if _OPTIONS["with-windows"] then
  177. windowsPlatform = _OPTIONS["with-windows"]
  178. elseif nil ~= os.getenv("WindowsSDKVersion") then
  179. windowsPlatform = string.gsub(os.getenv("WindowsSDKVersion"), "\\", "")
  180. end
  181. local compiler32bit = false
  182. if _OPTIONS["with-32bit-compiler"] then
  183. compiler32bit = true
  184. end
  185. flags {
  186. "Cpp20",
  187. "ExtraWarnings",
  188. "FloatFast",
  189. }
  190. if _ACTION == "gmake" or _ACTION == "ninja" then
  191. if nil == _OPTIONS["gcc"] then
  192. print("GCC flavor must be specified!")
  193. os.exit(1)
  194. end
  195. if "android-arm" == _OPTIONS["gcc"]
  196. or "android-arm64" == _OPTIONS["gcc"]
  197. or "android-x86" == _OPTIONS["gcc"]
  198. or "android-x86_64" == _OPTIONS["gcc"] then
  199. premake.gcc.cc = androidToolchainRoot() .. "/bin/clang"
  200. premake.gcc.cxx = androidToolchainRoot() .. "/bin/clang++"
  201. premake.gcc.ar = androidToolchainRoot() .. "/bin/llvm-ar"
  202. premake.gcc.llvm = true
  203. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  204. elseif "wasm2js" == _OPTIONS["gcc"] or "wasm" == _OPTIONS["gcc"] then
  205. if not os.getenv("EMSCRIPTEN") then
  206. print("Set EMSCRIPTEN environment variable to root directory of your Emscripten installation. (e.g. by entering the EMSDK command prompt)")
  207. end
  208. premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\""
  209. premake.gcc.cxx = "\"$(EMSCRIPTEN)/em++\""
  210. premake.gcc.ar = "\"$(EMSCRIPTEN)/emar\""
  211. premake.gcc.llvm = true
  212. premake.gcc.namestyle = "Emscripten"
  213. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  214. elseif "ios-arm64" == _OPTIONS["gcc"] then
  215. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  216. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  217. premake.gcc.ar = "ar"
  218. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  219. elseif "xros-arm64" == _OPTIONS["gcc"]
  220. or "xros-simulator" == _OPTIONS["gcc"] then
  221. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  222. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  223. premake.gcc.ar = "ar"
  224. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  225. elseif "ios-simulator" == _OPTIONS["gcc"] then
  226. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  227. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  228. premake.gcc.ar = "ar"
  229. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  230. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  231. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  232. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  233. premake.gcc.ar = "ar"
  234. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  235. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  236. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  237. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  238. premake.gcc.ar = "ar"
  239. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  240. elseif "linux-gcc" == _OPTIONS["gcc"] then
  241. location (path.join(_buildDir, "projects", _ACTION .. "-linux-gcc"))
  242. elseif "linux-gcc-afl" == _OPTIONS["gcc"] then
  243. premake.gcc.cc = "afl-gcc"
  244. premake.gcc.cxx = "afl-g++"
  245. premake.gcc.ar = "ar"
  246. location (path.join(_buildDir, "projects", _ACTION .. "-linux-gcc"))
  247. elseif "linux-clang" == _OPTIONS["gcc"] then
  248. premake.gcc.cc = "clang"
  249. premake.gcc.cxx = "clang++"
  250. premake.gcc.ar = "ar"
  251. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  252. elseif "linux-clang-afl" == _OPTIONS["gcc"] then
  253. premake.gcc.cc = "afl-clang"
  254. premake.gcc.cxx = "afl-clang++"
  255. premake.gcc.ar = "ar"
  256. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  257. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  258. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  259. elseif "linux-ppc64le-gcc" == _OPTIONS["gcc"] then
  260. location (path.join(_buildDir, "projects", _ACTION .. "-linux-ppc64le-gcc"))
  261. elseif "linux-ppc64le-clang" == _OPTIONS["gcc"] then
  262. premake.gcc.cc = "clang"
  263. premake.gcc.cxx = "clang++"
  264. premake.gcc.ar = "ar"
  265. premake.gcc.llvm = true
  266. location (path.join(_buildDir, "projects", _ACTION .. "-linux-ppc64le-clang"))
  267. elseif "linux-riscv64-gcc" == _OPTIONS["gcc"] then
  268. location (path.join(_buildDir, "projects", _ACTION .. "-linux-riscv64-gcc"))
  269. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  270. if not os.getenv("MINGW") then
  271. print("Set MINGW environment variable.")
  272. end
  273. local mingwToolchain = "x86_64-w64-mingw32"
  274. if compiler32bit then
  275. if os.is("linux") then
  276. mingwToolchain = "i686-w64-mingw32"
  277. else
  278. mingwToolchain = "mingw32"
  279. end
  280. end
  281. premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
  282. premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
  283. premake.gcc.ar = "$(MINGW)/bin/ar"
  284. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  285. elseif "mingw-clang" == _OPTIONS["gcc"] then
  286. if not os.getenv("MINGW") then
  287. print("Set MINGW environment variable.")
  288. end
  289. if not os.getenv("CLANG") then
  290. print("Set CLANG environment variable.")
  291. end
  292. premake.gcc.cc = "$(CLANG)/bin/clang"
  293. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  294. premake.gcc.ar = "$(MINGW)/bin/ar"
  295. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  296. -- premake.gcc.llvm = true
  297. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  298. elseif "osx-x64" == _OPTIONS["gcc"]
  299. or "osx-arm64" == _OPTIONS["gcc"] then
  300. if os.is("linux") then
  301. if not os.getenv("OSXCROSS") then
  302. print("Set OSXCROSS environment variable.")
  303. end
  304. local osxToolchain = "x86_64-apple-darwin15-"
  305. premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
  306. premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
  307. premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
  308. end
  309. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  310. elseif "orbis" == _OPTIONS["gcc"] then
  311. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  312. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  313. end
  314. orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-"
  315. premake.gcc.cc = orbisToolchain .. "clang"
  316. premake.gcc.cxx = orbisToolchain .. "clang++"
  317. premake.gcc.ar = orbisToolchain .. "ar"
  318. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  319. elseif "rpi" == _OPTIONS["gcc"] then
  320. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  321. elseif "riscv" == _OPTIONS["gcc"] then
  322. premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc"
  323. premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++"
  324. premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar"
  325. location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
  326. end
  327. elseif _ACTION == "vs2017"
  328. or _ACTION == "vs2019"
  329. or _ACTION == "vs2022"
  330. then
  331. local action = premake.action.current()
  332. if nil ~= windowsPlatform then
  333. action.vstudio.windowsTargetPlatformVersion = windowsPlatform
  334. action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
  335. end
  336. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  337. if "vs2017-clang" == _OPTIONS["vs"] then
  338. premake.vstudio.toolset = "v141_clang_c2"
  339. else
  340. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  341. end
  342. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  343. elseif "winstore100" == _OPTIONS["vs"] then
  344. premake.vstudio.toolset = "v141"
  345. premake.vstudio.storeapp = "10.0"
  346. platforms { "ARM" }
  347. location (path.join(_buildDir, "projects", _ACTION .. "-winstore100"))
  348. elseif "durango" == _OPTIONS["vs"] then
  349. if not os.getenv("DurangoXDK") then
  350. print("DurangoXDK not found.")
  351. end
  352. premake.vstudio.toolset = "v140"
  353. premake.vstudio.storeapp = "durango"
  354. platforms { "Durango" }
  355. location (path.join(_buildDir, "projects", _ACTION .. "-durango"))
  356. elseif "orbis" == _OPTIONS["vs"] then
  357. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  358. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  359. end
  360. platforms { "Orbis" }
  361. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  362. end
  363. elseif _ACTION and _ACTION:match("^xcode.+$") then
  364. local action = premake.action.current()
  365. local str_or = function(str, def)
  366. return #str > 0 and str or def
  367. end
  368. if "osx" == _OPTIONS["xcode"] then
  369. action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "13.0")
  370. premake.xcode.toolset = "macosx"
  371. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  372. elseif "ios" == _OPTIONS["xcode"] then
  373. action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "16.0")
  374. premake.xcode.toolset = "iphoneos"
  375. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  376. elseif "tvos" == _OPTIONS["xcode"] then
  377. action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "13.0")
  378. premake.xcode.toolset = "appletvos"
  379. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  380. elseif "xros" == _OPTIONS["xcode"] then
  381. action.xcode.visionOSTargetPlatformVersion = str_or(xrosPlatform, "1.0")
  382. premake.xcode.toolset = "xros"
  383. location (path.join(_buildDir, "projects", _ACTION .. "-xros"))
  384. end
  385. end
  386. if not _OPTIONS["with-dynamic-runtime"] then
  387. flags { "StaticRuntime" }
  388. end
  389. if _OPTIONS["with-avx"] then
  390. flags { "EnableAVX" }
  391. end
  392. if _OPTIONS["with-crtnone"] then
  393. crtNone()
  394. end
  395. flags {
  396. "NoPCH",
  397. "NativeWChar",
  398. "NoRTTI",
  399. "NoExceptions",
  400. "NoEditAndContinue",
  401. "NoFramePointer",
  402. "Symbols",
  403. }
  404. defines {
  405. "__STDC_LIMIT_MACROS",
  406. "__STDC_FORMAT_MACROS",
  407. "__STDC_CONSTANT_MACROS",
  408. }
  409. configuration { "Debug" }
  410. targetsuffix "Debug"
  411. defines {
  412. "_DEBUG",
  413. }
  414. configuration { "Release" }
  415. targetsuffix "Release"
  416. flags {
  417. "NoBufferSecurityCheck",
  418. "OptimizeSpeed",
  419. }
  420. defines {
  421. "NDEBUG",
  422. }
  423. configuration { "*-clang" }
  424. buildoptions {
  425. "-Wno-nan-infinity-disabled",
  426. "-Wno-tautological-constant-compare",
  427. }
  428. configuration { "vs*", "not NX32", "not NX64" }
  429. flags {
  430. "EnableAVX",
  431. }
  432. configuration { "vs*", "not orbis", "not NX32", "not NX64" }
  433. includedirs { path.join(bxDir, "include/compat/msvc") }
  434. defines {
  435. "WIN32",
  436. "_WIN32",
  437. "_HAS_EXCEPTIONS=0",
  438. "_SCL_SECURE=0",
  439. "_SECURE_SCL=0",
  440. "_SCL_SECURE_NO_WARNINGS",
  441. "_CRT_SECURE_NO_WARNINGS",
  442. "_CRT_SECURE_NO_DEPRECATE",
  443. }
  444. buildoptions {
  445. "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union
  446. "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier
  447. "/Ob2", -- The Inline Function Expansion
  448. "/Zc:__cplusplus", -- Enable updated __cplusplus macro.
  449. "/Zc:preprocessor", -- Enable preprocessor conformance mode.
  450. }
  451. linkoptions {
  452. "/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
  453. }
  454. configuration { "x32", "vs*" }
  455. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  456. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  457. libdirs {
  458. path.join(_libDir, "lib/win32_" .. _ACTION),
  459. }
  460. configuration { "x64", "vs*" }
  461. defines { "_WIN64" }
  462. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  463. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  464. libdirs {
  465. path.join(_libDir, "lib/win64_" .. _ACTION),
  466. }
  467. configuration { "x32", "vs2017" }
  468. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  469. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  470. libdirs {
  471. path.join(_libDir, "lib/win32_" .. _ACTION),
  472. }
  473. configuration { "x64", "vs2017" }
  474. defines { "_WIN64" }
  475. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  476. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  477. libdirs {
  478. path.join(_libDir, "lib/win64_" .. _ACTION),
  479. }
  480. configuration { "ARM", "vs*" }
  481. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  482. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  483. configuration { "vs*-clang" }
  484. buildoptions {
  485. "-Qunused-arguments",
  486. }
  487. configuration { "x32", "vs*-clang" }
  488. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  489. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  490. configuration { "x64", "vs*-clang" }
  491. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  492. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  493. configuration { "winstore*" }
  494. removeflags {
  495. "StaticRuntime",
  496. "NoBufferSecurityCheck",
  497. }
  498. buildoptions {
  499. "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
  500. }
  501. linkoptions {
  502. "/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
  503. }
  504. configuration { "*-gcc* or osx" }
  505. buildoptions {
  506. "-Wshadow",
  507. }
  508. configuration { "mingw-*" }
  509. defines { "WIN32" }
  510. includedirs { path.join(bxDir, "include/compat/mingw") }
  511. defines {
  512. "MINGW_HAS_SECURE_API=1",
  513. }
  514. buildoptions {
  515. "-Wa,-mbig-obj",
  516. "-Wundef",
  517. "-Wunused-value",
  518. "-fdata-sections",
  519. "-ffunction-sections",
  520. "-msse4.2",
  521. }
  522. linkoptions {
  523. "-Wl,--gc-sections",
  524. "-static",
  525. "-static-libgcc",
  526. "-static-libstdc++",
  527. }
  528. configuration { "x32", "mingw-gcc" }
  529. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  530. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  531. libdirs {
  532. path.join(_libDir, "lib/win32_mingw-gcc"),
  533. }
  534. buildoptions {
  535. "-m32",
  536. "-mstackrealign",
  537. }
  538. configuration { "x64", "mingw-gcc" }
  539. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  540. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  541. libdirs {
  542. path.join(_libDir, "lib/win64_mingw-gcc"),
  543. }
  544. buildoptions { "-m64" }
  545. configuration { "mingw-clang" }
  546. buildoptions {
  547. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  548. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  549. "-isystem $(MINGW)/x86_64-w64-mingw32/include",
  550. "-Wno-nan-infinity-disabled",
  551. }
  552. linkoptions {
  553. "-Qunused-arguments",
  554. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  555. }
  556. configuration { "x32", "mingw-clang" }
  557. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  558. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  559. libdirs {
  560. path.join(_libDir, "lib/win32_mingw-clang"),
  561. }
  562. buildoptions { "-m32" }
  563. configuration { "x64", "mingw-clang" }
  564. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  565. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  566. libdirs {
  567. path.join(_libDir, "lib/win64_mingw-clang"),
  568. }
  569. buildoptions { "-m64" }
  570. configuration { "linux-*" }
  571. includedirs { path.join(bxDir, "include/compat/linux") }
  572. configuration { "linux-gcc" }
  573. buildoptions {
  574. "-mfpmath=sse",
  575. }
  576. configuration { "linux-gcc* or linux-clang*" }
  577. buildoptions {
  578. "-msse4.2",
  579. -- "-Wdouble-promotion",
  580. -- "-Wduplicated-branches",
  581. -- "-Wduplicated-cond",
  582. -- "-Wjump-misses-init",
  583. "-Wshadow",
  584. -- "-Wnull-dereference",
  585. "-Wunused-value",
  586. "-Wundef",
  587. -- "-Wuseless-cast",
  588. }
  589. links {
  590. "rt",
  591. "dl",
  592. }
  593. linkoptions {
  594. "-Wl,--gc-sections",
  595. "-Wl,--as-needed",
  596. }
  597. configuration { "linux-gcc*" }
  598. buildoptions {
  599. "-Wlogical-op",
  600. }
  601. configuration { "linux-gcc*", "x32" }
  602. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  603. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  604. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  605. buildoptions {
  606. "-m32",
  607. }
  608. configuration { "linux-gcc*", "x64" }
  609. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  610. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  611. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  612. buildoptions {
  613. "-m64",
  614. }
  615. configuration { "linux-clang*", "x32" }
  616. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  617. objdir (path.join(_buildDir, "linux32_clang/obj"))
  618. libdirs { path.join(_libDir, "lib/linux32_clang") }
  619. buildoptions {
  620. "-m32",
  621. }
  622. configuration { "linux-clang*", "x64" }
  623. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  624. objdir (path.join(_buildDir, "linux64_clang/obj"))
  625. libdirs { path.join(_libDir, "lib/linux64_clang") }
  626. buildoptions {
  627. "-m64",
  628. }
  629. configuration { "linux-arm-gcc" }
  630. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  631. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  632. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  633. buildoptions {
  634. "-Wunused-value",
  635. "-Wundef",
  636. }
  637. links {
  638. "rt",
  639. "dl",
  640. }
  641. linkoptions {
  642. "-Wl,--gc-sections",
  643. }
  644. configuration { "android-*" }
  645. targetprefix ("lib")
  646. flags {
  647. "NoImportLib",
  648. }
  649. links {
  650. "c",
  651. "dl",
  652. "m",
  653. "android",
  654. "log",
  655. "c++_shared",
  656. }
  657. buildoptions {
  658. "--gcc-toolchain=" .. androidToolchainRoot(),
  659. "--sysroot=" .. androidToolchainRoot() .. "/sysroot",
  660. "-DANDROID",
  661. "-fPIC",
  662. "-no-canonical-prefixes",
  663. "-Wa,--noexecstack",
  664. "-fstack-protector-strong",
  665. "-ffunction-sections",
  666. "-Wunused-value",
  667. "-Wundef",
  668. }
  669. linkoptions {
  670. "--gcc-toolchain=" .. androidToolchainRoot(),
  671. "--sysroot=" .. androidToolchainRoot() .. "/sysroot",
  672. "-no-canonical-prefixes",
  673. "-Wl,--no-undefined",
  674. "-Wl,-z,noexecstack",
  675. "-Wl,-z,relro",
  676. "-Wl,-z,now",
  677. }
  678. configuration { "android-arm" }
  679. targetdir (path.join(_buildDir, "android-arm/bin"))
  680. objdir (path.join(_buildDir, "android-arm/obj"))
  681. buildoptions {
  682. "--target=armv7-none-linux-android" .. androidApiLevel,
  683. "-mthumb",
  684. "-march=armv7-a",
  685. "-mfloat-abi=softfp",
  686. "-mfpu=neon",
  687. }
  688. linkoptions {
  689. "--target=armv7-none-linux-android" .. androidApiLevel,
  690. "-march=armv7-a",
  691. }
  692. configuration { "android-arm64" }
  693. targetdir (path.join(_buildDir, "android-arm64/bin"))
  694. objdir (path.join(_buildDir, "android-arm64/obj"))
  695. buildoptions {
  696. "--target=aarch64-none-linux-android" .. androidApiLevel,
  697. }
  698. linkoptions {
  699. "--target=aarch64-none-linux-android" .. androidApiLevel,
  700. }
  701. configuration { "android-x86" }
  702. targetdir (path.join(_buildDir, "android-x86/bin"))
  703. objdir (path.join(_buildDir, "android-x86/obj"))
  704. buildoptions {
  705. "--target=i686-none-linux-android" .. androidApiLevel,
  706. "-mtune=atom",
  707. "-mstackrealign",
  708. "-msse4.2",
  709. "-mfpmath=sse",
  710. }
  711. linkoptions {
  712. "--target=i686-none-linux-android" .. androidApiLevel,
  713. }
  714. configuration { "android-x86_64" }
  715. targetdir (path.join(_buildDir, "android-x86_64/bin"))
  716. objdir (path.join(_buildDir, "android-x86_64/obj"))
  717. buildoptions {
  718. "--target=x86_64-none-linux-android" .. androidApiLevel,
  719. }
  720. linkoptions {
  721. "--target=x86_64-none-linux-android" .. androidApiLevel,
  722. }
  723. configuration { "wasm*" }
  724. buildoptions {
  725. "-Wunused-value",
  726. "-Wundef",
  727. }
  728. linkoptions {
  729. "-s MAX_WEBGL_VERSION=2",
  730. }
  731. configuration { "linux-ppc64le*" }
  732. buildoptions {
  733. "-fsigned-char",
  734. "-Wunused-value",
  735. "-Wundef",
  736. "-mcpu=power8",
  737. }
  738. links {
  739. "rt",
  740. "dl",
  741. }
  742. linkoptions {
  743. "-Wl,--gc-sections",
  744. }
  745. configuration { "linux-riscv64*" }
  746. buildoptions {
  747. "-Wunused-value",
  748. "-Wundef",
  749. "-march=rv64g"
  750. }
  751. links {
  752. "rt",
  753. "dl",
  754. }
  755. linkoptions {
  756. "-Wl,--gc-sections",
  757. }
  758. configuration { "linux-ppc64le-gcc" }
  759. targetdir (path.join(_buildDir, "linux_ppc64le_gcc/bin"))
  760. objdir (path.join(_buildDir, "linux_ppc64le_gcc/obj"))
  761. libdirs { path.join(_libDir, "lib/linux_ppc64le_gcc") }
  762. configuration { "linux-ppc64le-clang" }
  763. targetdir (path.join(_buildDir, "linux_ppc64le_clang/bin"))
  764. objdir (path.join(_buildDir, "linux_ppc64le_clang/obj"))
  765. libdirs { path.join(_libDir, "lib/linux_ppc64le_clang") }
  766. configuration { "linux-riscv64-gcc" }
  767. targetdir (path.join(_buildDir, "linux_riscv64_gcc/bin"))
  768. objdir (path.join(_buildDir, "linux_riscv64_gcc/obj"))
  769. libdirs { path.join(_libDir, "lib/linux_riscv64_gcc") }
  770. configuration { "wasm2js" }
  771. targetdir (path.join(_buildDir, "wasm2js/bin"))
  772. objdir (path.join(_buildDir, "wasm2js/obj"))
  773. libdirs { path.join(_libDir, "lib/wasm2js") }
  774. linkoptions {
  775. "-s WASM=0",
  776. }
  777. configuration { "wasm" }
  778. targetdir (path.join(_buildDir, "wasm/bin"))
  779. objdir (path.join(_buildDir, "wasm/obj"))
  780. libdirs { path.join(_libDir, "lib/wasm") }
  781. configuration { "durango" }
  782. targetdir (path.join(_buildDir, "durango/bin"))
  783. objdir (path.join(_buildDir, "durango/obj"))
  784. includedirs { path.join(bxDir, "include/compat/msvc") }
  785. libdirs { path.join(_libDir, "lib/durango") }
  786. removeflags { "StaticRuntime" }
  787. defines {
  788. "NOMINMAX",
  789. }
  790. configuration { "osx-x64" }
  791. targetdir (path.join(_buildDir, "osx-x64/bin"))
  792. objdir (path.join(_buildDir, "osx-x64/obj"))
  793. linkoptions {
  794. "-arch x86_64",
  795. }
  796. buildoptions {
  797. "-arch x86_64",
  798. "-msse4.2",
  799. "-target x86_64-apple-macos" .. (#macosPlatform > 0 and macosPlatform or "13.0"),
  800. }
  801. configuration { "osx-arm64" }
  802. targetdir (path.join(_buildDir, "osx-arm64/bin"))
  803. objdir (path.join(_buildDir, "osx-arm64/obj"))
  804. linkoptions {
  805. "-arch arm64",
  806. }
  807. buildoptions {
  808. "-arch arm64",
  809. "-Wno-error=unused-command-line-argument",
  810. "-Wno-unused-command-line-argument",
  811. }
  812. configuration { "osx*" }
  813. buildoptions {
  814. "-Wfatal-errors",
  815. "-Wunused-value",
  816. "-Wundef",
  817. -- "-Wno-overriding-t-option",
  818. -- "-mmacosx-version-min=13.0",
  819. }
  820. includedirs { path.join(bxDir, "include/compat/osx") }
  821. configuration { "xcode*", "ios*" }
  822. targetdir (path.join(_buildDir, "ios-arm/bin"))
  823. objdir (path.join(_buildDir, "ios-arm/obj"))
  824. configuration { "ios-arm64" }
  825. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  826. objdir (path.join(_buildDir, "ios-arm64/obj"))
  827. libdirs { path.join(_libDir, "lib/ios-arm64") }
  828. includedirs { path.join(bxDir, "include/compat/ios") }
  829. buildoptions {
  830. "-arch arm64",
  831. "-mios-version-min=16.0",
  832. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  833. "-fembed-bitcode",
  834. "-Wfatal-errors",
  835. "-Wunused-value",
  836. "-Wundef",
  837. }
  838. linkoptions {
  839. "-arch arm64",
  840. "-mios-version-min=16.0",
  841. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  842. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  843. }
  844. configuration { "xros*" }
  845. linkoptions {
  846. "-lc++",
  847. }
  848. buildoptions {
  849. "-Wfatal-errors",
  850. "-Wunused-value",
  851. "-Wundef",
  852. }
  853. includedirs { path.join(bxDir, "include/compat/ios") }
  854. configuration { "xros-arm64" }
  855. targetdir (path.join(_buildDir, "xros-arm64/bin"))
  856. objdir (path.join(_buildDir, "xros-arm64/obj"))
  857. libdirs { path.join(_libDir, "lib/xros-arm64") }
  858. linkoptions {
  859. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform.. ".sdk",
  860. "-L/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/usr/lib/system",
  861. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
  862. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  863. }
  864. buildoptions {
  865. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..tvosPlatform .. ".sdk",
  866. }
  867. configuration { "xros-simulator" }
  868. targetdir (path.join(_buildDir, "xros-simulator/bin"))
  869. objdir (path.join(_buildDir, "xros-simulator/obj"))
  870. libdirs { path.join(_libDir, "lib/xros-simulator") }
  871. linkoptions {
  872. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform.. ".sdk",
  873. "-L/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/usr/lib/system",
  874. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
  875. }
  876. buildoptions {
  877. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk",
  878. }
  879. configuration { "ios-simulator" }
  880. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  881. objdir (path.join(_buildDir, "ios-simulator/obj"))
  882. libdirs { path.join(_libDir, "lib/ios-simulator") }
  883. linkoptions {
  884. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  885. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  886. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  887. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  888. }
  889. buildoptions {
  890. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  891. }
  892. configuration { "tvos*" }
  893. linkoptions {
  894. "-lc++",
  895. }
  896. buildoptions {
  897. "-Wfatal-errors",
  898. "-Wunused-value",
  899. "-Wundef",
  900. }
  901. includedirs { path.join(bxDir, "include/compat/ios") }
  902. configuration { "xcode*", "tvos*" }
  903. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  904. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  905. configuration { "tvos-arm64" }
  906. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  907. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  908. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  909. linkoptions {
  910. "-mtvos-version-min=9.0",
  911. "-arch arm64",
  912. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  913. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  914. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  915. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  916. }
  917. buildoptions {
  918. "-mtvos-version-min=9.0",
  919. "-arch arm64",
  920. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  921. }
  922. configuration { "tvos-simulator" }
  923. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  924. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  925. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  926. linkoptions {
  927. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  928. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  929. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  930. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  931. }
  932. buildoptions {
  933. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  934. }
  935. configuration { "orbis" }
  936. targetdir (path.join(_buildDir, "orbis/bin"))
  937. objdir (path.join(_buildDir, "orbis/obj"))
  938. libdirs { path.join(_libDir, "lib/orbis") }
  939. includedirs {
  940. path.join(bxDir, "include/compat/freebsd"),
  941. "$(SCE_ORBIS_SDK_DIR)/target/include",
  942. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  943. }
  944. configuration { "rpi" }
  945. targetdir (path.join(_buildDir, "rpi/bin"))
  946. objdir (path.join(_buildDir, "rpi/obj"))
  947. libdirs {
  948. path.join(_libDir, "lib/rpi"),
  949. "/opt/vc/lib",
  950. }
  951. defines {
  952. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  953. "__STDC_VERSION__=199901L",
  954. }
  955. buildoptions {
  956. "-Wunused-value",
  957. "-Wundef",
  958. }
  959. includedirs {
  960. "/opt/vc/include",
  961. "/opt/vc/include/interface/vcos/pthreads",
  962. "/opt/vc/include/interface/vmcs_host/linux",
  963. }
  964. links {
  965. "rt",
  966. "dl",
  967. }
  968. linkoptions {
  969. "-Wl,--gc-sections",
  970. }
  971. configuration { "riscv" }
  972. targetdir (path.join(_buildDir, "riscv/bin"))
  973. objdir (path.join(_buildDir, "riscv/obj"))
  974. defines {
  975. "__BSD_VISIBLE",
  976. "__MISC_VISIBLE",
  977. }
  978. includedirs {
  979. "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include",
  980. path.join(bxDir, "include/compat/riscv"),
  981. }
  982. buildoptions {
  983. "-Wunused-value",
  984. "-Wundef",
  985. "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf",
  986. }
  987. configuration {} -- reset configuration
  988. return true
  989. end
  990. function strip()
  991. configuration { "android-*", "Release" }
  992. postbuildcommands {
  993. "$(SILENT) echo Stripping symbols.",
  994. "$(SILENT) " .. androidToolchainRoot() .. "/bin/llvm-strip -s \"$(TARGET)\""
  995. }
  996. configuration { "linux-* or rpi", "Release" }
  997. postbuildcommands {
  998. "$(SILENT) echo Stripping symbols.",
  999. "$(SILENT) strip -s \"$(TARGET)\""
  1000. }
  1001. configuration { "mingw*", "Release" }
  1002. postbuildcommands {
  1003. "$(SILENT) echo Stripping symbols.",
  1004. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1005. }
  1006. configuration { "riscv" }
  1007. postbuildcommands {
  1008. "$(SILENT) echo Stripping symbols.",
  1009. "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\""
  1010. }
  1011. configuration {} -- reset configuration
  1012. end