From 7f3bc9d37d13e2e9e9d7b8b96da9f8273784e910 Mon Sep 17 00:00:00 2001 From: Tom Spilman Date: Sun, 7 Jul 2024 12:48:12 -0500 Subject: [PATCH] Test of using xmake for building/generating C++ projects. --- .gitignore | 4 + MonoGame.Framework.Native.sln | 100 +--------- Tests/MonoGame.Tests.WindowsVK.csproj | 8 +- src/monogame/build_windows.bat | 8 + src/monogame/make_windows_solution.bat | 4 + src/monogame/windows/monogame_windows.vcxproj | 182 ------------------ .../windows/monogame_windows.vcxproj.filters | 52 ----- src/monogame/xmake.lua | 46 +++++ 8 files changed, 70 insertions(+), 334 deletions(-) create mode 100644 src/monogame/build_windows.bat create mode 100644 src/monogame/make_windows_solution.bat delete mode 100644 src/monogame/windows/monogame_windows.vcxproj delete mode 100644 src/monogame/windows/monogame_windows.vcxproj.filters create mode 100644 src/monogame/xmake.lua diff --git a/.gitignore b/.gitignore index 8f0a0f8f04c..81daac8ccab 100644 --- a/.gitignore +++ b/.gitignore @@ -88,5 +88,9 @@ IDE/MonoDevelop/MonoDevelop.MonoGame/templates/Common/MonoGame.Framework.dll.con # CAKE .cake/** +# Xmake +.xmake +vsxmake2022 + # docfx _* diff --git a/MonoGame.Framework.Native.sln b/MonoGame.Framework.Native.sln index e170e9317a8..c6ae8d03114 100644 --- a/MonoGame.Framework.Native.sln +++ b/MonoGame.Framework.Native.sln @@ -11,120 +11,30 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Generator.CTypes", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Tests.WindowsVK", "Tests\MonoGame.Tests.WindowsVK.csproj", "{C670BF60-56F7-493F-B5DD-50F97DB80A04}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "monogame.wndows", "src\monogame\windows\monogame_windows.vcxproj", "{E9536A29-2151-4839-A580-1A03FE787999}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "desktopvk", "src\monogame\vsxmake2022\desktopvk\desktopvk.vcxproj", "{92A214CA-39E6-4EBB-9A5F-8ADCCE4EF2B1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug_DX|Any CPU = Debug_DX|Any CPU - Debug_DX|x64 = Debug_DX|x64 Debug_VK|Any CPU = Debug_VK|Any CPU - Debug_VK|x64 = Debug_VK|x64 - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Release_DX|Any CPU = Release_DX|Any CPU - Release_DX|x64 = Release_DX|x64 Release_VK|Any CPU = Release_VK|Any CPU - Release_VK|x64 = Release_VK|x64 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_DX|Any CPU.ActiveCfg = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_DX|Any CPU.Build.0 = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_DX|x64.ActiveCfg = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_DX|x64.Build.0 = Debug|Any CPU {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_VK|Any CPU.ActiveCfg = Debug|Any CPU {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_VK|Any CPU.Build.0 = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_VK|x64.ActiveCfg = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug_VK|x64.Build.0 = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug|Any CPU.Build.0 = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug|x64.ActiveCfg = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Debug|x64.Build.0 = Debug|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_DX|Any CPU.ActiveCfg = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_DX|Any CPU.Build.0 = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_DX|x64.ActiveCfg = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_DX|x64.Build.0 = Release|Any CPU {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_VK|Any CPU.ActiveCfg = Release|Any CPU {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_VK|Any CPU.Build.0 = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_VK|x64.ActiveCfg = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release_VK|x64.Build.0 = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release|Any CPU.ActiveCfg = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release|Any CPU.Build.0 = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release|x64.ActiveCfg = Release|Any CPU - {56BA741D-6AF1-489B-AB00-338DE11B1D32}.Release|x64.Build.0 = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_DX|Any CPU.ActiveCfg = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_DX|Any CPU.Build.0 = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_DX|x64.ActiveCfg = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_DX|x64.Build.0 = Debug|Any CPU {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_VK|Any CPU.ActiveCfg = Debug|Any CPU {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_VK|Any CPU.Build.0 = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_VK|x64.ActiveCfg = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug_VK|x64.Build.0 = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug|Any CPU.Build.0 = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug|x64.ActiveCfg = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Debug|x64.Build.0 = Debug|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_DX|Any CPU.ActiveCfg = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_DX|Any CPU.Build.0 = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_DX|x64.ActiveCfg = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_DX|x64.Build.0 = Release|Any CPU {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_VK|Any CPU.ActiveCfg = Release|Any CPU {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_VK|Any CPU.Build.0 = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_VK|x64.ActiveCfg = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release_VK|x64.Build.0 = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release|Any CPU.ActiveCfg = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release|Any CPU.Build.0 = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release|x64.ActiveCfg = Release|Any CPU - {74F12E34-D96B-4EC1-A218-BAFC83DC6220}.Release|x64.Build.0 = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_DX|Any CPU.ActiveCfg = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_DX|Any CPU.Build.0 = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_DX|x64.ActiveCfg = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_DX|x64.Build.0 = Debug|Any CPU {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_VK|Any CPU.ActiveCfg = Debug|Any CPU {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_VK|Any CPU.Build.0 = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_VK|x64.ActiveCfg = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug_VK|x64.Build.0 = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug|x64.ActiveCfg = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Debug|x64.Build.0 = Debug|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_DX|Any CPU.ActiveCfg = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_DX|Any CPU.Build.0 = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_DX|x64.ActiveCfg = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_DX|x64.Build.0 = Release|Any CPU {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_VK|Any CPU.ActiveCfg = Release|Any CPU {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_VK|Any CPU.Build.0 = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_VK|x64.ActiveCfg = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release_VK|x64.Build.0 = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release|Any CPU.Build.0 = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release|x64.ActiveCfg = Release|Any CPU - {C670BF60-56F7-493F-B5DD-50F97DB80A04}.Release|x64.Build.0 = Release|Any CPU - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_DX|Any CPU.ActiveCfg = Debug_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_DX|Any CPU.Build.0 = Debug_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_DX|x64.ActiveCfg = Debug_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_DX|x64.Build.0 = Debug_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_VK|Any CPU.ActiveCfg = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_VK|Any CPU.Build.0 = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_VK|x64.ActiveCfg = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug_VK|x64.Build.0 = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug|Any CPU.ActiveCfg = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug|Any CPU.Build.0 = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug|x64.ActiveCfg = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Debug|x64.Build.0 = Debug_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_DX|Any CPU.ActiveCfg = Release_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_DX|Any CPU.Build.0 = Release_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_DX|x64.ActiveCfg = Release_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_DX|x64.Build.0 = Release_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_VK|Any CPU.ActiveCfg = Release_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_VK|Any CPU.Build.0 = Release_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_VK|x64.ActiveCfg = Release_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release_VK|x64.Build.0 = Release_VK|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release|Any CPU.ActiveCfg = Release_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release|Any CPU.Build.0 = Release_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release|x64.ActiveCfg = Release_DX|x64 - {E9536A29-2151-4839-A580-1A03FE787999}.Release|x64.Build.0 = Release_DX|x64 + {92A214CA-39E6-4EBB-9A5F-8ADCCE4EF2B1}.Debug_VK|Any CPU.ActiveCfg = Debug|x64 + {92A214CA-39E6-4EBB-9A5F-8ADCCE4EF2B1}.Debug_VK|Any CPU.Build.0 = Debug|x64 + {92A214CA-39E6-4EBB-9A5F-8ADCCE4EF2B1}.Release_VK|Any CPU.ActiveCfg = Release|x64 + {92A214CA-39E6-4EBB-9A5F-8ADCCE4EF2B1}.Release_VK|Any CPU.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tests/MonoGame.Tests.WindowsVK.csproj b/Tests/MonoGame.Tests.WindowsVK.csproj index 1d4879c030f..2a35d7ca2e4 100644 --- a/Tests/MonoGame.Tests.WindowsVK.csproj +++ b/Tests/MonoGame.Tests.WindowsVK.csproj @@ -1,4 +1,4 @@ - + Exe @@ -50,11 +50,9 @@ - - True - + - + PreserveNewest diff --git a/src/monogame/build_windows.bat b/src/monogame/build_windows.bat new file mode 100644 index 00000000000..5f75c6e38ce --- /dev/null +++ b/src/monogame/build_windows.bat @@ -0,0 +1,8 @@ +@echo off +@echo. +@echo === Debug ======================================================================== +xmake f -m debug && xmake -r + +@echo. +@echo === Release ====================================================================== +xmake f -m release && xmake -r \ No newline at end of file diff --git a/src/monogame/make_windows_solution.bat b/src/monogame/make_windows_solution.bat new file mode 100644 index 00000000000..9f175f3262b --- /dev/null +++ b/src/monogame/make_windows_solution.bat @@ -0,0 +1,4 @@ +@echo off +xmake project -m "Release,Debug" -k vsxmake + + diff --git a/src/monogame/windows/monogame_windows.vcxproj b/src/monogame/windows/monogame_windows.vcxproj deleted file mode 100644 index 541495791cc..00000000000 --- a/src/monogame/windows/monogame_windows.vcxproj +++ /dev/null @@ -1,182 +0,0 @@ - - - - - Debug_DX - x64 - - - Release_DX - x64 - - - Debug_VK - x64 - - - Release_VK - x64 - - - - 17.0 - Win32Proj - {E9536A29-2151-4839-A580-1A03FE787999} - nulldevice - 10.0 - monogame.wndows - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - monogame.native - ..\..\..\Artifacts\$(ProjectName)\$(Configuration)\ - - - monogame.native - ..\..\..\Artifacts\$(ProjectName)\$(Configuration)\ - - - monogame.native - ..\..\..\Artifacts\$(ProjectName)\$(Configuration)\ - - - monogame.native - ..\..\..\Artifacts\$(ProjectName)\$(Configuration)\ - - - - Level3 - true - _DEBUG;_CONSOLE;DLL_EXPORT;WIN32;%(PreprocessorDefinitions) - true - ..\..\..\ThirdParty\Dependencies\VulkanSDK\Include;..\..\..\ThirdParty\Dependencies\SDL\include;..\include - - - Console - true - ..\..\..\ThirdParty\Dependencies\SDL\Windows\x64\SDL2-static.lib;..\..\..\ThirdParty\Dependencies\VulkanSDK\Lib\Windows\volk.lib;ole32.lib;oleaut32.lib;imm32.lib;version.lib;winmm.lib;SetupAPI.lib;%(AdditionalDependencies) - - - - - Level3 - true - MG_SDL2;MG_VULKAN;_DEBUG;_CONSOLE;DLL_EXPORT;WIN32;%(PreprocessorDefinitions) - true - ..\..\..\ThirdParty\Dependencies\VulkanSDK\Include;..\..\..\ThirdParty\Dependencies\SDL\include;..\include - - - Console - true - ..\..\..\ThirdParty\Dependencies\SDL\Windows\x64\SDL2-static.lib;..\..\..\ThirdParty\Dependencies\VulkanSDK\Lib\Windows\volk.lib;ole32.lib;oleaut32.lib;imm32.lib;version.lib;winmm.lib;SetupAPI.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;DLL_EXPORT;WIN32;%(PreprocessorDefinitions) - true - ..\..\..\ThirdParty\Dependencies\VulkanSDK\Include;..\..\..\ThirdParty\Dependencies\SDL\include;..\include - - - Console - true - true - true - ..\..\..\ThirdParty\Dependencies\SDL\Windows\x64\SDL2-static.lib;..\..\..\ThirdParty\Dependencies\VulkanSDK\Lib\Windows\volk.lib;ole32.lib;oleaut32.lib;imm32.lib;version.lib;winmm.lib;SetupAPI.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - MG_SDL2;MG_VULKAN;NDEBUG;_CONSOLE;DLL_EXPORT;WIN32;%(PreprocessorDefinitions) - true - ..\..\..\ThirdParty\Dependencies\VulkanSDK\Include;..\..\..\ThirdParty\Dependencies\SDL\include;..\include - - - Console - true - true - true - ..\..\..\ThirdParty\Dependencies\SDL\Windows\x64\SDL2-static.lib;..\..\..\ThirdParty\Dependencies\VulkanSDK\Lib\Windows\volk.lib;ole32.lib;oleaut32.lib;imm32.lib;version.lib;winmm.lib;SetupAPI.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/src/monogame/windows/monogame_windows.vcxproj.filters b/src/monogame/windows/monogame_windows.vcxproj.filters deleted file mode 100644 index 00ffd3a1915..00000000000 --- a/src/monogame/windows/monogame_windows.vcxproj.filters +++ /dev/null @@ -1,52 +0,0 @@ - - - - - include - - - include - - - include - - - include - - - include - - - vulkan - - - - - {c518f7c6-d7c8-4bc7-8683-1813c63d8d7f} - - - {b53b6cd0-5d2b-4afa-bc93-52eec4260217} - - - {953c1e3f-488d-44db-8ea3-a837760f68fc} - - - - - vulkan - - - sdl - - - - - vulkan - - - - - vulkan - - - \ No newline at end of file diff --git a/src/monogame/xmake.lua b/src/monogame/xmake.lua new file mode 100644 index 00000000000..630a7b0be33 --- /dev/null +++ b/src/monogame/xmake.lua @@ -0,0 +1,46 @@ +-- MonoGame - Copyright (C) MonoGame Foundation, Inc +-- This file is subject to the terms and conditions defined in +-- file 'LICENSE.txt', which is part of this source code package. + +-- Bulding a dynamic link library. +set_kind("shared") +set_basename("monogame.native") +add_defines("DLL_EXPORT") + +-- Always include the common bits. +add_files("common/*.cpp") +add_includedirs("include") + +target("desktopvk") + + set_targetdir("../../Artifacts/monogame.native/$(os)/desktopvk/$(mode)") + + -- SDL is supported on all desktop platforms. + add_defines("MG_SDL2") + add_files("sdl/*.cpp") + add_includedirs("../../ThirdParty/Dependencies/SDL/include") + add_links("SDL2-static") + if is_plat("windows") then + add_linkdirs("../../ThirdParty/Dependencies/SDL/Windows/x64") + add_links("winmm", "imm32", "user32", "gdi32", "advapi32", "setupapi", "ole32", "oleaut32", "version", "shell32") + end + + -- Vulkan is supported for all desktop platforms. + add_defines("MG_VULKAN"); + add_files("vulkan/*.cpp") + add_includedirs("../../ThirdParty/Dependencies/VulkanSDK/Include") + if is_plat("windows") then + add_files("vulkan/vulkan.rc") + add_linkdirs("../../ThirdParty/Dependencies/VulkanSDK/Lib/Windows") + end + add_links("volk") + + target_end() + + -- + target("windowsdx") + + -- TODO! + + target_end() +