From 390cf6bc5fcdc1470733517af68183074b3cf851 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 19 Nov 2010 14:21:18 +0000 Subject: [PATCH] [CMAKE] 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 --- dll/win32/acledit/CMakeLists.txt | 8 +++----- dll/win32/aclui/CMakeLists.txt | 3 ++- dll/win32/avicap32/CMakeLists.txt | 3 ++- dll/win32/batt/CMakeLists.txt | 3 ++- dll/win32/beepmidi/CMakeLists.txt | 6 ++++-- dll/win32/cards/CMakeLists.txt | 3 ++- dll/win32/compstui/CMakeLists.txt | 7 ++++--- dll/win32/gdi32/CMakeLists.txt | 2 +- dll/win32/getuname/CMakeLists.txt | 3 ++- dll/win32/localui/CMakeLists.txt | 3 ++- dll/win32/lpk/CMakeLists.txt | 3 ++- gcc.cmake | 29 +++++++++++------------------ msc.cmake | 27 +++++++++++---------------- 13 files changed, 48 insertions(+), 52 deletions(-) diff --git a/dll/win32/acledit/CMakeLists.txt b/dll/win32/acledit/CMakeLists.txt index 3e1608ab0b1..e7d57d7f586 100644 --- a/dll/win32/acledit/CMakeLists.txt +++ b/dll/win32/acledit/CMakeLists.txt @@ -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) diff --git a/dll/win32/aclui/CMakeLists.txt b/dll/win32/aclui/CMakeLists.txt index 2cf6d96ae9f..edd1b08def4 100644 --- a/dll/win32/aclui/CMakeLists.txt +++ b/dll/win32/aclui/CMakeLists.txt @@ -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) diff --git a/dll/win32/avicap32/CMakeLists.txt b/dll/win32/avicap32/CMakeLists.txt index f75d829f50c..c2ac77bcc72 100644 --- a/dll/win32/avicap32/CMakeLists.txt +++ b/dll/win32/avicap32/CMakeLists.txt @@ -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) diff --git a/dll/win32/batt/CMakeLists.txt b/dll/win32/batt/CMakeLists.txt index 3e93140e520..c6d270b69a8 100644 --- a/dll/win32/batt/CMakeLists.txt +++ b/dll/win32/batt/CMakeLists.txt @@ -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) diff --git a/dll/win32/beepmidi/CMakeLists.txt b/dll/win32/beepmidi/CMakeLists.txt index dc9a37172e8..36916299b1f 100644 --- a/dll/win32/beepmidi/CMakeLists.txt +++ b/dll/win32/beepmidi/CMakeLists.txt @@ -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) + diff --git a/dll/win32/cards/CMakeLists.txt b/dll/win32/cards/CMakeLists.txt index 4c8227b7841..2643002eabc 100644 --- a/dll/win32/cards/CMakeLists.txt +++ b/dll/win32/cards/CMakeLists.txt @@ -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) diff --git a/dll/win32/compstui/CMakeLists.txt b/dll/win32/compstui/CMakeLists.txt index f2f6dd851f0..ffcb846814f 100644 --- a/dll/win32/compstui/CMakeLists.txt +++ b/dll/win32/compstui/CMakeLists.txt @@ -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) + diff --git a/dll/win32/gdi32/CMakeLists.txt b/dll/win32/gdi32/CMakeLists.txt index 9b56488d7a8..0170569ea9a 100644 --- a/dll/win32/gdi32/CMakeLists.txt +++ b/dll/win32/gdi32/CMakeLists.txt @@ -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}) diff --git a/dll/win32/getuname/CMakeLists.txt b/dll/win32/getuname/CMakeLists.txt index 59217017b0c..c97c109a10a 100644 --- a/dll/win32/getuname/CMakeLists.txt +++ b/dll/win32/getuname/CMakeLists.txt @@ -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) diff --git a/dll/win32/localui/CMakeLists.txt b/dll/win32/localui/CMakeLists.txt index 724571dba37..910e118365f 100644 --- a/dll/win32/localui/CMakeLists.txt +++ b/dll/win32/localui/CMakeLists.txt @@ -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) diff --git a/dll/win32/lpk/CMakeLists.txt b/dll/win32/lpk/CMakeLists.txt index febd777576c..0b987596d0f 100644 --- a/dll/win32/lpk/CMakeLists.txt +++ b/dll/win32/lpk/CMakeLists.txt @@ -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) diff --git a/gcc.cmake b/gcc.cmake index 03fd1a42aca..93be63ee0eb 100644 --- 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 diff --git a/msc.cmake b/msc.cmake index bf3b3975e73..40fe9caa742 100644 --- 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 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 ${CMAKE_C_COMPILER} /EP /c ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file} > ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_pdef_file}) - 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}) add_linkerflag(${_module} "/DEF:${CMAKE_CURRENT_BINARY_DIR}/${_file}.def") - add_dependencies(${_module} ${_file}_def) + add_dependencies(${_module} ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def) endmacro() file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)