You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
8.5KB

  1. --=======================================================================================--
  2. function make_library_project(name)
  3. project.name = name
  4. project.bindir = "../.."
  5. project.libdir = project.bindir
  6. project.configs = { "Release", "Debug" }
  7. package = newpackage()
  8. package.name = project.name
  9. package.kind = "lib"
  10. package.language = "c++"
  11. package.target = project.name
  12. package.objdir = "intermediate"
  13. package.defines = {}
  14. package.buildoptions = { "-fPIC", "-DPIC", "-Wall", "-pthread",
  15. "-Wno-multichar", "-Wno-misleading-indentation", "-Wno-unused-but-set-variable",
  16. os.getenv("CXXFLAGS") }
  17. package.config["Release"].target = project.name
  18. package.config["Release"].objdir = "intermediate/Release"
  19. package.config["Release"].defines = { "NDEBUG=1" }
  20. package.config["Release"].buildoptions = { "-O3", "-fvisibility=hidden", "-fvisibility-inlines-hidden" }
  21. if (not (os.getenv("NOOPTIMIZATIONS") or os.getenv("LINUX_EMBED"))) then
  22. package.config["Release"].buildoptions = {
  23. package.config["Release"].buildoptions,
  24. "-mtune=generic", "-msse", "-msse2"
  25. }
  26. end
  27. if (not macosx) then
  28. package.config["Release"].buildoptions = { package.config["Release"].buildoptions, "-fdata-sections", "-ffunction-sections" }
  29. end
  30. package.config["Debug"].target = project.name .. "_debug"
  31. package.config["Debug"].objdir = "intermediate/Debug"
  32. package.config["Debug"].defines = { "DEBUG=1", "_DEBUG=1" }
  33. package.config["Debug"].buildoptions = { "-O0", "-ggdb" }
  34. if (windows) then
  35. package.defines = { "WINDOWS=1" }
  36. package.buildoptions = { package.buildoptions, "-fpermissive", "-std=c++0x" }
  37. elseif (macosx) then
  38. package.defines = { "MAC=1" }
  39. package.buildoptions = { package.buildoptions, "-ObjC++" }
  40. elseif (os.getenv("LINUX_EMBED")) then
  41. package.defines = { "LINUX=1" }
  42. package.buildoptions = { package.buildoptions, "-DJUCE_LINUX_EMBED=1", "-std=c++0x" }
  43. else
  44. package.defines = { "LINUX=1" }
  45. package.buildoptions = { package.buildoptions, "`pkg-config --cflags alsa freetype2 x11 xext`", "-std=c++0x" }
  46. end
  47. return package
  48. end
  49. --=======================================================================================--
  50. function make_plugin_project(name, spec)
  51. if (spec == "LV2") then
  52. project.name = name .. ".lv2/" .. name
  53. project.bindir = "../../../bin/lv2"
  54. elseif (spec == "VST") then
  55. project.name = name
  56. project.bindir = "../../../bin/vst"
  57. end
  58. project.libdir = project.bindir
  59. project.configs = { "Release", "Debug" }
  60. package = newpackage()
  61. package.name = project.name
  62. package.kind = "dll"
  63. package.language = "c++"
  64. if (spec == "LV2") then
  65. package.defines = { "DISTRHO_PLUGIN_TARGET_LV2=1", "JucePlugin_Build_AU=0", "JucePlugin_Build_LV2=1", "JucePlugin_Build_RTAS=0", "JucePlugin_Build_VST=0", "JucePlugin_Build_Standalone=0" }
  66. elseif (spec == "VST") then
  67. package.defines = { "DISTRHO_PLUGIN_TARGET_VST=1", "JucePlugin_Build_AU=0", "JucePlugin_Build_LV2=0", "JucePlugin_Build_RTAS=0", "JucePlugin_Build_VST=1", "JucePlugin_Build_Standalone=0" }
  68. end
  69. package.target = project.name
  70. package.targetprefix = ""
  71. package.objdir = "intermediate"
  72. package.buildoptions = { "-Wall", "-Werror=deprecated-declarations", os.getenv("CXXFLAGS") }
  73. package.links = {}
  74. package.linkoptions = { "-pthread", os.getenv("LDFLAGS") }
  75. package.config["Release"].target = project.name
  76. package.config["Release"].objdir = "intermediate/Release"
  77. package.config["Release"].defines = { "NDEBUG=1", "CONFIGURATION=\"Release\"" }
  78. package.config["Release"].buildoptions = { "-O3", "-ffast-math", "-fomit-frame-pointer", "-fvisibility=hidden", "-fvisibility-inlines-hidden" }
  79. package.config["Release"].links = {}
  80. if (not (os.getenv("NOOPTIMIZATIONS") or os.getenv("LINUX_EMBED"))) then
  81. package.config["Release"].buildoptions = {
  82. package.config["Release"].buildoptions,
  83. "-mtune=generic", "-msse", "-msse2", "-mfpmath=sse"
  84. }
  85. end
  86. if (not macosx) then
  87. package.linkoptions = { package.linkoptions, "-Wl,--no-undefined" }
  88. package.config["Release"].buildoptions = { package.config["Release"].buildoptions, "-fdata-sections", "-ffunction-sections" }
  89. package.config["Release"].linkoptions = { "-fdata-sections", "-ffunction-sections", "-Wl,--gc-sections", "-Wl,--strip-all" }
  90. end
  91. package.config["Debug"].target = project.name .. "_debug"
  92. package.config["Debug"].objdir = "intermediate/Debug"
  93. package.config["Debug"].defines = { "DEBUG=1", "_DEBUG=1", "CONFIGURATION=\"Debug\"" }
  94. package.config["Debug"].buildoptions = { "-O0", "-ggdb" }
  95. package.config["Debug"].links = {}
  96. package.includepaths = {
  97. "../source",
  98. "../../../libs/juce/source",
  99. "../../../libs/juce/source/modules",
  100. "../../../libs/drowaudio/source",
  101. "../../../libs/juced/source",
  102. "../../../libs/juce-plugin"
  103. }
  104. package.libpaths = {
  105. "../../../libs"
  106. }
  107. if (windows) then
  108. package.defines = { package.defines, "WINDOWS=1", "BINTYPE=\"Windows-" .. spec .. "\"" }
  109. package.buildoptions = { package.buildoptions, "-fpermissive", "-std=c++0x" }
  110. elseif (macosx) then
  111. package.defines = { package.defines, "MAC=1", "BINTYPE=\"Mac-" .. spec .. "\"" }
  112. package.buildoptions = { package.buildoptions, "-ObjC++" }
  113. package.linkoptions = { package.linkoptions, "-dynamiclib" }
  114. package.targetextension = "dylib"
  115. else
  116. package.defines = { package.defines, "LINUX=1", "BINTYPE=\"Linux-" .. spec .. "\"" }
  117. package.buildoptions = { package.buildoptions, "-std=c++0x" }
  118. end
  119. if (os.getenv("LINUX_EMBED")) then
  120. package.buildoptions = { package.buildoptions, "-DJUCE_LINUX_EMBED=1" }
  121. end
  122. return package
  123. end
  124. --=======================================================================================--
  125. function make_juce_lv2_project(name)
  126. package = make_plugin_project(name, "LV2")
  127. package.config["Release"].links = { "juce" }
  128. package.config["Debug"].links = { "juce_debug" }
  129. if (windows) then
  130. package.links = { "comdlg32", "gdi32", "imm32", "ole32", "oleaut32", "shlwapi", "uuid", "version", "winmm", "wininet", "ws2_32" }
  131. elseif (macosx) then
  132. package.linkoptions = { package.linkoptions,
  133. "-framework Accelerate", "-framework AudioToolbox", "-framework AudioUnit", "-framework Carbon", "-framework Cocoa",
  134. "-framework CoreAudio", "-framework CoreAudioKit", "-framework CoreMIDI", "-framework IOKit", "-framework QuartzCore", "-framework WebKit" }
  135. elseif (os.getenv("LINUX_EMBED")) then
  136. package.links = { "dl", "rt" }
  137. else
  138. package.links = { "dl", "rt" }
  139. package.linkoptions = { package.linkoptions, "`pkg-config --libs freetype2 x11 xext`" }
  140. if (name == "drumsynth" or name == "eqinox" or name == "Dexed") then
  141. package.linkoptions = { package.linkoptions, "`pkg-config --libs alsa`" }
  142. else
  143. package.config["Debug"].linkoptions = { "`pkg-config --libs alsa`" }
  144. end
  145. end
  146. return package
  147. end
  148. function make_juce_vst_project(name)
  149. package = make_plugin_project(name, "VST")
  150. package.config["Release"].links = { "juce" }
  151. package.config["Debug"].links = { "juce_debug" }
  152. package.buildoptions = {
  153. package.buildoptions,
  154. "-Wno-multichar",
  155. "-Wno-write-strings"
  156. }
  157. package.includepaths = {
  158. package.includepaths,
  159. "../../../sdks/vstsdk2.4"
  160. }
  161. if (windows) then
  162. package.links = { "comdlg32", "gdi32", "imm32", "ole32", "oleaut32", "shlwapi", "uuid", "version", "winmm", "wininet", "ws2_32" }
  163. elseif (macosx) then
  164. package.linkoptions = { package.linkoptions,
  165. "-framework Accelerate", "-framework AudioToolbox", "-framework AudioUnit", "-framework Carbon", "-framework Cocoa",
  166. "-framework CoreAudio", "-framework CoreAudioKit", "-framework CoreMIDI", "-framework IOKit", "-framework QuartzCore", "-framework WebKit" }
  167. else
  168. package.links = { "dl", "rt" }
  169. package.linkoptions = { package.linkoptions, "`pkg-config --libs freetype2 x11 xext`" }
  170. if (name == "drumsynth" or name == "eqinox" or name == "Dexed") then
  171. package.linkoptions = { package.linkoptions, "`pkg-config --libs alsa`" }
  172. else
  173. package.config["Debug"].linkoptions = { "`pkg-config --libs alsa`" }
  174. end
  175. end
  176. return package
  177. end
  178. --=======================================================================================--