forked from dotnet/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
llvm.proj
117 lines (103 loc) · 7.42 KB
/
llvm.proj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<Project>
<Import Project="Directory.Build.props" />
<Import Project="Directory.Build.targets" />
<PropertyGroup>
<CMakeGenerator Condition="$(CMakeGenerator) == '' and '$(BuildOS)' != 'Windows_NT'">Unix Makefiles</CMakeGenerator>
<CMakeGenerator Condition="$(CMakeGenerator) == '' and '$(BuildOS)' == 'Windows_NT'">Ninja</CMakeGenerator>
<_VCVarsScriptName Condition="'$(BuildOS)' == 'Windows_NT'">vcvars64.bat</_VCVarsScriptName>
<_VCVarsScriptName Condition="'$(BuildOS)' == 'Windows_NT' and '$(TargetArchitecture)' == 'arm64'">vcvarsamd64_arm64.bat</_VCVarsScriptName>
<_VCVarsScriptName Condition="'$(BuildOS)' == 'Windows_NT' and '$(TargetArchitecture)' == 'arm'">vcvarsamd64_arm.bat</_VCVarsScriptName>
<_SetupEnvironment Condition="'$(BuildOS)' == 'Windows_NT'">
:: VisualStudio includes vswhere.exe that can be used to locate current VisualStudio installation.
set VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
set VS_VCINSTALL_DIR=
:: Try to locate installed VisualStudio VC environment.
if "%VCINSTALLDIR%" == "" if exist "%VSWHERE_TOOLS_BIN%" (
for /f "tokens=*" %%a in ('"%VSWHERE_TOOLS_BIN%" -prerelease -property installationPath') do (
set VS_VCINSTALL_DIR=%%a\VC\
)
)
if NOT "%VCINSTALLDIR%" == "" set VS_VCINSTALL_DIR=%VCINSTALLDIR%
:: Run VS build environment script.
call "%VS_VCINSTALL_DIR%\Auxiliary\Build\$(_VCVarsScriptName)"
</_SetupEnvironment>
<_CMakeConfigureCommand>$(_SetupEnvironment) cmake $(_LLVMSourceDir) -G "$(CMakeGenerator)" @(_LLVMBuildArgs->'%(Identity)',' ')</_CMakeConfigureCommand>
<_BuildSubset Condition="'$(BuildLLVMTableGenOnly)' == 'true'">llvm-tblgen</_BuildSubset>
<_BuildSubset Condition="'$(BuildLLVMTableGenOnly)' != 'true'">objwriter</_BuildSubset>
<_BuildCommand Condition="'$(CMakeGenerator)' == 'Unix Makefiles'">$(_SetupEnvironment) make $(_BuildSubset) -j$([System.Environment]::ProcessorCount)</_BuildCommand>
<_BuildCommand Condition="'$(CMakeGenerator)' == 'Ninja'">$(_SetupEnvironment) ninja $(_BuildSubset)</_BuildCommand>
<_CMakeInstallCommand>$(_SetupEnvironment) cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -DCMAKE_INSTALL_COMPONENT=objwriter -P cmake_install.cmake</_CMakeInstallCommand>
</PropertyGroup>
<!---DLLVM_TABLEGEN=C:\Users\Alexander\Desktop\llvm-project\build-x64\bin\llvm-tblgen.exe-->
<ItemGroup>
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'OSX'" Include="-DCMAKE_OSX_ARCHITECTURES=arm64"/>
<_LLVMBuildArgs Condition="'$(LLVMTableGenPath)' != ''" Include='-DLLVM_TABLEGEN="$(LLVMTableGenPath)"' />
<_LLVMBuildArgs Include="-DCMAKE_BUILD_TYPE=$(Configuration)" />
<_LLVMBuildArgs Include='-DLLVM_BUILD_TOOLS:BOOL=OFF' />
<_LLVMBuildArgs Include='-DLEGAL_COPYRIGHT:STRING="\xa9 Microsoft Corporation. All rights reserved."' />
<_LLVMBuildArgs Include='-DLLVM_ENABLE_TERMINFO:BOOL=OFF' />
<_LLVMBuildArgs Include="-DLLVM_INCLUDE_UTILS:BOOL=OFF" />
<_LLVMBuildArgs Include="-DLLVM_INCLUDE_RUNTIMES:BOOL=OFF" />
<_LLVMBuildArgs Include="-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF" />
<_LLVMBuildArgs Include="-DLLVM_INCLUDE_TESTS:BOOL=OFF" />
<_LLVMBuildArgs Include="-DLLVM_INCLUDE_DOCS:BOOL=OFF" />
<_LLVMBuildArgs Include='-DLLVM_TARGETS_TO_BUILD="X86%3BAArch64%3BARM"' />
<_LLVMBuildArgs Include='-DLLVM_ENABLE_PDB:BOOL=ON' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include='-DLLVM_USE_CRT_DEBUG=MTd' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include='-DLLVM_USE_CRT_RELEASE=MT' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Windows_NT'" Include='-DLLVM_ENABLE_ZLIB=OFF' />
</ItemGroup>
<PropertyGroup Condition="'$(BuildOS)' != 'Windows_NT'">
<_CrossCFlags Condition="'$(BuildOS)' == 'Linux' and ('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm')">--target=$(CLANG_TARGET) --sysroot=$(ROOTFS_DIR)</_CrossCFlags>
<_CrossCFlags Condition="'$(BuildOS)' == 'OSX' and '$(TargetArchitecture)' == 'arm64'">--target=aarch64-apple-darwin</_CrossCFlags>
<_ExeLinkerFlags>$(_CrossCFlags)</_ExeLinkerFlags>
<_ExeLinkerFlags Condition="'$(BuildOS)' == 'Linux'">-Wl,--build-id $(_ExeLinkerFlags)</_ExeLinkerFlags>
<_SharedLinkerFlags>$(_CrossCFlags)</_SharedLinkerFlags>
<_SharedLinkerFlags Condition="'$(BuildOS)' == 'Linux'">-Wl,--build-id $(_SharedLinkerFlags)</_SharedLinkerFlags>
</PropertyGroup>
<ItemGroup Condition="'$(BuildOS)' != 'Windows_NT' and ('$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'arm64')">
<_LLVMBuildArgs Include='-DCMAKE_MODULE_LINKER_FLAGS="$(_CrossCFlags)"' />
<_LLVMBuildArgs Include='-DCMAKE_SHARED_LINKER_FLAGS="$(_CrossCFlags)"' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_C_COMPILER=clang-9" />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_CXX_COMPILER=clang++-9" />
</ItemGroup>
<ItemGroup Condition="'$(BuildOS)' != 'Windows_NT'">
<_LLVMBuildArgs Include='-DCMAKE_C_FLAGS="-I../llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CrossCFlags)"' />
<_LLVMBuildArgs Include='-DCMAKE_CXX_FLAGS="-I../llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CrossCFlags) "' />
<_LLVMBuildArgs Include='-DCMAKE_EXE_LINKER_FLAGS="$(_ExeLinkerFlags)"' />
<_LLVMBuildArgs Include='-DCMAKE_SHARED_LINKER_FLAGS="$(_SharedLinkerFlags)"' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX' and '$(TargetArchitecture)' == 'arm64'" Include='-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX' and '$(TargetArchitecture)' == 'x64'" Include='-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13' />
</ItemGroup>
<Target Name="_LLVMBeforeBuild">
<MakeDir Directories="$(_LLVMBuildDir)" Condition="!Exists('$(_LLVMBuildDir)')" />
</Target>
<Target Name="_LLVMBuild">
<Exec WorkingDirectory="$(_LLVMBuildDir)"
Command="$(_CMakeConfigureCommand)"
Condition="!Exists('$(_LLVMBuildDir)/CMakeCache.txt')"
IgnoreStandardErrorWarningFormat="true" />
<Exec WorkingDirectory="$(_LLVMBuildDir)"
Command="$(_BuildCommand)"
IgnoreStandardErrorWarningFormat="true" />
<Exec WorkingDirectory="$(_LLVMBuildDir)"
Command="$(_CMakeInstallCommand)"
IgnoreStandardErrorWarningFormat="true"
Condition="'$(BuildLLVMTableGenOnly)' != 'true'" />
</Target>
<Target Name="_LLVMAfterBuild" Condition="'$(BuildLLVMTableGenOnly)' != 'true'">
<RemoveDir Directories="$(_LLVMInstallDir)/share" />
<ItemGroup>
<FilesToDelete Include="$(_LLVMInstallDir)/lib/libLTO*" />
<FilesToDelete Include="$(_LLVMInstallDir)/lib/LLVMHello*" />
<FilesToDelete Include="$(_LLVMInstallDir)/lib/BugpointPasses.*" />
</ItemGroup>
<Delete Files="@(FilesToDelete)" ContinueOnError="true" TreatErrorsAsWarnings="true" />
</Target>
<Target Name="Build" DependsOnTargets="_LLVMBeforeBuild;_LLVMBuild;_LLVMAfterBuild" />
<Target Name="Restore" />
<Target Name="Test" />
<Target Name="Pack" DependsOnTargets="Build">
<MSBuild Projects="nuget/packages.builds" Targets="Build" />
</Target>
</Project>