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})
|
2016-07-03 11:18:44 +00:00
|
|
|
if(${FILE} STREQUAL "std_ole_v1.idl")
|
|
|
|
set(IDL_FLAGS ${IDL_FLAGS} --oldtlb)
|
|
|
|
endif()
|
2011-05-16 13:12:07 +00:00
|
|
|
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
|
2020-11-20 08:47:33 +00:00
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -h -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h ${FILE}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} native-widl
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
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)
|
2018-01-15 20:04:56 +00:00
|
|
|
# Most proxy idl's have names like <proxyname>_<original>.idl
|
|
|
|
# We use this to create a dependency from the proxy to the original idl
|
|
|
|
string(REPLACE "_" ";" SPLIT_FILE ${FILE})
|
|
|
|
list(LENGTH SPLIT_FILE len)
|
|
|
|
unset(EXTRA_DEP)
|
|
|
|
if(len STREQUAL "2")
|
|
|
|
list(GET SPLIT_FILE 1 SPLIT_FILE)
|
|
|
|
if(EXISTS "${REACTOS_SOURCE_DIR}/sdk/include/psdk/${SPLIT_FILE}")
|
|
|
|
set(EXTRA_DEP ${REACTOS_SOURCE_DIR}/sdk/include/psdk/${SPLIT_FILE})
|
|
|
|
endif()
|
|
|
|
endif()
|
2020-11-20 08:47:33 +00:00
|
|
|
list(APPEND IDLS ${FILE})
|
|
|
|
list(APPEND IDL_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${EXTRA_DEP})
|
2018-01-15 20:04:56 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h
|
2020-11-20 18:56:56 +00:00
|
|
|
# We generate the two files in two passes because WIDL accepts only one custom file name as output
|
2020-11-20 09:17:43 +00:00
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -p -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c -H ${NAME}_p.h ${FILE}
|
2020-11-20 18:56:56 +00:00
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -h -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h ${FILE}
|
2020-11-20 08:47:33 +00:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${EXTRA_DEP} native-widl
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
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}
|
2020-11-20 08:47:33 +00:00
|
|
|
DEPENDS ${IDL_DEPS} native-widl
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
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)
|
2020-11-20 18:56:56 +00:00
|
|
|
set(__additional_flags -Oif)
|
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")
|
2020-11-20 18:56:56 +00:00
|
|
|
set(__server_client -s)
|
2011-08-07 00:53:19 +00:00
|
|
|
set(__suffix _s)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(__type STREQUAL "client")
|
2020-11-20 18:56:56 +00:00
|
|
|
set(__server_client -c)
|
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)
|
2020-11-20 18:56:56 +00:00
|
|
|
set(__name ${__name}${__suffix})
|
2011-05-16 13:12:07 +00:00
|
|
|
add_custom_command(
|
2020-11-20 18:56:56 +00:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${__name}.c ${CMAKE_CURRENT_BINARY_DIR}/${__name}.h
|
|
|
|
# We generate the two files in two passes because WIDL accepts only one custom file name as output
|
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${__additional_flags} ${__server_client} -o ${CMAKE_CURRENT_BINARY_DIR}/${__name}.c -H ${__name}.h ${FILE}
|
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${__additional_flags} -h -o ${CMAKE_CURRENT_BINARY_DIR}/${__name}.h ${FILE}
|
2020-11-20 08:47:33 +00:00
|
|
|
DEPENDS ${FILE} native-widl
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
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)
|
|
|
|
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
|
2020-11-20 08:47:33 +00:00
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -u -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c ${IDL_FILE}
|
|
|
|
DEPENDS ${IDL_FILE_FULL} native-widl
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
2012-12-12 15:09:49 +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_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_includes(INCLUDES)
|
|
|
|
get_defines(DEFINES)
|
|
|
|
get_filename_component(NAME ${IDL_FILE} NAME_WE)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_r.res
|
2020-11-20 08:47:33 +00:00
|
|
|
COMMAND native-widl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} -r -o ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_r.res ${IDL_FILE}
|
|
|
|
DEPENDS ${IDL_FILE_FULL} native-widl
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${NAME}_r.res PROPERTIES
|
2012-08-28 19:02:29 +00:00
|
|
|
GENERATED TRUE EXTERNAL_OBJECT TRUE)
|
|
|
|
endfunction()
|