2011-05-16 13:12:07 +00:00
|
|
|
|
|
|
|
#idl files support
|
2012-08-27 18:58:27 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
2012-03-29 15:57:55 +00:00
|
|
|
set(IDL_FLAGS /nologo /win32 /no_def_idir)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2012-03-29 15:57:55 +00:00
|
|
|
set(IDL_FLAGS /nologo /amd64 /no_def_idir)
|
|
|
|
else()
|
|
|
|
set(IDL_FLAGS /nologo /no_def_idir)
|
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2012-01-03 00:17:18 +00:00
|
|
|
function(add_typelib)
|
2012-03-29 18:48:12 +00:00
|
|
|
get_includes(_includes)
|
|
|
|
get_defines(_defines)
|
|
|
|
foreach(_idl_file ${ARGN})
|
|
|
|
get_filename_component(_name_we ${_idl_file} NAME_WE)
|
2011-05-16 13:12:07 +00:00
|
|
|
add_custom_command(
|
2012-03-29 18:48:12 +00:00
|
|
|
OUTPUT ${_name_we}.tlb
|
|
|
|
COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /tlb ${_name_we}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
|
2011-05-16 13:12:07 +00:00
|
|
|
endforeach()
|
2011-08-07 00:53:19 +00:00
|
|
|
endfunction()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2011-08-07 00:53:19 +00:00
|
|
|
function(add_idl_headers TARGET)
|
2012-03-29 18:48:12 +00:00
|
|
|
get_includes(_includes)
|
|
|
|
get_defines(_defines)
|
|
|
|
foreach(_idl_file ${ARGN})
|
|
|
|
get_filename_component(_name_we ${_idl_file} NAME_WE)
|
2011-05-16 13:12:07 +00:00
|
|
|
add_custom_command(
|
2012-03-30 15:36:19 +00:00
|
|
|
OUTPUT ${_name_we}.h
|
2012-03-31 11:09:22 +00:00
|
|
|
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}
|
2012-03-29 18:48:12 +00:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
|
|
|
|
list(APPEND _target_dependencies ${_name_we}.h)
|
2011-05-16 13:12:07 +00:00
|
|
|
endforeach()
|
2012-03-29 17:40:36 +00:00
|
|
|
add_custom_target(${TARGET} DEPENDS ${_target_dependencies})
|
2011-08-07 00:53:19 +00:00
|
|
|
endfunction()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2011-08-07 00:53:19 +00:00
|
|
|
function(add_rpcproxy_files)
|
2012-03-29 18:48:12 +00:00
|
|
|
get_includes(_includes)
|
|
|
|
get_defines(_defines)
|
2012-03-30 15:36:19 +00:00
|
|
|
set(_chain_dependency "")
|
2012-06-14 11:06:23 +00:00
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c PROPERTIES GENERATED TRUE)
|
2012-03-29 18:48:12 +00:00
|
|
|
foreach(_idl_file ${ARGN})
|
|
|
|
get_filename_component(_name_we ${_idl_file} NAME_WE)
|
2011-05-16 13:12:07 +00:00
|
|
|
add_custom_command(
|
2012-06-14 11:06:23 +00:00
|
|
|
OUTPUT ${_name_we}_p.c ${_name_we}_p.h
|
2012-03-31 11:09:22 +00:00
|
|
|
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}
|
2012-03-30 15:36:19 +00:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file} ${_chain_dependency})
|
|
|
|
list(APPEND _chain_dependency ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.c)
|
|
|
|
list(APPEND _chain_dependency ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.h)
|
2012-06-14 11:06:23 +00:00
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
|
2012-03-29 15:57:55 +00:00
|
|
|
endforeach()
|
2011-08-07 00:53:19 +00:00
|
|
|
endfunction()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2012-03-29 18:48:12 +00:00
|
|
|
function(add_rpc_files _type)
|
|
|
|
get_includes(_includes)
|
|
|
|
get_defines(_defines)
|
2011-08-07 00:53:19 +00:00
|
|
|
# Is it a client or server module?
|
2012-08-27 18:58:27 +00:00
|
|
|
if(_type STREQUAL "server")
|
2012-03-29 18:48:12 +00:00
|
|
|
set(_server_client /sstub)
|
|
|
|
set(_suffix _s)
|
2012-03-31 11:09:22 +00:00
|
|
|
set(_prevent_second_type /client none)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(_type STREQUAL "client")
|
2012-03-29 18:48:12 +00:00
|
|
|
set(_server_client /cstub)
|
|
|
|
set(_suffix _c)
|
2012-03-31 11:09:22 +00:00
|
|
|
set(_prevent_second_type /server none)
|
2011-08-07 00:53:19 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Please pass either server or client as argument to add_rpc_files")
|
|
|
|
endif()
|
2012-03-30 15:36:19 +00:00
|
|
|
foreach(_idl_file ${ARGN})
|
|
|
|
if(NOT IS_ABSOLUTE ${_idl_file})
|
|
|
|
set(_idl_file ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
|
2011-08-07 00:53:19 +00:00
|
|
|
endif()
|
2012-03-30 15:36:19 +00:00
|
|
|
get_filename_component(_name_we ${_idl_file} NAME_WE)
|
|
|
|
set(_name_we ${_name_we}${_suffix})
|
2011-05-16 13:12:07 +00:00
|
|
|
add_custom_command(
|
2012-03-29 18:48:12 +00:00
|
|
|
OUTPUT ${_name_we}.c ${_name_we}.h
|
2012-03-31 11:09:22 +00:00
|
|
|
COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}.h ${_server_client} ${_name_we}.c ${_prevent_second_type} ${_idl_file}
|
2012-03-30 15:36:19 +00:00
|
|
|
DEPENDS ${_idl_file})
|
2011-05-16 13:12:07 +00:00
|
|
|
endforeach()
|
2011-08-07 00:53:19 +00:00
|
|
|
endfunction()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2012-12-12 15:39:08 +00:00
|
|
|
function(generate_idl_iids)
|
|
|
|
foreach(_idl_file ${ARGN})
|
|
|
|
get_includes(_includes)
|
|
|
|
get_defines(_defines)
|
2012-03-29 18:48:12 +00:00
|
|
|
|
2012-12-12 15:39:08 +00:00
|
|
|
if(NOT IS_ABSOLUTE ${_idl_file})
|
|
|
|
set(_idl_file "${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}")
|
|
|
|
endif()
|
2012-03-29 18:48:12 +00:00
|
|
|
|
2012-12-12 15:39:08 +00:00
|
|
|
get_filename_component(_name_we ${_idl_file} NAME_WE)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${_name_we}_i.c ${_name_we}_i.h
|
|
|
|
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}
|
|
|
|
DEPENDS ${_idl_file})
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_i.c PROPERTIES GENERATED TRUE)
|
|
|
|
endforeach()
|
2011-08-07 00:53:19 +00:00
|
|
|
endfunction()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2012-03-29 18:48:12 +00:00
|
|
|
function(add_iid_library _target)
|
|
|
|
|
|
|
|
foreach(_idl_file ${ARGN})
|
|
|
|
generate_idl_iids(${_idl_file})
|
|
|
|
get_filename_component(_name_we ${_idl_file} NAME_WE)
|
|
|
|
list(APPEND _iid_sources ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_i.c)
|
2011-05-16 13:12:07 +00:00
|
|
|
endforeach()
|
2012-03-29 18:48:12 +00:00
|
|
|
add_library(${_target} ${_iid_sources})
|
|
|
|
|
|
|
|
# for wtypes.h
|
2013-04-18 21:19:09 +00:00
|
|
|
add_dependencies(${_target} psdk)
|
2012-03-29 18:48:12 +00:00
|
|
|
|
|
|
|
set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
2011-08-07 00:53:19 +00:00
|
|
|
endfunction()
|