Skip to content

Commit 0473cc6

Browse files
committed
Fix UWP documentation generation.
1 parent bc96a41 commit 0473cc6

6 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ prevent_in_source_build()
2828
option(TD_INSTALL_STATIC_LIBRARIES "Enable installation of static libraries." ON)
2929
option(TD_INSTALL_SHARED_LIBRARIES "Enable installation of shared libraries." ON)
3030
option(TD_ENABLE_JNI "Use \"ON\" to enable JNI-compatible TDLib API.")
31-
option(TD_ENABLE_DOTNET "Use \"ON\" to enable generation of C++/CLI or C++/CX TDLib API bindings.")
31+
option(TD_ENABLE_DOTNET "Use \"ON\" or \"CX\" to enable generation of C++/CLI or C++/CX TDLib API bindings respectively.")
3232
if (NOT CMAKE_CROSSCOMPILING)
3333
option(TD_GENERATE_SOURCE_FILES "Use \"ON\" to just generate TDLib source files.")
3434
endif()

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ See [example/java](https://github.com/tdlib/td/tree/master/example/java) for exa
116116

117117
<a name="using-dotnet"></a>
118118
## Using in .NET projects
119-
`TDLib` provides native .NET interface through `C++/CLI` and `C++/CX`. To enable it, specify option `-DTD_ENABLE_DOTNET=ON` to CMake.
119+
`TDLib` provides native .NET interface through `C++/CLI` and `C++/CX`. To enable it, specify option `-DTD_ENABLE_DOTNET=ON` or `-DTD_ENABLE_DOTNET=CX` respectively to CMake.
120120
.NET Core supports `C++/CLI` only since version 3.1 and only on Windows, so if older .NET Core is used or portability is needed, then `TDLib` JSON interface should be used through P/Invoke instead.
121121

122122
See [example/csharp](https://github.com/tdlib/td/tree/master/example/csharp) for example of using `TDLib` from C# and detailed build and usage instructions.

‎build.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,10 @@
10081008
if (target === 'JNI') {
10091009
cmake_init_options.push('-DTD_ENABLE_JNI=ON');
10101010
}
1011-
if (target === 'C++/CX' || target === 'C++/CLI') {
1011+
if (target === 'C++/CX') {
1012+
cmake_init_options.push('-DTD_ENABLE_DOTNET=CX');
1013+
}
1014+
if (target === 'C++/CLI') {
10121015
cmake_init_options.push('-DTD_ENABLE_DOTNET=ON');
10131016
}
10141017
if (use_lto) {

‎example/uwp/build.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function prepare {
4040

4141
cd build-native
4242

43-
cmake -A Win32 -DTD_GENERATE_SOURCE_FILES=ON -DTD_ENABLE_DOTNET=ON "$td_root"
43+
cmake -A Win32 -DTD_GENERATE_SOURCE_FILES=ON -DTD_ENABLE_DOTNET=CX "$td_root"
4444
CheckLastExitCode
4545
cmake --build .
4646
CheckLastExitCode
@@ -61,7 +61,7 @@ function config {
6161
if ($arch -eq "x86") {
6262
$fixed_arch = "win32"
6363
}
64-
cmake -A $fixed_arch -DCMAKE_SYSTEM_VERSION="10.0" -DCMAKE_SYSTEM_NAME="WindowsStore" -DCMAKE_TOOLCHAIN_FILE="$vcpkg_cmake" -DTD_ENABLE_DOTNET=ON "$td_root"
64+
cmake -A $fixed_arch -DCMAKE_SYSTEM_VERSION="10.0" -DCMAKE_SYSTEM_NAME="WindowsStore" -DCMAKE_TOOLCHAIN_FILE="$vcpkg_cmake" -DTD_ENABLE_DOTNET=CX "$td_root"
6565
CheckLastExitCode
6666
cd ..
6767
}

‎td/generate/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ if (NOT CMAKE_CROSSCOMPILING)
208208

209209
if (TD_ENABLE_DOTNET)
210210
if (PHP_EXECUTABLE)
211-
set(GENERATE_DOTNET_API_CMD td_generate_dotnet_api ${TD_API_TLO_FILE} && ${PHP_EXECUTABLE} ../DotnetTlDocumentationGenerator.php ../scheme/td_api.tl td/telegram/Telegram.Td.xml ${CMAKE_SYSTEM_NAME})
211+
set(GENERATE_DOTNET_API_CMD td_generate_dotnet_api ${TD_API_TLO_FILE} && ${PHP_EXECUTABLE} ../DotnetTlDocumentationGenerator.php ../scheme/td_api.tl td/telegram/Telegram.Td.xml ${TD_ENABLE_DOTNET})
212212
else()
213213
set(GENERATE_DOTNET_API_CMD td_generate_dotnet_api ${TD_API_TLO_FILE})
214214
endif()

‎td/generate/DotnetTlDocumentationGenerator.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,12 @@ protected function addFullConstructorDocumentation($class_name, $class_descripti
345345
$this->addDocumentation("M:$class_name.#ctor($full_constructor)", $full_doc);
346346
}
347347

348-
public function __construct($system_name) {
349-
$this->cpp_cli = $system_name !== 'WindowsStore';
348+
public function __construct($flavor_name) {
349+
$this->cpp_cli = $flavor_name !== 'CX';
350350
}
351351
}
352352

353-
$system_name = isset($argv[3]) ? $argv[3] : 'Windows';
353+
$flavor_name = isset($argv[3]) ? $argv[3] : 'Windows';
354354

355-
$generator = new DotnetTlDocumentationGenerator($system_name);
355+
$generator = new DotnetTlDocumentationGenerator($flavor_name);
356356
$generator->generate($argv[1], $argv[2]);

0 commit comments

Comments
 (0)