toolchain.lua 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  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-nan-infinity-disabled",
  428. "-Wno-tautological-constant-compare",
  429. }
  430. configuration { "vs*", "not NX32", "not NX64" }
  431. flags {
  432. "EnableAVX",
  433. }
  434. configuration { "vs*", "not orbis", "not NX32", "not NX64" }
  435. includedirs { path.join(bxDir, "include/compat/msvc") }
  436. defines {
  437. "WIN32",
  438. "_WIN32",
  439. "_HAS_EXCEPTIONS=0",
  440. "_SCL_SECURE=0",
  441. "_SECURE_SCL=0",
  442. "_SCL_SECURE_NO_WARNINGS",
  443. "_CRT_SECURE_NO_WARNINGS",
  444. "_CRT_SECURE_NO_DEPRECATE",
  445. }
  446. buildoptions {
  447. "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union
  448. "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier
  449. "/Ob2", -- The Inline Function Expansion
  450. "/Zc:__cplusplus", -- Enable updated __cplusplus macro.
  451. "/Zc:preprocessor", -- Enable preprocessor conformance mode.
  452. }
  453. linkoptions {
  454. "/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
  455. }
  456. configuration { "x32", "vs*" }
  457. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  458. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  459. libdirs {
  460. path.join(_libDir, "lib/win32_" .. _ACTION),
  461. }
  462. configuration { "x64", "vs*" }
  463. defines { "_WIN64" }
  464. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  465. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  466. libdirs {
  467. path.join(_libDir, "lib/win64_" .. _ACTION),
  468. }
  469. configuration { "x32", "vs2017" }
  470. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  471. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  472. libdirs {
  473. path.join(_libDir, "lib/win32_" .. _ACTION),
  474. }
  475. configuration { "x64", "vs2017" }
  476. defines { "_WIN64" }
  477. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  478. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  479. libdirs {
  480. path.join(_libDir, "lib/win64_" .. _ACTION),
  481. }
  482. configuration { "ARM", "vs*" }
  483. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  484. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  485. configuration { "vs*-clang" }
  486. buildoptions {
  487. "-Qunused-arguments",
  488. }
  489. configuration { "x32", "vs*-clang" }
  490. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  491. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  492. configuration { "x64", "vs*-clang" }
  493. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  494. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  495. configuration { "winstore*" }
  496. removeflags {
  497. "StaticRuntime",
  498. "NoBufferSecurityCheck",
  499. }
  500. buildoptions {
  501. "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
  502. }
  503. linkoptions {
  504. "/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
  505. }
  506. configuration { "*-gcc* or osx" }
  507. buildoptions {
  508. "-Wshadow",
  509. }
  510. configuration { "mingw-*" }
  511. defines { "WIN32" }
  512. includedirs { path.join(bxDir, "include/compat/mingw") }
  513. defines {
  514. "MINGW_HAS_SECURE_API=1",
  515. }
  516. buildoptions {
  517. "-Wa,-mbig-obj",
  518. "-Wundef",
  519. "-Wunused-value",
  520. "-fdata-sections",
  521. "-ffunction-sections",
  522. "-msse4.2",
  523. }
  524. linkoptions {
  525. "-Wl,--gc-sections",
  526. "-static",
  527. "-static-libgcc",
  528. "-static-libstdc++",
  529. }
  530. configuration { "x32", "mingw-gcc" }
  531. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  532. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  533. libdirs {
  534. path.join(_libDir, "lib/win32_mingw-gcc"),
  535. }
  536. buildoptions {
  537. "-m32",
  538. "-mstackrealign",
  539. }
  540. configuration { "x64", "mingw-gcc" }
  541. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  542. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  543. libdirs {
  544. path.join(_libDir, "lib/win64_mingw-gcc"),
  545. }
  546. buildoptions { "-m64" }
  547. configuration { "mingw-clang" }
  548. buildoptions {
  549. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  550. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  551. "-isystem $(MINGW)/x86_64-w64-mingw32/include",
  552. "-Wno-nan-infinity-disabled",
  553. }
  554. linkoptions {
  555. "-Qunused-arguments",
  556. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  557. }
  558. configuration { "x32", "mingw-clang" }
  559. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  560. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  561. libdirs {
  562. path.join(_libDir, "lib/win32_mingw-clang"),
  563. }
  564. buildoptions { "-m32" }
  565. configuration { "x64", "mingw-clang" }
  566. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  567. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  568. libdirs {
  569. path.join(_libDir, "lib/win64_mingw-clang"),
  570. }
  571. buildoptions { "-m64" }
  572. configuration { "linux-*" }
  573. includedirs { path.join(bxDir, "include/compat/linux") }
  574. configuration { "linux-gcc" }
  575. buildoptions {
  576. "-mfpmath=sse",
  577. }
  578. configuration { "linux-gcc* or linux-clang*" }
  579. buildoptions {
  580. "-msse4.2",
  581. -- "-Wdouble-promotion",
  582. -- "-Wduplicated-branches",
  583. -- "-Wduplicated-cond",
  584. -- "-Wjump-misses-init",
  585. "-Wshadow",
  586. -- "-Wnull-dereference",
  587. "-Wunused-value",
  588. "-Wundef",
  589. -- "-Wuseless-cast",
  590. }
  591. links {
  592. "rt",
  593. "dl",
  594. }
  595. linkoptions {
  596. "-Wl,--gc-sections",
  597. "-Wl,--as-needed",
  598. }
  599. configuration { "linux-gcc*" }
  600. buildoptions {
  601. "-Wlogical-op",
  602. }
  603. configuration { "linux-gcc*", "x32" }
  604. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  605. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  606. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  607. buildoptions {
  608. "-m32",
  609. }
  610. configuration { "linux-gcc*", "x64" }
  611. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  612. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  613. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  614. buildoptions {
  615. "-m64",
  616. }
  617. configuration { "linux-clang*", "x32" }
  618. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  619. objdir (path.join(_buildDir, "linux32_clang/obj"))
  620. libdirs { path.join(_libDir, "lib/linux32_clang") }
  621. buildoptions {
  622. "-m32",
  623. }
  624. configuration { "linux-clang*", "x64" }
  625. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  626. objdir (path.join(_buildDir, "linux64_clang/obj"))
  627. libdirs { path.join(_libDir, "lib/linux64_clang") }
  628. buildoptions {
  629. "-m64",
  630. }
  631. configuration { "linux-arm-gcc" }
  632. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  633. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  634. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  635. buildoptions {
  636. "-Wunused-value",
  637. "-Wundef",
  638. }
  639. links {
  640. "rt",
  641. "dl",
  642. }
  643. linkoptions {
  644. "-Wl,--gc-sections",
  645. }
  646. configuration { "android-*" }
  647. targetprefix ("lib")
  648. flags {
  649. "NoImportLib",
  650. }
  651. links {
  652. "c",
  653. "dl",
  654. "m",
  655. "android",
  656. "log",
  657. "c++_shared",
  658. }
  659. buildoptions {
  660. "--gcc-toolchain=" .. androidToolchainRoot(),
  661. "--sysroot=" .. androidToolchainRoot() .. "/sysroot",
  662. "-DANDROID",
  663. "-fPIC",
  664. "-no-canonical-prefixes",
  665. "-Wa,--noexecstack",
  666. "-fstack-protector-strong",
  667. "-ffunction-sections",
  668. "-Wunused-value",
  669. "-Wundef",
  670. }
  671. linkoptions {
  672. "--gcc-toolchain=" .. androidToolchainRoot(),
  673. "--sysroot=" .. androidToolchainRoot() .. "/sysroot",
  674. "-no-canonical-prefixes",
  675. "-Wl,--no-undefined",
  676. "-Wl,-z,noexecstack",
  677. "-Wl,-z,relro",
  678. "-Wl,-z,now",
  679. }
  680. configuration { "android-arm" }
  681. targetdir (path.join(_buildDir, "android-arm/bin"))
  682. objdir (path.join(_buildDir, "android-arm/obj"))
  683. buildoptions {
  684. "--target=armv7-none-linux-android" .. androidApiLevel,
  685. "-mthumb",
  686. "-march=armv7-a",
  687. "-mfloat-abi=softfp",
  688. "-mfpu=neon",
  689. }
  690. linkoptions {
  691. "--target=armv7-none-linux-android" .. androidApiLevel,
  692. "-march=armv7-a",
  693. }
  694. configuration { "android-arm64" }
  695. targetdir (path.join(_buildDir, "android-arm64/bin"))
  696. objdir (path.join(_buildDir, "android-arm64/obj"))
  697. buildoptions {
  698. "--target=aarch64-none-linux-android" .. androidApiLevel,
  699. }
  700. linkoptions {
  701. "--target=aarch64-none-linux-android" .. androidApiLevel,
  702. }
  703. configuration { "android-x86" }
  704. targetdir (path.join(_buildDir, "android-x86/bin"))
  705. objdir (path.join(_buildDir, "android-x86/obj"))
  706. buildoptions {
  707. "--target=i686-none-linux-android" .. androidApiLevel,
  708. "-mtune=atom",
  709. "-mstackrealign",
  710. "-msse4.2",
  711. "-mfpmath=sse",
  712. }
  713. linkoptions {
  714. "--target=i686-none-linux-android" .. androidApiLevel,
  715. }
  716. configuration { "android-x86_64" }
  717. targetdir (path.join(_buildDir, "android-x86_64/bin"))
  718. objdir (path.join(_buildDir, "android-x86_64/obj"))
  719. buildoptions {
  720. "--target=x86_64-none-linux-android" .. androidApiLevel,
  721. }
  722. linkoptions {
  723. "--target=x86_64-none-linux-android" .. androidApiLevel,
  724. }
  725. configuration { "wasm*" }
  726. buildoptions {
  727. "-Wunused-value",
  728. "-Wundef",
  729. }
  730. linkoptions {
  731. "-s MAX_WEBGL_VERSION=2",
  732. }
  733. configuration { "linux-ppc64le*" }
  734. buildoptions {
  735. "-fsigned-char",
  736. "-Wunused-value",
  737. "-Wundef",
  738. "-mcpu=power8",
  739. }
  740. links {
  741. "rt",
  742. "dl",
  743. }
  744. linkoptions {
  745. "-Wl,--gc-sections",
  746. }
  747. configuration { "linux-riscv64*" }
  748. buildoptions {
  749. "-Wunused-value",
  750. "-Wundef",
  751. "-march=rv64g"
  752. }
  753. links {
  754. "rt",
  755. "dl",
  756. }
  757. linkoptions {
  758. "-Wl,--gc-sections",
  759. }
  760. configuration { "linux-ppc64le-gcc" }
  761. targetdir (path.join(_buildDir, "linux_ppc64le_gcc/bin"))
  762. objdir (path.join(_buildDir, "linux_ppc64le_gcc/obj"))
  763. libdirs { path.join(_libDir, "lib/linux_ppc64le_gcc") }
  764. configuration { "linux-ppc64le-clang" }
  765. targetdir (path.join(_buildDir, "linux_ppc64le_clang/bin"))
  766. objdir (path.join(_buildDir, "linux_ppc64le_clang/obj"))
  767. libdirs { path.join(_libDir, "lib/linux_ppc64le_clang") }
  768. configuration { "linux-riscv64-gcc" }
  769. targetdir (path.join(_buildDir, "linux_riscv64_gcc/bin"))
  770. objdir (path.join(_buildDir, "linux_riscv64_gcc/obj"))
  771. libdirs { path.join(_libDir, "lib/linux_riscv64_gcc") }
  772. configuration { "wasm2js" }
  773. targetdir (path.join(_buildDir, "wasm2js/bin"))
  774. objdir (path.join(_buildDir, "wasm2js/obj"))
  775. libdirs { path.join(_libDir, "lib/wasm2js") }
  776. linkoptions {
  777. "-s WASM=0",
  778. }
  779. configuration { "wasm" }
  780. targetdir (path.join(_buildDir, "wasm/bin"))
  781. objdir (path.join(_buildDir, "wasm/obj"))
  782. libdirs { path.join(_libDir, "lib/wasm") }
  783. configuration { "durango" }
  784. targetdir (path.join(_buildDir, "durango/bin"))
  785. objdir (path.join(_buildDir, "durango/obj"))
  786. includedirs { path.join(bxDir, "include/compat/msvc") }
  787. libdirs { path.join(_libDir, "lib/durango") }
  788. removeflags { "StaticRuntime" }
  789. defines {
  790. "NOMINMAX",
  791. }
  792. configuration { "osx-x64" }
  793. targetdir (path.join(_buildDir, "osx-x64/bin"))
  794. objdir (path.join(_buildDir, "osx-x64/obj"))
  795. linkoptions {
  796. "-arch x86_64",
  797. }
  798. buildoptions {
  799. "-arch x86_64",
  800. "-msse4.2",
  801. "-target x86_64-apple-macos" .. (#macosPlatform > 0 and macosPlatform or "13.0"),
  802. }
  803. configuration { "osx-arm64" }
  804. targetdir (path.join(_buildDir, "osx-arm64/bin"))
  805. objdir (path.join(_buildDir, "osx-arm64/obj"))
  806. linkoptions {
  807. "-arch arm64",
  808. }
  809. buildoptions {
  810. "-arch arm64",
  811. "-Wno-error=unused-command-line-argument",
  812. "-Wno-unused-command-line-argument",
  813. }
  814. configuration { "osx*" }
  815. buildoptions {
  816. "-Wfatal-errors",
  817. "-Wunused-value",
  818. "-Wundef",
  819. -- "-Wno-overriding-t-option",
  820. -- "-mmacosx-version-min=13.0",
  821. }
  822. includedirs { path.join(bxDir, "include/compat/osx") }
  823. configuration { "ios*" }
  824. linkoptions {
  825. "-lc++",
  826. }
  827. buildoptions {
  828. "-Wfatal-errors",
  829. "-Wunused-value",
  830. "-Wundef",
  831. -- "-mios-version-min=16.0",
  832. }
  833. includedirs { path.join(bxDir, "include/compat/ios") }
  834. configuration { "xcode*", "ios*" }
  835. targetdir (path.join(_buildDir, "ios-arm/bin"))
  836. objdir (path.join(_buildDir, "ios-arm/obj"))
  837. configuration { "ios-arm" }
  838. targetdir (path.join(_buildDir, "ios-arm/bin"))
  839. objdir (path.join(_buildDir, "ios-arm/obj"))
  840. libdirs { path.join(_libDir, "lib/ios-arm") }
  841. linkoptions {
  842. "-arch armv7",
  843. }
  844. buildoptions {
  845. "-arch armv7",
  846. }
  847. configuration { "ios-arm64" }
  848. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  849. objdir (path.join(_buildDir, "ios-arm64/obj"))
  850. libdirs { path.join(_libDir, "lib/ios-arm64") }
  851. linkoptions {
  852. "-arch arm64",
  853. }
  854. buildoptions {
  855. "-arch arm64",
  856. }
  857. configuration { "ios-arm*" }
  858. linkoptions {
  859. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  860. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  861. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  862. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  863. }
  864. buildoptions {
  865. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  866. "-fembed-bitcode",
  867. }
  868. configuration { "xros*" }
  869. linkoptions {
  870. "-lc++",
  871. }
  872. buildoptions {
  873. "-Wfatal-errors",
  874. "-Wunused-value",
  875. "-Wundef",
  876. }
  877. includedirs { path.join(bxDir, "include/compat/ios") }
  878. configuration { "xros-arm64" }
  879. targetdir (path.join(_buildDir, "xros-arm64/bin"))
  880. objdir (path.join(_buildDir, "xros-arm64/obj"))
  881. libdirs { path.join(_libDir, "lib/xros-arm64") }
  882. linkoptions {
  883. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform.. ".sdk",
  884. "-L/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/usr/lib/system",
  885. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
  886. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  887. }
  888. buildoptions {
  889. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..tvosPlatform .. ".sdk",
  890. }
  891. configuration { "xros-simulator" }
  892. targetdir (path.join(_buildDir, "xros-simulator/bin"))
  893. objdir (path.join(_buildDir, "xros-simulator/obj"))
  894. libdirs { path.join(_libDir, "lib/xros-simulator") }
  895. linkoptions {
  896. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform.. ".sdk",
  897. "-L/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/usr/lib/system",
  898. "-F/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
  899. }
  900. buildoptions {
  901. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk",
  902. }
  903. configuration { "ios-simulator" }
  904. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  905. objdir (path.join(_buildDir, "ios-simulator/obj"))
  906. libdirs { path.join(_libDir, "lib/ios-simulator") }
  907. linkoptions {
  908. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  909. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  910. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  911. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  912. }
  913. buildoptions {
  914. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  915. }
  916. configuration { "tvos*" }
  917. linkoptions {
  918. "-lc++",
  919. }
  920. buildoptions {
  921. "-Wfatal-errors",
  922. "-Wunused-value",
  923. "-Wundef",
  924. }
  925. includedirs { path.join(bxDir, "include/compat/ios") }
  926. configuration { "xcode*", "tvos*" }
  927. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  928. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  929. configuration { "tvos-arm64" }
  930. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  931. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  932. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  933. linkoptions {
  934. "-mtvos-version-min=9.0",
  935. "-arch arm64",
  936. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  937. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  938. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  939. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  940. }
  941. buildoptions {
  942. "-mtvos-version-min=9.0",
  943. "-arch arm64",
  944. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  945. }
  946. configuration { "tvos-simulator" }
  947. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  948. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  949. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  950. linkoptions {
  951. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  952. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  953. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  954. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  955. }
  956. buildoptions {
  957. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  958. }
  959. configuration { "orbis" }
  960. targetdir (path.join(_buildDir, "orbis/bin"))
  961. objdir (path.join(_buildDir, "orbis/obj"))
  962. libdirs { path.join(_libDir, "lib/orbis") }
  963. includedirs {
  964. path.join(bxDir, "include/compat/freebsd"),
  965. "$(SCE_ORBIS_SDK_DIR)/target/include",
  966. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  967. }
  968. configuration { "rpi" }
  969. targetdir (path.join(_buildDir, "rpi/bin"))
  970. objdir (path.join(_buildDir, "rpi/obj"))
  971. libdirs {
  972. path.join(_libDir, "lib/rpi"),
  973. "/opt/vc/lib",
  974. }
  975. defines {
  976. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  977. "__STDC_VERSION__=199901L",
  978. }
  979. buildoptions {
  980. "-Wunused-value",
  981. "-Wundef",
  982. }
  983. includedirs {
  984. "/opt/vc/include",
  985. "/opt/vc/include/interface/vcos/pthreads",
  986. "/opt/vc/include/interface/vmcs_host/linux",
  987. }
  988. links {
  989. "rt",
  990. "dl",
  991. }
  992. linkoptions {
  993. "-Wl,--gc-sections",
  994. }
  995. configuration { "riscv" }
  996. targetdir (path.join(_buildDir, "riscv/bin"))
  997. objdir (path.join(_buildDir, "riscv/obj"))
  998. defines {
  999. "__BSD_VISIBLE",
  1000. "__MISC_VISIBLE",
  1001. }
  1002. includedirs {
  1003. "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include",
  1004. path.join(bxDir, "include/compat/riscv"),
  1005. }
  1006. buildoptions {
  1007. "-Wunused-value",
  1008. "-Wundef",
  1009. "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf",
  1010. }
  1011. configuration {} -- reset configuration
  1012. return true
  1013. end
  1014. function strip()
  1015. configuration { "android-*", "Release" }
  1016. postbuildcommands {
  1017. "$(SILENT) echo Stripping symbols.",
  1018. "$(SILENT) " .. androidToolchainRoot() .. "/bin/llvm-strip -s \"$(TARGET)\""
  1019. }
  1020. configuration { "linux-* or rpi", "Release" }
  1021. postbuildcommands {
  1022. "$(SILENT) echo Stripping symbols.",
  1023. "$(SILENT) strip -s \"$(TARGET)\""
  1024. }
  1025. configuration { "mingw*", "Release" }
  1026. postbuildcommands {
  1027. "$(SILENT) echo Stripping symbols.",
  1028. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1029. }
  1030. configuration { "riscv" }
  1031. postbuildcommands {
  1032. "$(SILENT) echo Stripping symbols.",
  1033. "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\""
  1034. }
  1035. configuration {} -- reset configuration
  1036. end