1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00

LLVM Clang-cl support and ninja build

Also update the submodule
This commit is contained in:
xddxd 2021-03-26 20:53:37 +02:00 committed by Ivan
parent b978aa6dca
commit 916ce7899b
8 changed files with 181 additions and 213 deletions

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Common default props for defining properties without macros. Import right before Microsoft.Cpp.Default.props -->
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="Globals">
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<!-- Spectre mitigation is disabled by default unless WDK is installed -->
<SpectreMitigation>false</SpectreMitigation>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<LanguageStandard>stdcpplatest</LanguageStandard>
<PreprocessorDefinitions>_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING=1;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary Condition = "$(Configuration.Contains('Release'))">MultiThreaded</RuntimeLibrary>
<RuntimeLibrary Condition = "$(Configuration.Contains('Debug'))">MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

2
llvm

@ -1 +1 @@
Subproject commit 716bb292ba3b4e5c0ceff72fee911ed2b53232cf
Subproject commit 5d8643e8eb3fcc60d8ca04b0aa61f6fd0722a0a8

View File

@ -1,29 +0,0 @@
REM You need cmake and python to update the project files
REM this script relies on CWD being the path that this script is in
cmake -G "Visual Studio 16 2019 Win64" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_UTILS=OFF -DLLVM_USE_INTEL_JITEVENTS=ON -DLLVM_ENABLE_Z3_SOLVER=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0 -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT ../llvm
RD /S /Q cmake
RD /S /Q CMakeFiles
RD /S /Q projects
RD /S /Q share
RD /S /Q tools
DEL ALL_BUILD.vcxproj
DEL ALL_BUILD.vcxproj.filters
DEL CMakeCache.txt
DEL cmake_install.cmake
DEL CPackConfig.cmake
DEL CPackSourceConfig.cmake
DEL DummyConfigureOutput
DEL INSTALL.vcxproj
DEL INSTALL.vcxproj.filters
DEL LLVM.sdf
DEL LLVM.sln
DEL LLVMBuild.cmake
DEL PACKAGE.vcxproj
DEL PACKAGE.vcxproj.filters
DEL ZERO_CHECK.vcxproj
DEL ZERO_CHECK.vcxproj.filters
DEL include\llvm\llvm_headers_do_not_build.vcxproj
DEL include\llvm\llvm_headers_do_not_build.vcxproj.filters
python make_paths_relative.py

View File

