Author: jgardou
Date: Sun May 15 19:31:13 2011
New Revision: 51772
URL:
http://svn.reactos.org/svn/reactos?rev=51772&view=rev
Log:
[CMAKE]
- generate source files and header files in one pass by passing right arguments to
widl.
Why this didn't work before is left as an exercise for the reader.
Modified:
branches/cmake-bringup/cmake/idl-support.cmake
Modified: branches/cmake-bringup/cmake/idl-support.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/cmake/idl-support…
==============================================================================
--- branches/cmake-bringup/cmake/idl-support.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/cmake/idl-support.cmake [iso-8859-1] Sun May 15 19:31:13 2011
@@ -9,7 +9,6 @@
set(IDL_CLIENT_ARG /cstub) #.c for stub client library
set(IDL_PROXY_ARG /proxy)
set(IDL_INTERFACE_ARG /iid)
- set(IDL_DLLDATA_ARG /dlldata)
if(ARCH MATCHES i386)
set(IDL_FLAGS /win32)
elseif(ARCH MATCHES amd64)
@@ -20,13 +19,12 @@
else()
set(IDL_COMPILER native-widl)
set(IDL_HEADER_ARG -h -o) #.h
- set(IDL_HEADER_ARG2 -H) #.h
+ set(IDL_HEADER_ARG2 -h -H) #.h
set(IDL_TYPELIB_ARG -t -o) #.tlb
- set(IDL_SERVER_ARG -s -S) #.c for server library
- set(IDL_CLIENT_ARG -c -C) #.c for stub client library
+ set(IDL_SERVER_ARG -s -o) #.c for server library
+ set(IDL_CLIENT_ARG -c -o) #.c for stub client library
set(IDL_PROXY_ARG -p -o)
set(IDL_INTERFACE_ARG -u -o)
- set(IDL_DLLDATA_ARG --dlldata-only -o)
if(ARCH MATCHES i386)
set(IDL_FLAGS -m32 --win32)
elseif(ARCH MATCHES amd64)
@@ -92,20 +90,12 @@
foreach(FILE ${ARGN})
get_filename_component(NAME ${FILE} NAME_WE)
if(NOT MSVC)
- # cmake internal dependency checker detects that .c depends on .h.
- # Building them in two passes avoids unnecessary recompilation (to put it
simple)
- # Fortunately, midl is smarter and generates .h BEFORE .c
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h
- COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS}
${IDL_HEADER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h
${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
- set(_depends ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h)
list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_PROXY_ARG}
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c ${IDL_HEADER_ARG2} ${NAME}_p.h
${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${DLLDATA_ARG}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${_depends})
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
endforeach()
# Extra pass to generate dlldata
@@ -126,29 +116,15 @@
foreach(FILE ${ARGN})
get_filename_component(NAME ${FILE} NAME_WE)
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h
- COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG}
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
- add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS}
${IDL_HEADER_ARG2} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h ${IDL_SERVER_ARG}
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
- set_source_files_properties(
- ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c
- PROPERTIES GENERATED TRUE)
list(APPEND server_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c)
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h
- COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG}
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c
COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS}
${IDL_HEADER_ARG2} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h ${IDL_CLIENT_ARG}
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
- set_source_files_properties(
- ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h
${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c
- PROPERTIES GENERATED TRUE)
list(APPEND client_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c)
endforeach()
add_library(${TARGET} ${server_SOURCES} ${client_SOURCES})