[CMAKE]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 19 Nov 2010 14:21:18 +0000 (14:21 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 19 Nov 2010 14:21:18 +0000 (14:21 +0000)
Add a new macro set_export_spec(), that replaces the use of spec2def + adding the generated def file to the sources
Remove EXTERNAL_OBJECT TRUE property for the generated def files.

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

13 files changed:
dll/win32/acledit/CMakeLists.txt
dll/win32/aclui/CMakeLists.txt
dll/win32/avicap32/CMakeLists.txt
dll/win32/batt/CMakeLists.txt
dll/win32/beepmidi/CMakeLists.txt
dll/win32/cards/CMakeLists.txt
dll/win32/compstui/CMakeLists.txt
dll/win32/gdi32/CMakeLists.txt
dll/win32/getuname/CMakeLists.txt
dll/win32/localui/CMakeLists.txt
dll/win32/lpk/CMakeLists.txt
gcc.cmake
msc.cmake

index 3e1608a..e7d57d7 100644 (file)
@@ -1,19 +1,17 @@
 
 set_unicode()
 
-spec2def(acledit.dll acledit.spec)
-
 list(APPEND SOURCE
     acledit.c
     stubs.c
-    acledit.rc
-    ${CMAKE_CURRENT_BINARY_DIR}/acledit.def)
-
+    acledit.rc)
 
 add_library(acledit SHARED ${SOURCE})
 
 set_module_type(acledit win32dll)
 
+set_export_spec(acledit acledit.spec)
+
 add_importlibs(acledit ntdll)
 
 add_cab_target(acledit 1)
index 2cf6d96..edd1b08 100644 (file)
@@ -17,7 +17,8 @@ add_library(aclui SHARED
 
 set_module_type(aclui win32dll)
 
-set_pdef_file(aclui aclui.pdef)
+set_export_spec(aclui aclui.spec aclui.dll)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/aclui.def)
 
 add_importlibs(aclui user32 gdi32 comctl32 ole32 oleaut32 advapi32 uxtheme kernel32 ntdll)
index f75d829..c2ac77b 100644 (file)
@@ -5,7 +5,8 @@ add_library(avicap32 SHARED avicap32.c avicap32.rc)
 
 set_module_type(avicap32 win32dll)
 
-set_pdef_file(avicap32 avicap32.pdef)
+set_export_spec(avicap32 avicap32.spec)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/avicap32.def)
 
 target_link_libraries(avicap32 wine)
index 3e93140..c6d270b 100644 (file)
@@ -5,7 +5,8 @@ add_library(batt SHARED batt.c batt.rc)
 
 set_module_type(batt win32dll)
 
-set_pdef_file(batt batt.pdef)
+set_export_spec(batt batt.spec)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/batt.def)
 
 add_importlibs(batt kernel32)
index dc9a371..3691629 100644 (file)
@@ -3,11 +3,13 @@ set_unicode()
 
 add_library(beepmidi SHARED beepmidi.c)
 
-set_pdef_file(beepmidi beepmidi.pdef)
+set_export_spec(beepmidi beepmidi.spec)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/beepmidi.def)
 
 set_entrypoint(beepmidi 0)
 
 add_importlibs(beepmidi winmm kernel32 ntdll)
 add_dependencies(beepmidi psdk)
-add_cab_target(beepmidi 1)
\ No newline at end of file
+add_cab_target(beepmidi 1)
+
index 4c8227b..2643002 100644 (file)
@@ -6,7 +6,8 @@ add_definitions(-DCARDSTYLE_DEFAULT)
 
 add_library(cards SHARED cards.c cards.rc)
 
-set_pdef_file(cards cards.pdef)
+set_export_spec(cards cards.spec)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/cards.def)
 
 set_module_type(cards win32dll)
index f2f6dd8..ffcb846 100644 (file)
@@ -4,13 +4,14 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 
 add_library(compstui SHARED compstui_main.c)
 
-set_pdef_file(compstui compstui.pdef)
-add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/compstui.def)
-
 set_module_type(compstui win32dll)
 
+set_export_spec(compstui compstui.spec)
+
 target_link_libraries(compstui wine)
 
 add_importlibs(compstui kernel32 ntdll)
 
 add_cab_target(compstui 1)
+add_importlib_target(compstui.spec)
+
index 9b56488..0170569 100644 (file)
@@ -49,7 +49,7 @@ target_link_libraries(gdi32
     dxguid
     ${PSEH_LIB})
 
