Rename TdWindows to TdDotNet.
GitOrigin-RevId: 0bfff62c224dcbd316534649b119917280b3b398
This commit is contained in:
parent
9874d08701
commit
6eadf472fe
@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
|
|||||||
|
|
||||||
project(TDLib VERSION 1.1.3 LANGUAGES CXX C)
|
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_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.")
|
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. \
|
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")
|
By default both methods are used to achieve maximum speed and accuracy")
|
||||||
|
|
||||||
# LIBRARIES
|
|
||||||
if (EMSCRIPTEN)
|
if (EMSCRIPTEN)
|
||||||
# use prebuilt zlib
|
# use prebuilt zlib
|
||||||
set(ZLIB_FOUND 1)
|
set(ZLIB_FOUND 1)
|
||||||
@ -283,7 +278,7 @@ set(TL_C_SCHEME_SOURCE
|
|||||||
set_source_files_properties(${TL_DOTNET_AUTO} PROPERTIES GENERATED TRUE)
|
set_source_files_properties(${TL_DOTNET_AUTO} PROPERTIES GENERATED TRUE)
|
||||||
set(TL_DOTNET_SCHEME_SOURCE
|
set(TL_DOTNET_SCHEME_SOURCE
|
||||||
${TL_TD_DOTNET_AUTO}
|
${TL_TD_DOTNET_AUTO}
|
||||||
td/tl/tl_win_object.h
|
td/tl/tl_dotnet_object.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TDLIB_SOURCE
|
set(TDLIB_SOURCE
|
||||||
@ -595,27 +590,25 @@ if (TD_ENABLE_JNI AND NOT ANDROID) # jni is available by default on Android
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (TD_ENABLE_DOTNET)
|
if (TD_ENABLE_DOTNET)
|
||||||
add_library(TdWindows SHARED
|
add_library(TdDotNet SHARED
|
||||||
td/telegram/ClientWindows.cpp
|
td/telegram/ClientDotNet.cpp
|
||||||
td/telegram/LogWindows.cpp
|
td/telegram/LogDotNet.cpp
|
||||||
${TL_DOTNET_SCHEME_SOURCE}
|
${TL_DOTNET_SCHEME_SOURCE}
|
||||||
)
|
)
|
||||||
target_link_libraries(TdWindows PRIVATE tdclient tdutils)
|
target_link_libraries(TdDotNet PRIVATE tdclient tdutils)
|
||||||
target_include_directories(TdWindows PUBLIC
|
target_include_directories(TdDotNet PUBLIC
|
||||||
$<BUILD_INTERFACE:${TL_TD_AUTO_INCLUDES}>
|
$<BUILD_INTERFACE:${TL_TD_AUTO_INCLUDES}>
|
||||||
)
|
)
|
||||||
if (NOT CMAKE_CROSSCOMPILING)
|
if (NOT CMAKE_CROSSCOMPILING)
|
||||||
add_dependencies(TdWindows generate_td_windows_api)
|
add_dependencies(TdDotNet generate_dotnet_api)
|
||||||
endif()
|
endif()
|
||||||
if (UWP)
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
|
||||||
set_target_properties(TdWindows PROPERTIES VS_WINRT_COMPONENT "true")
|
set_target_properties(TdDotNet PROPERTIES VS_WINRT_COMPONENT "true")
|
||||||
target_compile_options(TdWindows PUBLIC "/ZW")
|
target_compile_options(TdDotNet PUBLIC "/ZW")
|
||||||
else()
|
else()
|
||||||
set_target_properties(TdWindows PROPERTIES COMPILE_FLAGS "/GR /clr")
|
set_target_properties(TdDotNet PROPERTIES COMPILE_FLAGS "/GR /clr")
|
||||||
target_compile_options(TdWindows PUBLIC "/EHa")
|
target_compile_options(TdDotNet PUBLIC "/EHa")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_options(TdWindows PUBLIC "/bigobj")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# tdc - TDLib interface in pure c.
|
# tdc - TDLib interface in pure c.
|
||||||
@ -669,6 +662,9 @@ if (BIGOBJ)
|
|||||||
target_compile_options(tdclient PUBLIC ${BIGOBJ})
|
target_compile_options(tdclient PUBLIC ${BIGOBJ})
|
||||||
target_compile_options(tdjson PUBLIC ${BIGOBJ})
|
target_compile_options(tdjson PUBLIC ${BIGOBJ})
|
||||||
target_compile_options(tdjson_static PUBLIC ${BIGOBJ})
|
target_compile_options(tdjson_static PUBLIC ${BIGOBJ})
|
||||||
|
if (TD_ENABLE_DOTNET)
|
||||||
|
target_compile_options(TdDotNet PUBLIC "/bigobj")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (EMSCRIPTEN)
|
if (EMSCRIPTEN)
|
||||||
|
@ -40,8 +40,8 @@ elseif (MSVC)
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UWP)
|
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
|
||||||
target_compile_options(tdsqlite PRIVATE /DSQLITE_OS_WINRT=1)
|
target_compile_definitions(tdsqlite PRIVATE -DSQLITE_OS_WINRT=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS tdsqlite EXPORT TdTargets
|
install(TARGETS tdsqlite EXPORT TdTargets
|
||||||
|
@ -38,8 +38,8 @@ set(TL_C_AUTO
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(TL_TD_DOTNET_AUTO
|
set(TL_TD_DOTNET_AUTO
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdWindowsApi.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdDotNetApi.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdWindowsApi.h
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdDotNetApi.h
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ if (NOT CMAKE_CROSSCOMPILING)
|
|||||||
add_custom_target(tl_generate_common
|
add_custom_target(tl_generate_common
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMAND ${GENERATE_COMMON_CMD} COMMENT "Generate common tl source files"
|
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)
|
if (TD_ENABLE_JNI)
|
||||||
target_compile_definitions(generate_common PRIVATE TD_ENABLE_JNI=1)
|
target_compile_definitions(generate_common PRIVATE TD_ENABLE_JNI=1)
|
||||||
@ -110,7 +110,7 @@ if (NOT CMAKE_CROSSCOMPILING)
|
|||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMAND generate_c
|
COMMAND generate_c
|
||||||
COMMENT "Generate C tl source files"
|
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})
|
add_executable(td_generate_java_api ${TL_GENERATE_JAVA_SOURCE})
|
||||||
@ -122,7 +122,7 @@ if (NOT CMAKE_CROSSCOMPILING)
|
|||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMAND generate_json
|
COMMAND generate_json
|
||||||
COMMENT "Generate JSON tl source files"
|
COMMENT "Generate JSON tl source files"
|
||||||
DEPENDS generate_json scheme/td_api.tlo
|
DEPENDS generate_json ${TL_TD_API_TLO}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (TD_ENABLE_JNI)
|
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)
|
install(FILES scheme/td_api.tlo scheme/td_api.tl DESTINATION bin/td/generate/scheme)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(generate_td_windows_api_exe generate_td_windows_api.cpp tl_writer_win.h)
|
if (TD_ENABLE_DOTNET)
|
||||||
target_link_libraries(generate_td_windows_api_exe PRIVATE tdtl)
|
add_executable(td_generate_dotnet_api generate_dotnet.cpp tl_writer_dotnet.h)
|
||||||
add_custom_target(generate_td_windows_api
|
target_link_libraries(td_generate_dotnet_api PRIVATE tdtl)
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
add_custom_target(generate_dotnet_api
|
||||||
COMMAND generate_td_windows_api_exe ${TL_TD_API_TLO}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
COMMENT "Generate tl-files"
|
COMMAND td_generate_dotnet_api ${TL_TD_API_TLO}
|
||||||
DEPENDS generate_td_windows_api_exe ${TL_TD_API_TLO}
|
COMMENT "Generate .Net API files"
|
||||||
)
|
DEPENDS td_generate_dotnet_api ${TL_TD_API_TLO}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// 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)
|
// 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_config.h"
|
||||||
#include "td/tl/tl_generate.h"
|
#include "td/tl/tl_generate.h"
|
||||||
|
|
||||||
#include "tl_writer_win.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
return 1;
|
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::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::write_tl_to_file(config_td, "auto/td/telegram/TdDotNetApi.cpp",
|
||||||
td::tl::TlWriterWinCommon("TdApi", false, "#include \"td/telegram/TdWindowsApi.h\"\n"));
|
td::tl::TlWriterDotNet("TdApi", false, "#include \"td/telegram/TdDotNetApi.h\"\n"));
|
||||||
td::tl::write_tl_to_file(config_td, "auto/td/telegram/TdWindowsApi.h",
|
td::tl::write_tl_to_file(config_td, "auto/td/telegram/TdDotNetApi.h",
|
||||||
td::tl::TlWriterWinCommon("TdApi", true, "#include \"td/telegram/td_api.h\"\n"));
|
td::tl::TlWriterDotNet("TdApi", true, "#include \"td/telegram/td_api.h\"\n"));
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
@ -16,11 +16,11 @@
|
|||||||
namespace td {
|
namespace td {
|
||||||
namespace tl {
|
namespace tl {
|
||||||
|
|
||||||
class TlWriterWinCommon : public TL_writer {
|
class TlWriterDotNet : public TL_writer {
|
||||||
public:
|
public:
|
||||||
bool is_header_;
|
bool is_header_;
|
||||||
std::string prefix_;
|
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) {
|
: TL_writer(name), is_header_(is_header), prefix_(prefix) {
|
||||||
}
|
}
|
||||||
int get_max_arity(void) const override {
|
int get_max_arity(void) const override {
|
||||||
@ -179,7 +179,7 @@ class TlWriterWinCommon : public TL_writer {
|
|||||||
std::string gen_output_begin(void) const override {
|
std::string gen_output_begin(void) const override {
|
||||||
return prefix_ +
|
return prefix_ +
|
||||||
"#include \"td/utils/port/CxCli.h\"\n"
|
"#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";
|
"namespace TdWindows {\n";
|
||||||
}
|
}
|
||||||
std::string gen_output_end() const override {
|
std::string gen_output_end() const override {
|
@ -4,13 +4,14 @@
|
|||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// 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)
|
// 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/telegram/Client.h"
|
||||||
|
|
||||||
#include "td/utils/port/CxCli.h"
|
#include "td/utils/port/CxCli.h"
|
||||||
|
|
||||||
namespace TdWindows {
|
namespace TdWindows {
|
||||||
|
|
||||||
using namespace CxCli;
|
using namespace CxCli;
|
||||||
|
|
||||||
public interface class ClientResultHandler {
|
public interface class ClientResultHandler {
|
@ -9,7 +9,9 @@
|
|||||||
#include "td/utils/port/CxCli.h"
|
#include "td/utils/port/CxCli.h"
|
||||||
|
|
||||||
namespace TdWindows {
|
namespace TdWindows {
|
||||||
|
|
||||||
using namespace CxCli;
|
using namespace CxCli;
|
||||||
|
|
||||||
public ref class Log sealed {
|
public ref class Log sealed {
|
||||||
public:
|
public:
|
||||||
static void SetFilePath(String^ filePath) {
|
static void SetFilePath(String^ filePath) {
|
||||||
@ -24,4 +26,5 @@ public:
|
|||||||
::td::Log::set_verbosity_level(verbosityLevel);
|
::td::Log::set_verbosity_level(verbosityLevel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace TdWindows
|
} // namespace TdWindows
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "td/utils/misc.h"
|
#include "td/utils/misc.h"
|
||||||
#include "td/utils/port/CxCli.h"
|
#include "td/utils/port/CxCli.h"
|
||||||
#include "td/utils/tl_storers.h"
|
|
||||||
|
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
#include "td/telegram/td_api.hpp"
|
#include "td/telegram/td_api.hpp"
|
Reference in New Issue
Block a user