@ -38,32 +38,51 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<CmakeGenerator>"Visual Studio $(VisualStudioVersion.Substring(0,2))"</CmakeGenerator>
<CmakeCLI>cmake -G $(CmakeGenerator) -A x64 -Thost=x64 -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT ../llvm</CmakeCLI>
<CmakeReleaseCLI>call vsdevcmd.bat -arch=amd64
cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="./Release" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT ../llvm</CmakeReleaseCLI>
<CmakeDebugCLI>call vsdevcmd.bat -arch=amd64
cmake -G Ninja -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="./Debug" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT ../llvm</CmakeDebugCLI>
<CmakeCleanCLI>echo Cleaning..
for /F "delims= eol=|" %%f in ('
dir /b ^| findstr /V "[^.]*\build[^.]*\.vcxproj"') do (
echo Deleting .\%%f
if exist %%f\nul (
rmdir .\%%f /s /q
) else (
del .\%%f /q
)
)
</CmakeCleanCLI>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<NMakePreprocessorDefinitions>
</NMakePreprocessorDefinitions>
<NMakeBuildCommandLine>$(CmakeCLI)
msbuild.exe ALL_BUILD.vcxproj /t:build /p:Configuration=Debug /p:ForceImportBeforeCppTargets=$(SolutionDir)common_default.props /m
<NMakeBuildCommandLine>$(CmakeDebugCLI)
ninja
ninja install
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>$(CmakeCLI)
msbuild.exe ALL_BUILD.vcxproj /t:rebuild /p:Configuration=Debug /p:ForceImportBeforeCppTargets=$(SolutionDir)common_default.props /m
<NMakeReBuildCommandLine>del CMakeCache.txt
$(CmakeDebugCLI)
ninja
ninja install
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>$(CmakeCLI)
msbuild.exe ALL_BUILD.vcxproj /t:clean /p:Configuration=Debug /p:ForceImportBeforeCppTargets=$(SolutionDir)common_default.props /m
<NMakeCleanCommandLine>
$(CmakeCleanCLI)
</NMakeCleanCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<NMakePreprocessorDefinitions />
<NMakeBuildCommandLine>$(CmakeCLI)
msbuild.exe ALL_BUILD.vcxproj /t:build /p:Configuration=Release /p:ForceImportBeforeCppTargets=$(SolutionDir)common_default.props /m
<NMakeBuildCommandLine>$(CmakeReleaseCLI)
ninja
ninja install
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>$(CmakeCLI)
msbuild.exe ALL_BUILD.vcxproj /t:rebuild /p:Configuration=Release /p:ForceImportBeforeCppTargets=$(SolutionDir)common_default.props /m
<NMakeReBuildCommandLine>del CMakeCache.txt
$(CmakeReleaseCLI)
ninja
ninja install
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>$(CmakeCLI)
msbuild.exe ALL_BUILD.vcxproj /t:clean /p:Configuration=Release /p:ForceImportBeforeCppTargets=$(SolutionDir)common_default.props /m
<NMakeCleanCommandLine>
$(CmakeCleanCLI)
</NMakeCleanCommandLine>
</PropertyGroup>
<ItemDefinitionGroup>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A37E4273-85DB-4217-B775-CE971B87D9DF}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<Import Project="..\common_default_clang_cl.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="..\common_default_macros.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<CmakeReleaseCLI>call vsdevcmd.bat -arch=amd64
cmake -G Ninja -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_BUILD_TYPE="Release" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DCMAKE_INSTALL_PREFIX="./Release" -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT ../llvm</CmakeReleaseCLI>
<CmakeDebugCLI>call vsdevcmd.bat -arch=amd64
cmake -G Ninja -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_DEFAULT_TARGET_TRIPLE:STRING=x86_64-pc-windows-msvc -DLLVM_HOST_TRIPLE:STRING=x86_64-pc-windows-msvc -DCMAKE_INSTALL_PREFIX="./Debug" -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_INCLUDE_UTILS=OFF -DCMAKE_SYSTEM_VERSION=6.1 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=$(WindowsTargetPlatformVersion) -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT ../llvm</CmakeDebugCLI>
<CmakeCleanCLI>echo Cleaning..
for /F "delims= eol=|" %%f in ('
dir /b ^| findstr /V "[^.]*\build[^.]*\.vcxproj"') do (
echo Deleting .\%%f
if exist %%f\nul (
rmdir .\%%f /s /q
) else (
del .\%%f /q
)
)
</CmakeCleanCLI>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<NMakePreprocessorDefinitions>
</NMakePreprocessorDefinitions>
<NMakeBuildCommandLine>$(CmakeDebugCLI)
ninja
ninja install
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>del CMakeCache.txt
$(CmakeDebugCLI)
ninja
ninja install
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>
$(CmakeCleanCLI)
</NMakeCleanCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<NMakePreprocessorDefinitions />
<NMakeBuildCommandLine>$(CmakeReleaseCLI)
ninja
ninja install
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>del CMakeCache.txt
$(CmakeReleaseCLI)
ninja
ninja install
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>
$(CmakeCleanCLI)
</NMakeCleanCommandLine>
</PropertyGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{fad608c4-4182-4423-85ed-9d1813b9c696}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{02fc0ad3-18aa-4762-b24b-8226dfb0e223}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{22cf2f8c-de87-4f6f-9b26-a5b9b746968c}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
</Project>

View File

