mpt-OpenMPT.lua 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. if charset == "Unicode" then
  2. if stringmode == "WCHAR" then
  3. project "OpenMPT"
  4. mpt_projectname = "OpenMPT"
  5. uuid "37FC32A4-8DDC-4A9C-A30C-62989DD8ACE9"
  6. else
  7. project "OpenMPT-UTF8"
  8. mpt_projectname = "OpenMPT-UTF8"
  9. uuid "e89507fa-a251-457e-9957-f6b453c77daf"
  10. end
  11. else
  12. project "OpenMPT-ANSI"
  13. mpt_projectname = "OpenMPT-ANSI"
  14. uuid "ba66db50-e2f0-4c9e-b650-0cca6c66e1c1"
  15. end
  16. language "C++"
  17. location ( "../../build/" .. mpt_projectpathname )
  18. vpaths { ["*"] = "../../" }
  19. dofile "../../build/premake/premake-defaults-EXEGUI.lua"
  20. dofile "../../build/premake/premake-defaults.lua"
  21. if stringmode == "UTF8" then
  22. targetname "OpenMPT-UTF8"
  23. elseif charset == "MBCS" then
  24. targetname "OpenMPT-ANSI"
  25. else
  26. targetname "OpenMPT"
  27. end
  28. filter {}
  29. local extincludedirs = {
  30. "../../include",
  31. "../../include/ancient/api",
  32. "../../include/asiomodern/include",
  33. "../../include/ASIOSDK2/common",
  34. "../../include/flac/include",
  35. "../../include/lame/include",
  36. "../../include/lhasa/lib/public",
  37. "../../include/mpg123/ports/MSVC++",
  38. "../../include/mpg123/src/libmpg123",
  39. "../../include/nlohmann-json/include",
  40. "../../include/ogg/include",
  41. "../../include/opus/include",
  42. "../../include/opusenc/include",
  43. "../../include/opusfile/include",
  44. "../../include/portaudio/include",
  45. "../../include/rtaudio",
  46. "../../include/vorbis/include",
  47. "../../include/zlib",
  48. }
  49. filter { "action:vs*" }
  50. includedirs ( extincludedirs )
  51. filter { "not action:vs*" }
  52. sysincludedirs ( extincludedirs )
  53. filter {}
  54. includedirs {
  55. "../../src",
  56. "../../common",
  57. "../../soundlib",
  58. "$(IntDir)/svn_version",
  59. "../../build/svn_version",
  60. }
  61. if _OPTIONS["win10"] then
  62. files {
  63. "../../mptrack/res/OpenMPT-win10.manifest",
  64. }
  65. elseif _OPTIONS["win81"] then
  66. files {
  67. "../../mptrack/res/OpenMPT-win81.manifest",
  68. }
  69. elseif _OPTIONS["win7"] then
  70. files {
  71. "../../mptrack/res/OpenMPT-win7.manifest",
  72. }
  73. end
  74. if not _OPTIONS["winxp"] then
  75. files {
  76. "../../include/asiomodern/include/ASIOModern/*.hpp",
  77. }
  78. end
  79. files {
  80. "../../src/mpt/**.cpp",
  81. "../../src/mpt/**.hpp",
  82. "../../src/openmpt/**.cpp",
  83. "../../src/openmpt/**.hpp",
  84. "../../common/*.cpp",
  85. "../../common/*.h",
  86. "../../soundlib/*.cpp",
  87. "../../soundlib/*.h",
  88. "../../soundlib/plugins/*.cpp",
  89. "../../soundlib/plugins/*.h",
  90. "../../soundlib/plugins/dmo/*.cpp",
  91. "../../soundlib/plugins/dmo/*.h",
  92. "../../sounddsp/*.cpp",
  93. "../../sounddsp/*.h",
  94. "../../unarchiver/*.cpp",
  95. "../../unarchiver/*.h",
  96. "../../misc/*.cpp",
  97. "../../misc/*.h",
  98. "../../tracklib/*.cpp",
  99. "../../tracklib/*.h",
  100. "../../mptrack/*.cpp",
  101. "../../mptrack/*.h",
  102. "../../mptrack/plugins/*.cpp",
  103. "../../mptrack/plugins/*.h",
  104. "../../test/*.cpp",
  105. "../../test/*.h",
  106. "../../pluginBridge/BridgeCommon.h",
  107. "../../pluginBridge/BridgeWrapper.cpp",
  108. "../../pluginBridge/BridgeWrapper.h",
  109. }
  110. files {
  111. "../../mptrack/mptrack.rc",
  112. "../../mptrack/res/*.*", -- resource data files
  113. }
  114. if _OPTIONS["win10"] then
  115. excludes {
  116. "../../mptrack/res/OpenMPT-win7.manifest",
  117. "../../mptrack/res/OpenMPT-win81.manifest",
  118. }
  119. elseif _OPTIONS["win81"] then
  120. excludes {
  121. "../../mptrack/res/OpenMPT-win7.manifest",
  122. "../../mptrack/res/OpenMPT-win10.manifest",
  123. }
  124. elseif _OPTIONS["win7"] then
  125. excludes {
  126. "../../mptrack/res/OpenMPT-win81.manifest",
  127. "../../mptrack/res/OpenMPT-win10.manifest",
  128. }
  129. else
  130. excludes {
  131. "../../mptrack/res/OpenMPT-win7.manifest",
  132. "../../mptrack/res/OpenMPT-win81.manifest",
  133. "../../mptrack/res/OpenMPT-win10.manifest",
  134. }
  135. end
  136. defines { "MPT_BUILD_ENABLE_PCH" }
  137. pchsource "../../build/pch/PCH.cpp"
  138. pchheader "PCH.h"
  139. files {
  140. "../../build/pch/PCH.cpp",
  141. "../../build/pch/PCH.h"
  142. }
  143. includedirs {
  144. "../../build/pch"
  145. }
  146. forceincludes {
  147. "PCH.h"
  148. }
  149. defines { "MODPLUG_TRACKER" }
  150. dpiawareness "None"
  151. largeaddressaware ( true )
  152. characterset(charset)
  153. if charset == "Unicode" then
  154. else
  155. defines { "NO_WARN_MBCS_MFC_DEPRECATION" }
  156. end
  157. if stringmode == "UTF8" then
  158. defines { "MPT_USTRING_MODE_UTF8_FORCE" }
  159. end
  160. flags { "MFC" }
  161. -- work-around https://developercommunity.visualstudio.com/t/link-errors-when-building-mfc-application-with-cla/1617786
  162. if _OPTIONS["clang"] then
  163. filter {}
  164. filter { "configurations:Debug" }
  165. if true then -- _AFX_NO_MFC_CONTROLS_IN_DIALOGS
  166. ignoredefaultlibraries { "afxnmcdd.lib" }
  167. links { "afxnmcdd.lib" }
  168. end
  169. if charset == "Unicode" then
  170. ignoredefaultlibraries { "uafxcwd.lib", "libcmtd.lib" }
  171. links { "uafxcwd.lib", "libcmtd.lib" }
  172. else
  173. ignoredefaultlibraries { "nafxcwd.lib", "libcmtd.lib" }
  174. links { "nafxcwd.lib", "libcmtd.lib" }
  175. end
  176. filter { "configurations:DebugShared" }
  177. if charset == "Unicode" then
  178. ignoredefaultlibraries { "mfc140ud.lib", "msvcrtd.lib" }
  179. links { "mfc140ud.lib", "msvcrtd.lib" }
  180. else
  181. ignoredefaultlibraries { "mfc140d.lib", "msvcrtd.lib" }
  182. links { "mfc140d.lib", "msvcrtd.lib" }
  183. end
  184. filter { "configurations:Checked" }
  185. if true then -- _AFX_NO_MFC_CONTROLS_IN_DIALOGS
  186. ignoredefaultlibraries { "afxnmcd.lib" }
  187. links { "afxnmcd.lib" }
  188. end
  189. if charset == "Unicode" then
  190. ignoredefaultlibraries { "uafxcw.lib", "libcmt.lib" }
  191. links { "uafxcw.lib", "libcmt.lib" }
  192. else
  193. ignoredefaultlibraries { "nafxcw.lib", "libcmt.lib" }
  194. links { "nafxcw.lib", "libcmt.lib" }
  195. end
  196. filter { "configurations:CheckedShared" }
  197. if charset == "Unicode" then
  198. ignoredefaultlibraries { "mfc140u.lib", "msvcrt.lib" }
  199. links { "mfc140u.lib", "msvcrt.lib" }
  200. else
  201. ignoredefaultlibraries { "mfc140.lib", "msvcrt.lib" }
  202. links { "mfc140.lib", "msvcrt.lib" }
  203. end
  204. filter { "configurations:Release" }
  205. if true then -- _AFX_NO_MFC_CONTROLS_IN_DIALOGS
  206. ignoredefaultlibraries { "afxnmcd.lib" }
  207. links { "afxnmcd.lib" }
  208. end
  209. if charset == "Unicode" then
  210. ignoredefaultlibraries { "uafxcw.lib", "libcmt.lib" }
  211. links { "uafxcw.lib", "libcmt.lib" }
  212. else
  213. ignoredefaultlibraries { "nafxcw.lib", "libcmt.lib" }
  214. links { "nafxcw.lib", "libcmt.lib" }
  215. end
  216. filter { "configurations:ReleaseShared" }
  217. if charset == "Unicode" then
  218. ignoredefaultlibraries { "mfc140u.lib", "msvcrt.lib" }
  219. links { "mfc140u.lib", "msvcrt.lib" }
  220. else
  221. ignoredefaultlibraries { "mfc140.lib", "msvcrt.lib" }
  222. links { "mfc140.lib", "msvcrt.lib" }
  223. end
  224. filter {}
  225. end
  226. warnings "Extra"
  227. links {
  228. "ancient",
  229. "UnRAR",
  230. "zlib",
  231. "minizip",
  232. "smbPitchShift",
  233. "lame",
  234. "lhasa",
  235. "flac",
  236. "mpg123",
  237. "ogg",
  238. "opus",
  239. "opusenc",
  240. "opusfile",
  241. "portaudio",
  242. "r8brain",
  243. "rtaudio",
  244. "rtmidi",
  245. "soundtouch",
  246. "vorbis",
  247. }
  248. filter {}
  249. if not _OPTIONS["winxp"] then
  250. linkoptions {
  251. "/DELAYLOAD:mf.dll",
  252. "/DELAYLOAD:mfplat.dll",
  253. "/DELAYLOAD:mfreadwrite.dll",
  254. -- "/DELAYLOAD:mfuuid.dll", -- static library
  255. "/DELAYLOAD:propsys.dll",
  256. }
  257. end
  258. filter { "action:vs*" }
  259. files {
  260. "../../build/vs/debug/openmpt.natvis",
  261. }
  262. filter {}
  263. prebuildcommands { "..\\..\\build\\svn_version\\update_svn_version_vs_premake.cmd $(IntDir)" }
  264. project "OpenMPT-NativeSupport"
  265. uuid "563a631d-fe07-47bc-a98f-9fe5b3ebabfa"
  266. language "C++"
  267. location ( "../../build/" .. mpt_projectpathname )
  268. vpaths { ["*"] = "../../" }
  269. mpt_projectname = "OpenMPT-NativeSupport"
  270. dofile "../../build/premake/premake-defaults-DLL.lua"
  271. dofile "../../build/premake/premake-defaults.lua"
  272. includedirs {
  273. "../../src",
  274. "../../common",
  275. "../../include",
  276. "../../include/asiomodern/include",
  277. "../../include/ASIOSDK2/common",
  278. "../../include/nlohmann-json/include",
  279. "../../include/portaudio/include",
  280. "../../include/rtaudio",
  281. "$(IntDir)/svn_version",
  282. "../../build/svn_version",
  283. }
  284. files {
  285. "../../include/asiomodern/include/ASIOModern/*.hpp",
  286. "../../src/mpt/**.cpp",
  287. "../../src/mpt/**.hpp",
  288. "../../src/openmpt/**.cpp",
  289. "../../src/openmpt/**.hpp",
  290. "../../common/*.cpp",
  291. "../../common/*.h",
  292. "../../misc/*.cpp",
  293. "../../misc/*.h",
  294. "../../mptrack/wine/*.cpp",
  295. "../../mptrack/wine/*.h",
  296. }
  297. excludes {
  298. "../../mptrack/wine/WineWrapper.cpp",
  299. }
  300. defines { "MODPLUG_TRACKER", "MPT_BUILD_WINESUPPORT" }
  301. largeaddressaware ( true )
  302. characterset "Unicode"
  303. warnings "Extra"
  304. links {
  305. "portaudio",
  306. "rtaudio",
  307. }
  308. filter {}
  309. prebuildcommands { "..\\..\\build\\svn_version\\update_svn_version_vs_premake.cmd $(IntDir)" }
  310. project "OpenMPT-WineWrapper"
  311. uuid "f3da2bf5-e84a-4f71-80ab-884594863d3a"
  312. language "C"
  313. location ( "../../build/" .. mpt_projectpathname )
  314. vpaths { ["*"] = "../../" }
  315. mpt_projectname = "OpenMPT-WineWrapper"
  316. dofile "../../build/premake/premake-defaults-DLL.lua"
  317. dofile "../../build/premake/premake-defaults.lua"
  318. includedirs {
  319. "../../src",
  320. "../../common",
  321. "../../include",
  322. "$(IntDir)/svn_version",
  323. "../../build/svn_version",
  324. }
  325. files {
  326. "../../mptrack/wine/WineWrapper.c",
  327. }
  328. defines { "MODPLUG_TRACKER", "MPT_BUILD_WINESUPPORT_WRAPPER" }
  329. largeaddressaware ( true )
  330. characterset "Unicode"
  331. warnings "Extra"
  332. links {
  333. "OpenMPT-NativeSupport",
  334. }
  335. filter {}
  336. postbuildcommands { "..\\..\\build\\wine\\build_wine_support.cmd $(IntDir) $(OutDir)" }