[CMAKE]
authorJérôme Gardou <jerome.gardou@reactos.org>
Tue, 26 Oct 2010 17:42:02 +0000 (17:42 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Tue, 26 Oct 2010 17:42:02 +0000 (17:42 +0000)
  - midl support for building rpc server/client libraries

svn path=/branches/cmake-bringup/; revision=49289

CMakeMacros.cmake
gcc.cmake
msc.cmake

index 880555a..0499a92 100644 (file)
@@ -150,109 +150,122 @@ macro(set_cpp)
   include_directories(BEFORE ${REACTOS_SOURCE_DIR}/lib/3rdparty/stlport/stlport)
   set(IS_CPP 1)
 endmacro()
-\r
-MACRO(add_livecd_target _targetname _dir )# optional parameter : _nameoncd\r
-    \r
-    get_target_property(FILENAME ${_targetname} LOCATION)\r
-\r
-    if("${ARGN}" STREQUAL "")\r
-       get_filename_component(_nameoncd ${FILENAME} NAME)\r
-    else()\r
-       set(_nameoncd ${ARGN})\r
-    endif()\r
-\r
-    add_custom_command(\r
-        OUTPUT ${LIVECD_DIR}/${_dir}/${_nameoncd}        \r
-        COMMAND ${CMAKE_COMMAND} -E copy ${FILENAME} ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
-        \r
-    add_custom_target(${_targetname}_livecd DEPENDS ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
-\r
-    add_dependencies(${_targetname}_livecd ${_targetname})\r
-    add_dependencies(livecd ${_targetname}_livecd)\r
-ENDMACRO(add_livecd_target _targetname _dir _nameoncd)\r
-\r
-MACRO(add_livecd FILENAME _dir _nameoncd)\r
-    add_custom_command(\r
-        OUTPUT ${LIVECD_DIR}/${_dir}/${_nameoncd}\r
-        DEPENDS ${FILENAME}\r
-        COMMAND ${CMAKE_COMMAND} -E copy ${FILENAME} ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
-        \r
-    add_custom_target(${_nameoncd}_livecd DEPENDS ${LIVECD_DIR}/${_dir}/${_nameoncd})\r
-    \r
-    add_dependencies(livecd ${_nameoncd}_livecd)\r
-ENDMACRO(add_livecd)\r
-\r
-macro(custom_incdefs)\r
-    if(NOT DEFINED result_incs) #rpc_defines\r
-        get_directory_property(rpc_defines COMPILE_DEFINITIONS)\r
-        get_directory_property(rpc_includes INCLUDE_DIRECTORIES)\r
-\r
-        foreach(arg ${rpc_defines})\r
-            set(result_defs ${result_defs} -D${arg})\r
-        endforeach(arg ${defines})\r
-\r
-        foreach(arg ${rpc_includes})\r
-            set(result_incs -I${arg} ${result_incs})\r
-        endforeach(arg ${includes})\r
-    endif()\r
-endmacro(custom_incdefs)\r
-\r
-macro(rpcproxy TARGET)\r
-    custom_incdefs()\r
-        list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c)\r
-\r
-    foreach(_in_FILE ${ARGN})\r
-        get_filename_component(FILE ${_in_FILE} NAME_WE)\r
-        add_custom_command(\r
-            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c\r
-            COMMAND native-widl ${result_incs} ${result_defs} -m32 --win32 -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h -p -P ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl\r
-            DEPENDS native-widl)\r
-        set_source_files_properties(\r
-            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c\r
-            PROPERTIES GENERATED TRUE)\r
-        list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c)\r
-        list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl)\r
-        list(APPEND PROXY_DEPENDS ${TARGET}_${FILE}_p)\r
-        add_custom_target(${TARGET}_${FILE}_p \r
-            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c)\r
-        #add_dependencies(${TARGET}_proxy ${TARGET}_${FILE}_p)\r
-    endforeach(_in_FILE ${ARGN})\r
-    \r
-       add_custom_command(\r
-           OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c\r
-           COMMAND native-widl ${result_incs} ${result_defs}  -m32 --win32 --dlldata-only --dlldata=${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c ${IDLS}\r
-           DEPENDS native-widl)\r
-       set_source_files_properties(\r
-           ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c\r
-           PROPERTIES GENERATED TRUE)\r
-        \r
-        add_library(${TARGET}_proxy ${SOURCE})\r
-        add_dependencies(${TARGET}_proxy psdk ${PROXY_DEPENDS})\r
-endmacro(rpcproxy)\r
-\r
-macro (MACRO_IDL_FILES)\r
-    custom_incdefs()\r
-    foreach(_in_FILE ${ARGN})\r
-        get_filename_component(FILE ${_in_FILE} NAME_WE)\r
-        add_custom_command(\r
-            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c\r
-            COMMAND native-widl ${result_incs} ${result_defs} -m32 --win32 -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h -s -S ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl\r
-            DEPENDS native-widl)\r
-        set_source_files_properties(\r
-            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c\r
-            PROPERTIES GENERATED TRUE)\r
-        add_library(${FILE}_server ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c)\r
-        add_dependencies(${FILE}_server psdk)\r
-    \r
-        add_custom_command(\r
-            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c\r
-            COMMAND native-widl ${result_incs} ${result_defs} -m32 --win32 -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h -c -C ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl\r
-            DEPENDS native-widl)\r
-        set_source_files_properties(\r
-            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c\r
-            PROPERTIES GENERATED TRUE)\r
-        add_library(${FILE}_client ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c)\r
-        add_dependencies(${FILE}_client psdk)\r
-    endforeach(_in_FILE ${ARGN})\r
-\r
-endmacro (MACRO_IDL_FILES)\r
+
+MACRO(add_livecd_target _targetname _dir )# optional parameter : _nameoncd
+    
+    get_target_property(FILENAME ${_targetname} LOCATION)
+
+    if("${ARGN}" STREQUAL "")
+       get_filename_component(_nameoncd ${FILENAME} NAME)
+    else()
+       set(_nameoncd ${ARGN})
+    endif()
+
+    add_custom_command(
+        OUTPUT ${LIVECD_DIR}/${_dir}/${_nameoncd}        
+        COMMAND ${CMAKE_COMMAND} -E copy ${FILENAME} ${LIVECD_DIR}/${_dir}/${_nameoncd})
+        
+    add_custom_target(${_targetname}_livecd DEPENDS ${LIVECD_DIR}/${_dir}/${_nameoncd})
+
+    add_dependencies(${_targetname}_livecd ${_targetname})
+    add_dependencies(livecd ${_targetname}_livecd)
+ENDMACRO(add_livecd_target _targetname _dir _nameoncd)
+
+MACRO(add_livecd FILENAME _dir _nameoncd)
+    add_custom_command(
+        OUTPUT ${LIVECD_DIR}/${_dir}/${_nameoncd}
+        DEPENDS ${FILENAME}
+        COMMAND ${CMAKE_COMMAND} -E copy ${FILENAME} ${LIVECD_DIR}/${_dir}/${_nameoncd})
+        
+    add_custom_target(${_nameoncd}_livecd DEPENDS ${LIVECD_DIR}/${_dir}/${_nameoncd})
+    
+    add_dependencies(livecd ${_nameoncd}_livecd)
+ENDMACRO(add_livecd)
+
+macro(custom_incdefs)
+    if(NOT DEFINED result_incs) #rpc_defines
+        get_directory_property(rpc_defines COMPILE_DEFINITIONS)
+        get_directory_property(rpc_includes INCLUDE_DIRECTORIES)
+
+        foreach(arg ${rpc_defines})
+            set(result_defs ${result_defs} -D${arg})
+        endforeach(arg ${defines})
+
+        foreach(arg ${rpc_includes})
+            set(result_incs -I${arg} ${result_incs})
+        endforeach(arg ${includes})
+    endif()
+endmacro(custom_incdefs)
+
+macro(rpcproxy TARGET)
+    custom_incdefs()
+        list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c)
+
+    foreach(_in_FILE ${ARGN})
+        get_filename_component(FILE ${_in_FILE} NAME_WE)
+        add_custom_command(
+            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c
+            COMMAND native-widl ${result_incs} ${result_defs} -m32 --win32 -h -H ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.h -p -P ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl
+            DEPENDS native-widl)
+        set_source_files_properties(
+            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c
+            PROPERTIES GENERATED TRUE)
+        list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c)
+        list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl)
+        list(APPEND PROXY_DEPENDS ${TARGET}_${FILE}_p)
+        add_custom_target(${TARGET}_${FILE}_p 
+            DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_p.c)
+        #add_dependencies(${TARGET}_proxy ${TARGET}_${FILE}_p)
+    endforeach(_in_FILE ${ARGN})
+    
+       add_custom_command(
+           OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c
+           COMMAND native-widl ${result_incs} ${result_defs}  -m32 --win32 --dlldata-only --dlldata=${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c ${IDLS}
+           DEPENDS native-widl)
+       set_source_files_properties(
+           ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_proxy.dlldata.c
+           PROPERTIES GENERATED TRUE)
+        
+        add_library(${TARGET}_proxy ${SOURCE})
+        add_dependencies(${TARGET}_proxy psdk ${PROXY_DEPENDS})
+endmacro(rpcproxy)
+
+macro (MACRO_IDL_FILES)
+    custom_incdefs()
+    foreach(_in_FILE ${ARGN})
+        get_filename_component(FILE ${_in_FILE} NAME_WE)
+        add_custom_command(
+            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c
+            COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${IDL_FLAGS} ${IDL_HEADER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${IDL_SERVER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl
+            DEPENDS ${_in_file})
+        set_source_files_properties(
+            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c
+            PROPERTIES GENERATED TRUE)
+        add_library(${FILE}_server ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_s.c)
+        add_dependencies(${FILE}_server psdk)
+    
+        add_custom_command(
+            OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c
+            COMMAND ${IDL_COMPILER} ${result_incs} ${result_defs} ${IDL_FLAGS} ${IDL_HEADER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${IDL_CLIENT_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.idl
+            DEPENDS ${_in_file})
+        set_source_files_properties(
+            ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.h ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c
+            PROPERTIES GENERATED TRUE)
+        add_library(${FILE}_client ${CMAKE_CURRENT_BINARY_DIR}/${FILE}_c.c)
+        add_dependencies(${FILE}_client psdk)
+    endforeach(_in_FILE ${ARGN})
+
+endmacro (MACRO_IDL_FILES)
+
+macro(ADD_TYPELIB TARGET)
+  custom_incdefs()
+  foreach(SOURCE ${ARGN})
+    get_filename_component(FILE ${SOURCE} NAME_WE)
+    set(OBJECT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb)
+    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb
+                       COMMAND ${IDL_COMPILER} ${result_incs} ${IDL_FLAGS} ${IDL_TYPELIB_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
+                       DEPENDS ${SOURCE})
+    list(APPEND OBJECTS ${OBJECT})
+  endforeach()
+  add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})
+endmacro()
index cdd2d87..6392b6d 100644 (file)
--- a/gcc.cmake
+++ b/gcc.cmake
@@ -123,8 +123,6 @@ macro(set_module_type MODULE TYPE)
        endif()
 endmacro()
 
-endif()
-
 macro(set_unicode)
    add_definitions(-DUNICODE -D_UNICODE)
    set(IS_UNICODE 1)
@@ -146,15 +144,14 @@ macro(set_rc_compiler)
     set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${result_defs} ${result_incs} -i <SOURCE> -O coff -o <OBJECT>")
 endmacro()
 
-#typelib support
-macro(ADD_TYPELIB TARGET)
-  foreach(SOURCE ${ARGN})
-    get_filename_component(FILE ${SOURCE} NAME_WE)
-    set(OBJECT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb)
-    add_custom_command(OUTPUT ${OBJECT}
-                       COMMAND native-widl -I${REACTOS_SOURCE_DIR}/include/dxsdk -I. -I${REACTOS_SOURCE_DIR}/include -I${REACTOS_SOURCE_DIR}/include/psdk -m32 --win32 -t -T ${OBJECT} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
-                       DEPENDS native-widl)
-    list(APPEND OBJECTS ${OBJECT})
-  endforeach()
-  add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})
+#idl files support
+set(IDL_COMPILER native-widl)
+set(IDL_FLAGS -m32 --win32)
+set(IDL_HEADER_ARG -h -H) #.h
+set(IDL_TYPELIB_ARG -t -T) #.tlb
+set(IDL_SERVER_ARG -s -S) #.c for server library
+set(IDL_CLIENT_ARG -c -C) #.c for stub client library
+
 endmacro()
+
+endif()
\ No newline at end of file
index 3ca388f..5304db0 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -72,8 +72,6 @@ macro(set_unicode)
     add_definitions(-DUNICODE -D_UNICODE)\r
 endmacro()\r
 \r
-endif()\r
-\r
 set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi  /Ob0 /Od")\r
 set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od")\r
 \r
@@ -81,14 +79,12 @@ macro(set_rc_compiler)
 # dummy, this workaround is only needed in mingw due to lack of RC support in cmake\r
 endmacro()\r
 \r
-#typelib support\r
-macro(ADD_TYPELIB TARGET)\r
-    foreach(SOURCE ${ARGN})\r
-        get_filename_component(FILE ${SOURCE} NAME_WE)\r
-        set(OBJECT ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.tlb)\r
-        add_custom_command(OUTPUT ${OBJECT}\r
-                           COMMAND midl /I ${REACTOS_SOURCE_DIR}/include/dxsdk /I . /I ${REACTOS_SOURCE_DIR}/include /I ${REACTOS_SOURCE_DIR}/include/psdk /win32 /tlb ${OBJECT} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE})\r
-        list(APPEND OBJECTS ${OBJECT})\r
-    endforeach()\r
-    add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})\r
-endmacro()\r
+#idl files support\r
+set(IDL_COMPILER midl)\r
+set(IDL_FLAGS /win32)\r
+set(IDL_HEADER_ARG /h) #.h\r
+set(IDL_TYPELIB_ARG /tlb) #.tlb\r
+set(IDL_SERVER_ARG /sstub) #.c for stub server library\r
+set(IDL_CLIENT_ARG /cstub) #.c for stub client library\r
+\r
+endif()
\ No newline at end of file