選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

premake4.lua 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. -- sndlib premake4
  2. -- requires premake-4.4 (for os.is64bit)
  3. -- currently assumes you want s7 (scheme) as the extension language
  4. --------------------------------------------------------------------------------
  5. -- Command Line
  6. --------------------------------------------------------------------------------
  7. newoption({trigger = "with-g++", description = "Optionally use g++ compiler."})
  8. if (not _ACTION) then
  9. if (os.is("windows")) then
  10. _ACTION = "vs2010"
  11. else
  12. _ACTION = "gmake"
  13. end
  14. end
  15. --------------------------------------------------------------------------------
  16. -- Global Config
  17. --------------------------------------------------------------------------------
  18. --General
  19. DebugFlags = {"Symbols", "NoPCH", "NoManifest"}
  20. ReleaseFlags = {"NoPCH", "NoManifest"}
  21. SpeedFlags = {"OptimizeSpeed", "NoPCH", "NoManifest"}
  22. --Warnings
  23. StandardGCCWarnings = {"-Wall"}
  24. --Mac
  25. MacFrameworks = {"-framework CoreAudio", "-framework CoreFoundation", "-framework CoreMidi"}
  26. MacTarget = "-mmacosx-version-min=10.6"
  27. --------------------------------------------------------------------------------
  28. -- Paths
  29. --------------------------------------------------------------------------------
  30. PathToRoot = ""
  31. PathToSrc = "./"
  32. PathToLib = "lib/" -- folder to save libs in
  33. PathToBin = "bin/" -- folder to save apps in
  34. PathToObj = "obj/" -- intermediate dir for object files
  35. --------------------------------------------------------------------------------
  36. --
  37. --------------------------------------------------------------------------------
  38. solution("sndlib")
  39. --Create a release, debug, and speed configuration for each project.
  40. configurations({"Release", "Debug", "Speed"})
  41. --------------------------------------------------------------------------------
  42. -- project sndlib: create static libsndlib
  43. --------------------------------------------------------------------------------
  44. project("sndlib")
  45. -- optionally use g++ compiler for .c files
  46. if (_OPTIONS["with-g++"]) then
  47. language("C++")
  48. -- buildoptions( {"-x c++"})
  49. -- for clang on osx?
  50. else
  51. language("C")
  52. end
  53. if (_OPTIONS["with-gsl"]) then
  54. defines("HAVE_GSL")
  55. links({"gsl", "gslcblas"})
  56. end
  57. defines("WITH_AUDIO")
  58. defines("HAVE_SCHEME")
  59. defines("HAVE_PREMAKE")
  60. if (os.get() == "macosx") then
  61. -- links({"dl"})
  62. linkoptions(MacFrameworks)
  63. else
  64. if (os.get() == "windows") then
  65. links("winmm")
  66. else
  67. if (os.get() == "linux") then
  68. defines("HAVE_ALSA")
  69. else
  70. -- I tried FreeBSD (had to remove -ldl from LIBS in gmake.unix), but
  71. -- premake died with some lua error.
  72. end
  73. end
  74. end
  75. if (os.is64bit()) then
  76. defines("SIZEOF_VOID_P=8")
  77. else
  78. defines("SIZEOF_VOID_P=4")
  79. end
  80. -- TODO: WORDS_BIGENDIAN:
  81. -- I got this from some Lua mailing list -- I have no idea what it does!
  82. -- apparently it returns true if little-endian
  83. --
  84. -- function endian()
  85. -- return string.byte(string.dump(function() end),7)
  86. -- end
  87. --
  88. -- if (!endian()) then
  89. -- defines("WORDS_BIGENDIAN")
  90. -- end
  91. -- until I have a test case, I think I'll leave it little-endian by default
  92. -- it's not clear that Lua works in big-endian machines
  93. kind("StaticLib")
  94. flags({"StaticRuntime"})
  95. includedirs({PathToSrc})
  96. objdir(PathToObj)
  97. targetdir(PathToLib)
  98. files({"headers.*", "audio.*", "io.*", "sound.*", "xen.*", "vct.*", "clm.*", "sndlib2xen.*", "clm2xen.*", "s7.*"})
  99. defines({"HAVE_CONFIG_H=1"})
  100. -- ADD WHATEVER OTHER PROJECTS YOU WANT, EG:
  101. -- project("s7")
  102. -- kind("ConsoleApp")
  103. -- ...
  104. configuration "Debug" flags(DebugFlags) defines("DEBUG")
  105. configuration "Release" flags(ReleaseFlags) defines({"NDEBUG", "_NDEBUG"})
  106. configuration "Speed" flags(SpeedFlags) defines({"NDEBUG", "_NDEBUG"})
  107. -- to find a library os.findlib("X11"), nil if not found
  108. -- os.execute to run external prog
  109. -- os.isfile("path") true if file exists, else false
  110. -- os.outputof("command")