tdesktop/Telegram/cmake/generate_midl.cmake

53 lines
1.5 KiB
CMake
Raw Normal View History

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
function(generate_midl target_name src_loc)
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()
set(gen_timestamp ${gen_dst}/${target_name}_midl.timestamp)
set(gen_files "")
set(full_generation_sources "")
set(full_dependencies_list "")
2023-05-31 04:33:59 +00:00
foreach (file ${ARGN})
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}
${gen_commands}
2021-04-23 04:00:17 +00:00
COMMAND
echo 1> ${gen_timestamp}
COMMENT "Generating headers from IDLs (${target_name})"
2021-04-23 04:00:17 +00:00
DEPENDS
${full_generation_sources}
2021-04-23 04:00:17 +00:00
)
generate_target(${target_name} midl ${gen_timestamp} "${gen_files}" ${gen_dst})
endfunction()