toolchain.lua 35 KB

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