diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ea175edc..3b8539216 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/td/generate/CMakeLists.txt b/td/generate/CMakeLists.txt index 9450dcf45..a7517fcd6 100644 --- a/td/generate/CMakeLists.txt +++ b/td/generate/CMakeLists.txt @@ -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() diff --git a/td/generate/remove_documentation.cpp b/td/generate/remove_documentation.cpp new file mode 100644 index 000000000..d690f0ba8 --- /dev/null +++ b/td/generate/remove_documentation.cpp @@ -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 +#include +#include + +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(); + } + } +} diff --git a/tdutils/td/utils/logging.h b/tdutils/td/utils/logging.h index 5334abd5b..629a4f248 100644 --- a/tdutils/td/utils/logging.h +++ b/tdutils/td/utils/logging.h @@ -6,7 +6,7 @@ // #pragma once -/** +/* * Simple logging. * * Predefined log levels: FATAL, ERROR, WARNING, INFO, DEBUG