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 -m32 --win32)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2012-03-29 15:57:55 +00:00
|
|
|
set(IDL_FLAGS -m64 --win64)
|
|
|
|
else()
|
|
|
|
set(IDL_FLAGS "")
|
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2012-01-03 00:17:18 +00:00
|
|
|
function(add_typelib)
|
2011-05-16 13:12:07 +00:00
|
|
|
get_includes(INCLUDES)
|
|
|
|
get_defines(DEFINES)
|
|
|
|
foreach(FILE ${ARGN})
|
|
|
|
get_filename_component(NAME ${FILE} NAME_WE)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb
|
2012-03-29 15:57:55 +00:00
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -t -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} native-widl)
|
2011-05-16 13:12:07 +00:00
|
|
|
list(APPEND OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb)
|
|
|
|
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)
|
2011-05-16 13:12:07 +00:00
|
|
|
get_includes(INCLUDES)
|
|
|
|
get_defines(DEFINES)
|
|
|
|
foreach(FILE ${ARGN})
|
|
|
|
get_filename_component(NAME ${FILE} NAME_WE)
|
|
|
|
set(HEADER ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h
|
2012-03-29 15:57:55 +00:00
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -h -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} native-widl)
|
2011-05-16 13:12:07 +00:00
|
|
|
list(APPEND HEADERS ${HEADER})
|
|
|
|
endforeach()
|
2011-08-07 00:53:19 +00:00
|
|
|
add_custom_target(${TARGET} DEPENDS ${HEADERS})
|
|
|
|
endfunction()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2011-08-07 00:53:19 +00:00
|
|
|
function(add_rpcproxy_files)
|
2011-05-16 13:12:07 +00:00
|
|
|
get_includes(INCLUDES)
|
|
|
|
get_defines(DEFINES)
|
|
|
|
|
|
|
|
foreach(FILE ${ARGN})
|
|
|
|
get_filename_component(NAME ${FILE} NAME_WE)
|
|
|
|
list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
|
2012-03-29 13:07:08 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h
|
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -p -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c -h -H ${NAME}_p.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} native-widl)
|
2011-05-16 13:12:07 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Extra pass to generate dlldata
|
2012-03-29 15:57:55 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
|
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} --dlldata-only -o ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c ${IDLS}
|
|
|
|
DEPENDS ${IDLS} native-widl)
|
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_rpc_files __type)
|
2011-05-16 13:12:07 +00:00
|
|
|
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 15:57:55 +00:00
|
|
|
set(__server_client -Oif -s -o)
|
2011-08-07 00:53:19 +00:00
|
|
|
set(__suffix _s)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(__type STREQUAL "client")
|
2012-03-29 15:57:55 +00:00
|
|
|
set(__server_client -Oif -c -o)
|
2011-08-07 00:53:19 +00:00
|
|
|
set(__suffix _c)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Please pass either server or client as argument to add_rpc_files")
|
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
foreach(FILE ${ARGN})
|
2011-08-07 00:53:19 +00:00
|
|
|
get_filename_component(__name ${FILE} NAME_WE)
|
2012-03-29 15:57:55 +00:00
|
|
|
set(__name ${CMAKE_CURRENT_BINARY_DIR}/${__name}${__suffix})
|
2011-08-07 00:53:19 +00:00
|
|
|
if(NOT IS_ABSOLUTE ${FILE})
|
|
|
|
set(FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
|
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
add_custom_command(
|
2012-03-29 15:57:55 +00:00
|
|
|
OUTPUT ${__name}.c ${__name}.h
|
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -h -H ${__name}.h ${__server_client} ${__name}.c ${FILE}
|
|
|
|
DEPENDS ${FILE} native-widl)
|
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:09:49 +00:00
|
|
|
function(generate_idl_iids)
|
|
|
|
foreach(IDL_FILE ${ARGN})
|
|
|
|
get_filename_component(FILE ${IDL_FILE} NAME)
|
|
|
|
if(FILE STREQUAL "${IDL_FILE}")
|
|
|
|
set(IDL_FILE_FULL "${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}")
|
|
|
|
else()
|
|
|
|
set(IDL_FILE_FULL ${IDL_FILE})
|
|
|
|
endif()
|
|
|
|
get_includes(INCLUDES)
|
|
|
|
get_defines(DEFINES)
|
|
|
|
get_filename_component(NAME ${IDL_FILE} NAME_WE)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c
|
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -u -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c ${IDL_FILE_FULL}
|
|
|
|
DEPENDS ${IDL_FILE_FULL} native-widl)
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c PROPERTIES GENERATED TRUE)
|
|
|
|
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_iid_library TARGET)
|
2011-05-16 13:12:07 +00:00
|
|
|
foreach(IDL_FILE ${ARGN})
|
|
|
|
get_filename_component(NAME ${IDL_FILE} NAME_WE)
|
|
|
|
generate_idl_iids(${IDL_FILE})
|
|
|
|
list(APPEND IID_SOURCES ${NAME}_i.c)
|
|
|
|
endforeach()
|
|
|
|
add_library(${TARGET} ${IID_SOURCES})
|
2013-04-18 21:19:09 +00:00
|
|
|
add_dependencies(${TARGET} psdk)
|
2011-08-07 00:53:19 +00:00
|
|
|
set_target_properties(${TARGET} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
|
|
|
endfunction()
|
2012-08-28 19:02:29 +00:00
|
|
|
|
|
|
|
function(add_idl_reg_script IDL_FILE)
|
|
|
|
get_filename_component(FILE ${IDL_FILE} NAME)
|
|
|
|
if(FILE STREQUAL "${IDL_FILE}")
|
|
|
|
set(IDL_FILE_FULL "${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}")
|
|
|
|
else()
|
|
|
|
set(IDL_FILE_FULL ${IDL_FILE})
|
|
|
|
endif()
|
|
|
|
get_includes(INCLUDES)
|
|
|
|
get_defines(DEFINES)
|
|
|
|
get_filename_component(NAME ${IDL_FILE} NAME_WE)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_r.res
|
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -r -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_r.res ${IDL_FILE_FULL}
|
|
|
|
DEPENDS ${IDL_FILE_FULL} native-widl)
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${NAME}_r.res PROPERTIES
|
|
|
|
GENERATED TRUE EXTERNAL_OBJECT TRUE)
|
|
|
|
endfunction()
|