toolchain.lua 36 KB

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