-set_pdef_file(gdi32 gdi32.pdef)
+set_export_spec(gdi32 gdi32.spec)
 
 add_importlibs(gdi32 user32 advapi32 kernel32 ntdll)
 add_pch(gdi32 ${CMAKE_CURRENT_SOURCE_DIR}/include/precomp.h ${SOURCE})
index 5921701..c97c109 100644 (file)
@@ -5,7 +5,8 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 
 add_library(getuname SHARED getuname.c getuname.rc)
 
-set_pdef_file(getuname getuname.pdef)
+set_export_spec(getuname getuname.spec)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/getuname.def)
 
 set_module_type(getuname win32dll)
index 724571d..910e118 100644 (file)
@@ -4,7 +4,8 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 
 add_library(localui SHARED localui.c localui.rc)
 
-set_pdef_file(localui localui.pdef)
+set_export_spec(localui localui.spec)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/localui.def)
 
 set_module_type(localui win32dll)
index febd777..0b98759 100644 (file)
@@ -6,7 +6,8 @@ include_directories(include)
 
 add_library(lpk SHARED dllmain.c stub.c lpk.rc)
 
-set_pdef_file(lpk lpk.pdef)
+set_export_spec(lpk lpk.spec)
+
 add_importlib_target(${CMAKE_CURRENT_BINARY_DIR}/lpk.def)
 
 set_module_type(lpk win32dll)
index 03fd1a4..93be63e 100644 (file)
--- a/gcc.cmake
+++ b/gcc.cmake
@@ -161,27 +161,20 @@ MACRO(spec2def _dllname _spec_file)
         COMMAND native-winebuild -o ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def --def -E ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} --filename ${_dllname}
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})
     set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
-        PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
+        PROPERTIES GENERATED TRUE)
 ENDMACRO(spec2def _dllname _spec_file)
 
-macro(pdef2def _pdef_file)
-    get_filename_component(_file ${_pdef_file} NAME_WE)
-    add_custom_command(
-        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
-        COMMAND ${MINGW_PREFIX}cpp -o ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -P -E ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file}
-        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file})
-    set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
-        PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
-    add_custom_target(
-        ${_file}_def
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def)
-endmacro(pdef2def _pdef_file)
-
-macro(set_pdef_file _module _pdef_file)
-    pdef2def(${_pdef_file})
-    get_filename_component(_file ${_pdef_file} NAME_WE)
+# Optional 3rd parameter: dllname
+macro(set_export_spec _module _spec_file)
+    get_filename_component(_file ${_spec_file} NAME_WE)
+    if (${ARGC} GREATER 2)
+        set(_dllname ${ARGV2})
+    else()
+        set(_dllname ${_file}.dll)
+    endif()
+    spec2def(${_dllname} ${_spec_file})
     target_link_libraries(${_module} "${CMAKE_CURRENT_BINARY_DIR}/${_file}.def")
-    add_dependencies(${_module} ${_file}_def)
+    add_dependencies(${_module} ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def)
 endmacro()
 
 #pseh lib, needed with mingw
index bf3b397..40fe9ca 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -155,25 +155,20 @@ MACRO(spec2def _dllname _spec_file)
         COMMAND native-spec2pdef -n  --dll ${_dllname} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def\r
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})\r
     set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def\r
-        PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)\r
+        PROPERTIES GENERATED TRUE)\r
 ENDMACRO(spec2def _dllname _spec_file)\r
 \r
-macro(pdef2def _pdef_file)\r
-    get_filename_component(_file ${_pdef_file} NAME_WE)\r
-    add_custom_command(\r
-        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def\r
-        COMMAND ${CMAKE_C_COMPILER} /EP /c ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file} > ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def\r
-        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file})\r
-    add_custom_target(\r
-        ${_file}_def\r
-        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def)\r
-endmacro(pdef2def _pdef_file)\r
-\r
-macro(set_pdef_file _module _pdef_file)\r
-    pdef2def(${_pdef_file})\r
-    get_filename_component(_file ${_pdef_file} NAME_WE)\r
+# Optional 3rd parameter: dllname\r
+macro(set_export_spec _module _spec_file)\r
+    get_filename_component(_file ${_spec_file} NAME_WE)\r
+    if (${ARGC} GREATER 2)\r
+        set(_dllname ${ARGV2})\r
+    else()\r
+        set(_dllname ${_file}.dll)\r
+    endif()\r
+    spec2def(${_dllname} ${_spec_file})\r
     add_linkerflag(${_module} "/DEF:${CMAKE_CURRENT_BINARY_DIR}/${_file}.def")\r
-    add_dependencies(${_module} ${_file}_def)\r
+    add_dependencies(${_module} ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def)\r
 endmacro()\r
 \r
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)\r