diff options
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/generate/CMakeLists.txt')
-rw-r--r-- | protocols/Telegram/tdlib/td/td/generate/CMakeLists.txt | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/protocols/Telegram/tdlib/td/td/generate/CMakeLists.txt b/protocols/Telegram/tdlib/td/td/generate/CMakeLists.txt index e7f6aea067..1ff2d3d81f 100644 --- a/protocols/Telegram/tdlib/td/td/generate/CMakeLists.txt +++ b/protocols/Telegram/tdlib/td/td/generate/CMakeLists.txt @@ -14,10 +14,14 @@ set(TL_TD_AUTO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/auto PARENT_SCOPE) set(TD_AUTO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/auto/td) -set(TL_TD_AUTO_SOURCE +set(TL_MTPROTO_AUTO_SOURCE ${TD_AUTO_INCLUDE_DIR}/mtproto/mtproto_api.cpp ${TD_AUTO_INCLUDE_DIR}/mtproto/mtproto_api.h ${TD_AUTO_INCLUDE_DIR}/mtproto/mtproto_api.hpp + PARENT_SCOPE +) + +set(TL_TD_AUTO_SOURCE ${TD_AUTO_INCLUDE_DIR}/telegram/telegram_api.cpp ${TD_AUTO_INCLUDE_DIR}/telegram/telegram_api.h ${TD_AUTO_INCLUDE_DIR}/telegram/telegram_api.hpp @@ -53,9 +57,7 @@ set(TL_DOTNET_AUTO_SOURCE PARENT_SCOPE ) -set(TL_GENERATE_COMMON_SOURCE - generate_common.cpp - +set(TL_WRITER_CPP_SOURCE tl_writer_cpp.cpp tl_writer_h.cpp tl_writer_hpp.cpp @@ -71,6 +73,14 @@ set(TL_GENERATE_COMMON_SOURCE tl_writer_td.h ) +set(TL_GENERATE_MTPROTO_SOURCE + generate_mtproto.cpp +) + +set(TL_GENERATE_COMMON_SOURCE + generate_common.cpp +) + set(TL_GENERATE_C_SOURCE generate_c.cpp @@ -101,7 +111,7 @@ if (NOT CMAKE_CROSSCOMPILING) endif() if (PHP_EXECUTABLE AND NOT TD_ENABLE_DOTNET) - set(GENERATE_COMMON_CMD generate_common && ${PHP_EXECUTABLE} DoxygenTlDocumentationGenerator.php scheme/td_api.tl auto/td/telegram/td_api.h) + set(GENERATE_COMMON_CMD generate_common && ${PHP_EXECUTABLE} ../DoxygenTlDocumentationGenerator.php ../scheme/td_api.tl td/telegram/td_api.h) else() set(GENERATE_COMMON_CMD generate_common) endif() @@ -129,10 +139,29 @@ if (NOT CMAKE_CROSSCOMPILING) DEPENDS tl-parser ${CMAKE_CURRENT_SOURCE_DIR}/scheme/mtproto_api.tl ${CMAKE_CURRENT_SOURCE_DIR}/scheme/secret_api.tl ${CMAKE_CURRENT_SOURCE_DIR}/scheme/td_api.tl ${CMAKE_CURRENT_SOURCE_DIR}/scheme/telegram_api.tl ) + add_library(tl_writer_cpp STATIC ${TL_WRITER_CPP_SOURCE}) + target_link_libraries(tl_writer_cpp PRIVATE tdtl) + target_include_directories(tl_writer_cpp PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) + if (TD_ENABLE_JNI) + target_compile_definitions(tl_writer_cpp PRIVATE TD_ENABLE_JNI=1 GIT_COMMIT_HASH=${TD_GIT_COMMIT_HASH}) + endif() + if (TD_ENABLE_DOTNET) + target_compile_definitions(tl_writer_cpp PRIVATE DISABLE_HPP_DOCUMENTATION=1) + endif() + + add_executable(generate_mtproto ${TL_GENERATE_MTPROTO_SOURCE}) + target_link_libraries(generate_mtproto PRIVATE tdtl tl_writer_cpp) + add_custom_target(tl_generate_mtproto + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auto + COMMAND generate_mtproto + COMMENT "Generate MTProto API source files" + DEPENDS generate_mtproto tl_generate_tlo ${TLO_FILES} + ) + add_executable(generate_common ${TL_GENERATE_COMMON_SOURCE}) - target_link_libraries(generate_common PRIVATE tdtl) + target_link_libraries(generate_common PRIVATE tdtl tl_writer_cpp) add_custom_target(tl_generate_common - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auto COMMAND ${GENERATE_COMMON_CMD} COMMENT "Generate common TL source files" DEPENDS generate_common tl_generate_tlo ${TLO_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/scheme/td_api.tl ${CMAKE_CURRENT_SOURCE_DIR}/DoxygenTlDocumentationGenerator.php @@ -140,14 +169,11 @@ if (NOT CMAKE_CROSSCOMPILING) if (TD_ENABLE_JNI) target_compile_definitions(generate_common PRIVATE TD_ENABLE_JNI=1) endif() - if (TD_ENABLE_DOTNET) - target_compile_definitions(generate_common PRIVATE DISABLE_HPP_DOCUMENTATION=1) - endif() add_executable(generate_c ${TL_GENERATE_C_SOURCE}) target_link_libraries(generate_c PRIVATE tdtl) add_custom_target(tl_generate_c - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auto COMMAND generate_c COMMENT "Generate C TL source files" DEPENDS generate_c tl_generate_tlo ${TD_API_TLO_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/scheme/td_api.tl @@ -155,11 +181,12 @@ if (NOT CMAKE_CROSSCOMPILING) add_executable(td_generate_java_api ${TL_GENERATE_JAVA_SOURCE}) target_link_libraries(td_generate_java_api PRIVATE tdtl) + target_compile_definitions(td_generate_java_api PRIVATE GIT_COMMIT_HASH=${TD_GIT_COMMIT_HASH}) add_executable(generate_json ${TL_GENERATE_JSON_SOURCE}) target_link_libraries(generate_json PRIVATE tdtl tdutils) add_custom_target(tl_generate_json - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auto COMMAND generate_json COMMENT "Generate JSON TL source files" DEPENDS generate_json tl_generate_tlo ${TD_API_TLO_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/scheme/td_api.tl @@ -173,7 +200,7 @@ if (NOT CMAKE_CROSSCOMPILING) if (TD_ENABLE_DOTNET) if (PHP_EXECUTABLE) - set(GENERATE_DOTNET_API_CMD td_generate_dotnet_api ${TD_API_TLO_FILE} && ${PHP_EXECUTABLE} DotnetTlDocumentationGenerator.php scheme/td_api.tl auto/td/telegram/TdDotNetApi.h) + set(GENERATE_DOTNET_API_CMD td_generate_dotnet_api ${TD_API_TLO_FILE} && ${PHP_EXECUTABLE} ../DotnetTlDocumentationGenerator.php ../scheme/td_api.tl td/telegram/TdDotNetApi.h) else() set(GENERATE_DOTNET_API_CMD td_generate_dotnet_api ${TD_API_TLO_FILE}) endif() @@ -181,7 +208,7 @@ if (NOT CMAKE_CROSSCOMPILING) 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} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auto COMMAND ${GENERATE_DOTNET_API_CMD} COMMENT "Generate .NET API files" DEPENDS td_generate_dotnet_api tl_generate_tlo ${TD_API_TLO_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/scheme/td_api.tl ${CMAKE_CURRENT_SOURCE_DIR}/DotnetTlDocumentationGenerator.php |