3 if(ARCH STREQUAL "i386")
4 set(IDL_FLAGS /nologo /win32 /no_def_idir)
5 elseif(ARCH STREQUAL "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)
30 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}.h /client none /server none /iid ${_name_we}_dummy_i.c ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}
31 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
32 list(APPEND _target_dependencies ${_name_we}.h)
34 add_custom_target(${TARGET} DEPENDS ${_target_dependencies})
37 function(add_rpcproxy_files)
38 get_includes(_includes)
40 set(_chain_dependency "")
41 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c PROPERTIES GENERATED TRUE)
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
46 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /client none /server none /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} ${_chain_dependency})
48 list(APPEND _chain_dependency ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.c)
49 list(APPEND _chain_dependency ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.h)
50 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
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 set(_prevent_second_type /client none)
62 elseif(_type STREQUAL "client")
63 set(_server_client /cstub)
65 set(_prevent_second_type /server none)
67 message(FATAL_ERROR "Please pass either server or client as argument to add_rpc_files")
69 foreach(_idl_file ${ARGN})
70 if(NOT IS_ABSOLUTE ${_idl_file})
71 set(_idl_file ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
73 get_filename_component(_name_we ${_idl_file} NAME_WE)
74 set(_name_we ${_name_we}${_suffix})
76 OUTPUT ${_name_we}.c ${_name_we}.h
77 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}.h ${_server_client} ${_name_we}.c ${_prevent_second_type} ${_idl_file}
82 function(generate_idl_iids)
83 foreach(_idl_file ${ARGN})
84 get_includes(_includes)
87 if(NOT IS_ABSOLUTE ${_idl_file})
88 set(_idl_file "${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}")
91 get_filename_component(_name_we ${_idl_file} NAME_WE)
93 OUTPUT ${_name_we}_i.c ${_name_we}_i.h
94 COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}_i.h /client none /server none /iid ${_name_we}_i.c /proxy ${_name_we}_dummy_p.c ${_idl_file}
96 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_i.c PROPERTIES GENERATED TRUE)
100 function(add_iid_library _target)
102 foreach(_idl_file ${ARGN})
103 generate_idl_iids(${_idl_file})
104 get_filename_component(_name_we ${_idl_file} NAME_WE)
105 list(APPEND _iid_sources ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_i.c)
107 add_library(${_target} ${_iid_sources})
110 add_dependencies(${_target} psdk)
112 set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL TRUE)