[CMAKE]
authorJérôme Gardou <jerome.gardou@reactos.org>
Tue, 3 Jan 2012 00:17:18 +0000 (00:17 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Tue, 3 Jan 2012 00:17:18 +0000 (00:17 +0000)
- add module module type, which is basically a DLL without entry point and use it for typelibs
- get rid of custom targets for generating .tlb files and use source file dependencies instead

svn path=/trunk/; revision=54813

reactos/cmake/CMakeMacros.cmake
reactos/cmake/idl-support.cmake
reactos/dll/win32/jscript/CMakeLists.txt
reactos/dll/win32/mshtml.tlb/CMakeLists.txt
reactos/dll/win32/msi/CMakeLists.txt
reactos/dll/win32/msxml3/CMakeLists.txt
reactos/dll/win32/pstorec/CMakeLists.txt
reactos/dll/win32/shdocvw/CMakeLists.txt
reactos/dll/win32/stdole2.tlb/CMakeLists.txt
reactos/dll/win32/stdole32.tlb/CMakeLists.txt
reactos/include/psdk/CMakeLists.txt

index 325e88f..783c3f5 100644 (file)
@@ -294,7 +294,8 @@ function(set_module_type MODULE TYPE)
         set(__subsystem console)
     elseif(${TYPE} STREQUAL win32gui)
         set(__subsystem windows)
-    elseif(NOT ((${TYPE} STREQUAL win32dll) OR (${TYPE} STREQUAL win32ocx) OR (${TYPE} STREQUAL cpl)))
+    elseif(NOT ((${TYPE} STREQUAL win32dll) OR (${TYPE} STREQUAL win32ocx)
+            OR (${TYPE} STREQUAL cpl) OR (${TYPE} STREQUAL module)))
         message(FATAL_ERROR "Unknown type ${TYPE} for module ${MODULE}")
     endif()
 
@@ -336,6 +337,8 @@ function(set_module_type MODULE TYPE)
     elseif(${TYPE} STREQUAL nativedll)
         set(__entrypoint DllMain)
         set(__entrystack 12)
+    elseif(${TYPE} STREQUAL module)
+        set(__entrypoint 0)
     endif()
 
     if(DEFINED __entrypoint)
index c18f22e..2a7ce5b 100644 (file)
@@ -53,7 +53,7 @@ function(get_defines OUTPUT_VAR)
     set(${OUTPUT_VAR} ${__tmp_var} PARENT_SCOPE)
 endfunction()
 
-function(add_typelib TARGET)
+function(add_typelib)
     get_includes(INCLUDES)
     get_defines(DEFINES)
     foreach(FILE ${ARGN})
@@ -64,7 +64,6 @@ function(add_typelib TARGET)
             DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${IDL_DEPENDS})
         list(APPEND OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb)
     endforeach()
-    add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS})
 endfunction()
 
 function(add_idl_headers TARGET)
index b4d4869..6079656 100644 (file)
@@ -1,7 +1,5 @@
 
-add_typelib(jsglobal jsglobal.idl)
-
-add_dependencies(jsglobal stdole2)
+add_typelib(jsglobal.idl)
 
 remove_definitions(-D_WIN32_WINNT=0x502)
 add_definitions(-D_WIN32_WINNT=0x600)
@@ -60,9 +58,12 @@ add_importlibs(jscript
     ntdll)
 
 add_pch(jscript jscript.h)
-add_dependencies(jscript jsglobal)
+# jsglobal.tlb needs stdole2.tlb
+add_dependencies(jscript stdole2)
 add_cd_file(TARGET jscript DESTINATION reactos/system32 FOR all)
 
 if(NOT MSVC)
     allow_warnings(jscript)
 endif()
+
+set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/jsglobal.tlb)
index f3bd5ee..77b5d91 100644 (file)
@@ -1,6 +1,5 @@
 
-add_typelib(mshtml__tlb mshtml_tlb.idl)
-add_dependencies(mshtml__tlb stdole2)
+add_typelib(mshtml_tlb.idl)
 
 add_definitions(-D__WINESRC__)
 
@@ -8,7 +7,9 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 
 add_library(mshtml.tlb SHARED rsrc.rc)
 
-set_module_type(mshtml.tlb win32dll ENTRYPOINT 0 )
+set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mshtml_tlb.tlb)
+
+set_module_type(mshtml.tlb module)
 set_target_properties(mshtml.tlb PROPERTIES SUFFIX "")
-add_dependencies(mshtml.tlb mshtml__tlb)
+add_dependencies(mshtml.tlb stdole2)
 add_cd_file(TARGET mshtml.tlb DESTINATION reactos/system32 FOR all)
index 73b510d..52670a1 100644 (file)
@@ -70,10 +70,13 @@ endif()
 add_library(msi SHARED ${SOURCE})
 
 add_idl_headers(msi_idlheader msiserver.idl)
-add_typelib(msi_tlb msiserver.idl)
+add_typelib(msiserver.idl)
+
+set_source_files_properties(msi.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/msiserver.tlb)
+
 set_module_type(msi win32dll)
 target_link_libraries(msi uuid ${PSEH_LIB} wine)
