xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. add_rules("mode.debug", "mode.release")
  2. set_project("gl2ps")
  3. set_version("1.4.2")
  4. set_languages("c99")
  5. option("zlib", {description = "Enable ZLIB compression", default = true})
  6. option("png", {description = "Enable PNG support", default = true})
  7. includes("@builtin/check")
  8. set_configvar("GL2PS_MAJOR_VERSION", 1)
  9. set_configvar("GL2PS_MINOR_VERSION", 4)
  10. set_configvar("GL2PS_PATCH_VERSION", 2)
  11. set_configvar("GL2PS_EXTRA_VERSION", "")
  12. set_configvar("GL2PS_OS", is_plat("macosx") and "MacOSX" or (is_plat("windows", "mingw") and "Windows" or "Linux"))
  13. option("HAVE_VSNPRINTF")
  14. add_cfuncs("vsnprintf")
  15. add_cincludes("stdio.h")
  16. option_end()
  17. if not has_config("HAVE_VSNPRINTF") then
  18. add_defines("HAVE_NO_VSNPRINTF")
  19. end
  20. add_requires("opengl", {optional = true})
  21. add_requires("glut")
  22. if has_config("zlib") then
  23. add_requires("zlib")
  24. add_defines("HAVE_ZLIB")
  25. end
  26. if has_config("png") then
  27. add_requires("libpng")
  28. add_defines("HAVE_PNG")
  29. end
  30. if is_plat("linux", "macosx") then
  31. add_syslinks("m")
  32. end
  33. if is_plat("macosx") then
  34. add_cflags("-Wno-deprecated-declarations")
  35. end
  36. target("gl2ps")
  37. set_kind("$(kind)")
  38. add_files("gl2ps.c")
  39. add_headerfiles("gl2ps.h")
  40. add_packages("opengl", "glut")
  41. if is_kind("shared") and is_plat("windows", "cygwin") then
  42. add_defines("GL2PSDLL", "GL2PSDLL_EXPORTS")
  43. end
  44. if is_kind("static") then
  45. add_defines("GL2PS_STATIC")
  46. end
  47. if has_config("zlib") then
  48. add_packages("zlib")
  49. end
  50. if has_config("png") then
  51. add_packages("libpng")
  52. end