Author: tkreuzer
Date: Thu Mar 29 18:48:12 2012
New Revision: 56281
URL:
http://svn.reactos.org/svn/reactos?rev=56281&view=rev
Log:
[CMAKE]
Fix generation of _i.c iid files with midl. Simplify code, use better naming
Modified:
trunk/reactos/cmake/midl-support.cmake
Modified: trunk/reactos/cmake/midl-support.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/midl-support.cmake?r…
==============================================================================
--- trunk/reactos/cmake/midl-support.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/midl-support.cmake [iso-8859-1] Thu Mar 29 18:48:12 2012
@@ -9,98 +9,102 @@
endif()
function(add_typelib)
- get_includes(INCLUDES)
- get_defines(DEFINES)
- foreach(FILE ${ARGN})
- get_filename_component(NAME ${FILE} NAME_WE)
+ get_includes(_includes)
+ get_defines(_defines)
+ foreach(_idl_file ${ARGN})
+ get_filename_component(_name_we ${_idl_file} NAME_WE)
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb
- COMMAND midl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} /tlb
${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
+ 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})
endforeach()
endfunction()
function(add_idl_headers TARGET)
- get_includes(INCLUDES)
- get_defines(DEFINES)
- foreach(_input_file ${ARGN})
- get_filename_component(_name ${_input_file} NAME_WE)
- set(_name ${CMAKE_CURRENT_BINARY_DIR}/${_name})
+ get_includes(_includes)
+ get_defines(_defines)
+ foreach(_idl_file ${ARGN})
+ get_filename_component(_name_we ${_idl_file} NAME_WE)
+ #set(_name ${CMAKE_CURRENT_BINARY_DIR}/${_name_we})
add_custom_command(
- OUTPUT ${_name}.h
- COMMAND midl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} /h ${_name}.h /iid
${_name}_dummy_i.h ${CMAKE_CURRENT_SOURCE_DIR}/${_input_file}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_input_file})
- list(APPEND _target_dependencies ${_name}.h)
+ OUTPUT ${_name_we}.h ${_name_we}_dummy_i.c
+ COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}.h /iid
${_name_we}_dummy_i.c ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file})
+ list(APPEND _target_dependencies ${_name_we}.h)
endforeach()
add_custom_target(${TARGET} DEPENDS ${_target_dependencies})
endfunction()
function(add_rpcproxy_files)
- get_includes(INCLUDES)
- get_defines(DEFINES)
- set(OUTPUT_FILES "")
- foreach(FILE ${ARGN})
- get_filename_component(NAME ${FILE} NAME_WE)
+ get_includes(_includes)
+ get_defines(_defines)
+ set(_output_files "")
+ foreach(_idl_file ${ARGN})
+ get_filename_component(_name_we ${_idl_file} NAME_WE)
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
- COMMAND midl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} /proxy
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c /h ${NAME}_p.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
/dlldata ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${OUTPUT_FILES})
- list(APPEND OUTPUT_FILES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c)
- list(APPEND OUTPUT_FILES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h)
+ OUTPUT ${_name_we}_p.c ${_name_we}_p.h proxy.dlldata.c
+ 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}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file} ${_output_files})
+ list(APPEND _output_files ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.c)
+ list(APPEND _output_files ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_p.h)
endforeach()
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c PROPERTIES
GENERATED TRUE)
endfunction()
-function(add_rpc_files __type)
- get_includes(INCLUDES)
- get_defines(DEFINES)
+function(add_rpc_files _type)
+ get_includes(_includes)
+ get_defines(_defines)
# Is it a client or server module?
- if(__type STREQUAL server)
- set(__server_client /sstub)
- set(__suffix _s)
- elseif(__type STREQUAL client)
- set(__server_client /cstub)
- set(__suffix _c)
+ if(_type STREQUAL server)
+ set(_server_client /sstub)
+ set(_suffix _s)
+ elseif(_type STREQUAL client)
+ set(_server_client /cstub)
+ set(_suffix _c)
else()
message(FATAL_ERROR "Please pass either server or client as argument to
add_rpc_files")
endif()
foreach(FILE ${ARGN})
- get_filename_component(__name ${FILE} NAME_WE)
- set(__name ${CMAKE_CURRENT_BINARY_DIR}/${__name}${__suffix})
+ get_filename_component(_name_we ${FILE} NAME_WE)
+ set(_name_we ${CMAKE_CURRENT_BINARY_DIR}/${_name_we}${_suffix})
if(NOT IS_ABSOLUTE ${FILE})
set(FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
endif()
add_custom_command(
- OUTPUT ${__name}.c ${__name}.h
- COMMAND midl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} /h ${__name}.h
${__server_client} ${__name}.c ${FILE}
+ OUTPUT ${_name_we}.c ${_name_we}.h
+ COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}.h
${_server_client} ${_name_we}.c ${FILE}
DEPENDS ${FILE})
endforeach()
endfunction()
-function(generate_idl_iids 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)
+function(generate_idl_iids _idl_file)
+ get_includes(_includes)
+ get_defines(_defines)
+
+ get_filename_component(_name ${_idl_file} NAME)
+ #if(_name STREQUAL "${_idl_file}")
+ # set(_idl_file "${CMAKE_CURRENT_SOURCE_DIR}/${_idl_file}")
+ #endif()
+
+ get_filename_component(_name_we ${_idl_file} NAME_WE)
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c
- COMMAND midl ${INCLUDES} ${DEFINES} ${IDL_FLAGS} /iid
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c ${IDL_FILE_FULL}
- DEPENDS ${IDL_FILE_FULL})
- set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c PROPERTIES
GENERATED TRUE)
+ OUTPUT ${_name_we}_i.c ${_name_we}_i.h
+ COMMAND midl ${_includes} ${_defines} ${IDL_FLAGS} /h ${_name_we}_i.h /iid
${_name_we}_i.c ${_idl_file}
+ DEPENDS ${_idl_file})
+ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_name_we}_i.c PROPERTIES
GENERATED TRUE)
endfunction()
-function(add_iid_library TARGET)
- foreach(IDL_FILE ${ARGN})
- get_filename_component(NAME ${IDL_FILE} NAME_WE)
- generate_idl_iids(${IDL_FILE})
- list(APPEND IID_SOURCES ${NAME}_i.c)
+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)
endforeach()
- add_library(${TARGET} ${IID_SOURCES})
- add_dependencies(${TARGET} psdk)
- set_target_properties(${TARGET} PROPERTIES EXCLUDE_FROM_ALL TRUE)
+ add_library(${_target} ${_iid_sources})
+
+ # for wtypes.h
+ add_dependencies(${_target} psdk)
+
+ set_target_properties(${_target} PROPERTIES EXCLUDE_FROM_ALL TRUE)
endfunction()