@ -1,169 +0,0 @@
import os
import re
import shutil
import xml.etree.ElementTree as ET
RPCS3DIR = ""
cmake_dirs = ["CMakeFiles"]
cmake_files = ["INSTALL.vcxproj",
"INSTALL.vcxproj.filters",
"PACKAGE.vcxproj",
"PACKAGE.vcxproj.filters",
"cmake_install.cmake",
]
vcxproj_files_blacklist = ["llvm_build.vcxproj", "llvm_build.vcxproj.filters"]
vcxproj_files = ["lib\Analysis\LLVMAnalysis.vcxproj",
"lib\Analysis\IPA\LLVMipa.vcxproj",
"lib\AsmParser\LLVMAsmParser.vcxproj",
"lib\Bitcode\Reader\LLVMBitReader.vcxproj",
"lib\Bitcode\Writer\LLVMBitWriter.vcxproj",
"lib\CodeGen\LLVMCodeGen.vcxproj",
"lib\CodeGen\AsmPrinter\LLVMAsmPrinter.vcxproj",
"lib\CodeGen\SelectionDAG\LLVMSelectionDAG.vcxproj",
"lib\DebugInfo\LLVMDebugInfo.vcxproj",
"lib\ExecutionEngine\LLVMExecutionEngine.vcxproj",
"lib\ExecutionEngine\Interpreter\LLVMInterpreter.vcxproj",
"lib\ExecutionEngine\JIT\LLVMJIT.vcxproj",
"lib\ExecutionEngine\MCJIT\LLVMMCJIT.vcxproj",
"lib\ExecutionEngine\RuntimeDyld\LLVMRuntimeDyld.vcxproj",
"lib\IR\LLVMCore.vcxproj",
"lib\IRReader\LLVMIRReader.vcxproj",
"lib\LineEditor\LLVMLineEditor.vcxproj",
"lib\Linker\LLVMLinker.vcxproj",
"lib\LTO\LLVMLTO.vcxproj",
"lib\MC\LLVMMC.vcxproj",
"lib\MC\MCAnalysis\LLVMMCAnalysis.vcxproj",
"lib\MC\MCDisassembler\LLVMMCDisassembler.vcxproj",
"lib\MC\MCParser\LLVMMCParser.vcxproj",
"lib\Object\LLVMObject.vcxproj",
"lib\Option\LLVMOption.vcxproj",
"lib\ProfileData\LLVMProfileData.vcxproj",
"lib\Support\LLVMSupport.vcxproj",
"lib\TableGen\LLVMTableGen.vcxproj",
"lib\Target\LLVMTarget.vcxproj",
"lib\Target\X86\LLVMX86CodeGen.vcxproj",
"lib\Target\X86\X86CommonTableGen.vcxproj",
"lib\Target\X86\AsmParser\LLVMX86AsmParser.vcxproj",
"lib\Target\X86\Disassembler\LLVMX86Disassembler.vcxproj",
"lib\Target\X86\InstPrinter\LLVMX86AsmPrinter.vcxproj",
"lib\Target\X86\MCTargetDesc\LLVMX86Desc.vcxproj",
"lib\Target\X86\TargetInfo\LLVMX86Info.vcxproj",
"lib\Target\X86\Utils\LLVMX86Utils.vcxproj",
"lib\Transforms\Hello\LLVMHello.vcxproj",
"lib\Transforms\InstCombine\LLVMInstCombine.vcxproj",
"lib\Transforms\Instrumentation\LLVMInstrumentation.vcxproj",
"lib\Transforms\IPO\LLVMipo.vcxproj",
"lib\Transforms\ObjCARC\LLVMObjCARCOpts.vcxproj",
"lib\Transforms\Scalar\LLVMScalarOpts.vcxproj",
"lib\Transforms\Utils\LLVMTransformUtils.vcxproj",
"lib\Transforms\Vectorize\LLVMVectorize.vcxproj",
"include\llvm\IR\intrinsics_gen.vcxproj",
"utils\TableGen\llvm-tblgen.vcxproj",
]
def get_parent_dir():
path = os.getcwd()
os.chdir("..")
rpcs3_dir = os.getcwd()
os.chdir(path)
return rpcs3_dir
def rem_cmake_files(root_path):
for root, dirs, files in os.walk(root_path):
for directory in dirs:
if directory in cmake_dirs:
print("deleting: {}".format(os.path.join(root, directory)))
shutil.rmtree(os.path.join(root, directory))
dirs = [item for item in dirs if item not in cmake_dirs]
for file in files:
if file in cmake_files:
print("deleting: {}".format(os.path.join(root, file)))
os.remove(os.path.join(root, file))
def repl_cmake_copy(match):
newtext = "copy /y "
files = match.group(1)
files = files.replace('/', '\\')
return newtext + files
def make_paths_relative(file):
global vcxproj_files
global vcxproj_files_blacklist
this_vcxproj = os.path.relpath(file, os.getcwd())
if this_vcxproj in vcxproj_files_blacklist:
return
if (file.find('.vcxproj') != len(file) - 8) and (file.find('.vcxproj.filters') != len(file) - 16):
print('ERROR: File "{}" is not vcxproj file'.format(file))
return
proj_path = os.path.dirname(file)
if proj_path[1] != ':':
print('ERROR: Path "{}" is not in the Windows format'.format(proj_path))
return
# check if we expected this project file
if file[-8:] == '.vcxproj':
if this_vcxproj in vcxproj_files:
vcxproj_files.remove(this_vcxproj)
else:
print('ERROR: unexpected vcxproj file: "{}" please update the script'.format(this_vcxproj))
return
# open the file and text-replace the absolute paths
with open(file, 'r') as f:
file_cont = f.read()
rel_path = '$(ProjDir)' + os.path.relpath(RPCS3DIR, proj_path)
file_cont = file_cont.replace(RPCS3DIR, rel_path)
rpcs3_path_alt = RPCS3DIR.replace('\\', '/')
rel_path_alt = rel_path.replace('\\', '/')
file_cont = file_cont.replace(rpcs3_path_alt, rel_path_alt)
# interpret the XML to remove the cmake commands from the "Command" tags
ET.register_namespace('', 'http://schemas.microsoft.com/developer/msbuild/2003')
tree = ET.fromstring(file_cont)
for parent in tree.findall('.//{http://schemas.microsoft.com/developer/msbuild/2003}Command/..'):
for element in parent.findall('{http://schemas.microsoft.com/developer/msbuild/2003}Command'):
text = str(element.text)
rgx = re.compile(r'[^\r\n<>]+cmake.exe["]?\s+-E copy_if_different([^\r\n]+)')
text, num_rep = rgx.subn(repl_cmake_copy, text)
rgx = re.compile(r'[^\r\n<>]+cmake.exe([^\r\n]*)')
text, num_rep2 = rgx.subn(r'REM OMMITTED CMAKE COMMAND', text)
num_rep += num_rep2
rgx = re.compile(r'[^\r\n<>]+ml64.exe"?([^\r\n]*)')
text, num_rep2 = rgx.subn(r'"$(VCInstallDir)bin\x86_amd64\ml64.exe" \1', text)
num_rep += num_rep2
if num_rep > 0:
element.text = text
# re-create the XML and save the file
file_cont = ET.tostring(tree, 'utf-8')
with open(file, 'w') as f:
f.write(file_cont)
def iterate_proj_file(root_path):
for root, dirs, files in os.walk(root_path):
for file in files:
if file.find('.vcxproj') != -1:
make_paths_relative(os.path.join(root, file))
def main_func():
global RPCS3DIR
RPCS3DIR = get_parent_dir()
rem_cmake_files(os.getcwd())
iterate_proj_file(os.getcwd())
for a in vcxproj_files:
print('ERROR: project file was not found "{}"'.format(a))
if __name__ == "__main__":
main_func()