-add_dependencies(msi msi_idlheader msi_tlb)
+add_dependencies(msi msi_idlheader)
 add_delay_importlibs(msi odbccp32)
 
 add_importlibs(msi
index 4b8102a..0144b4c 100644 (file)
@@ -1,7 +1,4 @@
 
-add_typelib(msxml3_v1 msxml3_v1.idl)
-add_dependencies(msxml3_v1 stdole2)
-
 remove_definitions(-D_WIN32_WINNT=0x502)
 add_definitions(-D_WIN32_WINNT=0x601)
 
@@ -20,6 +17,8 @@ set_rc_compiler()
 
 spec2def(msxml3.dll msxml3.spec)
 
+add_typelib(msxml3_v1.idl)
+
 list(APPEND SOURCE
     attribute.c
     comment.c
@@ -59,6 +58,8 @@ add_library(msxml3 SHARED ${SOURCE})
 
 set_module_type(msxml3 win32dll)
 
+set_source_files_properties(version.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/msxml3_v1.tlb)
+
 target_link_libraries(msxml3
     libxml2
     uuid
@@ -87,5 +88,7 @@ add_importlibs(msxml3
     kernel32
     ntdll)
 
-add_dependencies(msxml3 msxml3_v1)
+# msxml3_v1.tlb needs stdole2.tlb
+add_dependencies(msxml3 stdole2)
+
 add_cd_file(TARGET msxml3 DESTINATION reactos/system32 FOR all)
index dc5aa64..78ac132 100644 (file)
@@ -1,6 +1,5 @@
 
-add_typelib(pstorec_tlb pstorec_tlb.idl)
-add_dependencies(pstorec_tlb stdole2)
+add_typelib(pstorec_tlb.idl)
 
 add_definitions(-D__WINESRC__)
 
@@ -13,10 +12,13 @@ list(APPEND SOURCE
     ${CMAKE_CURRENT_BINARY_DIR}/pstorec_stubs.c
     ${CMAKE_CURRENT_BINARY_DIR}/pstorec.def)
 
+set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pstorec_tlb.tlb)
+
 add_library(pstorec SHARED ${SOURCE})
 
 set_module_type(pstorec win32dll)
 target_link_libraries(pstorec uuid wine)
 add_importlibs(pstorec msvcrt kernel32 ntdll)
-add_dependencies(pstorec pstorec_tlb)
+# pstorec_tlb.tlb needs stdole2.tlb
+add_dependencies(pstorec stdole2)
 add_cd_file(TARGET pstorec DESTINATION reactos/system32 FOR all)
index 1be4704..20f505b 100644 (file)
@@ -1,6 +1,5 @@
 
-add_typelib(shdocvw_v1 shdocvw_v1.idl)
-add_dependencies(shdocvw_v1 stdole2)
+add_typelib(shdocvw_v1.idl)
 
 add_definitions(-D_SHDOCVW_)
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
@@ -32,6 +31,8 @@ list(APPEND SOURCE
     ${CMAKE_CURRENT_BINARY_DIR}/shdocvw_stubs.c
     ${CMAKE_CURRENT_BINARY_DIR}/shdocvw.def)
 
+set_source_files_properties(shdocvw.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/shdocvw_v1.tlb)
+
 add_library(shdocvw SHARED ${SOURCE})
 set_module_type(shdocvw win32dll)
 target_link_libraries(shdocvw uuid wine)
@@ -49,7 +50,9 @@ add_importlibs(shdocvw
     kernel32
     ntdll)
 
-add_dependencies(shdocvw shdocvw_v1)
+# shdocvw_v1.tlb needs stdole2.tlb
+add_dependencies(shdocvw stdole2)
+
 add_pch(shdocvw shdocvw.h)
 add_cd_file(TARGET shdocvw DESTINATION reactos/system32 FOR all)
 add_importlib_target(shdocvw.spec)
index 75ac0e1..a1c27d5 100644 (file)
@@ -2,17 +2,19 @@
 add_definitions(-D__WINESRC__)
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 
-add_typelib(std_ole_v2 std_ole_v2.idl)
+add_typelib(std_ole_v2.idl)
 
 spec2def(stdole2.tlb stdole2.tlb.spec)
 
 list(APPEND SOURCE
     rsrc.rc
     ${CMAKE_CURRENT_BINARY_DIR}/stdole2.def)
+    
+set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/std_ole_v2.tlb)
 
 add_library(stdole2.tlb SHARED ${SOURCE})
 
-set_module_type(stdole2.tlb win32dll ENTRYPOINT 0 )
+set_module_type(stdole2.tlb module)
 set_target_properties(stdole2.tlb PROPERTIES SUFFIX "")
-add_dependencies(stdole2.tlb std_ole_v2)
+
 add_cd_file(TARGET stdole2.tlb DESTINATION reactos/system32 FOR all)
index b4d1fbe..85cdaf1 100644 (file)
@@ -2,18 +2,19 @@
 add_definitions(-D__WINESRC__)
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 
-add_typelib(std_ole_v1 std_ole_v1.idl)
+add_typelib(std_ole_v1.idl)
 
 spec2def(stdole32.tlb stdole32.tlb.spec)
 
 list(APPEND SOURCE
     rsrc.rc
     ${CMAKE_CURRENT_BINARY_DIR}/stdole32.def)
+    
+set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/std_ole_v1.tlb)
 
 add_library(stdole32.tlb SHARED ${SOURCE})
 
-set_module_type(stdole32.tlb win32dll ENTRYPOINT 0 )
+set_module_type(stdole32.tlb module)
 set_target_properties(stdole32.tlb PROPERTIES SUFFIX "")
 
-add_dependencies(stdole32.tlb std_ole_v1)
 add_cd_file(TARGET stdole32.tlb DESTINATION reactos/system32 FOR all)
index 5b5929e..e685e80 100644 (file)
@@ -116,7 +116,8 @@ endif()
 
 add_idl_headers(psdk ${SOURCE})
 
-add_typelib(stdole2 stdole2.idl)
+add_typelib(stdole2.idl)
+add_custom_target(stdole2 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/stdole2.tlb)
 
 add_iid_library(wuguid wuapi.idl)
 add_iid_library(xml_uuids msxml2.idl)