summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-07-15 20:59:48 +0800
committerGitHub <[email protected]>2019-07-15 20:59:48 +0800
commit861733b4d417d2b69b79a3720acbe659458aeaf4 (patch)
treea4b6e89a613c960e69c0d92f19348748d2797f59
parentdd8f3463d7b5f6ff96c45ca71238a6ec699ff4f1 (diff)
parent8cd138e181b63fa327b4b3caa3250fb1dce4b407 (diff)
Merge pull request #472 from OpportunityLiu/vsproj
Support call xmake from msbuild
-rw-r--r--scripts/installer.nsi684
-rw-r--r--xmake/core/base/colors.lua8
-rw-r--r--xmake/core/base/dump.lua77
-rw-r--r--xmake/modules/detect/tools/find_nvcc.lua2
-rwxr-xr-xxmake/plugins/project/main.lua39
-rw-r--r--xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua15
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x_solution.lua3
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua39
-rwxr-xr-xxmake/plugins/project/vstudio/impl/vs201x_vcxproj_filters.lua3
-rw-r--r--xmake/plugins/project/vstudio/impl/vsinfo.lua93
-rw-r--r--xmake/plugins/project/vstudio/vs.lua (renamed from xmake/plugins/project/vstudio/vs2002.lua)21
-rw-r--r--xmake/plugins/project/vstudio/vs2005.lua36
-rw-r--r--xmake/plugins/project/vstudio/vs2008.lua36
-rw-r--r--xmake/plugins/project/vstudio/vs2010.lua37
-rw-r--r--xmake/plugins/project/vstudio/vs2012.lua37
-rw-r--r--xmake/plugins/project/vstudio/vs2013.lua37
-rw-r--r--xmake/plugins/project/vstudio/vs2015.lua37
-rwxr-xr-xxmake/plugins/project/vstudio/vs2017.lua37
-rwxr-xr-xxmake/plugins/project/vstudio/vs2019.lua37
-rw-r--r--xmake/plugins/project/vstudio/vsx.lua (renamed from xmake/plugins/project/vstudio/vs2003.lua)23
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua293
-rw-r--r--xmake/plugins/project/vsxmake/render.lua74
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.props141
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/Xmake.targets167
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user10
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props35
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets27
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/sln/ProjConfig(target,mode,arch)2
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/sln/Project(target)2
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/sln/SlnConfig(mode,arch)1
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/sln/vsxmake.sln34
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters46
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj59
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu)1
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj)1
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc)1
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)1
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch)4
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)13
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch)9
-rw-r--r--xmake/plugins/project/vsxmake/vsxmake.lua160
-rw-r--r--xmake/plugins/project/xmake.lua6
-rw-r--r--xmake/themes/dark/xmake.lua4
-rw-r--r--xmake/themes/default/xmake.lua4
-rw-r--r--xmake/themes/emoji/xmake.lua8
-rw-r--r--xmake/themes/plain/xmake.lua4
56 files changed, 1672 insertions, 766 deletions
diff --git a/scripts/installer.nsi b/scripts/installer.nsi
index e05a33dd4..488292aeb 100644
--- a/scripts/installer.nsi
+++ b/scripts/installer.nsi
@@ -1,339 +1,345 @@
-; xmake.nsi
-;
-; This script is perhaps one of the simplest NSIs you can make. All of the
-; optional settings are left to their default settings. The installer simply
-; prompts the user asking them where to install, and drops a copy of xmake.nsi
-; there.
-
-;--------------------------------
-; includes
-!include "MUI2.nsh"
-!include "WordFunc.nsh"
-!include "WinMessages.nsh"
-!include FileFunc.nsh
-!include UAC.nsh
-
-; xmake version Information
-!ifndef MAJOR
- !define MAJOR 2
-!endif
-!ifndef MINOR
- !define MINOR 2
-!endif
-!ifndef ALTER
- !define ALTER 7
-!endif
-!ifndef BUILD
- !define BUILD 201906200000
-!endif
-
-!define VERSION ${MAJOR}.${MINOR}.${ALTER}
-!define VERSION_FULL ${VERSION}+${BUILD}
-
-!ifdef x64
- !define ARCH x64
-!else
- !define ARCH x86
-!endif
-
-;--------------------------------
-
-; The name of the installer
-Name "XMake - v${VERSION}"
-
-; The file to write
-OutFile "xmake.exe"
-
-; The default installation directory
-!ifdef x64
- !define PROGRAMFILES $PROGRAMFILES64
- !define HKLM HKLM64
- !define HKCU HKCU64
-!else
- !define PROGRAMFILES $PROGRAMFILES
- !define HKLM HKLM
- !define HKCU HKCU
-!endif
-
-; Request application privileges for Windows Vista
-RequestExecutionLevel user
-
-; Set DPI Aware
-ManifestDPIAware true
-
-;--------------------------------
-; Interface Settings
-
-!define MUI_ABORTWARNING
-
-;--------------------------------
-; Icon
-!define MUI_ICON "..\core\src\demo\xmake.ico"
-
-;--------------------------------
-; UAC helper
-
-!macro Init thing
- uac_tryagain:
- !insertmacro UAC_RunElevated
- ${Switch} $0
- ${Case} 0
- ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
- ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
- ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
- MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
- ${EndIf}
- ;fall-through and die
- ${Case} 1223
- MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!"
- Quit
- ${Case} 1062
- MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!"
- Quit
- ${Default}
- MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0"
- Quit
- ${EndSwitch}
-
- SetShellVarContext all
-!macroend
-
-;--------------------------------
-; Install Pages
-
-!insertmacro MUI_PAGE_WELCOME
-!insertmacro MUI_PAGE_LICENSE "..\LICENSE.md"
-!insertmacro MUI_PAGE_COMPONENTS
-!insertmacro MUI_PAGE_DIRECTORY
-!insertmacro MUI_PAGE_INSTFILES
-!define MUI_FINISHPAGE_LINK "Donate $$5"
-!define MUI_FINISHPAGE_LINK_LOCATION "https://xmake.io/pages/donation.html#donate"
-!insertmacro MUI_PAGE_FINISH
-
-;--------------------------------
-; Uninstall Pages
-
-!insertmacro MUI_UNPAGE_CONFIRM
-!insertmacro MUI_UNPAGE_INSTFILES
-!insertmacro MUI_UNPAGE_FINISH
-
-;--------------------------------
-; Languages
-
-!insertmacro MUI_LANGUAGE "English"
-
-;--------------------------------
-; Version Information
-
-
-VIProductVersion ${VERSION}.0
-VIFileVersion ${VERSION}.0
-VIAddVersionKey /LANG=0 ProductName XMake
-VIAddVersionKey /LANG=0 Comments "A cross-platform build utility based on Lua$\nwebsite: https://xmake.io"
-VIAddVersionKey /LANG=0 CompanyName "The TBOOX Open Source Group"
-VIAddVersionKey /LANG=0 LegalCopyright "Copyright (C) 2015-2019 Ruki Wang, tboox.org, xmake.io$\nCopyright (C) 2005-2015 Mike Pall, luajit.org"
-VIAddVersionKey /LANG=0 FileDescription "XMake Installer - v${VERSION}"
-VIAddVersionKey /LANG=0 OriginalFilename "xmake-${ARCH}.exe"
-VIAddVersionKey /LANG=0 FileVersion ${VERSION_FULL}
-VIAddVersionKey /LANG=0 ProductVersion ${VERSION_FULL}
-
-
-;--------------------------------
-; Reg pathes
-
-!define RegUninstall "Software\Microsoft\Windows\CurrentVersion\Uninstall\XMake"
-
-;--------------------------------
-
-Var NOADMIN
-
-Function TrimQuote
- Exch $R1 ; Original string
- Push $R2
-
-Loop:
- StrCpy $R2 "$R1" 1
- StrCmp "$R2" "'" TrimLeft
- StrCmp "$R2" "$\"" TrimLeft
- StrCmp "$R2" "$\r" TrimLeft
- StrCmp "$R2" "$\n" TrimLeft
- StrCmp "$R2" "$\t" TrimLeft
- StrCmp "$R2" " " TrimLeft
- GoTo Loop2
-TrimLeft:
- StrCpy $R1 "$R1" "" 1
- Goto Loop
-
-Loop2:
- StrCpy $R2 "$R1" 1 -1
- StrCmp "$R2" "'" TrimRight
- StrCmp "$R2" "$\"" TrimRight
- StrCmp "$R2" "$\r" TrimRight
- StrCmp "$R2" "$\n" TrimRight
- StrCmp "$R2" "$\t" TrimRight
- StrCmp "$R2" " " TrimRight
- GoTo Done
-TrimRight:
- StrCpy $R1 "$R1" -1
- Goto Loop2
-
-Done:
- Pop $R2
- Exch $R1
-FunctionEnd
-
-; Installer
-Function .onInit
- ${GetOptions} $CMDLINE "/NOADMIN" $NOADMIN
- ${If} ${Errors}
- !insertmacro Init "installer"
- StrCpy $NOADMIN "false"
- ${Else}
- StrCpy $NOADMIN "true"
- ${EndIf}
-
- ; load from reg
- ${If} $InstDir == ""
- ${If} $NOADMIN == "false"
- ReadRegStr $R0 ${HKLM} ${RegUninstall} "InstallLocation"
- ${Else}
- ReadRegStr $R0 ${HKCU} ${RegUninstall} "InstallLocation"
- ${EndIf}
- ${If} $R0 != ""
- Push $R0
- Call TrimQuote
- Pop $R0
- StrCpy $InstDir $R0
- ${EndIf}
- ${EndIf}
- ; use default
- ${If} $InstDir == ""
- StrCpy $InstDir ${PROGRAMFILES}\xmake
- ${EndIf}
-
-FunctionEnd
-
-Section "XMake (required)" InstallExeutable
-
- SectionIn RO
-
- ; Set output path to the installation directory.
- SetOutPath $InstDir
-
- ; Remove previous directories used
- RMDir /r "$InstDir"
-
- ; Put file there
- File /r /x ".DS_Store" /x "*.swp" "..\xmake\*.*"
- File "..\*.md"
- File "..\core\build\xmake.exe"
- File /r /x ".DS_Store" "..\winenv"
-
- WriteUninstaller "uninstall.exe"
-
- !macro AddReg RootKey
-
- ; Write uac info
- WriteRegStr ${RootKey} ${RegUninstall} "NoAdmin" "$NOADMIN"
-
- ; Write the uninstall keys for Windows
- WriteRegStr ${RootKey} ${RegUninstall} "DisplayName" "XMake build utility"
- WriteRegStr ${RootKey} ${RegUninstall} "DisplayIcon" '"$InstDir\xmake.exe"'
- WriteRegStr ${RootKey} ${RegUninstall} "Comments" "A cross-platform build utility based on Lua"
- WriteRegStr ${RootKey} ${RegUninstall} "Publisher" "The TBOOX Open Source Group"
- WriteRegStr ${RootKey} ${RegUninstall} "UninstallString" '"$InstDir\uninstall.exe"'
- WriteRegStr ${RootKey} ${RegUninstall} "QuiteUninstallString" '"$InstDir\uninstall.exe" /S'
- WriteRegStr ${RootKey} ${RegUninstall} "InstallLocation" $InstDir
- WriteRegStr ${RootKey} ${RegUninstall} "HelpLink" 'https://xmake.io/'
- WriteRegStr ${RootKey} ${RegUninstall} "URLInfoAbout" 'https://github.com/xmake-io/xmake'
- WriteRegStr ${RootKey} ${RegUninstall} "URLUpdateInfo" 'https://github.com/xmake-io/xmake/releases'
- WriteRegDWORD ${RootKey} ${RegUninstall} "VersionMajor" ${MAJOR}
- WriteRegDWORD ${RootKey} ${RegUninstall} "VersionMinor" ${MINOR}
- WriteRegStr ${RootKey} ${RegUninstall} "DisplayVersion" ${VERSION_FULL}
- WriteRegDWORD ${RootKey} ${RegUninstall} "NoModify" 1
- WriteRegDWORD ${RootKey} ${RegUninstall} "NoRepair" 1
-
- ;write size to reg
- ${GetSize} "$InstDir" "/S=0K" $0 $1 $2
- IntFmt $0 "0x%08X" $0
- WriteRegDWORD ${RootKey} ${RegUninstall} "EstimatedSize" "$0"
- !macroend
-
- ${If} $NOADMIN == "false"
- !insertmacro AddReg ${HKLM}
- ${Else}
- !insertmacro AddReg ${HKCU}
- ${EndIf}
-
-SectionEnd
-
-Section "Add to PATH" InstallPath
-
- !macro AddRegPATH RootKey
- ; Remove the installation path from the $PATH environment variable first
- ReadRegStr $R0 ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
- ${WordReplace} $R0 ";$InstDir" "" "+" $R1
-
- ; Write the installation path into the $PATH environment variable
- WriteRegExpandStr ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1;$InstDir"
- !macroend
-
- ${If} $NOADMIN == "false"
- !insertmacro AddRegPATH ${HKLM}
- ${Else}
- !insertmacro AddRegPATH ${HKCU}
- ${EndIf}
-
-SectionEnd
-
-;--------------------------------
-; Descriptions
-
-; Language strings
-LangString DESC_InstallExeutable ${LANG_ENGLISH} "A cross-platform build utility based on Lua"
-LangString DESC_InstallPath ${LANG_ENGLISH} "Add xmake to PATH"
-
-; Assign language strings to sections
-!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
-!insertmacro MUI_DESCRIPTION_TEXT ${InstallExeutable} $(DESC_InstallExeutable)
-!insertmacro MUI_DESCRIPTION_TEXT ${InstallPath} $(DESC_InstallPath)
-!insertmacro MUI_FUNCTION_DESCRIPTION_END
-
-;--------------------------------
-
-; Uninstaller
-
-Function un.onInit
- ; check if we need uac
- ReadRegStr $NOADMIN ${HKLM} ${RegUninstall} "NoAdmin"
- IfErrors 0 +2
- ReadRegStr $NOADMIN ${HKCU} ${RegUninstall} "NoAdmin"
-
- ${IfNot} $NOADMIN == "true"
- !insertmacro Init "uninstaller"
- ${EndIf}
-
-FunctionEnd
-
-Section "Uninstall"
-
- !macro RemoveReg RootKey
- ; Remove registry keys
- DeleteRegKey ${RootKey} ${RegUninstall}
-
- ; Remove the installation path from the $PATH environment variable
- ReadRegStr $R0 ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
- ${WordReplace} $R0 ";$InstDir" "" "+" $R1
- ; MessageBox MB_OK|MB_USERICON '$R0 - $InstDir - $R1 '
- WriteRegExpandStr ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1"
- !macroend
-
- ; Remove directories used
- RMDir /r "$InstDir"
- ${If} $NOADMIN == "false"
- !insertmacro RemoveReg ${HKLM}
- ${Else}
- !insertmacro RemoveReg ${HKCU}
- ${EndIf}
-
-SectionEnd
+; xmake.nsi
+;
+; This script is perhaps one of the simplest NSIs you can make. All of the
+; optional settings are left to their default settings. The installer simply
+; prompts the user asking them where to install, and drops a copy of xmake.nsi
+; there.
+
+;--------------------------------
+; includes
+!include "MUI2.nsh"
+!include "WordFunc.nsh"
+!include "WinMessages.nsh"
+!include FileFunc.nsh
+!include UAC.nsh
+
+; xmake version Information
+!ifndef MAJOR
+ !define MAJOR 2
+!endif
+!ifndef MINOR
+ !define MINOR 2
+!endif
+!ifndef ALTER
+ !define ALTER 7
+!endif
+!ifndef BUILD
+ !define BUILD 201906200000
+!endif
+
+!define VERSION ${MAJOR}.${MINOR}.${ALTER}
+!define VERSION_FULL ${VERSION}+${BUILD}
+
+!ifdef x64
+ !define ARCH x64
+!else
+ !define ARCH x86
+!endif
+
+;--------------------------------
+
+; The name of the installer
+Name "XMake - v${VERSION}"
+
+; The file to write
+OutFile "xmake.exe"
+
+; Use unicode
+Unicode true
+
+; Use best compressor
+SetCompressor /FINAL /SOLID lzma
+
+; The default installation directory
+!ifdef x64
+ !define PROGRAMFILES $PROGRAMFILES64
+ !define HKLM HKLM64
+ !define HKCU HKCU64
+!else
+ !define PROGRAMFILES $PROGRAMFILES
+ !define HKLM HKLM
+ !define HKCU HKCU
+!endif
+
+; Request application privileges for Windows Vista
+RequestExecutionLevel user
+
+; Set DPI Aware
+ManifestDPIAware true
+
+;--------------------------------
+; Interface Settings
+
+!define MUI_ABORTWARNING
+
+;--------------------------------
+; Icon
+!define MUI_ICON "..\core\src\demo\xmake.ico"
+
+;--------------------------------
+; UAC helper
+
+!macro Init thing
+ uac_tryagain:
+ !insertmacro UAC_RunElevated
+ ${Switch} $0
+ ${Case} 0
+ ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
+ ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
+ ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
+ MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
+ ${EndIf}
+ ;fall-through and die
+ ${Case} 1223
+ MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!"
+ Quit
+ ${Case} 1062
+ MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!"
+ Quit
+ ${Default}
+ MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0"
+ Quit
+ ${EndSwitch}
+
+ SetShellVarContext all
+!macroend
+
+;--------------------------------
+; Install Pages
+
+!insertmacro MUI_PAGE_WELCOME
+!insertmacro MUI_PAGE_LICENSE "..\LICENSE.md"
+!insertmacro MUI_PAGE_COMPONENTS
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+!define MUI_FINISHPAGE_LINK "Donate $$5"
+!define MUI_FINISHPAGE_LINK_LOCATION "https://xmake.io/pages/donation.html#donate"
+!insertmacro MUI_PAGE_FINISH
+
+;--------------------------------
+; Uninstall Pages
+
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+!insertmacro MUI_UNPAGE_FINISH
+
+;--------------------------------
+; Languages
+
+!insertmacro MUI_LANGUAGE "English"
+
+;--------------------------------
+; Version Information
+
+
+VIProductVersion ${VERSION}.0
+VIFileVersion ${VERSION}.0
+VIAddVersionKey /LANG=0 ProductName XMake
+VIAddVersionKey /LANG=0 Comments "A cross-platform build utility based on Lua$\nwebsite: https://xmake.io"
+VIAddVersionKey /LANG=0 CompanyName "The TBOOX Open Source Group"
+VIAddVersionKey /LANG=0 LegalCopyright "Copyright (C) 2015-2019 Ruki Wang, tboox.org, xmake.io$\nCopyright (C) 2005-2015 Mike Pall, luajit.org"
+VIAddVersionKey /LANG=0 FileDescription "XMake Installer - v${VERSION}"
+VIAddVersionKey /LANG=0 OriginalFilename "xmake-${ARCH}.exe"
+VIAddVersionKey /LANG=0 FileVersion ${VERSION_FULL}
+VIAddVersionKey /LANG=0 ProductVersion ${VERSION_FULL}
+
+
+;--------------------------------
+; Reg pathes
+
+!define RegUninstall "Software\Microsoft\Windows\CurrentVersion\Uninstall\XMake"
+
+;--------------------------------
+
+Var NOADMIN
+
+Function TrimQuote
+ Exch $R1 ; Original string
+ Push $R2
+
+Loop:
+ StrCpy $R2 "$R1" 1
+ StrCmp "$R2" "'" TrimLeft
+ StrCmp "$R2" "$\"" TrimLeft
+ StrCmp "$R2" "$\r" TrimLeft
+ StrCmp "$R2" "$\n" TrimLeft
+ StrCmp "$R2" "$\t" TrimLeft
+ StrCmp "$R2" " " TrimLeft
+ GoTo Loop2
+TrimLeft:
+ StrCpy $R1 "$R1" "" 1
+ Goto Loop
+
+Loop2:
+ StrCpy $R2 "$R1" 1 -1
+ StrCmp "$R2" "'" TrimRight
+ StrCmp "$R2" "$\"" TrimRight
+ StrCmp "$R2" "$\r" TrimRight
+ StrCmp "$R2" "$\n" TrimRight
+ StrCmp "$R2" "$\t" TrimRight
+ StrCmp "$R2" " " TrimRight
+ GoTo Done
+TrimRight:
+ StrCpy $R1 "$R1" -1
+ Goto Loop2
+
+Done:
+ Pop $R2
+ Exch $R1
+FunctionEnd
+
+; Installer
+Function .onInit
+ ${GetOptions} $CMDLINE "/NOADMIN" $NOADMIN
+ ${If} ${Errors}
+ !insertmacro Init "installer"
+ StrCpy $NOADMIN "false"
+ ${Else}
+ StrCpy $NOADMIN "true"
+ ${EndIf}
+
+ ; load from reg
+ ${If} $InstDir == ""
+ ${If} $NOADMIN == "false"
+ ReadRegStr $R0 ${HKLM} ${RegUninstall} "InstallLocation"
+ ${Else}
+ ReadRegStr $R0 ${HKCU} ${RegUninstall} "InstallLocation"
+ ${EndIf}
+ ${If} $R0 != ""
+ Push $R0
+ Call TrimQuote
+ Pop $R0
+ StrCpy $InstDir $R0
+ ${EndIf}
+ ${EndIf}
+ ; use default
+ ${If} $InstDir == ""
+ StrCpy $InstDir ${PROGRAMFILES}\xmake
+ ${EndIf}
+
+FunctionEnd
+
+Section "XMake (required)" InstallExeutable
+
+ SectionIn RO
+
+ ; Set output path to the installation directory.
+ SetOutPath $InstDir
+
+ ; Remove previous directories used
+ RMDir /r "$InstDir"
+
+ ; Put file there
+ File /r /x ".DS_Store" /x "*.swp" "..\xmake\*.*"
+ File "..\*.md"
+ File "..\core\build\xmake.exe"
+ File /r /x ".DS_Store" "..\winenv"
+
+ WriteUninstaller "uninstall.exe"
+
+ !macro AddReg RootKey
+
+ ; Write uac info
+ WriteRegStr ${RootKey} ${RegUninstall} "NoAdmin" "$NOADMIN"
+
+ ; Write the uninstall keys for Windows
+ WriteRegStr ${RootKey} ${RegUninstall} "DisplayName" "XMake build utility"
+ WriteRegStr ${RootKey} ${RegUninstall} "DisplayIcon" '"$InstDir\xmake.exe"'
+ WriteRegStr ${RootKey} ${RegUninstall} "Comments" "A cross-platform build utility based on Lua"
+ WriteRegStr ${RootKey} ${RegUninstall} "Publisher" "The TBOOX Open Source Group"
+ WriteRegStr ${RootKey} ${RegUninstall} "UninstallString" '"$InstDir\uninstall.exe"'
+ WriteRegStr ${RootKey} ${RegUninstall} "QuiteUninstallString" '"$InstDir\uninstall.exe" /S'
+ WriteRegStr ${RootKey} ${RegUninstall} "InstallLocation" $InstDir
+ WriteRegStr ${RootKey} ${RegUninstall} "HelpLink" 'https://xmake.io/'
+ WriteRegStr ${RootKey} ${RegUninstall} "URLInfoAbout" 'https://github.com/xmake-io/xmake'
+ WriteRegStr ${RootKey} ${RegUninstall} "URLUpdateInfo" 'https://github.com/xmake-io/xmake/releases'
+ WriteRegDWORD ${RootKey} ${RegUninstall} "VersionMajor" ${MAJOR}
+ WriteRegDWORD ${RootKey} ${RegUninstall} "VersionMinor" ${MINOR}
+ WriteRegStr ${RootKey} ${RegUninstall} "DisplayVersion" ${VERSION_FULL}
+ WriteRegDWORD ${RootKey} ${RegUninstall} "NoModify" 1
+ WriteRegDWORD ${RootKey} ${RegUninstall} "NoRepair" 1
+
+ ;write size to reg
+ ${GetSize} "$InstDir" "/S=0K" $0 $1 $2
+ IntFmt $0 "0x%08X" $0
+ WriteRegDWORD ${RootKey} ${RegUninstall} "EstimatedSize" "$0"
+ !macroend
+
+ ${If} $NOADMIN == "false"
+ !insertmacro AddReg ${HKLM}
+ ${Else}
+ !insertmacro AddReg ${HKCU}
+ ${EndIf}
+
+SectionEnd
+
+Section "Add to PATH" InstallPath
+
+ !macro AddRegPATH RootKey
+ ; Remove the installation path from the $PATH environment variable first
+ ReadRegStr $R0 ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
+ ${WordReplace} $R0 ";$InstDir" "" "+" $R1
+
+ ; Write the installation path into the $PATH environment variable
+ WriteRegExpandStr ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1;$InstDir"
+ !macroend
+
+ ${If} $NOADMIN == "false"
+ !insertmacro AddRegPATH ${HKLM}
+ ${Else}
+ !insertmacro AddRegPATH ${HKCU}
+ ${EndIf}
+
+SectionEnd
+
+;--------------------------------
+; Descriptions
+
+; Language strings
+LangString DESC_InstallExeutable ${LANG_ENGLISH} "A cross-platform build utility based on Lua"
+LangString DESC_InstallPath ${LANG_ENGLISH} "Add xmake to PATH"
+
+; Assign language strings to sections
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+!insertmacro MUI_DESCRIPTION_TEXT ${InstallExeutable} $(DESC_InstallExeutable)
+!insertmacro MUI_DESCRIPTION_TEXT ${InstallPath} $(DESC_InstallPath)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;--------------------------------
+
+; Uninstaller
+
+Function un.onInit
+ ; check if we need uac
+ ReadRegStr $NOADMIN ${HKLM} ${RegUninstall} "NoAdmin"
+ IfErrors 0 +2
+ ReadRegStr $NOADMIN ${HKCU} ${RegUninstall} "NoAdmin"
+
+ ${IfNot} $NOADMIN == "true"
+ !insertmacro Init "uninstaller"
+ ${EndIf}
+
+FunctionEnd
+
+Section "Uninstall"
+
+ !macro RemoveReg RootKey
+ ; Remove registry keys
+ DeleteRegKey ${RootKey} ${RegUninstall}
+
+ ; Remove the installation path from the $PATH environment variable
+ ReadRegStr $R0 ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
+ ${WordReplace} $R0 ";$InstDir" "" "+" $R1
+ ; MessageBox MB_OK|MB_USERICON '$R0 - $InstDir - $R1 '
+ WriteRegExpandStr ${RootKey} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1"
+ !macroend
+
+ ; Remove directories used
+ RMDir /r "$InstDir"
+ ${If} $NOADMIN == "false"
+ !insertmacro RemoveReg ${HKLM}
+ ${Else}
+ !insertmacro RemoveReg ${HKCU}
+ ${EndIf}
+
+SectionEnd
diff --git a/xmake/core/base/colors.lua b/xmake/core/base/colors.lua
index d44670fab..5df37b54a 100644
--- a/xmake/core/base/colors.lua
+++ b/xmake/core/base/colors.lua
@@ -260,6 +260,7 @@ end
-- @param str the string with colors
-- @param opt options
-- patch_reset: wrap str with `"${reset}"`?
+-- ignore_unknown: ignore unknown codes like `"${unknown_code}"`?
--
-- 8 colors:
--
@@ -340,12 +341,12 @@ function colors.translate(str, opt)
for _, theme_block_sub in ipairs(theme_block:split("%s")) do
table.insert(blocks, theme_block_sub)
end
- else
+ else
table.insert(blocks, block)
end
elseif block:startswith("color.") or block:startswith("text.") then
local default_theme = {["color.error"] = "red", ["color.warning"] = "yellow", ["text.error"] = "error", ["text.warning"] = "warning"}
- local theme_block = default_theme[block]
+ local theme_block = default_theme[block]
if theme_block then
table.insert(blocks, theme_block)
else
@@ -384,7 +385,8 @@ function colors.translate(str, opt)
local emoji_code = emoji.translate(block)
if emoji_code then
table.insert(text_buffer, emoji_code)
- else
+ elseif not opt.ignore_unknown then
+ -- unknown code, regard as plain text
table.insert(text_buffer, block)
end
end
diff --git a/xmake/core/base/dump.lua b/xmake/core/base/dump.lua
index 34e54508a..cfa25918b 100644
--- a/xmake/core/base/dump.lua
+++ b/xmake/core/base/dump.lua
@@ -28,34 +28,42 @@ local table = require("base/table")
-- format string with theme colors
function dump._format(fmtkey, fmtdefault, ...)
local theme = colors.theme()
- local fmt = theme and theme:get(fmtkey) or fmtdefault
- return string.format(fmt, ...)
+ if theme then
+ return colors.translate(string.format(theme:get(fmtkey), ...), { patch_reset = false, ignore_unknown = true })
+ else
+ return string.format(fmtdefault, ...)
+ end
+end
+
+-- translate string with theme formats
+function dump._translate(str)
+ return colors.translate(str, { patch_reset = false, ignore_unknown = true })
end
-- print string
function dump._print_string(str, as_key)
local quote = (not as_key) or (not str:match("^[a-zA-Z_][a-zA-Z0-9_]*$"))
if quote then
- io.write(colors.translate("${reset}${color.dump.string_quote}\"${reset}${color.dump.string}", { patch_reset = false }))
+ io.write(dump._translate("${reset}${color.dump.string_quote}\"${reset}${color.dump.string}"))
else
- io.write(colors.translate("${reset}${color.dump.string}", { patch_reset = false }))
+ io.write(dump._translate("${reset}${color.dump.string}"))
end
io.write(str)
if quote then
- io.write(colors.translate("${reset}${color.dump.string_quote}\"${reset}", { patch_reset = false }))
+ io.write(dump._translate("${reset}${color.dump.string_quote}\"${reset}"))
else
- io.write(colors.translate("${reset}", { patch_reset = false }))
+ io.write(dump._translate("${reset}"))
end
end
-- print keyword
function dump._print_keyword(keyword)
- io.write(colors.translate("${color.dump.keyword}" .. tostring(keyword)))
+ io.write(dump._translate("${reset}${color.dump.keyword}"), tostring(keyword), dump._translate("${reset}"))
end
-- print number
function dump._print_number(num)
- io.write(colors.translate("${color.dump.number}" .. tostring(num)))
+ io.write(dump._translate("${reset}${color.dump.number}"), tostring(num), dump._translate("${reset}"))
end
-- print function
@@ -68,14 +76,23 @@ function dump._print_function(func, as_key)
if funcinfo.linedefined >= 0 then
srcinfo = srcinfo .. ":" .. funcinfo.linedefined
end
- io.write(colors.translate("${color.dump.function}function ${bright}" .. (funcinfo.name or "") .. "${reset}${dim}" .. srcinfo))
+ local funcname = funcinfo.name and (funcinfo.name .. " ") or ""
+ io.write(dump._translate("${reset}${color.dump.function}function ${bright}"), funcname, dump._translate("${reset}${dim}"), srcinfo)
end
-- print value with default format
function dump._print_default(value)
- io.write(colors.translate("${color.dump.default}", { patch_reset = false }))
- io.write(dump._format("text.dump.default_format", "%s", value))
- io.write(colors.translate("${reset}", { patch_reset = false }))
+ io.write(dump._translate("${reset}${color.dump.default}"), dump._format("text.dump.default_format", "<%s>", value), dump._translate("${reset}"))
+end
+
+-- print udata value with scalar format
+function dump._print_udata_scalar(value)
+ io.write(dump._translate("${reset}${color.dump.udata}"), dump._format("text.dump.udata_format", "[%s]", value), dump._translate("${reset}"))
+end
+
+-- print table value with scalar format
+function dump._print_table_scalar(value)
+ io.write(dump._translate("${reset}${color.dump.table}"), dump._format("text.dump.table_format", "{%s}", value), dump._translate("${reset}"))
end
-- print scalar value
@@ -90,6 +107,10 @@ function dump._print_scalar(value, as_key)
dump._print_string(value, as_key)
elseif type(value) == "function" then
dump._print_function(value, as_key)
+ elseif type(value) == "userdata" then
+ dump._print_udata_scalar(value)
+ elseif type(value) == "table" then
+ dump._print_table_scalar(value)
else
dump._print_default(value)
end
@@ -97,17 +118,15 @@ end
-- print anchor
function dump._print_anchor(value)
- io.write(colors.translate("${color.dump.anchor}", { patch_reset = false }))
- io.write(dump._format("text.dump.anchor", "&%s", value))
- io.write(colors.translate("${reset}", { patch_reset = false }))
+ io.write(dump._translate("${color.dump.anchor}"), dump._format("text.dump.anchor", "&%s", value), dump._translate("${reset}"))
end
+
-- print reference
function dump._print_reference(value)
- io.write(colors.translate("${color.dump.reference}", { patch_reset = false }))
- io.write(dump._format("text.dump.reference", "*%s", value))
- io.write(colors.translate("${reset}", { patch_reset = false }))
+ io.write(dump._translate("${color.dump.reference}"), dump._format("text.dump.reference", "*%s", value), dump._translate("${reset}"))
end
+-- print anchor and store to printed_set
function dump._print_table_anchor(value, printed_set)
printed_set.len = printed_set.len + 1
io.write(" ")
@@ -115,6 +134,7 @@ function dump._print_table_anchor(value, printed_set)
printed_set[value] = printed_set.len
end
+-- print metatable of value
function dump._print_metatable(value, metatable, inner_indent, printed_set, print_archor)
if not metatable then
return false
@@ -136,7 +156,7 @@ function dump._print_metatable(value, metatable, inner_indent, printed_set, prin
io.write("\n", inner_indent)
local funcname = k:sub(3)
dump._print_keyword(funcname)
- io.write(colors.translate("${dim} = "))
+ io.write(dump._translate("${reset} ${dim}=${reset} "))
if funcname == "tostring" or funcname == "len" then
local ok, result = pcall(v, value, value)
if ok then
@@ -173,7 +193,7 @@ function dump._print_metatable(value, metatable, inner_indent, printed_set, prin
dump._print_keyword("(")
dump._print_scalar(k, true)
dump._print_keyword(")")
- io.write(colors.translate("${dim} = "))
+ io.write(dump._translate("${reset} ${dim}=${reset} "))
if v and printed_set[v] then
dump._print_reference(printed_set[v])
else
@@ -193,16 +213,16 @@ function dump._print_udata(value, first_indent, remain_indent)
local inner_indent = remain_indent .. " "
-- print open brackets
- io.write(colors.translate("${dim}["))
+ io.write(dump._translate("${reset}${color.dump.udata}[${reset}"))
-- print metatable
local no_value = not dump._print_metatable(value, metatable, inner_indent, { len = 0 }, false)
-- print close brackets
if no_value then
- io.write(colors.translate(" ${dim}]"))
+ io.write(dump._translate(" ${color.dump.udata}]${reset}"))
else
- io.write("\b \n" .. remain_indent .. colors.translate("${dim}]"))
+ io.write("\b \n", remain_indent, dump._translate("${reset}${color.dump.udata}]${reset}"))
end
end
@@ -216,7 +236,7 @@ function dump._print_table(value, first_indent, remain_indent, printed_set)
if not first_level and tostringmethod then
local ok, strrep = pcall(tostringmethod, value, value)
if ok then
- return dump._print_default(strrep)
+ return dump._print_table_scalar(strrep)
end
end
printed_set = printed_set or { len = 0 }
@@ -224,7 +244,7 @@ function dump._print_table(value, first_indent, remain_indent, printed_set)
local first_value = true
-- print open brackets
- io.write(colors.translate("${dim}{"))
+ io.write(dump._translate("${reset}${color.dump.table}{${reset}"))
local function print_newline()
if first_value then
@@ -235,6 +255,7 @@ function dump._print_table(value, first_indent, remain_indent, printed_set)
end
if first_level then
+ -- print metatable
first_value = not dump._print_metatable(value, metatable, inner_indent, printed_set, true)
end
@@ -262,7 +283,7 @@ function dump._print_table(value, first_indent, remain_indent, printed_set)
if not is_arr or type(k) ~= "number" then
print_newline()
dump._print_scalar(k, true)
- io.write(colors.translate("${dim} = "))
+ io.write(dump._translate("${reset} ${dim}=${reset} "))
if type(v) == "table" then
if printed_set[v] then
dump._print_reference(printed_set[v])
@@ -278,9 +299,9 @@ function dump._print_table(value, first_indent, remain_indent, printed_set)
-- print close brackets
if first_value then
- io.write(colors.translate(" ${dim}}"))
+ io.write(dump._translate(" ${color.dump.table}}${reset}"))
else
- io.write("\b \n" .. remain_indent .. colors.translate("${dim}}"))
+ io.write("\b \n", remain_indent, dump._translate("${reset}${color.dump.table}}${reset}"))
end
end
diff --git a/xmake/modules/detect/tools/find_nvcc.lua b/xmake/modules/detect/tools/find_nvcc.lua
index 5b97f3dc9..ce98c9a60 100644
--- a/xmake/modules/detect/tools/find_nvcc.lua
+++ b/xmake/modules/detect/tools/find_nvcc.lua
@@ -51,7 +51,7 @@ function main(opt)
-- not found? attempt to find program from cuda toolchains
if not program then
- local toolchains = find_cuda(config.get("cuda"))
+ local toolchains = find_cuda()
if toolchains and toolchains.bindir then
program = find_program(path.join(toolchains.bindir, "nvcc"), opt)
end
diff --git a/xmake/plugins/project/main.lua b/xmake/plugins/project/main.lua
index e56795086..d2ce39a10 100755
--- a/xmake/plugins/project/main.lua
+++ b/xmake/plugins/project/main.lua
@@ -24,16 +24,9 @@ import("core.base.task")
import("core.platform.environment")
import("make.makefile")
import("cmake.cmakelists")
-import("vstudio.vs2002")
-import("vstudio.vs2003")
-import("vstudio.vs2005")
-import("vstudio.vs2008")
-import("vstudio.vs2010")
-import("vstudio.vs2012")
-import("vstudio.vs2013")
-import("vstudio.vs2015")
-import("vstudio.vs2017")
-import("vstudio.vs2019")
+import("vstudio.vs")
+import("vstudio.vsx")
+import("vsxmake.vsxmake")
import("clang.compile_flags")
import("clang.compile_commands")
@@ -45,16 +38,22 @@ function _make(kind)
{
makefile = makefile.make
, cmakelists = cmakelists.make
- , vs2002 = vs2002.make
- , vs2003 = vs2003.make
- , vs2005 = vs2005.make
- , vs2008 = vs2008.make
- , vs2010 = vs2010.make
- , vs2012 = vs2012.make
- , vs2013 = vs2013.make
- , vs2015 = vs2015.make
- , vs2017 = vs2017.make
- , vs2019 = vs2019.make
+ , vs2002 = vs.make(2002)
+ , vs2003 = vs.make(2003)
+ , vs2005 = vs.make(2005)
+ , vs2008 = vs.make(2008)
+ , vs2010 = vsx.make(2010)
+ , vs2012 = vsx.make(2012)
+ , vs2013 = vsx.make(2013)
+ , vs2015 = vsx.make(2015)
+ , vs2017 = vsx.make(2017)
+ , vs2019 = vsx.make(2019)
+ , vsxmake2010 = vsxmake.make(2010)
+ , vsxmake2012 = vsxmake.make(2012)
+ , vsxmake2013 = vsxmake.make(2013)
+ , vsxmake2015 = vsxmake.make(2015)
+ , vsxmake2017 = vsxmake.make(2017)
+ , vsxmake2019 = vsxmake.make(2019)
, compile_flags = compile_flags.make
, compile_commands = compile_commands.make
}
diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua
index 61878af6a..91769a6bf 100644
--- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua
+++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua
@@ -97,7 +97,7 @@ function _make_linkflags(target, vcprojdir)
-- save flag
table.insert(flags, flag)
end
-
+
-- make flags string
flags = os.args(flags)
@@ -114,20 +114,11 @@ function _make_header(vcprojfile, vsinfo, target)
-- the target name
local targetname = target:name()
- -- the versions
- local versions =
- {
- vs2002 = '7.0'
- , vs2003 = '7.1'
- , vs2005 = '8.0'
- , vs2008 = '9.0'
- }
-
-- make header
- vcprojfile:print("<?xml version=\"1.0\" encoding=\"gb2312\"?>")
+ vcprojfile:print("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
vcprojfile:enter("<VisualStudioProject")
vcprojfile:print("ProjectType=\"Visual C++\"")
- vcprojfile:print("Version=\"%s0\"", assert(versions["vs" .. vsinfo.vstudio_version]))
+ vcprojfile:print("Version=\"%s0\"", assert(vsinfo.project_version))
vcprojfile:print("Name=\"%s\"", targetname)
vcprojfile:print("ProjectGUID=\"{%s}\"", hash.uuid(targetname))
vcprojfile:print("RootNamespace=\"%s\"", targetname)
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_solution.lua b/xmake/plugins/project/vstudio/impl/vs201x_solution.lua
index 3cd2ce4e0..d38ac15cf 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x_solution.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_solution.lua
@@ -116,7 +116,4 @@ function make(vsinfo)
-- exit solution file
slnfile:close()
-
- -- convert gb2312 to utf8
- io.writefile(slnpath, io.readfile(slnpath):convert("gb2312", "utf8"))
end
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
index 8545ee802..6fea45987 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
@@ -26,17 +26,6 @@ import("vsfile")
-- get toolset version
function _get_toolset_ver(targetinfo, vsinfo)
- -- the toolset versions
- local toolset_vers =
- {
- vs2010 = "v100"
- , vs2012 = "v110"
- , vs2013 = "v120"
- , vs2015 = "v140"
- , vs2017 = "v141"
- , vs2019 = "v142"
- }
-
-- get toolset version from vs version
local toolset_ver = nil
local vs_toolset = config.get("vs_toolset")
@@ -45,7 +34,7 @@ function _get_toolset_ver(targetinfo, vsinfo)
toolset_ver = "v" .. verinfo[1] .. (verinfo[2] or "0")
end
if not toolset_ver then
- toolset_ver = toolset_vers["vs" .. vsinfo.vstudio_version]
+ toolset_ver = vsinfo.toolset_version
end
-- for xp?
@@ -63,14 +52,6 @@ end
-- get platform sdk version
function _get_platform_sdkver(target, vsinfo)
- -- the default sdk version
- local sdkvers =
- {
- vs2015 = "10.0.10240.0"
- , vs2017 = "10.0.14393.0"
- , vs2019 = "10.0.17763.0"
- }
-
-- get sdk version for vcvarsall[arch].WindowsSDKVersion
local sdkver = nil
for _, targetinfo in ipairs(target.info) do
@@ -81,7 +62,7 @@ function _get_platform_sdkver(target, vsinfo)
end
-- done
- return sdkver or sdkvers["vs" .. vsinfo.vstudio_version]
+ return sdkver or vsinfo.sdk_version
end
-- make compiling command
@@ -167,20 +148,9 @@ end
-- make header
function _make_header(vcxprojfile, vsinfo)
- -- the versions
- local versions =
- {
- vs2010 = '4'
- , vs2012 = '4'
- , vs2013 = '12'
- , vs2015 = '14'
- , vs2017 = '15'
- , vs2019 = '16'
- }
-
-- make header
vcxprojfile:print("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
- vcxprojfile:enter("<Project DefaultTargets=\"Build\" ToolsVersion=\"%s.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">", assert(versions["vs" .. vsinfo.vstudio_version]))
+ vcxprojfile:enter("<Project DefaultTargets=\"Build\" ToolsVersion=\"%s.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">", assert(vsinfo.project_version))
end
-- make tailer
@@ -813,7 +783,4 @@ function make(vsinfo, target)
-- exit solution file
vcxprojfile:close()
-
- -- convert gb2312 to utf8
- io.writefile(vcxprojpath, io.readfile(vcxprojpath):convert("gb2312", "utf8"))
end
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj_filters.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj_filters.lua
index 0a850bda1..d241dd909 100755
--- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj_filters.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj_filters.lua
@@ -161,7 +161,4 @@ function make(vsinfo, target)
-- exit solution file
filtersfile:close()
-
- -- convert gb2312 to utf8
- io.writefile(filterspath, io.readfile(filterspath):convert("gb2312", "utf8"))
end
diff --git a/xmake/plugins/project/vstudio/impl/vsinfo.lua b/xmake/plugins/project/vstudio/impl/vsinfo.lua
new file mode 100644
index 000000000..3da30d398
--- /dev/null
+++ b/xmake/plugins/project/vstudio/impl/vsinfo.lua
@@ -0,0 +1,93 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
+--
+-- @author OpportunityLiu
+-- @file vsinfo.lua
+--
+
+local vsinfo =
+{
+ [2002] =
+ { vstudio_version = "2002"
+ , solution_version = "7"
+ , project_version = "7.0"
+ }
+, [2003] =
+ { vstudio_version = "2003"
+ , solution_version = "8"
+ , project_version = "7.1"
+ }
+, [2005] =
+ { vstudio_version = "2005"
+ , solution_version = "9"
+ , project_version = "8.0"
+ }
+, [2008] =
+ { vstudio_version = "2008"
+ , solution_version = "10"
+ , project_version = "9.0"
+ }
+, [2010] =
+ { vstudio_version = "2010"
+ , project_version = "4"
+ , filters_version = "4.0"
+ , solution_version = "11"
+ , toolset_version = "v100"
+ }
+, [2012] =
+ { vstudio_version = "2012"
+ , project_version = "4"
+ , filters_version = "4.0"
+ , solution_version = "12"
+ , toolset_version = "v110"
+ }
+, [2013] =
+ { vstudio_version = "2013"
+ , project_version = "12"
+ , filters_version = "4.0"
+ , solution_version = "12"
+ , toolset_version = "v120"
+ }
+, [2015] =
+ { vstudio_version = "2015"
+ , project_version = "14"
+ , filters_version = "4.0"
+ , solution_version = "12"
+ , toolset_version = "v140"
+ , sdk_version = "10.0.10240.0"
+ }
+, [2017] =
+ { vstudio_version = "2017"
+ , project_version = "15"
+ , filters_version = "4.0"
+ , solution_version = "12"
+ , toolset_version = "v141"
+ , sdk_version = "10.0.14393.0"
+ }
+, [2019] =
+ { vstudio_version = "2019"
+ , project_version = "16"
+ , filters_version = "4.0"
+ , solution_version = "12"
+ , toolset_version = "v142"
+ , sdk_version = "10.0.17763.0"
+ }
+}
+
+function main(version)
+ assert(version)
+ return assert(vsinfo[version]);
+end \ No newline at end of file
diff --git a/xmake/plugins/project/vstudio/vs2002.lua b/xmake/plugins/project/vstudio/vs.lua
index 98b4125b2..a50180a23 100644
--- a/xmake/plugins/project/vstudio/vs2002.lua
+++ b/xmake/plugins/project/vstudio/vs.lua
@@ -15,22 +15,21 @@
-- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
--
-- @author ruki
--- @file vs2003.lua
+-- @file vs.lua
--
-- imports
import("impl.vs200x")
+import("impl.vsinfo")
--- make
-function make(outputdir)
+-- make factory
+function make(version)
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2002"
- , solution_version = "7"
- }
+ -- get vs version info
+ local info = vsinfo(version)
- -- make project
- vs200x.make(outputdir, vsinfo)
+ -- make
+ return function(outputdir)
+ vs200x.make(outputdir, info)
+ end
end
diff --git a/xmake/plugins/project/vstudio/vs2005.lua b/xmake/plugins/project/vstudio/vs2005.lua
deleted file mode 100644
index d212a7264..000000000
--- a/xmake/plugins/project/vstudio/vs2005.lua
+++ /dev/null
@@ -1,36 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2005.lua
---
-
--- imports
-import("impl.vs200x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2005"
- , solution_version = "9"
- }
-
- -- make project
- vs200x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2008.lua b/xmake/plugins/project/vstudio/vs2008.lua
deleted file mode 100644
index 226847af0..000000000
--- a/xmake/plugins/project/vstudio/vs2008.lua
+++ /dev/null
@@ -1,36 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2008.lua
---
-
--- imports
-import("impl.vs200x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2008"
- , solution_version = "10"
- }
-
- -- make project
- vs200x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2010.lua b/xmake/plugins/project/vstudio/vs2010.lua
deleted file mode 100644
index ed399691d..000000000
--- a/xmake/plugins/project/vstudio/vs2010.lua
+++ /dev/null
@@ -1,37 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2010.lua
---
-
--- imports
-import("impl.vs201x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2010"
- , filters_version = "4.0"
- , solution_version = "11"
- }
-
- -- make project
- vs201x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2012.lua b/xmake/plugins/project/vstudio/vs2012.lua
deleted file mode 100644
index 4d420336d..000000000
--- a/xmake/plugins/project/vstudio/vs2012.lua
+++ /dev/null
@@ -1,37 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2012.lua
---
-
--- imports
-import("impl.vs201x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2012"
- , filters_version = "4.0"
- , solution_version = "12"
- }
-
- -- make project
- vs201x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2013.lua b/xmake/plugins/project/vstudio/vs2013.lua
deleted file mode 100644
index f29cd1b66..000000000
--- a/xmake/plugins/project/vstudio/vs2013.lua
+++ /dev/null
@@ -1,37 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2013.lua
---
-
--- imports
-import("impl.vs201x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2013"
- , filters_version = "4.0"
- , solution_version = "12"
- }
-
- -- make project
- vs201x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2015.lua b/xmake/plugins/project/vstudio/vs2015.lua
deleted file mode 100644
index de00e0346..000000000
--- a/xmake/plugins/project/vstudio/vs2015.lua
+++ /dev/null
@@ -1,37 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2015.lua
---
-
--- imports
-import("impl.vs201x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2015"
- , filters_version = "4.0"
- , solution_version = "12"
- }
-
- -- make project
- vs201x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2017.lua b/xmake/plugins/project/vstudio/vs2017.lua
deleted file mode 100755
index 6ffa58e0f..000000000
--- a/xmake/plugins/project/vstudio/vs2017.lua
+++ /dev/null
@@ -1,37 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2017.lua
---
-
--- imports
-import("impl.vs201x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2017"
- , filters_version = "4.0"
- , solution_version = "12"
- }
-
- -- make project
- vs201x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2019.lua b/xmake/plugins/project/vstudio/vs2019.lua
deleted file mode 100755
index e45ca355a..000000000
--- a/xmake/plugins/project/vstudio/vs2019.lua
+++ /dev/null
@@ -1,37 +0,0 @@
---!A cross-platform build utility based on Lua
---
--- Licensed under the Apache License, Version 2.0 (the "License");
--- you may not use this file except in compliance with the License.
--- You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
---
--- @author ruki
--- @file vs2019.lua
---
-
--- imports
-import("impl.vs201x")
-
--- make
-function make(outputdir)
-
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2019"
- , filters_version = "4.0"
- , solution_version = "12"
- }
-
- -- make project
- vs201x.make(outputdir, vsinfo)
-end
diff --git a/xmake/plugins/project/vstudio/vs2003.lua b/xmake/plugins/project/vstudio/vsx.lua
index 6acc282f9..ff8b83281 100644
--- a/xmake/plugins/project/vstudio/vs2003.lua
+++ b/xmake/plugins/project/vstudio/vsx.lua
@@ -15,22 +15,21 @@
-- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
--
-- @author ruki
--- @file vs2003.lua
+-- @file vsx.lua
--
-- imports
-import("impl.vs200x")
+import("impl.vs201x")
+import("impl.vsinfo")
--- make
-function make(outputdir)
+-- make factory
+function make(version)
- -- init vstudio info
- local vsinfo =
- {
- vstudio_version = "2003"
- , solution_version = "8"
- }
+ -- get vs version info
+ local info = vsinfo(version)
- -- make project
- vs200x.make(outputdir, vsinfo)
+ -- make
+ return function(outputdir)
+ vs201x.make(outputdir, info)
+ end
end
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
new file mode 100644
index 000000000..4567adb1e
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -0,0 +1,293 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
+--
+-- @author OpportunityLiu
+-- @file getinfo.lua
+--
+
+-- imports
+import("core.base.option")
+import("core.base.semver")
+import("core.project.config")
+import("core.project.project")
+import("core.platform.platform")
+import("core.platform.environment")
+import("core.tool.compiler")
+import("core.tool.linker")
+import("lib.detect.find_tool")
+import("actions.config.configheader", {alias = "generate_configheader", rootdir = os.programdir()})
+import("actions.config.configfiles", {alias = "generate_configfiles", rootdir = os.programdir()})
+
+function _make_dirs(dir)
+ if dir == nil then
+ return ""
+ end
+ if type(dir) == "string" then
+ dir = path.translate(dir)
+ if dir == "" then
+ return ""
+ end
+ if path.is_absolute(dir) then
+ if dir:startswith(project.directory()) then
+ return path.join("$(XmakeProjectDir)", path.relative(dir, project.directory()))
+ end
+ return dir
+ end
+ return path.join("$(XmakeProjectDir)", dir)
+ end
+ local r = {}
+ for k, v in ipairs(dir) do
+ r[k] = _make_dirs(v)
+ end
+ r = table.unique(r)
+ return table.concat(r, path.envsep())
+end
+
+function _get_values(target, name)
+ local values = table.wrap(target:get(name))
+ for _, dep in irpairs(target:orderdeps()) do
+ local depinherit = target:extraconf("deps", dep:name(), "inherit")
+ if depinherit == nil or depinherit then
+ table.join2(values, dep:get(name, {interface = true}))
+ end
+ end
+ return values
+end
+
+-- make target info
+function _make_targetinfo(mode, arch, target)
+
+ -- init target info
+ local targetinfo = { mode = mode, arch = arch, plat = config.get("plat"), vsarch = (arch == "x86" and "Win32" or arch) }
+
+ -- write only if not default
+ -- use target:get("xxx") rather than target:xxx()
+
+ -- save target kind
+ targetinfo.kind = target:get("kind")
+
+ -- save target file
+ targetinfo.basename = target:get("basename")
+ targetinfo.filename = target:get("filename")
+
+ -- save dirs
+ targetinfo.targetdir = _make_dirs(target:get("targetdir"))
+ targetinfo.buildir = _make_dirs(config.get("buildir"))
+ targetinfo.rundir = _make_dirs(target:get("rundir"))
+ targetinfo.configdir = _make_dirs(os.getenv("XMAKE_CONFIGDIR"))
+ targetinfo.configfiledir = _make_dirs(target:get("configdir"))
+ targetinfo.includedirs = _make_dirs(_get_values(target, "includedirs"))
+ targetinfo.linkdirs = _make_dirs(_get_values(target, "linkdirs"))
+
+ -- save defines
+ targetinfo.defines = table.concat(_get_values(target, "defines"), ";")
+ targetinfo.languages = table.concat(_get_values(target, "languages"), ";")
+
+ -- save runenvs
+ local runenvs = {}
+ for k, v in pairs(target:get("runenvs")) do
+ local defs = {}
+ for _, d in ipairs(v) do
+ table.insert(defs, vformat(d))
+ end
+ table.insert(runenvs, format("%s=%s", k, table.concat(defs, path.envsep())))
+ end
+ targetinfo.runenvs = table.concat(runenvs, "\n")
+
+ -- use mfc? save the mfc runtime kind
+ if target:rule("win.sdk.mfc.shared_app") or target:rule("win.sdk.mfc.shared") then
+ targetinfo.mfckind = "Dynamic"
+ elseif target:rule("win.sdk.mfc.static_app") or target:rule("win.sdk.mfc.static") then
+ targetinfo.mfckind = "Static"
+ end
+
+ -- use cuda? save the cuda runtime version
+ if target:rule("cuda") then
+ local nvcc = find_tool("nvcc", { version = true })
+ local ver = semver.new(nvcc.version)
+ targetinfo.cudaver = ver:major() .. "." .. ver:minor()
+ end
+
+ -- ok
+ return targetinfo
+end
+
+function _make_vsinfo_modes()
+ local vsinfo_modes = {}
+ local modes = option.get("modes")
+ if modes then
+ for _, mode in ipairs(modes:split(',')) do
+ table.insert(vsinfo_modes, mode:trim())
+ end
+ else
+ vsinfo_modes = project.modes()
+ end
+ if not vsinfo_modes or #vsinfo_modes == 0 then
+ vsinfo_modes = { config.mode() }
+ end
+ return vsinfo_modes
+end
+
+function _make_vsinfo_archs()
+ local vsinfo_archs = {}
+ local archs = option.get("archs")
+ if archs then
+ for _, arch in ipairs(archs:split(',')) do
+ table.insert(vsinfo_archs, arch:trim())
+ end
+ else
+ vsinfo_archs = platform.archs()
+ end
+ if not vsinfo_archs or #vsinfo_archs == 0 then
+ vsinfo_archs = { config.arch() }
+ end
+ return vsinfo_archs
+end
+
+-- make vstudio project
+function main(outputdir, vsinfo)
+
+ -- enter project directory
+ local oldir = os.cd(project.directory())
+
+ -- init solution directory
+ vsinfo.solution_dir = path.absolute(path.join(outputdir, "vsxmake" .. vsinfo.vstudio_version))
+ vsinfo.programdir = xmake.programdir()
+ vsinfo.projectdir = project.directory()
+ vsinfo.sln_projectfile = path.relative(project.file(), vsinfo.solution_dir)
+ local projectfile = path.filename(project.file())
+ vsinfo.slnfile = path.filename(project.directory())
+ -- write only if not default
+ if projectfile ~= "xmake.lua" then
+ vsinfo.projectfile = projectfile
+ vsinfo.slnfile = path.basename(projectfile)
+ end
+
+ vsinfo.xmake_info = format("xmake version %s", xmake.version())
+ vsinfo.solution_id = hash.uuid(project.directory() .. vsinfo.solution_dir)
+ vsinfo.vs_version = vsinfo.project_version .. ".0"
+
+ -- init modes
+ vsinfo.modes = _make_vsinfo_modes()
+ -- init archs
+ vsinfo.archs = _make_vsinfo_archs()
+
+ -- load targets
+ local targets = {}
+ vsinfo._sub2 = {}
+ for _, mode in ipairs(vsinfo.modes) do
+ vsinfo._sub2[mode] = {}
+ for _, arch in ipairs(vsinfo.archs) do
+ vsinfo._sub2[mode][arch] = { mode = mode, arch = arch }
+
+ -- trace
+ print("checking for the %s.%s ...", mode, arch)
+
+ -- reload config, project and platform
+ -- modify config
+ config.set("as", nil, {force = true}) -- force to re-check as for ml/ml64
+ config.set("mode", mode, {readonly = true, force = true})
+ config.set("arch", arch, {readonly = true, force = true})
+
+ -- clear project to reload and recheck it
+ project.clear()
+
+ -- check project options
+ project.check()
+
+ -- reload platform
+ platform.load(config.plat())
+
+ -- re-generate configheader
+ generate_configheader()
+
+ -- re-generate configfiles
+ generate_configfiles()
+
+ -- ensure to enter project directory
+ os.cd(project.directory())
+
+ -- enter environment (maybe check flags by calling tools)
+ environment.enter("toolchains")
+
+ -- save targets
+ for targetname, target in pairs(project.targets()) do
+ if not target:isphony() then
+
+ -- make target with the given mode and arch
+ targets[targetname] = targets[targetname] or {}
+ local _target = targets[targetname]
+
+ -- init target info
+ _target.target = targetname
+ _target.vcxprojdir = path.join(vsinfo.solution_dir, targetname)
+ _target.target_id = hash.uuid(targetname)
+ _target.kind = target:targetkind()
+ _target.scriptdir = path.relative(target:scriptdir(), _target.vcxprojdir)
+ _target.projectdir = path.relative(project.directory(), _target.vcxprojdir)
+ local tgtdir = target:get("targetdir")
+ if tgtdir then _target.targetdir = path.relative(tgtdir, _target.vcxprojdir) end
+ _target._sub = _target._sub or {}
+ _target._sub[mode] = _target._sub[mode] or {}
+ _target._sub[mode][arch] = _make_targetinfo(mode, arch, target)
+
+ -- save all sourcefiles and headerfiles
+ _target.sourcefiles = table.unique(table.join(_target.sourcefiles or {}, (target:sourcefiles())))
+ _target.headerfiles = table.unique(table.join(_target.headerfiles or {}, (target:headerfiles())))
+
+ _target.deps = table.unique(table.join(_target.deps or {}, table.keys(target:deps()), nil))
+ end
+ end
+
+ -- leave environment
+ environment.leave("toolchains")
+ end
+ end
+
+ -- leave project directory
+ os.cd(oldir)
+ for _,target in pairs(targets) do
+ target._sub2 = {}
+ local dirs = {}
+ for _,f in ipairs(table.join(target.sourcefiles, target.headerfiles)) do
+ local dir = path.directory(f)
+ target._sub2[f] =
+ {
+ path = path.join("$(XmakeProjectDir)", f),
+ dir = dir
+ }
+ while dir ~= "." do
+ if not dirs[dir] then
+ dirs[dir] =
+ {
+ dir = dir,
+ dir_id = hash.uuid(dir)
+ }
+ end
+ dir = path.directory(dir)
+ end
+ end
+ target._sub3 = dirs
+ target.dirs = table.keys(dirs)
+ target._sub4 = {}
+ for _, v in ipairs(target.deps) do
+ target._sub4[v] = targets[v]
+ end
+ end
+ vsinfo.targets = table.keys(targets)
+ vsinfo._sub = targets
+ return vsinfo
+end
diff --git a/xmake/plugins/project/vsxmake/render.lua b/xmake/plugins/project/vsxmake/render.lua
new file mode 100644
index 000000000..c672b30cd
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/render.lua
@@ -0,0 +1,74 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
+--
+-- @author OpportunityLiu
+-- @file render.lua
+--
+
+function _fill(opt, parmas)
+ return function(match)
+ local imp = match:match("^Import%((.+)%)$")
+ if imp then
+ local func, overload = os.files(path.join(opt.templatedir, imp .. "(*)"))
+ assert(overload == 1)
+ func = func[1]
+ local args = path.filename(func):match("%((.+)%)$"):split(",")
+ return _render(func, opt, args)
+ end
+ return opt.paramsprovider(match, parmas) or "<Not Provided>"
+ end
+end
+
+function _expand(params)
+ local r = {""}
+ for _, v in ipairs(params) do
+ if type(v) == "string" then
+ for i, p in ipairs(r) do
+ r[i] = p .. ";" .. v
+ end
+ else
+ local newr = {}
+ for _, c in ipairs(v) do
+ local rcopy = {}
+ for i, p in ipairs(r) do
+ rcopy[i] = p .. ";" .. c
+ end
+ newr= table.join(newr, rcopy)
+ end
+ r = newr
+ end
+ end
+ for i, p in ipairs(r) do
+ r[i] = p:split(";")
+ end
+ return r
+end
+
+function _render(templatepath, opt, args)
+
+ local template = io.readfile(templatepath)
+ local params = _expand(opt.paramsprovider(args))
+ local replaced = ""
+ for _, v in ipairs(params) do
+ replaced = replaced .. template:gsub(opt.pattern, _fill(opt, v))
+ end
+ return replaced
+end
+
+function main(templatepath, pattern, paramsprovider)
+ local opt = { pattern = pattern, paramsprovider = paramsprovider, templatedir = path.directory(templatepath) }
+ return _render(templatepath, opt, {})
+end \ No newline at end of file
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.props b/xmake/plugins/project/vsxmake/vsproj/Xmake.props
new file mode 100644
index 000000000..0198714f3
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.props
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Label="XmakePropsInit">
+ <!-- initialize this first to allow `Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'"` in custom props file -->
+ <XmakeMode Condition="'$(XmakeMode)' == ''">$(Configuration)</XmakeMode>
+ <XmakeMode Condition="'$(XmakeMode)' == ''">release</XmakeMode>
+
+ <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' == 'win32'">x86</XmakeArch>
+ <XmakeArch Condition="'$(XmakeArch)' == '' And '$(Platform.ToLower())' != 'win32'">$(Platform)</XmakeArch>
+ <XmakeArch Condition="'$(XmakeArch)' == ''">x86</XmakeArch>
+ </PropertyGroup>
+
+ <ImportGroup Label="CustomSettings">
+ <!--only search 2 levels to avoid accidentally import-->
+ <Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props')"
+ Project="$(MSBuildProjectDirectory)\Xmake.Custom.props" />
+ <Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.props') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.props')"
+ Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.props" />
+ </ImportGroup>
+
+ <PropertyGroup Label="XmakePropsFallback">
+ <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(XmakeTarget)</XmakeBasename>
+ <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(TargetName)</XmakeBasename>
+ <XmakeBasename Condition="'$(XmakeBasename)' == ''">$(MSBuildProjectName)</XmakeBasename>
+
+ <XmakeKind Condition="'$(XmakeKind)' == ''">binary</XmakeKind>
+ <XmakePlat Condition="'$(XmakePlat)' == ''">windows</XmakePlat>
+ </PropertyGroup>
+
+ <PropertyGroup Label="XmakePathsFallback">
+ <XmakeBuilDir Condition="'$(XmakeBuilDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDir>
+ <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir>
+ <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir>
+
+ <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XMAKE_CONFIGDIR)</XmakeConfigDir>
+ <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XmakeProjectDir)\.xmake</XmakeConfigDir>
+
+ <XmakeRunDir Condition="'$(XmakeRunDir)' == ''">$(XmakeTargetDir)</XmakeRunDir>
+ </PropertyGroup>
+
+ <PropertyGroup Label="XmakePathsResolve">
+ <!-- resolve if they are relative paths -->
+ <XmakeProjectDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeProjectDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeProjectDir)'))</XmakeProjectDir>
+ <XmakeScriptDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeScriptDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeScriptDir)'))</XmakeScriptDir>
+ <XmakeBuilDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuilDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDir)'))</XmakeBuilDir>
+ <XmakeTargetDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeTargetDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDir)'))</XmakeTargetDir>
+ <XmakeConfigDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDir)'))</XmakeConfigDir>
+ <XmakeConfigFileDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigFileDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDir)'))</XmakeConfigFileDir>
+ <XmakeRunDir Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeRunDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDir)'))</XmakeRunDir>
+
+ <!-- normalize paths -->
+ <XmakeProgramDir>$([MSBuild]::NormalizeDirectory('$(XmakeProgramDir)'))</XmakeProgramDir>
+ <XmakeProjectDir>$([MSBuild]::NormalizeDirectory('$(XmakeProjectDir)'))</XmakeProjectDir>
+ <XmakeScriptDir>$([MSBuild]::NormalizeDirectory('$(XmakeScriptDir)'))</XmakeScriptDir>
+ <XmakeBuilDir>$([MSBuild]::NormalizeDirectory('$(XmakeBuilDir)'))</XmakeBuilDir>
+ <XmakeTargetDir>$([MSBuild]::NormalizeDirectory('$(XmakeTargetDir)'))</XmakeTargetDir>
+ <XmakeConfigDir>$([MSBuild]::NormalizeDirectory('$(XmakeConfigDir)'))</XmakeConfigDir>
+ <XmakeConfigFileDir>$([MSBuild]::NormalizeDirectory('$(XmakeConfigFileDir)'))</XmakeConfigFileDir>
+ <XmakeRunDir>$([MSBuild]::NormalizeDirectory('$(XmakeRunDir)'))</XmakeRunDir>
+ </PropertyGroup>
+
+ <PropertyGroup Label="XmakeFlagsFallback">
+ <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning>
+ <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose>
+ <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(WindowsTargetPlatformVersion)' == ''">
+ <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '14.0'">10.0.10240.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '15.0'">10.0.14393.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion Condition="'$(VisualStudioVersion)' == '16.0'">10.0.17763.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(PlatformToolset)' == ''">
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
+ </PropertyGroup>
+
+ <PropertyGroup Label="AdditionalProps">
+ <UseOfMfc Condition="'$(XmakeMfcKind)' != ''">$(XmakeMfcKind)</UseOfMfc>
+ <CharacterSet Condition="'$(CharacterSet)' == '' And ($(XmakeDefines.Contains(';UNICODE;')) Or $(XmakeDefines.EndsWith(';UNICODE')) Or $(XmakeDefines.StartsWith('UNICODE;')) Or $(XmakeDefines.Equals('UNICODE')))">Unicode</CharacterSet>
+ <CharacterSet Condition="'$(CharacterSet)' == ''">MultiByte</CharacterSet>
+ </PropertyGroup>
+
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <Choose>
+ <When Condition="'$(XmakeKind)' == 'binary'">
+ <PropertyGroup>
+ <ConfigurationType>Application</ConfigurationType>
+ </PropertyGroup>
+ </When>
+ <When Condition="'$(XmakeKind)' == 'shared'">
+ <PropertyGroup>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ </When>
+ <When Condition="'$(XmakeKind)' == 'static'">
+ <PropertyGroup>
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ </PropertyGroup>
+ </When>
+ </Choose>
+
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);$(XmakeDefines)</PreprocessorDefinitions>
+ <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx17'))">stdcpp17</LanguageStandard>
+ <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx14'))">stdcpp14</LanguageStandard>
+ <LanguageStandard Condition="'%(LanguageStandard)' == '' And $(XmakeLanguages.Contains('cxx11'))">stdcpp11</LanguageStandard>
+ </ClCompile>
+ </ItemDefinitionGroup>
+
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+
+ <ImportGroup Label="ExtensionSettings">
+ <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')"
+ Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props" />
+ </ImportGroup>
+
+ <ImportGroup Label="PropertySheets">
+ <Import Condition="Exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
+ Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
+ </ImportGroup>
+
+ <PropertyGroup Label="GlobalsFallback">
+ <TargetName Condition="'$(XmakeFilename)' == ''">$(XmakeBasename)</TargetName>
+ <TargetName Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetFileNameWithoutExtension('$(XmakeFilename)'))</TargetName>
+ <TargetExt Condition="'$(XmakeFilename)' != ''">$([System.IO.Path]::GetExtension('$(XmakeFilename)'))</TargetExt>
+ </PropertyGroup>
+
+ <PropertyGroup Label="Path">
+ <IncludePath>$(XmakeIncludeDir);$(IncludePath)</IncludePath>
+ <LibraryPath>$(XmakeLinkDir);$(LibraryPath)</LibraryPath>
+ <OutDir>$(XmakeTargetDir)</OutDir>
+ <IntDir>$(XmakeBuilDir).vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir>
+ </PropertyGroup>
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/Xmake.targets b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
new file mode 100644
index 000000000..947251b97
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/Xmake.targets
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ <Import Condition="'$(XmakeCudaVersion)' != '' And Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')"
+ Project="$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets" />
+ </ImportGroup>
+
+ <PropertyGroup Label="XmakeInternal">
+ <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' != ''">-F "$(XmakeProjectFile)"</_XmakeProjectFlag>
+ <_XmakeProjectFlag Condition="'$(XmakeProjectFile)' == ''">-P .</_XmakeProjectFlag>
+
+ <_XmakeCommonFlags>$(XmakeCommonFlags.Trim())</_XmakeCommonFlags>
+ <_XmakeCommonFlags Condition="$(XmakeVerbose)">$(_XmakeCommonFlags) -v</_XmakeCommonFlags>
+ <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">$(_XmakeCommonFlags) -D</_XmakeCommonFlags>
+ <_XmakeCommonFlags>$(_XmakeCommonFlags) $(_XmakeProjectFlag)</_XmakeCommonFlags>
+
+ <_XmakeBuilDir>$([MSBuild]::MakeRelative('$(XmakeProjectDir)', '$(XmakeBuilDir)').TrimEnd('/\'.ToCharArray()))</_XmakeBuilDir>
+
+ <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags>
+ <_XmakeConfigFlags>$(_XmakeConfigFlags) -p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) -o "$(_XmakeBuilDir)"</_XmakeConfigFlags>
+
+ <_XmakeBuildFlags>$(XmakeBuildFlags.Trim())</_XmakeBuildFlags>
+ <_XmakeBuildFlags Condition="$(XmakeWarning)">$(_XmakeBuildFlags) -w</_XmakeBuildFlags>
+
+ <_XmakeCleanFlags>$(XmakeCleanFlags.Trim())</_XmakeCleanFlags>
+
+ <_XmakeBuildFlags>$(_XmakeBuildFlags.Trim())</_XmakeBuildFlags>
+ <_XmakeCleanFlags>$(_XmakeCleanFlags.Trim())</_XmakeCleanFlags>
+ <_XmakeConfigFlags>$(_XmakeConfigFlags.Trim())</_XmakeConfigFlags>
+ <_XmakeCommonFlags>$(_XmakeCommonFlags.Trim())</_XmakeCommonFlags>
+
+ <_XmakeExecutable>"$([System.IO.Path]::GetFullPath('$(XmakeProgramDir)xmake.exe'))"</_XmakeExecutable>
+ <_XmakeEnv>
+ pushd "$(XmakeProjectDir)"
+ set XMAKE_CONFIGDIR=$(XmakeConfigDir)
+ set XMAKE_PROGRAM_DIR=$(XmakeProgramDir)
+ </_XmakeEnv>
+ </PropertyGroup>
+
+ <Target Name="_XmakeProjCheck">
+ <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets')"
+ Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).targets' not found" />
+ <Warning Condition="'$(XmakeCudaVersion)' != '' And !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props')"
+ Text="File '$(VCTargetsPath)\BuildCustomizations\CUDA $(XmakeCudaVersion).props' not found" />
+ <Error Condition="!Exists('$(XmakeProgramDir)\xmake.exe')"
+ Text="xmake.exe not found at '$(XmakeProgramDir)', please set XMAKE_PROGRAM_DIR in environments or XmakeProgramDir in vcxproj file" />
+ <Error Condition="'$(XmakeProjectFile)' == '' And !Exists('$(XmakeProjectDir)\xmake.lua')"
+ Text="xmake.lua not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" />
+ <Error Condition="'$(XmakeProjectFile)' != '' And !Exists('$(XmakeProjectDir)\$(XmakeProjectFile)')"
+ Text="$(XmakeProjectFile) not found at '$(XmakeProjectDir)', please set XmakeProjectDir in vcxproj file" />
+ </Target>
+ <Target Name="_XmakeConfig" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" />
+ <Exec Command="$(_XmakeEnv)
+$(_XmakeExecutable) config $(_XmakeCommonFlags) $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/>
+ </Target>
+ <Target Name="_XmakeReconfig" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" Importance="High" />
+ <Exec Command="$(_XmakeEnv)
+$(_XmakeExecutable) config $(_XmakeCommonFlags) -c $(_XmakeConfigFlags) $(XmakeTarget)" EchoOff="true"/>
+ </Target>
+ <Target Name="_XmakeBuild" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" Importance="High" />
+ <Exec Command="$(_XmakeEnv)
+$(_XmakeExecutable) build $(_XmakeCommonFlags) $(_XmakeBuildFlags) $(XmakeTarget)" EchoOff="true"/>
+ </Target>
+ <Target Name="_XmakeClean" DependsOnTargets="_XmakeProjCheck">
+ <Message Text="$xmake clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" Importance="High" />
+ <Exec Command="$(_XmakeEnv)
+$(_XmakeExecutable) clean $(_XmakeCommonFlags) -a $(_XmakeCleanFlags) $(XmakeTarget)" EchoOff="true"/>
+ </Target>
+
+ <Target Name="Show">
+ <Message Text="
+MSBuild Properties:
+ Xmake Props:
+ XmakeTarget: $(XmakeTarget)
+ 'XmakePlat|Mode|Arch': '$(XmakePlat)|$(XmakeMode)|$(XmakeArch)'
+ XmakeBasename: $(XmakeBasename)
+ XmakeFilename: $(XmakeFilename)
+ XmakeKind: $(XmakeKind)
+ XmakeCudaVersion: $(XmakeCudaVersion)
+ XmakeMfcKind: $(XmakeMfcKind)
+ XmakeDefines: $(XmakeDefines)
+ XmakeLanguages: $(XmakeLanguages)
+ Xmake Path:
+ XmakeProjectDir: $(XmakeProjectDir)
+ XmakeScriptDir: $(XmakeScriptDir)
+ XmakeBuilDir: $(XmakeBuilDir)
+ XmakeConfigDir: $(XmakeConfigDir)
+ XmakeIncludeDir: $(XmakeIncludeDir)
+ XmakeLinkDir: $(XmakeLinkDir)
+ Xmake Flags:
+ XmakeWarning: $(XmakeWarning)
+ XmakeVerbose: $(XmakeVerbose)
+ XmakeDiagnosis: $(XmakeDiagnosis)
+ XmakeCommonFlags: $(XmakeCommonFlags)
+ XmakeConfigFlags: $(XmakeConfigFlags)
+ XmakeBuildFlags: $(XmakeBuildFlags)
+ XmakeCleanFlags: $(XmakeCleanFlags)
+ Xmake Internal:
+ _XmakeCommonFlags: $(_XmakeCommonFlags)
+ _XmakeConfigFlags: $(_XmakeConfigFlags)
+ _XmakeBuildFlags: $(_XmakeBuildFlags)
+ _XmakeCleanFlags: $(_XmakeCleanFlags)
+ _XmakeExecutable: $(_XmakeExecutable)
+ _XmakeEnv: $(_XmakeEnv)
+ Vs Props:
+ 'Configuration|Platform': '$(Configuration)|$(Platform)'
+ VisualStudioVersion: $(VisualStudioVersion)
+ MSBuildProjectDirectory: $(MSBuildProjectDirectory)
+ MSBuildProjectName: $(MSBuildProjectName)
+ OutDir: $(OutDir)
+ IntDir: $(IntDir)
+ TargetName: $(TargetName)
+ TargetExt: $(TargetExt)
+ PlatformToolset: $(PlatformToolset)
+ CharacterSet: $(CharacterSet)
+ UseOfMfc: $(UseOfMfc)
+ WindowsTargetPlatformVersion: $(WindowsTargetPlatformVersion)
+ PreprocessorDefinitions: %(ClCompile.PreprocessorDefinitions)
+ LanguageStandard: %(ClCompile.LanguageStandard)
+ " Importance="High" />
+ </Target>
+
+ <Target Name="BeforeBuild" />
+ <Target Name="AfterBuild" />
+ <Target Name="Build" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
+ <CallTarget Targets="BeforeBuild" />
+ <CallTarget Targets="_XmakeConfig;_XmakeBuild" />
+ <CallTarget Targets="AfterBuild" />
+ </Target>
+
+ <Target Name="BeforeClean" />
+ <Target Name="AfterClean" />
+ <Target Name="Clean" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
+ <CallTarget Targets="BeforeClean" />
+ <CallTarget Targets="_XmakeClean;_XmakeReconfig" />
+ <CallTarget Targets="AfterClean" />
+ </Target>
+
+ <Target Name="BeforeRebuild" />
+ <Target Name="AfterRebuild" />
+ <Target Name="Rebuild" Condition="'$(DesignTimeBuild)' != 'true'">
+ <CallTarget Targets="Show" Condition="$(XmakeDiagnosis)" />
+ <CallTarget Targets="BeforeRebuild" />
+ <CallTarget Targets="BeforeClean" />
+ <CallTarget Targets="_XmakeClean;_XmakeReconfig" />
+ <CallTarget Targets="AfterClean" />
+ <CallTarget Targets="BeforeBuild" />
+ <CallTarget Targets="_XmakeBuild" />
+ <CallTarget Targets="AfterBuild" />
+ <CallTarget Targets="AfterRebuild" />
+ </Target>
+
+ <ImportGroup Label="CustomTargets">
+ <!--only search 2 levels to avoid accidentally import-->
+ <Import Condition="Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets')"
+ Project="$(MSBuildProjectDirectory)\Xmake.Custom.targets" />
+ <Import Condition="!Exists('$(MSBuildProjectDirectory)\Xmake.Custom.targets') And Exists('$(MSBuildProjectDirectory)\..\Xmake.Custom.targets')"
+ Project="$(MSBuildProjectDirectory)\..\Xmake.Custom.targets" />
+ </ImportGroup>
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user b/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user
new file mode 100644
index 000000000..399b00e30
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/#target#.vcxproj.user
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <LocalDebuggerCommandArguments></LocalDebuggerCommandArguments>
+ <LocalDebuggerWorkingDirectory>$(XmakeRunDir)</LocalDebuggerWorkingDirectory>
+ <LocalDebuggerEnvironment>$(XmakeRunEnvs)
+$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
+ <LocalDebuggerMergeEnvironment>true</LocalDebuggerMergeEnvironment>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props
new file mode 100644
index 000000000..6f47fe7a0
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.props
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- inherit parent settings -->
+ <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.props')"
+ Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.props" />
+
+ <PropertyGroup Label="XmakePaths">
+ <!-- set environment XMAKE_CONFIGDIR for xmake tasks -->
+ <!--
+ <XmakeConfigDir Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'">$(XmakeProjectDir)\.xmake</XmakeConfigDir>
+ <XmakeBuilDir>$(XmakeProjectDir)\build</XmakeBuilDir>
+ -->
+ </PropertyGroup>
+
+ <PropertyGroup Label="XmakeFlags">
+ <!-- Configure these flags to customize xmake build process -->
+ <!--
+ Inherit parents:
+ <XmakeCleanFlags>$(XmakeCleanflags) -D</XmakeCleanFlags>
+ Override parents:
+ <XmakeCleanFlags>-D</XmakeCleanFlags>
+ Respect parents:
+ <XmakeCleanFlags Condition=" '$(XmakeCleanFlags)' == '' ">-D</XmakeCleanFlags>
+
+ For -w, -v and -D, use <XmakeWarning>, <XmakeVerbose> and <XmakeDiagnosis> is more convenient.
+ -->
+ <XmakeWarning Condition="'$(XmakeWarning)' == ''">true</XmakeWarning>
+ <XmakeVerbose Condition="'$(XmakeVerbose)' == ''">false</XmakeVerbose>
+ <XmakeDiagnosis Condition="'$(XmakeDiagnosis)' == ''">false</XmakeDiagnosis>
+ <XmakeCleanFlags>$(XmakeCleanflags)</XmakeCleanFlags>
+ <XmakeBuildFlags>$(XmakeBuildFlags)</XmakeBuildFlags>
+ <XmakeConfigFlags>$(XmakeConfigFlags)</XmakeConfigFlags>
+ <XmakeCommonFlags>$(XmakeCommonFlags)</XmakeCommonFlags>
+ </PropertyGroup>
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets
new file mode 100644
index 000000000..c63cbed32
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/Xmake.Custom.targets
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- inherit parent settings -->
+ <Import Condition="Exists('$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets')"
+ Project="$(MSBuildThisFileDirectory)\..\Xmake.Custom.targets" />
+
+ <!-- Override these targets to customize your build workflow -->
+ <!--
+ If you uncomment targets below,
+ targets with same name that comes from ../Xmake.Custom.targets will be overrided.
+
+ You can also define your own targets and call them like:
+ <Target Name="BeforeBuild">
+ <CallTarget Targets="CustomStep1;CustomStep2" />
+ </Target>
+
+ To find task that you can used in custom targets,
+ see: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-task-reference
+ -->
+
+ <!-- <Target Name="BeforeRebuild"></Target> -->
+ <!-- <Target Name="AfterRebuild"></Target> -->
+ <!-- <Target Name="BeforeBuild"></Target> -->
+ <!-- <Target Name="AfterBuild"></Target> -->
+ <!-- <Target Name="BeforeClean"></Target> -->
+ <!-- <Target Name="AfterClean"></Target> -->
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/sln/ProjConfig(target,mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/sln/ProjConfig(target,mode,arch)
new file mode 100644
index 000000000..427703018
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/sln/ProjConfig(target,mode,arch)
@@ -0,0 +1,2 @@
+ {#target_id#}.#mode#|#arch#.ActiveCfg = #mode#|#vsarch#
+ {#target_id#}.#mode#|#arch#.Build.0 = #mode#|#vsarch#
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/sln/Project(target) b/xmake/plugins/project/vsxmake/vsproj/templates/sln/Project(target)
new file mode 100644
index 000000000..11e743c8a
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/sln/Project(target)
@@ -0,0 +1,2 @@
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "#target#", "#target#\#target#.vcxproj", "{#target_id#}"
+EndProject
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/sln/SlnConfig(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/sln/SlnConfig(mode,arch)
new file mode 100644
index 000000000..b1784b846
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/sln/SlnConfig(mode,arch)
@@ -0,0 +1 @@
+ #mode#|#arch# = #mode#|#arch#
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/sln/vsxmake.sln b/xmake/plugins/project/vsxmake/vsproj/templates/sln/vsxmake.sln
new file mode 100644
index 000000000..bc2872afe
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/sln/vsxmake.sln
@@ -0,0 +1,34 @@
+Microsoft Visual Studio Solution File, Format Version #solution_version#.0
+# Visual Studio Version #vs_version#
+#
+# #xmake_info#
+#
+# This file is auto generated by xmake.
+#
+# Please DO NOT EDIT since all your modification will lost after re-generation.
+# See https://github.com/xmake-io/xmake/pull/472 for more infomation.
+#
+VisualStudioVersion = #vs_version#
+MinimumVisualStudioVersion = 10.0
+#Import(Project)#
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Properties", "Properties", "{007754BD-BB1F-452F-A0D8-13EF216C5ED9}"
+ ProjectSection(SolutionItems) = preProject
+ Xmake.Custom.props = Xmake.Custom.props
+ Xmake.Custom.targets = Xmake.Custom.targets
+ #sln_projectfile# = #sln_projectfile#
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+#Import(SlnConfig)#
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+#Import(ProjConfig)#
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {#solution_id#}
+ EndGlobalSection
+EndGlobal
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters
new file mode 100644
index 000000000..c79ec740a
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+#xmake_info#
+
+ This file is auto generated by xmake.
+
+ Please DO NOT EDIT since all your modification will lost after re-generation.
+ See https://github.com/xmake-io/xmake/pull/472 for more infomation.
+-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Properties">
+ <UniqueIdentifier>{CC7C6180-942D-056E-3227-E6A2B3FB19CD}</UniqueIdentifier>
+ </Filter>
+#Import(Filter)#
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Xmake.Custom.props">
+ <Filter>Properties</Filter>
+ </None>
+ <None Include="Xmake.Custom.targets">
+ <Filter>Properties</Filter>
+ </None>
+ <None Include="$(XmakeScriptDir)\xmake.lua">
+ <Filter>Properties</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+#Import(Include)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.c)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.cxx)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.cu)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.obj)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.rc)#
+ </ItemGroup>
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)
new file mode 100644
index 000000000..d33f87944
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)
@@ -0,0 +1,3 @@
+ <ClCompile Include="#path#">
+ <Filter>#dir#</Filter>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu)
new file mode 100644
index 000000000..643bb220f
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cu(filecu)
@@ -0,0 +1,3 @@
+ <CudaCompile Include="#path#">
+ <Filter>#dir#</Filter>
+ </CudaCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx)
new file mode 100644
index 000000000..d33f87944
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.cxx(filecxx)
@@ -0,0 +1,3 @@
+ <ClCompile Include="#path#">
+ <Filter>#dir#</Filter>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj)
new file mode 100644
index 000000000..adacd3b67
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.obj(fileobj)
@@ -0,0 +1,3 @@
+ <Object Include="#path#">
+ <Filter>#dir#</Filter>
+ </Object>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc)
new file mode 100644
index 000000000..a46047781
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.rc(filerc)
@@ -0,0 +1,3 @@
+ <ResourceCompile Include="#path#">
+ <Filter>#dir#</Filter>
+ </ResourceCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir)
new file mode 100644
index 000000000..6f97fa98d
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Filter(dir)
@@ -0,0 +1,3 @@
+ <Filter Include="#dir#">
+ <UniqueIdentifier>{#dir_id#}</UniqueIdentifier>
+ </Filter>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)
new file mode 100644
index 000000000..17344346b
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)
@@ -0,0 +1,3 @@
+ <ClInclude Include="#path#">
+ <Filter>#dir#</Filter>
+ </ClInclude>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj
new file mode 100644
index 000000000..d0e4e94d7
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+#xmake_info#
+
+ This file is auto generated by xmake.
+
+ Please DO NOT EDIT since all your modification will lost after re-generation.
+ If you would like to have any customization,
+ edit Xmake.Custom.props and Xmake.Custom.targets instead.
+
+ See https://github.com/xmake-io/xmake/pull/472 for more infomation.
+-->
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+#Import(ProjectConfiguration)#
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{#target_id#}</ProjectGuid>
+ <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">$(XMAKE_PROGRAM_DIR)</XmakeProgramDir>
+ <XmakeProgramDir Condition="'$(XmakeProgramDir)' == ''">#programdir#</XmakeProgramDir>
+ <Configuration Condition="'$(Configuration)' == ''">release</Configuration>
+ <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+ <XmakeScriptDir>#scriptdir#</XmakeScriptDir>
+ <XmakeProjectDir>#projectdir#</XmakeProjectDir>
+ <XmakeProjectFile>#projectfile#</XmakeProjectFile>
+ <XmakeTarget>#target#</XmakeTarget>
+ </PropertyGroup>
+#Import(XmakeConfig)#
+#Import(XmakePath)#
+ <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.props" />
+ <ItemGroup>
+ <None Include="Xmake.Custom.props" />
+ <None Include="Xmake.Custom.targets" />
+ <None Condition="'$(XmakeScriptDir)' != '$(XmakeProjectDir)' And Exists('$(XmakeScriptDir)\xmake.lua')"
+ Include="$(XmakeScriptDir)\xmake.lua" />
+ </ItemGroup>
+ <ItemGroup>
+#Import(Include)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.c)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.cxx)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.cu)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.obj)#
+ </ItemGroup>
+ <ItemGroup>
+#Import(File.rc)#
+ </ItemGroup>
+ <!-- <ItemGroup>
+#Import(ProjectRef)#
+ </ItemGroup> -->
+ <Import Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\xmake.targets" />
+</Project>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec)
new file mode 100644
index 000000000..36e16832a
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.c(filec)
@@ -0,0 +1,3 @@
+ <ClCompile Include="#path#">
+ <CompileAs>CompileAsC</CompileAs>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu)
new file mode 100644
index 000000000..7b3f0a6fe
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cu(filecu)
@@ -0,0 +1 @@
+ <CudaCompile Include="#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx)
new file mode 100644
index 000000000..076adfd5a
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.cxx(filecxx)
@@ -0,0 +1,3 @@
+ <ClCompile Include="#path#">
+ <CompileAs>CompileAsCpp</CompileAs>
+ </ClCompile>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj)
new file mode 100644
index 000000000..1e7cd6f45
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.obj(fileobj)
@@ -0,0 +1 @@
+ <Object Include="#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc)
new file mode 100644
index 000000000..25d1c58ab
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/File.rc(filerc)
@@ -0,0 +1 @@
+ <ResourceCompile Include="#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)
new file mode 100644
index 000000000..0178e0f9a
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)
@@ -0,0 +1 @@
+ <ClInclude Include="#path#" />
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch)
new file mode 100644
index 000000000..f2169767f
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectConfiguration(mode,arch)
@@ -0,0 +1,4 @@
+ <ProjectConfiguration Include="#mode#|#arch#">
+ <Configuration>#mode#</Configuration>
+ <Platform>#vsarch#</Platform>
+ </ProjectConfiguration>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep)
new file mode 100644
index 000000000..7804e4cba
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/ProjectRef(dep)
@@ -0,0 +1,3 @@
+ <ProjectReference Include="..\#target#\#target#.vcxproj">
+ <Project>{#target_id#}</Project>
+ </ProjectReference>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)
new file mode 100644
index 000000000..da73700f4
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakeConfig(mode,arch)
@@ -0,0 +1,13 @@
+ <PropertyGroup Label="XmakeConfig" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'">
+ <XmakeBasename>#basename#</XmakeBasename>
+ <XmakeFilename>#filename#</XmakeFilename>
+ <XmakeMode>#mode#</XmakeMode>
+ <XmakePlat>#plat#</XmakePlat>
+ <XmakeArch>#arch#</XmakeArch>
+ <XmakeKind>#kind#</XmakeKind>
+ <XmakeDefines>#defines#</XmakeDefines>
+ <XmakeLanguages>#languages#</XmakeLanguages>
+ <XmakeCudaVersion>#cudaver#</XmakeCudaVersion>
+ <XmakeMfcKind>#mfckind#</XmakeMfcKind>
+ <XmakeRunEnvs>#runenvs#</XmakeRunEnvs>
+ </PropertyGroup>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch)
new file mode 100644
index 000000000..2c8adc429
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch)
@@ -0,0 +1,9 @@
+ <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'">
+ <XmakeBuilDir>#buildir#</XmakeBuilDir>
+ <XmakeConfigDir>#configdir#</XmakeConfigDir>
+ <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir>
+ <XmakeTargetDir>#targetdir#</XmakeTargetDir>
+ <XmakeIncludeDir>#includedirs#</XmakeIncludeDir>
+ <XmakeLinkDir>#linkdirs#</XmakeLinkDir>
+ <XmakeRunDir>#rundir#</XmakeRunDir>
+ </PropertyGroup>
diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua
new file mode 100644
index 000000000..cf91eb40e
--- /dev/null
+++ b/xmake/plugins/project/vsxmake/vsxmake.lua
@@ -0,0 +1,160 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2019, TBOOX Open Source Group.
+--
+-- @author OpportunityLiu
+-- @file vsxmake.lua
+--
+
+-- imports
+import("core.base.hashset")
+import("vstudio.impl.vsinfo", { rootdir = path.directory(os.scriptdir()) })
+import("render")
+import("getinfo")
+
+local template_root = path.join(os.scriptdir(), "vsproj", "templates")
+local template_sln = path.join(template_root, "sln", "vsxmake.sln")
+local template_vcx = path.join(template_root, "vcxproj", "#target#.vcxproj")
+
+local template_fil = path.join(template_root, "vcxproj.filters", "#target#.vcxproj.filters")
+local template_usr = path.join(template_root, "#target#.vcxproj.user")
+local template_props = path.join(template_root, "Xmake.Custom.props")
+local template_targets = path.join(template_root, "Xmake.Custom.targets")
+
+function _filter_files(files, exts)
+ local extset = hashset.from(exts)
+ local f = {}
+ for _, file in ipairs(files) do
+ local ext = path.extension(file)
+ if extset:has(ext) then
+ table.insert(f, file)
+ end
+ end
+ return f
+end
+
+function _buildparams(info, target, default)
+
+ local function getprop(match, opt)
+ local i = info
+ local r = info[match]
+ if target then
+ opt = table.join(target, opt)
+ end
+ for _,k in ipairs(opt) do
+ local v = (i._sub or {})[k] or (i._sub2 or {})[k] or (i._sub3 or {})[k] or (i._sub4 or {})[k]or i[k]
+ if v == nil then
+ raise("key '" .. k .. "' not found")
+ end
+ i = v
+ r = i[match] or r
+ end
+
+ return r or default
+ end
+
+ local function listconfig(args)
+ for _, k in ipairs(args) do
+ args[k] = true
+ end
+ local r = {}
+ if args.target then
+ table.insert(r, info.targets)
+ end
+ if args.mode then
+ table.insert(r, info.modes)
+ end
+ if args.arch then
+ table.insert(r, info.archs)
+ end
+ if args.dir then
+ table.insert(r, info._sub[target].dirs)
+ end
+ if args.dep then
+ table.insert(r, info._sub[target].deps)
+ end
+ if args.filec then
+ local files = info._sub[target].sourcefiles
+ table.insert(r, _filter_files(files, {".c"}))
+ elseif args.filecxx then
+ local files = info._sub[target].sourcefiles
+ table.insert(r, _filter_files(files, {".cpp", ".cc", ".cxx"}))
+ elseif args.filecu then
+ local files = info._sub[target].sourcefiles
+ table.insert(r, _filter_files(files, {".cu"}))
+ elseif args.fileobj then
+ local files = info._sub[target].sourcefiles
+ table.insert(r, _filter_files(files, {".obj", ".o"}))
+ elseif args.filerc then
+ local files = info._sub[target].sourcefiles
+ table.insert(r, _filter_files(files, {".rc"}))
+ elseif args.inc then
+ table.insert(r, info._sub[target].headerfiles)
+ end
+ return r
+ end
+
+ return function(match, opt)
+ if type(match) == "table" then
+ return listconfig(match)
+ end
+ return getprop(match, opt)
+ end
+end
+
+function _trycp(file, target, targetname)
+ targetname = targetname or path.filename(file)
+ local targetfile = path.join(target, targetname)
+ if os.isfile(targetfile) then
+ dprint("skipped file %s", path.relative(targetfile))
+ return
+ end
+ os.cp(file,targetfile)
+end
+
+-- make
+function make(version)
+
+ return function(outputdir)
+ local info = getinfo(outputdir, vsinfo(version))
+ local paramsprovidersln = _buildparams(info)
+
+ -- write solution file
+ local sln = path.join(info.solution_dir, info.slnfile .. "_vsxmake" .. info.vstudio_version .. ".sln")
+ io.writefile(sln, render(template_sln, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidersln))
+
+ -- add solution custom file
+ _trycp(template_props, info.solution_dir)
+ _trycp(template_targets, info.solution_dir)
+
+ for _, target in ipairs(info.targets) do
+ local paramsprovidertarget = _buildparams(info, target, "<!-- nil -->")
+ local proj_dir = info._sub[target].vcxprojdir
+
+ -- write project file
+ local proj = path.join(proj_dir, target .. ".vcxproj")
+ io.writefile(proj, render(template_vcx, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidertarget))
+
+ local projfil = path.join(proj_dir, target .. ".vcxproj.filters")
+ io.writefile(projfil, render(template_fil, "#([A-Za-z0-9_,%.%*%(%)]+)#", paramsprovidertarget))
+
+ -- add project custom file
+ _trycp(template_props, proj_dir)
+ _trycp(template_targets, proj_dir)
+ -- add project user file
+ _trycp(template_usr, proj_dir, target .. ".vcxproj.user")
+ end
+ end
+end
diff --git a/xmake/plugins/project/xmake.lua b/xmake/plugins/project/xmake.lua
index 717c41b0d..023d3d87d 100644
--- a/xmake/plugins/project/xmake.lua
+++ b/xmake/plugins/project/xmake.lua
@@ -42,8 +42,10 @@ task("project")
, " - makefile"
, " - compile_flags"
, " - compile_commands (clang compilation database with json format)"
- , " - vs2002, vs2003, vs2005, vs2008, vs2010, vs2012, vs2013, vs2015, vs2017" }
- , {'m', "modes", "kv", nil, "Set the project modes."
+ , " - vs2002, vs2003, vs2005, vs2008"
+ , " - vs2010, vs2012, vs2013, vs2015, vs2017, vs2019"
+ , " - vsxmake2010 ~ vsmake2019" }
+ , {'m', "modes", "kv", nil, "Set the project modes."
, " .e.g "
, " - xmake project -k makefile"
, " - xmake project -k compile_commands"
diff --git a/xmake/themes/dark/xmake.lua b/xmake/themes/dark/xmake.lua
index ad1152e97..cb9c6a093 100644
--- a/xmake/themes/dark/xmake.lua
+++ b/xmake/themes/dark/xmake.lua
@@ -53,11 +53,15 @@ theme("dark")
-- color dump
set_text("dump.default_format", "<%s>")
+ set_text("dump.udata_format", "[%s]")
+ set_text("dump.table_format", "{%s}")
set_text("dump.anchor", "&%s")
set_text("dump.reference", "*%s")
set_color("dump.anchor", "yellow")
set_color("dump.reference", "yellow")
set_color("dump.default", "bright")
+ set_color("dump.udata", "yellow")
+ set_color("dump.table", "bright")
set_color("dump.string", "magenta bright")
set_color("dump.string_quote", "magenta")
set_color("dump.keyword", "blue")
diff --git a/xmake/themes/default/xmake.lua b/xmake/themes/default/xmake.lua
index f099196db..568e351e2 100644
--- a/xmake/themes/default/xmake.lua
+++ b/xmake/themes/default/xmake.lua
@@ -53,11 +53,15 @@ theme("default")
-- color dump
set_text("dump.default_format", "<%s>")
+ set_text("dump.udata_format", "[%s]")
+ set_text("dump.table_format", "{%s}")
set_text("dump.anchor", "&%s")
set_text("dump.reference", "*%s")
set_color("dump.anchor", "yellow")
set_color("dump.reference", "yellow")
set_color("dump.default", "bright")
+ set_color("dump.udata", "yellow")
+ set_color("dump.table", "bright")
set_color("dump.string", "magenta bright")
set_color("dump.string_quote", "magenta")
set_color("dump.keyword", "blue")
diff --git a/xmake/themes/emoji/xmake.lua b/xmake/themes/emoji/xmake.lua
index 663271719..da189e23f 100644
--- a/xmake/themes/emoji/xmake.lua
+++ b/xmake/themes/emoji/xmake.lua
@@ -53,11 +53,15 @@ theme("emoji")
-- color dump
set_text("dump.default_format", "<%s>")
- set_text("dump.anchor", "⚓ %s")
- set_text("dump.reference", "⛵ %s")
+ set_text("dump.udata_format", "[%s]")
+ set_text("dump.table_format", "{%s}")
+ set_text("dump.anchor", "${anchor} %s")
+ set_text("dump.reference", "${sailboat} %s")
set_color("dump.anchor", "yellow")
set_color("dump.reference", "yellow")
set_color("dump.default", "bright")
+ set_color("dump.udata", "yellow")
+ set_color("dump.table", "bright")
set_color("dump.string", "magenta bright")
set_color("dump.string_quote", "magenta")
set_color("dump.keyword", "blue")
diff --git a/xmake/themes/plain/xmake.lua b/xmake/themes/plain/xmake.lua
index 69760dca2..057d2ddf0 100644
--- a/xmake/themes/plain/xmake.lua
+++ b/xmake/themes/plain/xmake.lua
@@ -53,11 +53,15 @@ theme("plain")
-- color dump
set_text("dump.default_format", "<%s>")
+ set_text("dump.udata_format", "[%s]")
+ set_text("dump.table_format", "{%s}")
set_text("dump.anchor", "&%s")
set_text("dump.reference", "*%s")
set_color("dump.anchor", "")
set_color("dump.reference", "")
set_color("dump.default", "")
+ set_color("dump.udata", "")
+ set_color("dump.table", "")
set_color("dump.string", "")
set_color("dump.string_quote", "")
set_color("dump.keyword", "")