Skip to content

Commit f088d90

Browse files
committed
port
1 parent 76ab889 commit f088d90

702 files changed

Lines changed: 105202 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
x86
44
x64
55
*.user
6+
build
7+
packages

CMakeLists.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/cppwinrt.exe" cppwinrt_exe)
2+
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" CmakeOutDir)
3+
4+
set(build msbuild /nologo /m /p:Configuration=${CMAKE_BUILD_TYPE},Platform=$ENV{VSCMD_ARG_TGT_ARCH},XlangBuildVersion=${XLANG_BUILD_VERSION},CmakeOutDir=${CmakeOutDir} ${CMAKE_CURRENT_SOURCE_DIR}/cppwinrt.sln)
5+
6+
add_custom_command(OUTPUT ${cppwinrt_exe}
7+
COMMAND ${build} /t:cppwinrt
8+
)
9+
10+
add_custom_target(cppwinrt ALL DEPENDS ${cppwinrt_exe})
11+
12+
add_custom_target(cppwinrt_test ALL DEPENDS cppwinrt
13+
COMMAND ${cppwinrt_exe} -in sdk -out ${CMAKE_CURRENT_BINARY_DIR} -verbose
14+
COMMAND ${build} /t:fast_fwd
15+
COMMAND ${build} /t:test
16+
COMMAND ${build} /t:test_fast
17+
COMMAND ${build} /t:test_fast_fwd
18+
COMMAND ${build} /t:old_tests\\test_old
19+
)
20+
21+
set_target_properties(cppwinrt PROPERTIES "cppwinrt_exe" ${cppwinrt_exe})
22+
23+
# For x86, build all arches of fast forwarder lib for NuGet dependency
24+
if (WIN32 AND ("$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "x86"))
25+
26+
set(ffbuild msbuild /nologo /m /p:Configuration=${CMAKE_BUILD_TYPE},XlangBuildVersion=${XLANG_BUILD_VERSION} ${CMAKE_CURRENT_SOURCE_DIR}/cppwinrt.sln /t:fast_fwd)
27+
28+
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/cppwinrt_fast_forwarder.lib" cppwinrt_fast_fwd_x86)
29+
30+
set(CmakeOutDir_x86 ${CmakeOutDir})
31+
string(REGEX REPLACE "x86" "x64" CmakeOutDir_x64 ${CmakeOutDir})
32+
string(REGEX REPLACE "x86" "arm" CmakeOutDir_arm ${CmakeOutDir})
33+
string(REGEX REPLACE "x86" "arm64" CmakeOutDir_arm64 ${CmakeOutDir})
34+
35+
add_custom_command(OUTPUT ${cppwinrt_fast_fwd_x86}
36+
COMMAND ${ffbuild} /p:Platform=x86,CmakeOutDir=${CmakeOutDir_x86}
37+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CmakeOutDir_x64}
38+
COMMAND cd /d ${CmakeOutDir_x64}
39+
COMMAND ${ffbuild} /p:Platform=x64,CmakeOutDir=${CmakeOutDir_x64}
40+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CmakeOutDir_arm}
41+
COMMAND cd /d ${CmakeOutDir_arm}
42+
COMMAND ${ffbuild} /p:Platform=arm,CmakeOutDir=${CmakeOutDir_arm}
43+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CmakeOutDir_arm64}
44+
COMMAND cd /d ${CmakeOutDir_arm64}
45+
COMMAND ${ffbuild} /p:Platform=arm64,CmakeOutDir=${CmakeOutDir_arm64}
46+
)
47+
48+
add_custom_target(cppwinrt_fast_fwd ALL DEPENDS ${cppwinrt_fast_fwd_x86})
49+
50+
set_target_properties(cppwinrt_fast_fwd PROPERTIES "cppwinrt_fast_fwd_x86" ${cppwinrt_fast_fwd_x86})
51+
52+
endif()

