toolchain.lua 38 KB

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