bimg.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --
  2. -- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
  4. --
  5. function filesexist(_srcPath, _dstPath, _files)
  6. for _, file in ipairs(_files) do
  7. file = path.getrelative(_srcPath, file)
  8. local filePath = path.join(_dstPath, file)
  9. if not os.isfile(filePath) then return false end
  10. end
  11. return true
  12. end
  13. function overridefiles(_srcPath, _dstPath, _files)
  14. local remove = {}
  15. local add = {}
  16. for _, file in ipairs(_files) do
  17. file = path.getrelative(_srcPath, file)
  18. local filePath = path.join(_dstPath, file)
  19. if not os.isfile(filePath) then return end
  20. table.insert(remove, path.join(_srcPath, file))
  21. table.insert(add, filePath)
  22. end
  23. removefiles {
  24. remove,
  25. }
  26. files {
  27. add,
  28. }
  29. end
  30. project "bimg"
  31. kind "StaticLib"
  32. includedirs {
  33. path.join(BX_DIR, "include"),
  34. path.join(BIMG_DIR, "include"),
  35. }
  36. files {
  37. path.join(BIMG_DIR, "include/**"),
  38. path.join(BIMG_DIR, "src/image.*"),
  39. }
  40. overridefiles(BIMG_DIR, path.join(BIMG_DIR, "../bimg-ext"), {
  41. path.join(BIMG_DIR, "src/image_gnf.cpp"),
  42. })
  43. configuration { "linux-*" }
  44. buildoptions {
  45. "-fPIC",
  46. }
  47. configuration {}
  48. if filesexist(BIMG_DIR, path.join(BIMG_DIR, "../bimg-ext"), { path.join(BIMG_DIR, "scripts/bimg.lua"), }) then
  49. dofile(path.join(BIMG_DIR, "../bimg-ext/scripts/bimg.lua") )
  50. end