4 set(IDL_FLAGS /nologo /win32 /no_def_idir)
5 elseif(ARCH MATCHES amd64)
6 set(IDL_FLAGS /nologo /amd64 /no_def_idir)
8 set(IDL_FLAGS /nologo /no_def_idir)
12 get_includes(_includes)
14 foreach(_idl_file ${ARGN})
15 get_filename_component(_name_we ${_idl_file} NAME_WE)
17 OUTPUT ${_name_we}.tlb
18 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /tlb ${_name_we}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}
19 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
23 function(add_idl_headers TARGET)
24 get_includes(_includes)
26 foreach(_idl_file ${ARGN})
27 get_filename_component(_name_we ${_idl_file} NAME_WE)
28 #set(_name ${CMAKE_CURRENT_BINARY_DIR}/${_name_we})
30 OUTPUT ${_name_we}.h ${_name_we}_dummy_i.c
31 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}.h /iid ${_name_we}_dummy_i.c ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}
32 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
33 list(APPEND _target_dependencies ${_name_we}.h)
35 add_custom_target(${TARGET} DEPENDS ${_target_dependencies})
38 function(add_rpcproxy_files)
39 get_includes(_includes)
42 foreach(_idl_file ${ARGN})
43 get_filename_component(_name_we ${_idl_file} NAME_WE)
45 OUTPUT ${_name_we}_p.c ${_name_we}_p.h proxy.dlldata.c
46 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /proxy ${_name_we}_p.c /h ${_name_we}_p.h /dlldata proxy.dlldata.c ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}
47 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file} ${_output_files})
48 list(APPEND _output_files ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.c)
49 list(APPEND _output_files ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.h)
51 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c PROPERTIES GENERATED TRUE)
54 function(add_rpc_files _type)
55 get_includes(_includes)
57 # Is it a client or server module?
58 if(_type STREQUAL server)
59 set(_server_client /sstub)
61 elseif(_type STREQUAL client)
62 set(_server_client /cstub)
65 message(FATAL_ERROR "Please pass either server or client as argument to add_rpc_files")
68 get_filename_component(_name_we ${FILE} NAME_WE)
69 set(_name_we ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}${_suffix})
70 if(NOT IS_ABSOLUTE ${FILE})
71 set(FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
74 OUTPUT ${_name_we}.c ${_name_we}.h
75 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}.h ${_server_client} ${_name_we}.c ${FILE}
80 function(generate_idl_iids _idl_file)
81 get_includes(_includes)
84 get_filename_component(_name ${_idl_file} NAME)
85 if(_name STREQUAL "${_idl_file}")
86 set(_idl_file "${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}")
89 get_filename_component(_name_we ${_idl_file} NAME_WE)
91 OUTPUT ${_name_we}_i.c ${_name_we}_i.h
92 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}_i.h /iid ${_name_we}_i.c ${_idl_file}
94 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_i.c PROPERTIES GENERATED TRUE)
97 function(add_iid_library _target)
99 foreach(_idl_file ${ARGN})
100 generate_idl_iids(${_idl_file})
101 get_filename_component(_name_we ${_idl_file} NAME_WE)
102 list(APPEND _iid_sources ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_i.c)
104 add_library(${_target} ${_iid_sources})
107 add_dependencies(${_target} psdk)
109 set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL TRUE)