premake-defaults.lua 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. filter {}
  2. objdir ( "../../build/obj/" .. mpt_projectpathname .. "/" .. mpt_projectname )
  3. filter {}
  4. filter {}
  5. if _OPTIONS["clang"] then
  6. toolset "clang"
  7. end
  8. filter {}
  9. filter {}
  10. if _OPTIONS["winxp"] then
  11. if _ACTION == "vs2017" then
  12. toolset "v141_xp"
  13. end
  14. defines { "MPT_BUILD_RETRO" }
  15. filter { "action:vs*" }
  16. buildoptions { "/Zc:threadSafeInit-" }
  17. filter {}
  18. end
  19. filter {}
  20. filter {}
  21. filter {}
  22. filter { "action:vs*", "language:C++", "action:vs2017" }
  23. cppdialect "C++17"
  24. filter { "action:vs*", "language:C++", "action:vs2019" }
  25. cppdialect "C++17"
  26. filter { "action:vs*", "language:C++", "not action:vs2017", "not action:vs2019" }
  27. if _OPTIONS["clang"] then
  28. cppdialect "C++17"
  29. else
  30. cppdialect "C++20"
  31. end
  32. filter { "action:vs*", "action:vs2017" }
  33. if _OPTIONS["win10"] then
  34. conformancemode "On"
  35. end
  36. filter { "action:vs*", "not action:vs2017" }
  37. conformancemode "On"
  38. filter { "not action:vs*", "language:C++" }
  39. buildoptions { "-std=c++17" }
  40. filter { "not action:vs*", "language:C" }
  41. buildoptions { "-std=c99" }
  42. filter {}
  43. filter {}
  44. filter { "action:vs*" }
  45. if not _OPTIONS["clang"] and not _OPTIONS["winxp"] and not _OPTIONS["uwp"] then
  46. spectremitigations "On"
  47. end
  48. filter {}
  49. filter { "action:vs*", "architecture:x86" }
  50. resdefines { "VER_ARCHNAME=\"x86\"" }
  51. filter { "action:vs*", "architecture:x86_64" }
  52. resdefines { "VER_ARCHNAME=\"amd64\"" }
  53. filter { "action:vs*", "architecture:ARM" }
  54. resdefines { "VER_ARCHNAME=\"arm\"" }
  55. filter { "action:vs*", "architecture:ARM64" }
  56. resdefines { "VER_ARCHNAME=\"arm64\"" }
  57. filter {}
  58. filter { "kind:StaticLib", "configurations:Debug", "architecture:x86" }
  59. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86/Debug" )
  60. filter { "kind:StaticLib", "configurations:DebugShared", "architecture:x86" }
  61. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86/DebugShared" )
  62. filter { "kind:StaticLib", "configurations:Checked", "architecture:x86" }
  63. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86/Checked" )
  64. filter { "kind:StaticLib", "configurations:CheckedShared", "architecture:x86" }
  65. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86/CheckedShared" )
  66. filter { "kind:StaticLib", "configurations:Release", "architecture:x86" }
  67. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86/Release" )
  68. filter { "kind:StaticLib", "configurations:ReleaseShared", "architecture:x86" }
  69. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86/ReleaseShared" )
  70. filter { "kind:StaticLib", "configurations:Debug", "architecture:x86_64" }
  71. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86_64/Debug" )
  72. filter { "kind:StaticLib", "configurations:DebugShared", "architecture:x86_64" }
  73. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86_64/DebugShared" )
  74. filter { "kind:StaticLib", "configurations:Checked", "architecture:x86_64" }
  75. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86_64/Checked" )
  76. filter { "kind:StaticLib", "configurations:CheckedShared", "architecture:x86_64" }
  77. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86_64/CheckedShared" )
  78. filter { "kind:StaticLib", "configurations:Release", "architecture:x86_64" }
  79. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86_64/Release" )
  80. filter { "kind:StaticLib", "configurations:ReleaseShared", "architecture:x86_64" }
  81. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/x86_64/ReleaseShared" )
  82. filter { "kind:StaticLib", "configurations:Debug", "architecture:ARM" }
  83. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm/Debug" )
  84. filter { "kind:StaticLib", "configurations:DebugShared", "architecture:ARM" }
  85. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm/DebugShared" )
  86. filter { "kind:StaticLib", "configurations:Checked", "architecture:ARM" }
  87. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm/Checked" )
  88. filter { "kind:StaticLib", "configurations:CheckedShared", "architecture:ARM" }
  89. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm/CheckedShared" )
  90. filter { "kind:StaticLib", "configurations:Release", "architecture:ARM" }
  91. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm/Release" )
  92. filter { "kind:StaticLib", "configurations:ReleaseShared", "architecture:ARM" }
  93. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm/ReleaseShared" )
  94. filter { "kind:StaticLib", "configurations:Debug", "architecture:ARM64" }
  95. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm64/Debug" )
  96. filter { "kind:StaticLib", "configurations:DebugShared", "architecture:ARM64" }
  97. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm64/DebugShared" )
  98. filter { "kind:StaticLib", "configurations:Checked", "architecture:ARM64" }
  99. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm64/Checked" )
  100. filter { "kind:StaticLib", "configurations:CheckedShared", "architecture:ARM64" }
  101. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm64/CheckedShared" )
  102. filter { "kind:StaticLib", "configurations:Release", "architecture:ARM64" }
  103. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm64/Release" )
  104. filter { "kind:StaticLib", "configurations:ReleaseShared", "architecture:ARM64" }
  105. targetdir ( "../../build/lib/" .. mpt_projectpathname .. "/arm64/ReleaseShared" )
  106. filter { "kind:not StaticLib", "configurations:Debug", "architecture:x86" }
  107. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-static/x86" )
  108. filter { "kind:not StaticLib", "configurations:DebugShared", "architecture:x86" }
  109. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-shared/x86" )
  110. filter { "kind:not StaticLib", "configurations:Checked", "architecture:x86" }
  111. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-static/x86" )
  112. filter { "kind:not StaticLib", "configurations:CheckedShared", "architecture:x86" }
  113. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-shared/x86" )
  114. filter { "kind:not StaticLib", "configurations:Release", "architecture:x86" }
  115. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-static/x86" )
  116. filter { "kind:not StaticLib", "configurations:ReleaseShared", "architecture:x86" }
  117. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-shared/x86" )
  118. filter { "kind:not StaticLib", "configurations:Debug", "architecture:x86_64" }
  119. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-static/amd64" )
  120. filter { "kind:not StaticLib", "configurations:DebugShared", "architecture:x86_64" }
  121. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-shared/amd64" )
  122. filter { "kind:not StaticLib", "configurations:Checked", "architecture:x86_64" }
  123. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-static/amd64" )
  124. filter { "kind:not StaticLib", "configurations:CheckedShared", "architecture:x86_64" }
  125. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-shared/amd64" )
  126. filter { "kind:not StaticLib", "configurations:Release", "architecture:x86_64" }
  127. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-static/amd64" )
  128. filter { "kind:not StaticLib", "configurations:ReleaseShared", "architecture:x86_64" }
  129. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-shared/amd64" )
  130. filter { "kind:not StaticLib", "configurations:Debug", "architecture:ARM" }
  131. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-static/arm" )
  132. filter { "kind:not StaticLib", "configurations:DebugShared", "architecture:ARM" }
  133. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-shared/arm" )
  134. filter { "kind:not StaticLib", "configurations:Checked", "architecture:ARM" }
  135. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-static/arm" )
  136. filter { "kind:not StaticLib", "configurations:CheckedShared", "architecture:ARM" }
  137. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-shared/arm" )
  138. filter { "kind:not StaticLib", "configurations:Release", "architecture:ARM" }
  139. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-static/arm" )
  140. filter { "kind:not StaticLib", "configurations:ReleaseShared", "architecture:ARM" }
  141. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix32 .. "-shared/arm" )
  142. filter { "kind:not StaticLib", "configurations:Debug", "architecture:ARM64" }
  143. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-static/arm64" )
  144. filter { "kind:not StaticLib", "configurations:DebugShared", "architecture:ARM64" }
  145. targetdir ( "../../bin/debug/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-shared/arm64" )
  146. filter { "kind:not StaticLib", "configurations:Checked", "architecture:ARM64" }
  147. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-static/arm64" )
  148. filter { "kind:not StaticLib", "configurations:CheckedShared", "architecture:ARM64" }
  149. targetdir ( "../../bin/checked/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-shared/arm64" )
  150. filter { "kind:not StaticLib", "configurations:Release", "architecture:ARM64" }
  151. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-static/arm64" )
  152. filter { "kind:not StaticLib", "configurations:ReleaseShared", "architecture:ARM64" }
  153. targetdir ( "../../bin/release/" .. _ACTION .. "-" .. mpt_bindirsuffix64 .. "-shared/arm64" )
  154. filter { "configurations:Debug", "architecture:ARM" }
  155. editandcontinue "Off"
  156. filter { "configurations:Debug", "architecture:ARM64" }
  157. editandcontinue "Off"
  158. filter { "configurations:DebugShared", "architecture:ARM" }
  159. editandcontinue "Off"
  160. filter { "configurations:DebugShared", "architecture:ARM64" }
  161. editandcontinue "Off"
  162. filter { "configurations:Debug" }
  163. defines { "DEBUG" }
  164. defines { "MPT_BUILD_DEBUG" }
  165. defines { "MPT_BUILD_MSVC_STATIC" }
  166. filter { "configurations:Debug", "architecture:ARM" }
  167. symbols "On"
  168. filter { "configurations:Debug", "architecture:ARM64" }
  169. symbols "On"
  170. filter { "configurations:Debug", "architecture:not ARM", "architecture:not ARM64" }
  171. symbols "FastLink"
  172. filter { "configurations:Debug" }
  173. if not _OPTIONS["uwp"] then
  174. staticruntime "On"
  175. end
  176. runtime "Debug"
  177. optimize "Debug"
  178. filter { "configurations:DebugShared" }
  179. defines { "DEBUG" }
  180. defines { "MPT_BUILD_DEBUG" }
  181. defines { "MPT_BUILD_MSVC_SHARED" }
  182. symbols "On"
  183. runtime "Debug"
  184. optimize "Debug"
  185. filter { "configurations:Checked" }
  186. defines { "DEBUG" }
  187. defines { "MPT_BUILD_MSVC_STATIC" }
  188. defines { "MPT_BUILD_CHECKED" }
  189. symbols "On"
  190. if not _OPTIONS["uwp"] then
  191. staticruntime "On"
  192. end
  193. runtime "Release"
  194. optimize "On"
  195. omitframepointer "Off"
  196. filter { "configurations:CheckedShared" }
  197. defines { "DEBUG" }
  198. defines { "MPT_BUILD_MSVC_SHARED" }
  199. defines { "MPT_BUILD_CHECKED" }
  200. symbols "On"
  201. runtime "Release"
  202. optimize "On"
  203. omitframepointer "Off"
  204. filter { "configurations:Release" }
  205. defines { "NDEBUG" }
  206. defines { "MPT_BUILD_MSVC_STATIC" }
  207. symbols "On"
  208. if not _OPTIONS["clang"] then
  209. flags { "LinkTimeOptimization" }
  210. end
  211. if not _OPTIONS["uwp"] then
  212. staticruntime "On"
  213. end
  214. runtime "Release"
  215. optimize "Speed"
  216. filter { "configurations:ReleaseShared" }
  217. defines { "NDEBUG" }
  218. defines { "MPT_BUILD_MSVC_SHARED" }
  219. symbols "On"
  220. if not _OPTIONS["clang"] then
  221. flags { "LinkTimeOptimization" }
  222. end
  223. runtime "Release"
  224. optimize "Speed"
  225. filter {}
  226. if not _OPTIONS["clang"] then
  227. flags { "MultiProcessorCompile" }
  228. end
  229. if _OPTIONS["winxp"] then
  230. filter { "architecture:x86" }
  231. vectorextensions "IA32"
  232. filter {}
  233. filter { "architecture:x86", "configurations:Release" }
  234. floatingpoint "Fast"
  235. filter {}
  236. filter { "architecture:x86", "configurations:ReleaseShared" }
  237. floatingpoint "Fast"
  238. filter {}
  239. else
  240. filter {}
  241. filter { "architecture:x86", "configurations:Checked" }
  242. vectorextensions "SSE2"
  243. filter { "architecture:x86", "configurations:CheckedShared" }
  244. vectorextensions "SSE2"
  245. filter { "architecture:x86", "configurations:Release" }
  246. vectorextensions "SSE2"
  247. filter { "architecture:x86", "configurations:ReleaseShared" }
  248. vectorextensions "SSE2"
  249. filter {}
  250. end
  251. filter {}
  252. defines { "MPT_BUILD_MSVC" }
  253. filter {}
  254. defines {
  255. "WIN32",
  256. "_CRT_NONSTDC_NO_WARNINGS",
  257. "_CRT_SECURE_NO_WARNINGS",
  258. "_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1",
  259. "_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1",
  260. }
  261. filter {}
  262. if not _OPTIONS["winxp"] and not _OPTIONS["uwp"] then
  263. filter {}
  264. filter { "action:vs2017" }
  265. systemversion "10.0.17763.0"
  266. filter {}
  267. filter { "action:vs2019" }
  268. systemversion "10.0.20348.0"
  269. filter {}
  270. filter { "action:vs2022" }
  271. systemversion "10.0.20348.0"
  272. filter {}
  273. end
  274. if _OPTIONS["win10"] then
  275. filter {}
  276. defines { "_WIN32_WINNT=0x0A00" }
  277. filter {}
  278. filter { "architecture:x86" }
  279. defines { "NTDDI_VERSION=0x0A000000" }
  280. filter {}
  281. filter { "architecture:x86_64" }
  282. defines { "NTDDI_VERSION=0x0A000000" }
  283. filter {}
  284. filter { "architecture:ARM" }
  285. defines { "NTDDI_VERSION=0x0A000004" } -- Windows 10 1709 Build 16299
  286. filter {}
  287. filter { "architecture:ARM64" }
  288. defines { "NTDDI_VERSION=0x0A000004" } -- Windows 10 1709 Build 16299
  289. filter {}
  290. elseif _OPTIONS["win81"] then
  291. filter {}
  292. defines { "_WIN32_WINNT=0x0603" }
  293. defines { "NTDDI_VERSION=0x06030000" }
  294. elseif _OPTIONS["win7"] then
  295. filter {}
  296. defines { "_WIN32_WINNT=0x0601" }
  297. defines { "NTDDI_VERSION=0x06010000" }
  298. elseif _OPTIONS["winxp"] then
  299. filter {}
  300. systemversion "7.0"
  301. filter {}
  302. filter { "architecture:x86" }
  303. defines { "_WIN32_WINNT=0x0501" }
  304. defines { "NTDDI_VERSION=0x05010100" } -- Windows XP SP1
  305. filter { "architecture:x86_64" }
  306. defines { "_WIN32_WINNT=0x0502" }
  307. defines { "NTDDI_VERSION=0x05020000" } -- Windows XP x64
  308. filter {}
  309. end
  310. filter {}