build_projection.cmd

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@echo off
2+
3+
setlocal ENABLEDELAYEDEXPANSION
4+
5+
set target_platform=%1
6+
set target_configuration=%2
7+
if "%target_platform%"=="" set target_platform=x64
8+
9+
if /I "%target_platform%" equ "all" (
10+
if "%target_configuration%"=="" (
11+
set target_configuration=all
12+
)
13+
call %0 x86 !target_configuration!
14+
call %0 x64 !target_configuration!
15+
call %0 arm !target_configuration!
16+
call %0 arm64 !target_configuration!
17+
goto :eof
18+
)
19+
20+
if /I "%target_configuration%" equ "all" (
21+
call %0 %target_platform% Debug
22+
call %0 %target_platform% Release
23+
goto :eof
24+
)
25+
26+
if "%target_configuration%"=="" (
27+
set target_configuration=Debug
28+
)
29+
30+
echo Building projection into %target_platform% %target_configuration%
31+
%~p0\build\x64\Release\cppwinrt.exe -in local -out %~p0\build\%target_platform%\%target_configuration% -verbose
32+
echo.

compile_tests.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cl /EHsc /std:c++17 /MP /I ..\..\..\_build\Windows\x64\Debug\tool\cppwinrt ..\..\..\_build\Windows\x64\Debug\tool\cppwinrt\tests\*.cpp

cppwinrt.props

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<!-- Set common MSBuild properties and item metadata for CppWinRT tool and tests -->
4+
5+
<PropertyGroup Condition="'$(VisualStudioVersion)' == '15.0'">
6+
<PlatformToolset>v141</PlatformToolset>
7+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
8+
</PropertyGroup>
9+
10+
<PropertyGroup Condition="'$(VisualStudioVersion)' == '16.0'">
11+
<PlatformToolset>v142</PlatformToolset>
12+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
13+
</PropertyGroup>
14+
15+
<!--
16+
Can be used as follows.
17+
18+
Compile with Visual C++:
19+
20+
msbuild /m /p:Configuration=Debug,Platform=x64 cppwinrt.sln
21+
22+
Compile with Clang:
23+
24+
msbuild /m /p:Configuration=Debug,Platform=x64,Clang=1 cppwinrt.sln
25+
26+
Optionally add /t:<project> to only build a given a solution project:
27+
28+
msbuild /m /p:Configuration=Debug,Platform=x64,Clang=1 cppwinrt.sln /t:cppwinrt
29+
-->
30+
31+
<PropertyGroup Condition="'$(Clang)'=='1'">
32+
<CLToolExe>clang-cl.exe</CLToolExe>
33+
<CLToolPath>C:\Program Files\LLVM\bin</CLToolPath>
34+
</PropertyGroup>
35+
36+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
37+
38+
<PropertyGroup>
39+
<XlangBuildVersion Condition="'$(XlangBuildVersion)'==''">2.3.4.5</XlangBuildVersion>
40+
<CmakePlatform>$(Platform)</CmakePlatform>
41+
<CmakePlatform Condition="'$(Platform)'=='Win32'">x86</CmakePlatform>
42+
<CmakeOutDir Condition="'$(CmakeOutDir)'==''">$(SolutionDir)build\$(CmakePlatform)\$(Configuration)</CmakeOutDir>
43+
<CppWinRTDir>$(CmakeOutDir)\</CppWinRTDir>
44+
<CppWinRTDir Condition="'$(Platform)'=='ARM' or '$(Platform)'=='ARM64'">$(SolutionDir)build\x86\$(Configuration)\</CppWinRTDir>
45+
<OutDir>$(CmakeOutDir)\</OutDir>
46+
</PropertyGroup>
47+
48+
<ItemDefinitionGroup>
49+
<ClCompile>
50+
<WarningLevel>Level4</WarningLevel>
51+
<SDLCheck>true</SDLCheck>
52+
<ConformanceMode>true</ConformanceMode>
53+
<LanguageStandard>stdcpp17</LanguageStandard>
54+
<PrecompiledHeader>Use</PrecompiledHeader>
55+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
56+
<PreprocessorDefinitions>XLANG_VERSION_STRING="$(XlangBuildVersion)";NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
57+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
58+
<AdditionalOptions>/await /bigobj</AdditionalOptions>
59+
<AdditionalOptions Condition="'$(Clang)'=='1'">-Wno-unused-command-line-argument -fno-delayed-template-parsing -Xclang -fcoroutines-ts -mcx16</AdditionalOptions>
60+
</ClCompile>
61+
<Link>
62+
<AdditionalDependencies>onecore.lib</AdditionalDependencies>
63+
</Link>
64+
<ResourceCompile>
65+
<PreprocessorDefinitions>XLANG_VERSION_STRING="$(XlangBuildVersion)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
66+
</ResourceCompile>
67+
</ItemDefinitionGroup>
68+
69+
</Project>

0 commit comments

Comments
 (0)