2018-12-31 20:04:05 +01:00
|
|
|
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
|
|
|
|
|
|
|
|
file(MAKE_DIRECTORY auto/td/telegram)
|
|
|
|
file(MAKE_DIRECTORY auto/td/mtproto)
|
|
|
|
|
|
|
|
set(TL_TD_AUTO_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/auto PARENT_SCOPE)
|
|
|
|
|
|
|
|
set(TL_TD_AUTO
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/mtproto/mtproto_api.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/mtproto/mtproto_api.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/mtproto/mtproto_api.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_api.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_api.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_api.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/telegram_api.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/telegram_api.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/telegram_api.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/secret_api.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/secret_api.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/secret_api.hpp
|
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TL_TD_JSON_AUTO
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_api_json.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_api_json.h
|
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
2018-02-26 19:08:47 +01:00
|
|
|
set(TL_TD_API_TLO ${CMAKE_CURRENT_SOURCE_DIR}/scheme/td_api.tlo)
|
|
|
|
set(TL_TD_API_TLO ${TL_TD_API_TLO} PARENT_SCOPE)
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
set(TL_C_AUTO
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_tdc_api.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_tdc_api.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/td_tdc_api_inner.h
|
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
2018-02-28 02:11:29 +01:00
|
|
|
set(TL_DOTNET_AUTO
|
2018-02-28 00:09:23 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdDotNetApi.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/auto/td/telegram/TdDotNetApi.h
|
2018-02-26 19:08:47 +01:00
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
set(TL_GENERATE_COMMON_SOURCE
|
|
|
|
generate_common.cpp
|
|
|
|
|
|
|
|
tl_writer_cpp.cpp
|
|
|
|
tl_writer_h.cpp
|
|
|
|
tl_writer_hpp.cpp
|
|
|
|
tl_writer_jni_cpp.cpp
|
|
|
|
tl_writer_jni_h.cpp
|
|
|
|
tl_writer_td.cpp
|
|
|
|
|
|
|
|
tl_writer_cpp.h
|
|
|
|
tl_writer_h.h
|
|
|
|
tl_writer_hpp.h
|
|
|
|
tl_writer_jni_cpp.h
|
|
|
|
tl_writer_jni_h.h
|
|
|
|
tl_writer_td.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TL_GENERATE_C_SOURCE
|
|
|
|
generate_c.cpp
|
|
|
|
|
|
|
|
tl_writer_c.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TL_GENERATE_JAVA_SOURCE
|
|
|
|
generate_java.cpp
|
|
|
|
|
|
|
|
tl_writer_java.cpp
|
|
|
|
|
|
|
|
tl_writer_java.h
|
|
|
|
)
|
|
|
|
|
|
|
|
set(TL_GENERATE_JSON_SOURCE
|
|
|
|
generate_json.cpp
|
|
|
|
|
|
|
|
tl_json_converter.cpp
|
|
|
|
|
|
|
|
tl_json_converter.h
|
|
|
|
)
|
|
|
|
|
2018-02-26 19:08:47 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
if (NOT CMAKE_CROSSCOMPILING)
|
|
|
|
find_program(PHP_EXECUTABLE php)
|
|
|
|
|
2018-03-15 17:25:51 +01:00
|
|
|
if (PHP_EXECUTABLE AND NOT TD_ENABLE_DOTNET)
|
2018-12-31 20:04:05 +01:00
|
|
|
set(GENERATE_COMMON_CMD generate_common && ${PHP_EXECUTABLE} DoxygenTlDocumentationGenerator.php scheme/td_api.tl auto/td/telegram/td_api.h)
|
|
|
|
else()
|
|
|
|
set(GENERATE_COMMON_CMD generate_common)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(generate_common ${TL_GENERATE_COMMON_SOURCE})
|
|
|
|
target_link_libraries(generate_common PRIVATE tdtl)
|
|
|
|
add_custom_target(tl_generate_common
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
2018-02-28 02:22:17 +01:00
|
|
|
COMMAND ${GENERATE_COMMON_CMD}
|
|
|
|
COMMENT "Generate common tl source files"
|
2018-02-28 00:09:23 +01:00
|
|
|
DEPENDS generate_common scheme/mtproto_api.tlo scheme/telegram_api.tlo scheme/secret_api.tlo ${TL_TD_API_TLO}
|
2018-12-31 20:04:05 +01:00
|
|
|
)
|
2018-01-21 12:45:24 +01:00
|
|
|
if (TD_ENABLE_JNI)
|
|
|
|
target_compile_definitions(generate_common PRIVATE TD_ENABLE_JNI=1)
|
2018-12-31 20:04:05 +01:00
|
|
|
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}
|
|
|
|
COMMAND generate_c
|
|
|
|
COMMENT "Generate C tl source files"
|
2018-02-28 00:09:23 +01:00
|
|
|
DEPENDS generate_c ${TL_TD_API_TLO}
|
2018-12-31 20:04:05 +01:00
|
|
|
)
|
|
|
|
|
2018-01-21 14:06:54 +01:00
|
|
|
add_executable(td_generate_java_api ${TL_GENERATE_JAVA_SOURCE})
|
|
|
|
target_link_libraries(td_generate_java_api PRIVATE tdtl)
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
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}
|
|
|
|
COMMAND generate_json
|
|
|
|
COMMENT "Generate JSON tl source files"
|
2018-02-28 00:09:23 +01:00
|
|
|
DEPENDS generate_json ${TL_TD_API_TLO}
|
2018-12-31 20:04:05 +01:00
|
|
|
)
|
2018-01-21 12:45:24 +01:00
|
|
|
|
|
|
|
if (TD_ENABLE_JNI)
|
2018-01-21 14:06:54 +01:00
|
|
|
install(TARGETS td_generate_java_api RUNTIME DESTINATION bin)
|
2018-01-21 12:45:24 +01:00
|
|
|
install(FILES JavadocTlDocumentationGenerator.php TlDocumentationGenerator.php DESTINATION bin/td/generate)
|
|
|
|
install(FILES scheme/td_api.tlo scheme/td_api.tl DESTINATION bin/td/generate/scheme)
|
|
|
|
endif()
|
2018-02-28 11:25:07 +01:00
|
|
|
|
2018-02-28 00:09:23 +01:00
|
|
|
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}
|
2018-03-12 00:38:07 +01:00
|
|
|
COMMENT "Generate .NET API files"
|
2018-02-28 00:09:23 +01:00
|
|
|
DEPENDS td_generate_dotnet_api ${TL_TD_API_TLO}
|
|
|
|
)
|
|
|
|
endif()
|
2018-12-31 20:04:05 +01:00
|
|
|
endif()
|