View File

@ -77,6 +77,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spirv-tools-build", "Vulkan
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rdParty", "3rdParty", "{6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "llvm_build_clang_cl", "llvm_build\llvm_build_clang_cl.vcxproj", "{A37E4273-85DB-4217-B775-CE971B87D9DF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug - LLVM|x64 = Debug - LLVM|x64
@ -232,6 +234,13 @@ Global
{4CBD3DDD-5555-49A4-A44D-DD3D8CB516A1}.Debug|x64.ActiveCfg = Debug|x64
{4CBD3DDD-5555-49A4-A44D-DD3D8CB516A1}.Release - LLVM|x64.ActiveCfg = Release|x64
{4CBD3DDD-5555-49A4-A44D-DD3D8CB516A1}.Release|x64.ActiveCfg = Release|x64
{A37E4273-85DB-4217-B775-CE971B87D9DF}.Debug - LLVM|x64.ActiveCfg = Debug|x64
{A37E4273-85DB-4217-B775-CE971B87D9DF}.Debug - LLVM|x64.Build.0 = Debug|x64
{A37E4273-85DB-4217-B775-CE971B87D9DF}.Debug|x64.ActiveCfg = Debug|x64
{A37E4273-85DB-4217-B775-CE971B87D9DF}.Debug|x64.Build.0 = Debug|x64
{A37E4273-85DB-4217-B775-CE971B87D9DF}.Release - LLVM|x64.ActiveCfg = Release|x64
{A37E4273-85DB-4217-B775-CE971B87D9DF}.Release|x64.ActiveCfg = Release|x64
{A37E4273-85DB-4217-B775-CE971B87D9DF}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -256,6 +265,7 @@ Global
{73973223-5EE8-41CA-8E88-1D60E89A237B} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} = {6C3B64A0-8F8A-4DC4-8C0B-D71EBEED7FA8}
{4CBD3DDD-5555-49A4-A44D-DD3D8CB516A1} = {B0AC29FD-7B01-4B5E-9C8D-0A081E4C5668}
{A37E4273-85DB-4217-B775-CE971B87D9DF} = {B0AC29FD-7B01-4B5E-9C8D-0A081E4C5668}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {06CC7920-E085-4B81-9582-8DE8AAD42510}