2021-04-23 04:00:17 +00:00
|
|
|
# This file is part of Telegram Desktop,
|
|
|
|
# the official desktop application for the Telegram messaging service.
|
|
|
|
#
|
|
|
|
# For license and copyright information please follow this link:
|
|
|
|
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
|
2021-10-05 18:37:34 +00:00
|
|
|
function(generate_midl target_name src_loc)
|
|
|
|
set(list ${ARGV})
|
|
|
|
list(REMOVE_AT list 0 1)
|
|
|
|
|
2021-04-23 04:00:17 +00:00
|
|
|
set(gen_dst ${CMAKE_CURRENT_BINARY_DIR}/gen)
|
|
|
|
file(MAKE_DIRECTORY ${gen_dst})
|
|
|
|
|
|
|
|
if (build_win64)
|
|
|
|
set(env x64)
|
|
|
|
else()
|
|
|
|
set(env win32)
|
|
|
|
endif()
|
2021-10-05 18:37:34 +00:00
|
|
|
|
|
|
|
set(gen_timestamp ${gen_dst}/${target_name}_midl.timestamp)
|
|
|
|
set(gen_files "")
|
|
|
|
set(full_generation_sources "")
|
|
|
|
set(full_dependencies_list "")
|
|
|
|
foreach (file ${list})
|
|
|
|
list(APPEND full_generation_sources ${src_loc}/${file})
|
|
|
|
get_filename_component(file_name ${file} NAME_WLE)
|
|
|
|
list(APPEND gen_files
|
|
|
|
${gen_dst}/${file_name}_i.c
|
|
|
|
${gen_dst}/${file_name}_h.h
|
|
|
|
)
|
|
|
|
list(APPEND gen_commands
|
|
|
|
COMMAND
|
|
|
|
midl
|
|
|
|
/out ${gen_dst}
|
|
|
|
/h ${file_name}_h.h
|
|
|
|
/env ${env}
|
|
|
|
/notlb
|
|
|
|
${src_loc}/${file}
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
2021-04-23 04:00:17 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
${gen_timestamp}
|
|
|
|
BYPRODUCTS
|
|
|
|
${gen_files}
|
2021-10-05 18:37:34 +00:00
|
|
|
${gen_commands}
|
2021-04-23 04:00:17 +00:00
|
|
|
COMMAND
|
|
|
|
echo 1> ${gen_timestamp}
|
2021-10-05 18:37:34 +00:00
|
|
|
COMMENT "Generating headers from IDLs (${target_name})"
|
2021-04-23 04:00:17 +00:00
|
|
|
DEPENDS
|
2021-10-05 18:37:34 +00:00
|
|
|
${full_generation_sources}
|
2021-04-23 04:00:17 +00:00
|
|
|
)
|
|
|
|
generate_target(${target_name} midl ${gen_timestamp} "${gen_files}" ${gen_dst})
|
|
|
|
endfunction()
|