Rename TdWindows to TdDotNet.

GitOrigin-RevId: 0bfff62c224dcbd316534649b119917280b3b398
This commit is contained in:
levlam 2018-02-28 02:09:23 +03:00
parent 9874d08701
commit 6eadf472fe
8 changed files with 46 additions and 47 deletions

View File

@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(TDLib VERSION 1.1.3 LANGUAGES CXX C)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set(UWP 1)
endif()
option(TD_ENABLE_JNI "Use \"ON\" to enable JNI-compatible TDLib API.")
option(TD_ENABLE_DOTNET "Use \"ON\" to enable generation of C++/CLI or C++/CX TDLib API bindings.")
@ -53,7 +49,6 @@ In FAST mode stack is unwinded only using frame pointers, which may fail. \
In SAFE mode stack is unwinded using backtrace function from execinfo.h, which may be very slow. \
By default both methods are used to achieve maximum speed and accuracy")
# LIBRARIES
if (EMSCRIPTEN)
# use prebuilt zlib
set(ZLIB_FOUND 1)
@ -283,7 +278,7 @@ set(TL_C_SCHEME_SOURCE
set_source_files_properties(${TL_DOTNET_AUTO} PROPERTIES GENERATED TRUE)
set(TL_DOTNET_SCHEME_SOURCE
${TL_TD_DOTNET_AUTO}
td/tl/tl_win_object.h
td/tl/tl_dotnet_object.h
)
set(TDLIB_SOURCE
@ -595,27 +590,25 @@ if (TD_ENABLE_JNI AND NOT ANDROID) # jni is available by default on Android
endif()
if (TD_ENABLE_DOTNET)
add_library(TdWindows SHARED
td/telegram/ClientWindows.cpp
td/telegram/LogWindows.cpp
add_library(TdDotNet SHARED
td/telegram/ClientDotNet.cpp
td/telegram/LogDotNet.cpp
${TL_DOTNET_SCHEME_SOURCE}
)
target_link_libraries(TdWindows PRIVATE tdclient tdutils)
target_include_directories(TdWindows PUBLIC
target_link_libraries(TdDotNet PRIVATE tdclient tdutils)
target_include_directories(TdDotNet PUBLIC
$<BUILD_INTERFACE:${TL_TD_AUTO_INCLUDES}>
)
if (NOT CMAKE_CROSSCOMPILING)
add_dependencies(TdWindows generate_td_windows_api)
add_dependencies(TdDotNet generate_dotnet_api)
endif()
if (UWP)
set_target_properties(TdWindows PROPERTIES VS_WINRT_COMPONENT "true")
target_compile_options(TdWindows PUBLIC "/ZW")
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set_target_properties(TdDotNet PROPERTIES VS_WINRT_COMPONENT "true")
target_compile_options(TdDotNet PUBLIC "/ZW")
else()
set_target_properties(TdWindows PROPERTIES COMPILE_FLAGS "/GR /clr")
target_compile_options(TdWindows PUBLIC "/EHa")
set_target_properties(TdDotNet PROPERTIES COMPILE_FLAGS "/GR /clr")
target_compile_options(TdDotNet PUBLIC "/EHa")
endif()
target_compile_options(TdWindows PUBLIC "/bigobj")
endif()
# tdc - TDLib interface in pure c.
@ -669,6 +662,9 @@ if (BIGOBJ)
target_compile_options(tdclient PUBLIC ${BIGOBJ})
target_compile_options(tdjson PUBLIC ${BIGOBJ})
target_compile_options(tdjson_static PUBLIC ${BIGOBJ})
if (TD_ENABLE_DOTNET)
target_compile_options(TdDotNet PUBLIC "/bigobj")
endif()
endif()
if (EMSCRIPTEN)

View File

@ -40,8 +40,8 @@ elseif (MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
endif()
if (UWP)
target_compile_options(tdsqlite PRIVATE /DSQLITE_OS_WINRT=1)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
target_compile_definitions(tdsqlite PRIVATE -DSQLITE_OS_WINRT=1)
endif()
install(TARGETS tdsqlite EXPORT TdTargets

View File

@ -38,8 +38,8 @@ set(TL_C_AUTO
)
set(TL_TD_DOTNET_AUTO
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdWindowsApi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdWindowsApi.h
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdDotNetApi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdDotNetApi.h
PARENT_SCOPE
)
@ -98,7 +98,7 @@ if (NOT CMAKE_CROSSCOMPILING)
add_custom_target(tl_generate_common
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${GENERATE_COMMON_CMD} COMMENT "Generate common tl source files"
DEPENDS generate_common scheme/mtproto_api.tlo scheme/telegram_api.tlo scheme/secret_api.tlo scheme/td_api.tlo
DEPENDS generate_common scheme/mtproto_api.tlo scheme/telegram_api.tlo scheme/secret_api.tlo ${TL_TD_API_TLO}
)
if (TD_ENABLE_JNI)
target_compile_definitions(generate_common PRIVATE TD_ENABLE_JNI=1)
@ -110,7 +110,7 @@ if (NOT CMAKE_CROSSCOMPILING)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND generate_c
COMMENT "Generate C tl source files"
DEPENDS generate_c scheme/td_api.tlo
DEPENDS generate_c ${TL_TD_API_TLO}
)
add_executable(td_generate_java_api ${TL_GENERATE_JAVA_SOURCE})
@ -122,7 +122,7 @@ if (NOT CMAKE_CROSSCOMPILING)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND generate_json
COMMENT "Generate JSON tl source files"
DEPENDS generate_json scheme/td_api.tlo
DEPENDS generate_json ${TL_TD_API_TLO}
)
if (TD_ENABLE_JNI)
@ -131,12 +131,14 @@ if (NOT CMAKE_CROSSCOMPILING)
install(FILES scheme/td_api.tlo scheme/td_api.tl DESTINATION bin/td/generate/scheme)
endif()
add_executable(generate_td_windows_api_exe generate_td_windows_api.cpp tl_writer_win.h)
target_link_libraries(generate_td_windows_api_exe PRIVATE tdtl)
add_custom_target(generate_td_windows_api
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND generate_td_windows_api_exe ${TL_TD_API_TLO}
COMMENT "Generate tl-files"
DEPENDS generate_td_windows_api_exe ${TL_TD_API_TLO}
)
if (TD_ENABLE_DOTNET)
add_executable(td_generate_dotnet_api generate_dotnet.cpp tl_writer_dotnet.h)
target_link_libraries(td_generate_dotnet_api PRIVATE tdtl)
add_custom_target(generate_dotnet_api
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND td_generate_dotnet_api ${TL_TD_API_TLO}
COMMENT "Generate .Net API files"
DEPENDS td_generate_dotnet_api ${TL_TD_API_TLO}
)
endif()
endif()

View File

@ -4,11 +4,11 @@
// 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 "tl_writer_dotnet.h"
#include "td/tl/tl_config.h"
#include "td/tl/tl_generate.h"
#include "tl_writer_win.h"
int main(int argc, char *argv[]) {
if (argc < 2) {
return 1;
@ -16,10 +16,8 @@ int main(int argc, char *argv[]) {
td::tl::tl_config config_td = td::tl::read_tl_config_from_file(argv[1]);
td::tl::write_tl_to_file(config_td, "auto/td/telegram/TdWindowsApi.cpp",
td::tl::TlWriterWinCommon("TdApi", false, "#include \"td/telegram/TdWindowsApi.h\"\n"));
td::tl::write_tl_to_file(config_td, "auto/td/telegram/TdWindowsApi.h",
td::tl::TlWriterWinCommon("TdApi", true, "#include \"td/telegram/td_api.h\"\n"));
return 0;
td::tl::write_tl_to_file(config_td, "auto/td/telegram/TdDotNetApi.cpp",
td::tl::TlWriterDotNet("TdApi", false, "#include \"td/telegram/TdDotNetApi.h\"\n"));
td::tl::write_tl_to_file(config_td, "auto/td/telegram/TdDotNetApi.h",
td::tl::TlWriterDotNet("TdApi", true, "#include \"td/telegram/td_api.h\"\n"));
}

View File

@ -16,11 +16,11 @@
namespace td {
namespace tl {
class TlWriterWinCommon : public TL_writer {
class TlWriterDotNet : public TL_writer {
public:
bool is_header_;
std::string prefix_;
TlWriterWinCommon(const std::string &name, bool is_header, const std::string &prefix = "")
TlWriterDotNet(const std::string &name, bool is_header, const std::string &prefix = "")
: TL_writer(name), is_header_(is_header), prefix_(prefix) {
}
int get_max_arity(void) const override {
@ -179,7 +179,7 @@ class TlWriterWinCommon : public TL_writer {
std::string gen_output_begin(void) const override {
return prefix_ +
"#include \"td/utils/port/CxCli.h\"\n"
"#include \"td/tl/tl_win_object.h\"\n\n"
"#include \"td/tl/tl_dotnet_object.h\"\n\n"
"namespace TdWindows {\n";
}
std::string gen_output_end() const override {

View File

@ -4,13 +4,14 @@
// 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/telegram/TdWindowsApi.h"
#include "td/telegram/TdDotNetApi.h"
#include "td/telegram/Client.h"
#include "td/utils/port/CxCli.h"
namespace TdWindows {
using namespace CxCli;
public interface class ClientResultHandler {

View File

@ -9,7 +9,9 @@
#include "td/utils/port/CxCli.h"
namespace TdWindows {
using namespace CxCli;
public ref class Log sealed {
public:
static void SetFilePath(String^ filePath) {
@ -24,4 +26,5 @@ public:
::td::Log::set_verbosity_level(verbosityLevel);
}
};
} // namespace TdWindows

View File

@ -8,7 +8,6 @@
#include "td/utils/misc.h"
#include "td/utils/port/CxCli.h"
#include "td/utils/tl_storers.h"
#include "td/telegram/td_api.h"
#include "td/telegram/td_api.hpp"