toolchain.lua 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. --
  2. -- Copyright 2010-2013 Branimir Karadzic. All rights reserved.
  3. -- License: http://www.opensource.org/licenses/BSD-2-Clause
  4. --
  5. local bxDir = (path.getabsolute("..") .. "/")
  6. local naclToolchain = ""
  7. function toolchain(_buildDir, _libDir)
  8. newoption {
  9. trigger = "gcc",
  10. value = "GCC",
  11. description = "Choose GCC flavor",
  12. allowed = {
  13. { "android-arm", "Android - ARM" },
  14. { "android-mips", "Android - MIPS" },
  15. { "android-x86", "Android - x86" },
  16. { "asmjs", "Emscripten/asm.js" },
  17. { "freebsd", "FreeBSD" },
  18. { "linux-gcc", "Linux (GCC compiler)" },
  19. { "linux-clang", "Linux (Clang compiler)" },
  20. { "ios-arm", "iOS - ARM" },
  21. { "ios-simulator", "iOS - Simulator" },
  22. { "mingw", "MinGW" },
  23. { "nacl", "Native Client" },
  24. { "nacl-arm", "Native Client - ARM" },
  25. { "osx", "OSX" },
  26. { "pnacl", "Native Client - PNaCl" },
  27. { "qnx-arm", "QNX/Blackberry - ARM" },
  28. { "rpi", "RaspberryPi" },
  29. }
  30. }
  31. -- Avoid error when invoking premake4 --help.
  32. if (_ACTION == nil) then return end
  33. location (_buildDir .. "projects/" .. _ACTION)
  34. if _ACTION == "clean" then
  35. os.rmdir(BUILD_DIR)
  36. end
  37. if _ACTION == "gmake" then
  38. if nil == _OPTIONS["gcc"] then
  39. print("GCC flavor must be specified!")
  40. os.exit(1)
  41. end
  42. flags {
  43. "ExtraWarnings",
  44. }
  45. if "android-arm" == _OPTIONS["gcc"] then
  46. if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_ROOT") then
  47. print("Set ANDROID_NDK_ARM and ANDROID_NDK_ROOT envrionment variables.")
  48. end
  49. premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
  50. premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
  51. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  52. location (_buildDir .. "projects/" .. _ACTION .. "-android-arm")
  53. end
  54. if "android-mips" == _OPTIONS["gcc"] then
  55. if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then
  56. print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
  57. end
  58. premake.gcc.cc = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc"
  59. premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
  60. premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
  61. location (_buildDir .. "projects/" .. _ACTION .. "-android-mips")
  62. end
  63. if "android-x86" == _OPTIONS["gcc"] then
  64. if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then
  65. print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
  66. end
  67. premake.gcc.cc = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc"
  68. premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
  69. premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
  70. location (_buildDir .. "projects/" .. _ACTION .. "-android-x86")
  71. end
  72. if "asmjs" == _OPTIONS["gcc"] then
  73. if not os.getenv("EMSCRIPTEN") then
  74. print("Set EMSCRIPTEN enviroment variables.")
  75. end
  76. premake.gcc.cc = "$(EMSCRIPTEN)/emcc"
  77. premake.gcc.cxx = "$(EMSCRIPTEN)/em++"
  78. premake.gcc.ar = "ar"
  79. location (_buildDir .. "projects/" .. _ACTION .. "-asmjs")
  80. end
  81. if "freebsd" == _OPTIONS["gcc"] then
  82. location (_buildDir .. "projects/" .. _ACTION .. "-freebsd")
  83. end
  84. if "ios-arm" == _OPTIONS["gcc"] then
  85. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  86. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  87. premake.gcc.ar = "ar"
  88. location (_buildDir .. "projects/" .. _ACTION .. "-ios-arm")
  89. end
  90. if "ios-simulator" == _OPTIONS["gcc"] then
  91. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  92. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  93. premake.gcc.ar = "ar"
  94. location (_buildDir .. "projects/" .. _ACTION .. "-ios-simulator")
  95. end
  96. if "linux-gcc" == _OPTIONS["gcc"] then
  97. location (_buildDir .. "projects/" .. _ACTION .. "-linux")
  98. end
  99. if "linux-clang" == _OPTIONS["gcc"] then
  100. premake.gcc.cc = "clang"
  101. premake.gcc.cxx = "clang++"
  102. premake.gcc.ar = "ar"
  103. location (_buildDir .. "projects/" .. _ACTION .. "-linux-clang")
  104. end
  105. if "mingw" == _OPTIONS["gcc"] then
  106. premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
  107. premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
  108. premake.gcc.ar = "$(MINGW)/bin/ar"
  109. location (_buildDir .. "projects/" .. _ACTION .. "-mingw")
  110. end
  111. if "nacl" == _OPTIONS["gcc"] then
  112. if not os.getenv("NACL_SDK_ROOT") then
  113. print("Set NACL_SDK_ROOT enviroment variables.")
  114. end
  115. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-"
  116. if os.is("macosx") then
  117. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_newlib/bin/x86_64-nacl-"
  118. elseif os.is("linux") then
  119. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/x86_64-nacl-"
  120. end
  121. premake.gcc.cc = naclToolchain .. "gcc"
  122. premake.gcc.cxx = naclToolchain .. "g++"
  123. premake.gcc.ar = naclToolchain .. "ar"
  124. location (_buildDir .. "projects/" .. _ACTION .. "-nacl")
  125. end
  126. if "nacl-arm" == _OPTIONS["gcc"] then
  127. if not os.getenv("NACL_SDK_ROOT") then
  128. print("Set NACL_SDK_ROOT enviroment variables.")
  129. end
  130. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-"
  131. if os.is("macosx") then
  132. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_newlib/bin/arm-nacl-"
  133. elseif os.is("linux") then
  134. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_newlib/bin/arm-nacl-"
  135. end
  136. premake.gcc.cc = naclToolchain .. "gcc"
  137. premake.gcc.cxx = naclToolchain .. "g++"
  138. premake.gcc.ar = naclToolchain .. "ar"
  139. location (_buildDir .. "projects/" .. _ACTION .. "-nacl-arm")
  140. end
  141. if "osx" == _OPTIONS["gcc"] then
  142. location (_buildDir .. "projects/" .. _ACTION .. "-osx")
  143. end
  144. if "pnacl" == _OPTIONS["gcc"] then
  145. if not os.getenv("NACL_SDK_ROOT") then
  146. print("Set NACL_SDK_ROOT enviroment variables.")
  147. end
  148. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-"
  149. if os.is("macosx") then
  150. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_pnacl/bin/pnacl-"
  151. elseif os.is("linux") then
  152. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-"
  153. end
  154. premake.gcc.cc = naclToolchain .. "clang"
  155. premake.gcc.cxx = naclToolchain .. "clang++"
  156. premake.gcc.ar = naclToolchain .. "ar"
  157. location (_buildDir .. "projects/" .. _ACTION .. "-pnacl")
  158. end
  159. if "qnx-arm" == _OPTIONS["gcc"] then
  160. if not os.getenv("QNX_HOST") then
  161. print("Set QNX_HOST enviroment variables.")
  162. end
  163. premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc"
  164. premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
  165. premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
  166. location (_buildDir .. "projects/" .. _ACTION .. "-qnx-arm")
  167. end
  168. if "rpi" == _OPTIONS["gcc"] then
  169. location (_buildDir .. "projects/" .. _ACTION .. "-rpi")
  170. end
  171. end
  172. flags {
  173. "StaticRuntime",
  174. "NoMinimalRebuild",
  175. "NoPCH",
  176. "NativeWChar",
  177. "NoRTTI",
  178. "NoExceptions",
  179. "NoEditAndContinue",
  180. "Symbols",
  181. }
  182. defines {
  183. "__STDC_LIMIT_MACROS",
  184. "__STDC_FORMAT_MACROS",
  185. "__STDC_CONSTANT_MACROS",
  186. }
  187. configuration { "Debug" }
  188. targetsuffix "Debug"
  189. configuration { "Release" }
  190. flags {
  191. "OptimizeSpeed",
  192. }
  193. targetsuffix "Release"
  194. configuration { "vs*" }
  195. flags {
  196. "EnableSSE2",
  197. }
  198. includedirs { bxDir .. "include/compat/msvc" }
  199. defines {
  200. "WIN32",
  201. "_WIN32",
  202. "_HAS_EXCEPTIONS=0",
  203. "_HAS_ITERATOR_DEBUGGING=0",
  204. "_SCL_SECURE=0",
  205. "_SECURE_SCL=0",
  206. "_SCL_SECURE_NO_WARNINGS",
  207. "_CRT_SECURE_NO_WARNINGS",
  208. "_CRT_SECURE_NO_DEPRECATE",
  209. }
  210. buildoptions {
  211. "/Oy-", -- Suppresses creation of frame pointers on the call stack.
  212. "/Ob2", -- The Inline Function Expansion
  213. }
  214. linkoptions {
  215. "/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
  216. }
  217. configuration { "vs2008" }
  218. includedirs { bxDir .. "include/compat/msvc/pre1600" }
  219. configuration { "x32", "vs*" }
  220. targetdir (_buildDir .. "win32_" .. _ACTION .. "/bin")
  221. objdir (_buildDir .. "win32_" .. _ACTION .. "/obj")
  222. libdirs {
  223. _libDir .. "lib/win32_" .. _ACTION,
  224. "$(DXSDK_DIR)/lib/x86",
  225. }
  226. configuration { "x64", "vs*" }
  227. defines { "_WIN64" }
  228. targetdir (_buildDir .. "win64_" .. _ACTION .. "/bin")
  229. objdir (_buildDir .. "win64_" .. _ACTION .. "/obj")
  230. libdirs {
  231. _libDir .. "lib/win64_" .. _ACTION,
  232. "$(DXSDK_DIR)/lib/x64",
  233. }
  234. configuration { "mingw" }
  235. defines { "WIN32" }
  236. includedirs { bxDir .. "include/compat/mingw" }
  237. buildoptions {
  238. "-std=c++11",
  239. "-U__STRICT_ANSI__",
  240. "-Wunused-value",
  241. "-fdata-sections",
  242. "-ffunction-sections",
  243. "-msse2",
  244. "-Wunused-value",
  245. "-Wundef",
  246. }
  247. linkoptions {
  248. "-Wl,--gc-sections",
  249. }
  250. configuration { "x32", "mingw" }
  251. targetdir (_buildDir .. "win32_mingw" .. "/bin")
  252. objdir (_buildDir .. "win32_mingw" .. "/obj")
  253. libdirs {
  254. _libDir .. "lib/win32_mingw",
  255. "$(DXSDK_DIR)/lib/x86",
  256. }
  257. buildoptions { "-m32" }
  258. configuration { "x64", "mingw" }
  259. targetdir (_buildDir .. "win64_mingw" .. "/bin")
  260. objdir (_buildDir .. "win64_mingw" .. "/obj")
  261. libdirs {
  262. _libDir .. "lib/win64_mingw",
  263. "$(DXSDK_DIR)/lib/x64",
  264. "$(GLES_X64_DIR)",
  265. }
  266. buildoptions { "-m64" }
  267. configuration { "linux-gcc and not linux-clang" }
  268. buildoptions {
  269. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  270. }
  271. configuration { "linux-clang" }
  272. buildoptions {
  273. "--analyze",
  274. }
  275. configuration { "linux-*" }
  276. buildoptions {
  277. "-std=c++0x",
  278. "-U__STRICT_ANSI__",
  279. "-msse2",
  280. "-Wunused-value",
  281. "-Wundef",
  282. }
  283. links {
  284. "rt",
  285. }
  286. linkoptions {
  287. "-Wl,--gc-sections",
  288. }
  289. configuration { "linux-gcc", "x32" }
  290. targetdir (_buildDir .. "linux32_gcc" .. "/bin")
  291. objdir (_buildDir .. "linux32_gcc" .. "/obj")
  292. libdirs { _libDir .. "lib/linux32_gcc" }
  293. buildoptions {
  294. "-m32",
  295. }
  296. configuration { "linux-gcc", "x64" }
  297. targetdir (_buildDir .. "linux64_gcc" .. "/bin")
  298. objdir (_buildDir .. "linux64_gcc" .. "/obj")
  299. libdirs { _libDir .. "lib/linux64_gcc" }
  300. buildoptions {
  301. "-m64",
  302. }
  303. configuration { "linux-clang", "x32" }
  304. targetdir (_buildDir .. "linux32_clang" .. "/bin")
  305. objdir (_buildDir .. "linux32_clang" .. "/obj")
  306. libdirs { _libDir .. "lib/linux32_clang" }
  307. buildoptions {
  308. "-m32",
  309. }
  310. configuration { "linux-clang", "x64" }
  311. targetdir (_buildDir .. "linux64_clang" .. "/bin")
  312. objdir (_buildDir .. "linux64_clang" .. "/obj")
  313. libdirs { _libDir .. "lib/linux64_clang" }
  314. buildoptions {
  315. "-m64",
  316. }
  317. configuration { "android-*" }
  318. flags {
  319. "NoImportLib",
  320. }
  321. includedirs {
  322. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/include",
  323. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  324. }
  325. linkoptions {
  326. "-nostdlib",
  327. "-static-libgcc",
  328. }
  329. links {
  330. "c",
  331. "dl",
  332. "m",
  333. "android",
  334. "log",
  335. "gnustl_static",
  336. "gcc",
  337. }
  338. buildoptions {
  339. "-fPIC",
  340. "-std=c++0x",
  341. "-U__STRICT_ANSI__",
  342. "-no-canonical-prefixes",
  343. "-Wa,--noexecstack",
  344. "-fstack-protector",
  345. "-ffunction-sections",
  346. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  347. "-Wunused-value",
  348. "-Wundef",
  349. }
  350. linkoptions {
  351. "-no-canonical-prefixes",
  352. "-Wl,--no-undefined",
  353. "-Wl,-z,noexecstack",
  354. "-Wl,-z,relro",
  355. "-Wl,-z,now",
  356. }
  357. configuration { "android-arm" }
  358. targetdir (_buildDir .. "android-arm" .. "/bin")
  359. objdir (_buildDir .. "android-arm" .. "/obj")
  360. libdirs {
  361. _libDir .. "lib/android-arm",
  362. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
  363. }
  364. includedirs {
  365. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
  366. }
  367. buildoptions {
  368. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm",
  369. "-mthumb",
  370. "-march=armv7-a",
  371. "-mfloat-abi=softfp",
  372. "-mfpu=neon",
  373. "-Wunused-value",
  374. "-Wundef",
  375. }
  376. linkoptions {
  377. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm",
  378. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtbegin_so.o",
  379. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtend_so.o",
  380. "-march=armv7-a",
  381. "-Wl,--fix-cortex-a8",
  382. }
  383. configuration { "android-mips" }
  384. targetdir (_buildDir .. "android-mips" .. "/bin")
  385. objdir (_buildDir .. "android-mips" .. "/obj")
  386. libdirs {
  387. _libDir .. "lib/android-mips",
  388. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips",
  389. }
  390. includedirs {
  391. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include",
  392. }
  393. buildoptions {
  394. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  395. "-Wunused-value",
  396. "-Wundef",
  397. }
  398. linkoptions {
  399. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  400. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtbegin_so.o",
  401. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtend_so.o",
  402. }
  403. configuration { "android-x86" }
  404. targetdir (_buildDir .. "android-x86" .. "/bin")
  405. objdir (_buildDir .. "android-x86" .. "/obj")
  406. libdirs {
  407. _libDir .. "lib/android-x86",
  408. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86",
  409. }
  410. includedirs {
  411. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include",
  412. }
  413. buildoptions {
  414. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  415. "-march=i686",
  416. "-mtune=atom",
  417. "-mstackrealign",
  418. "-msse3",
  419. "-mfpmath=sse",
  420. "-Wunused-value",
  421. "-Wundef",
  422. }
  423. linkoptions {
  424. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  425. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtbegin_so.o",
  426. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtend_so.o",
  427. }
  428. configuration { "asmjs" }
  429. targetdir (_buildDir .. "asmjs" .. "/bin")
  430. objdir (_buildDir .. "asmjs" .. "/obj")
  431. libdirs { _libDir .. "lib/asmjs" }
  432. includedirs {
  433. "$(EMSCRIPTEN)/system/include",
  434. "$(EMSCRIPTEN)/system/include/libc",
  435. }
  436. buildoptions {
  437. "-Wno-unknown-warning-option", -- Linux Emscripten doesn't know about no-warn-absolute-paths...
  438. "-Wno-warn-absolute-paths",
  439. "-Wunused-value",
  440. "-Wundef",
  441. }
  442. configuration { "freebsd" }
  443. targetdir (_buildDir .. "freebsd" .. "/bin")
  444. objdir (_buildDir .. "freebsd" .. "/obj")
  445. libdirs { _libDir .. "lib/freebsd" }
  446. includedirs {
  447. bxDir .. "include/compat/freebsd",
  448. }
  449. configuration { "nacl or nacl-arm or pnacl" }
  450. includedirs {
  451. "$(NACL_SDK_ROOT)/include",
  452. bxDir .. "include/compat/nacl",
  453. }
  454. configuration { "nacl" }
  455. buildoptions {
  456. "-std=c++0x",
  457. "-U__STRICT_ANSI__",
  458. "-pthread",
  459. "-fno-stack-protector",
  460. "-fdiagnostics-show-option",
  461. "-fdata-sections",
  462. "-ffunction-sections",
  463. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  464. "-msse2",
  465. "-Wunused-value",
  466. "-Wundef",
  467. }
  468. linkoptions {
  469. "-Wl,--gc-sections",
  470. }
  471. configuration { "x32", "nacl" }
  472. targetdir (_buildDir .. "nacl-x86" .. "/bin")
  473. objdir (_buildDir .. "nacl-x86" .. "/obj")
  474. libdirs { _libDir .. "lib/nacl-x86" }
  475. linkoptions { "-melf32_nacl" }
  476. configuration { "x32", "nacl", "Debug" }
  477. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
  478. configuration { "x32", "nacl", "Release" }
  479. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
  480. configuration { "x64", "nacl" }
  481. targetdir (_buildDir .. "nacl-x64" .. "/bin")
  482. objdir (_buildDir .. "nacl-x64" .. "/obj")
  483. libdirs { _libDir .. "lib/nacl-x64" }
  484. linkoptions { "-melf64_nacl" }
  485. configuration { "x64", "nacl", "Debug" }
  486. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
  487. configuration { "x64", "nacl", "Release" }
  488. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
  489. configuration { "nacl-arm" }
  490. buildoptions {
  491. "-std=c++0x",
  492. "-U__STRICT_ANSI__",
  493. "-fno-stack-protector",
  494. "-fdiagnostics-show-option",
  495. "-fdata-sections",
  496. "-ffunction-sections",
  497. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  498. "-Wunused-value",
  499. "-Wundef",
  500. }
  501. targetdir (_buildDir .. "nacl-arm" .. "/bin")
  502. objdir (_buildDir .. "nacl-arm" .. "/obj")
  503. libdirs { _libDir .. "lib/nacl-arm" }
  504. configuration { "nacl-arm", "Debug" }
  505. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
  506. configuration { "nacl-arm", "Release" }
  507. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
  508. configuration { "pnacl" }
  509. buildoptions {
  510. "-std=c++0x",
  511. "-U__STRICT_ANSI__",
  512. "-fno-stack-protector",
  513. "-fdiagnostics-show-option",
  514. "-fdata-sections",
  515. "-ffunction-sections",
  516. "-Wunused-value",
  517. "-Wundef",
  518. }
  519. targetdir (_buildDir .. "pnacl" .. "/bin")
  520. objdir (_buildDir .. "pnacl" .. "/obj")
  521. libdirs { _libDir .. "lib/pnacl" }
  522. configuration { "pnacl", "Debug" }
  523. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  524. configuration { "pnacl", "Release" }
  525. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  526. configuration { "Xbox360" }
  527. targetdir (_buildDir .. "xbox360" .. "/bin")
  528. objdir (_buildDir .. "xbox360" .. "/obj")
  529. includedirs { bxDir .. "include/compat/msvc" }
  530. libdirs { _libDir .. "lib/xbox360" }
  531. defines {
  532. "NOMINMAX",
  533. "_XBOX",
  534. }
  535. configuration { "osx", "x32" }
  536. targetdir (_buildDir .. "osx32_gcc" .. "/bin")
  537. objdir (_buildDir .. "osx32_gcc" .. "/obj")
  538. libdirs { _libDir .. "lib/osx32_gcc" }
  539. buildoptions {
  540. "-m32",
  541. }
  542. configuration { "osx", "x64" }
  543. targetdir (_buildDir .. "osx64_gcc" .. "/bin")
  544. objdir (_buildDir .. "osx64_gcc" .. "/obj")
  545. libdirs { _libDir .. "lib/osx64_gcc" }
  546. buildoptions {
  547. "-m64",
  548. }
  549. configuration { "osx" }
  550. buildoptions {
  551. "-U__STRICT_ANSI__",
  552. "-Wfatal-errors",
  553. "-msse2",
  554. "-Wunused-value",
  555. "-Wundef",
  556. }
  557. includedirs { bxDir .. "include/compat/osx" }
  558. configuration { "ios-*" }
  559. linkoptions {
  560. "-lc++",
  561. }
  562. buildoptions {
  563. "-miphoneos-version-min=7.0",
  564. "-U__STRICT_ANSI__",
  565. "-Wfatal-errors",
  566. "-Wunused-value",
  567. "-Wundef",
  568. }
  569. includedirs { bxDir .. "include/compat/ios" }
  570. configuration { "ios-arm" }
  571. targetdir (_buildDir .. "ios-arm" .. "/bin")
  572. objdir (_buildDir .. "ios-arm" .. "/obj")
  573. libdirs { _libDir .. "lib/ios-arm" }
  574. linkoptions {
  575. "-arch armv7",
  576. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk",
  577. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/lib/system",
  578. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks",
  579. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/PrivateFrameworks",
  580. }
  581. buildoptions {
  582. "-arch armv7",
  583. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk",
  584. }
  585. configuration { "ios-simulator" }
  586. targetdir (_buildDir .. "ios-simulator" .. "/bin")
  587. objdir (_buildDir .. "ios-simulator" .. "/obj")
  588. libdirs { _libDir .. "lib/ios-simulator" }
  589. linkoptions {
  590. "-arch i386",
  591. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk",
  592. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/lib/system",
  593. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks",
  594. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/PrivateFrameworks",
  595. }
  596. buildoptions {
  597. "-arch i386",
  598. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk",
  599. }
  600. configuration { "qnx-arm" }
  601. targetdir (_buildDir .. "qnx-arm" .. "/bin")
  602. objdir (_buildDir .. "qnx-arm" .. "/obj")
  603. libdirs { _libDir .. "lib/qnx-arm" }
  604. -- includedirs { bxDir .. "include/compat/qnx" }
  605. buildoptions {
  606. "-std=c++0x",
  607. "-U__STRICT_ANSI__",
  608. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  609. "-Wunused-value",
  610. "-Wundef",
  611. }
  612. configuration { "rpi" }
  613. defines {
  614. "BCM2708", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  615. }
  616. buildoptions {
  617. "-std=c++0x",
  618. "-U__STRICT_ANSI__",
  619. "-Wunused-value",
  620. "-Wundef",
  621. }
  622. includedirs {
  623. "/opt/vc/include",
  624. "/opt/vc/include/interface/vcos/pthreads",
  625. "/opt/vc/include/interface/vmcs_host/linux",
  626. }
  627. libdirs {
  628. "/opt/vc/lib",
  629. }
  630. links {
  631. "rt",
  632. }
  633. linkoptions {
  634. "-Wl,--gc-sections",
  635. }
  636. configuration {} -- reset configuration
  637. end
  638. function strip()
  639. configuration { "android-arm", "Release" }
  640. postbuildcommands {
  641. "@echo Stripping symbols.",
  642. "@$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  643. }
  644. configuration { "android-mips", "Release" }
  645. postbuildcommands {
  646. "@echo Stripping symbols.",
  647. "@$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  648. }
  649. configuration { "android-x86", "Release" }
  650. postbuildcommands {
  651. "@echo Stripping symbols.",
  652. "@$(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  653. }
  654. configuration { "linux-* or rpi", "Release" }
  655. postbuildcommands {
  656. "@echo Stripping symbols.",
  657. "@strip -s \"$(TARGET)\""
  658. }
  659. configuration { "mingw", "Release" }
  660. postbuildcommands {
  661. "@echo Stripping symbols.",
  662. "@$(MINGW)/bin/strip -s \"$(TARGET)\""
  663. }
  664. configuration { "pnacl" }
  665. postbuildcommands {
  666. "@echo Running pnacl-finalize.",
  667. "@" .. naclToolchain .. "finalize \"$(TARGET)\""
  668. }
  669. configuration { "*nacl*", "Release" }
  670. postbuildcommands {
  671. "@echo Stripping symbols.",
  672. "@" .. naclToolchain .. "strip -s \"$(TARGET)\""
  673. }
  674. configuration { "asmjs" }
  675. postbuildcommands {
  676. "@echo Running asmjs finalize.",
  677. "@$(EMSCRIPTEN)/emcc -O2 -s TOTAL_MEMORY=268435456 \"$(TARGET)\" -o \"$(TARGET)\".html"
  678. -- ALLOW_MEMORY_GROWTH
  679. }
  680. configuration {} -- reset configuration
  681. end