Remove C++ documentation when compiling for .NET. Enable .NET documentation generation.
GitOrigin-RevId: 426774bdad76bf42ceb261029589441961673ac8
This commit is contained in:
parent
0bbad22da4
commit
a80b8e951a
@ -225,7 +225,14 @@ add_subdirectory(td/generate)
|
||||
if (NOT CMAKE_CROSSCOMPILING)
|
||||
add_custom_target(prepare_cross_compiling DEPENDS tl_generate_common tdmime_auto tl_generate_json)
|
||||
if (TD_ENABLE_DOTNET)
|
||||
add_dependencies(prepare_cross_compiling generate_dotnet_api)
|
||||
add_custom_target(remove_cpp_documentation
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND remove_documentation ${TL_TD_AUTO} td/telegram/Client.h td/telegram/Log.h td/tl/TlObject.h
|
||||
COMMENT "Remove C++ documentation from sources"
|
||||
DEPENDS remove_documentation tl_generate_common generate_dotnet_api ${TL_TD_AUTO} td/telegram/Client.h td/telegram/Log.h td/tl/TlObject.h
|
||||
)
|
||||
|
||||
add_dependencies(prepare_cross_compiling generate_dotnet_api remove_cpp_documentation)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -600,6 +607,9 @@ if (NOT CMAKE_CROSSCOMPILING)
|
||||
if (TD_ENABLE_JNI)
|
||||
add_dependencies(tdcore td_generate_java_api)
|
||||
endif()
|
||||
if (TD_ENABLE_DOTNET)
|
||||
add_dependencies(tdcore remove_cpp_documentation)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(tdclient td/telegram/Client.cpp td/telegram/Client.h td/telegram/Log.cpp td/telegram/Log.h)
|
||||
@ -630,6 +640,7 @@ if (TD_ENABLE_DOTNET)
|
||||
add_dependencies(tddotnet generate_dotnet_api)
|
||||
endif()
|
||||
|
||||
target_compile_options(tddotnet PRIVATE "/doc")
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
|
||||
set_target_properties(tddotnet PROPERTIES VS_WINRT_COMPONENT "true")
|
||||
target_compile_options(tddotnet PUBLIC "/ZW")
|
||||
@ -656,6 +667,9 @@ target_include_directories(tdjson_private PUBLIC
|
||||
target_link_libraries(tdjson_private PUBLIC tdclient tdutils)
|
||||
if (NOT CMAKE_CROSSCOMPILING)
|
||||
add_dependencies(tdjson_private tl_generate_common tl_generate_json)
|
||||
if (TD_ENABLE_DOTNET)
|
||||
add_dependencies(tdjson_private remove_cpp_documentation)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(TD_JSON_HEADERS td/telegram/td_json_client.h td/telegram/td_log.h)
|
||||
|
@ -83,7 +83,6 @@ set(TL_GENERATE_JSON_SOURCE
|
||||
tl_json_converter.h
|
||||
)
|
||||
|
||||
|
||||
if (NOT CMAKE_CROSSCOMPILING)
|
||||
find_program(PHP_EXECUTABLE php)
|
||||
|
||||
@ -142,4 +141,7 @@ if (NOT CMAKE_CROSSCOMPILING)
|
||||
DEPENDS td_generate_dotnet_api ${TL_TD_API_TLO}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(remove_documentation remove_documentation.cpp)
|
||||
target_link_libraries(remove_documentation PRIVATE tdtl)
|
||||
endif()
|
||||
|
23
td/generate/remove_documentation.cpp
Normal file
23
td/generate/remove_documentation.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/tl/tl_file_utils.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
std::string file_name = argv[i];
|
||||
std::string old_contents = td::tl::get_file_contents(file_name, "rb");
|
||||
std::string new_contents = td::tl::remove_documentation(old_contents);
|
||||
if (new_contents != old_contents && !td::tl::put_file_contents(file_name, "wb", new_contents)) {
|
||||
std::fprintf(stderr, "Can't write file %s\n", file_name.c_str());
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
/*
|
||||
* Simple logging.
|
||||
*
|
||||
* Predefined log levels: FATAL, ERROR, WARNING, INFO, DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user