drawstuff.lua 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package.name = "drawstuff"
  2. package.language = "c++"
  3. package.objdir = "obj/drawstuff"
  4. package.links = {}
  5. -- Append a "d" to the debug version of the libraries
  6. for k,v in ipairs(project.configs) do
  7. if (string.find(v, "Debug") ~= nil) then
  8. package.config[v].target = "drawstuffd"
  9. end
  10. end
  11. -- Output is placed in a directory named for the target toolset.
  12. package.path = options["target"]
  13. -- Package Build Settings
  14. local dll_defines =
  15. {
  16. "DS_DLL",
  17. "USRDLL"
  18. }
  19. local lib_defines =
  20. {
  21. "DS_LIB"
  22. }
  23. if (not options["enable-shared-only"]) then
  24. package.config["DebugSingleLib"].kind = "lib"
  25. package.config["ReleaseSingleLib"].kind = "lib"
  26. table.insert(package.config["DebugSingleLib"].defines, lib_defines)
  27. table.insert(package.config["ReleaseSingleLib"].defines, lib_defines)
  28. table.insert(package.config["DebugSingleLib"].defines, "dSINGLE")
  29. table.insert(package.config["ReleaseSingleLib"].defines, "dSINGLE")
  30. package.config["DebugDoubleLib"].kind = "lib"
  31. package.config["ReleaseDoubleLib"].kind = "lib"
  32. table.insert(package.config["DebugDoubleLib"].defines, lib_defines)
  33. table.insert(package.config["ReleaseDoubleLib"].defines, lib_defines)
  34. table.insert(package.config["DebugDoubleLib"].defines, "dDOUBLE")
  35. table.insert(package.config["ReleaseDoubleLib"].defines, "dDOUBLE")
  36. end
  37. if (not options["enable-static-only"]) then
  38. package.config["DebugSingleDLL"].kind = "dll"
  39. package.config["ReleaseSingleDLL"].kind = "dll"
  40. table.insert(package.config["DebugSingleDLL"].defines, dll_defines)
  41. table.insert(package.config["ReleaseSingleDLL"].defines, dll_defines)
  42. table.insert(package.config["DebugSingleDLL"].defines, "dSINGLE")
  43. table.insert(package.config["ReleaseSingleDLL"].defines, "dSINGLE")
  44. package.config["DebugDoubleDLL"].kind = "dll"
  45. package.config["ReleaseDoubleDLL"].kind = "dll"
  46. table.insert(package.config["DebugDoubleDLL"].defines, dll_defines)
  47. table.insert(package.config["ReleaseDoubleDLL"].defines, dll_defines)
  48. table.insert(package.config["DebugDoubleDLL"].defines, "dDOUBLE")
  49. table.insert(package.config["ReleaseDoubleDLL"].defines, "dDOUBLE")
  50. end
  51. package.includepaths =
  52. {
  53. "../../include",
  54. "../../ode/src"
  55. }
  56. -- disable VS2005 CRT security warnings
  57. if (options["target"] == "vs2005") then
  58. table.insert(package.defines, "_CRT_SECURE_NO_DEPRECATE")
  59. end
  60. -- Build Flags
  61. package.config["DebugSingleLib"].buildflags = { }
  62. package.config["DebugSingleDLL"].buildflags = { }
  63. package.config["ReleaseSingleDLL"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" }
  64. package.config["ReleaseSingleLib"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" }
  65. package.config["DebugDoubleLib"].buildflags = { }
  66. package.config["DebugDoubleDLL"].buildflags = { }
  67. package.config["ReleaseDoubleDLL"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" }
  68. package.config["ReleaseDoubleLib"].buildflags = { "optimize-speed", "no-symbols", "no-frame-pointer" }
  69. if (options.target == "vs6" or options.target == "vs2002" or options.target == "vs2003") then
  70. for k,v in ipairs(project.configs) do
  71. if (string.find(v, "Lib") ~= nil) then
  72. table.insert(package.config[v].buildflags, "static-runtime")
  73. end
  74. end
  75. end
  76. -- Libraries
  77. local windows_libs =
  78. {
  79. "user32",
  80. "opengl32",
  81. "glu32",
  82. "winmm",
  83. "gdi32"
  84. }
  85. local x11_libs =
  86. {
  87. "X11",
  88. "GL",
  89. "GLU"
  90. }
  91. if (windows) then
  92. table.insert(package.links, windows_libs)
  93. else
  94. table.insert(package.links, x11_libs)
  95. end
  96. -- Files
  97. package.files =
  98. {
  99. matchfiles("../../include/drawstuff/*.h"),
  100. "../../drawstuff/src/internal.h",
  101. "../../drawstuff/src/drawstuff.cpp"
  102. }
  103. if (windows) then
  104. table.insert(package.defines, "WIN32")
  105. table.insert(package.files, "../../drawstuff/src/resource.h")
  106. table.insert(package.files, "../../drawstuff/src/resources.rc")
  107. table.insert(package.files, "../../drawstuff/src/windows.cpp")
  108. else
  109. table.insert(package.files, "../../drawstuff/src/x11.cpp")
  110. end