From 03e43b5850361c76e25a0e8c0a146e836d140390 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 10 Mar 2012 19:20:27 +0000 Subject: [PATCH] [CMAKE] * Make use of the cmake rc handling. As a result we don't need set_rc_compiler() anymore, among other benefits. * There's one minor issue mentioned as a FIXME, we'll get that sorted out as soon as the bug report we filed upstream gets resolved. * Set set_rc_compiler() to be a dummy, to be removed later. [IMM32] * Properly set the compiler flag. svn path=/trunk/; revision=56105 --- reactos/cmake/gcc.cmake | 14 +---------- reactos/cmake/msvc.cmake | 14 +---------- reactos/dll/win32/imm32/CMakeLists.txt | 11 ++++----- .../drivers/filters/mountmgr/CMakeLists.txt | 2 +- .../storage/class/disk_new/CMakeLists.txt | 17 +++++++++++-- .../drivers/storage/classpnp/CMakeLists.txt | 24 +++++++++++-------- .../drivers/storage/ide/uniata/CMakeLists.txt | 14 ++++++++--- .../video/miniport/vga_new/CMakeLists.txt | 11 +++++---- .../wdm/audio/backpln/portcls/CMakeLists.txt | 12 +++++++--- reactos/include/c++/stlport/stddef.h | 4 ++++ reactos/include/c++/stlport/stl/_cprolog.h | 4 ++++ .../include/c++/stlport/stl/config/compat.h | 4 ++++ .../include/c++/stlport/stl/config/features.h | 4 ++++ 13 files changed, 79 insertions(+), 56 deletions(-) diff --git a/reactos/cmake/gcc.cmake b/reactos/cmake/gcc.cmake index 50a5234b4e8..1d204a06442 100644 --- a/reactos/cmake/gcc.cmake +++ b/reactos/cmake/gcc.cmake @@ -162,7 +162,7 @@ SET(CMAKE_C_COMPILE_OBJECT "${CCACHE} -o -o -c ") set(CMAKE_ASM_COMPILE_OBJECT " -x assembler-with-cpp -o -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm -D__ASM__ -c ") -set(CMAKE_RC_COMPILE_OBJECT " -i ${I18N_DEFS} -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 -I${REACTOS_SOURCE_DIR}/include/psdk -I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos -I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt -I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -O coff -o ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 ${I18N_DEFS} ") # Optional 3rd parameter: stdcall stack bytes function(set_entrypoint MODULE ENTRYPOINT) @@ -198,18 +198,6 @@ function(set_module_type_toolchain MODULE TYPE) endfunction() function(set_rc_compiler) - get_directory_property(defines COMPILE_DEFINITIONS) - get_directory_property(includes INCLUDE_DIRECTORIES) - - foreach(arg ${defines}) - set(rc_result_defs "${rc_result_defs} -D${arg}") - endforeach() - - foreach(arg ${includes}) - set(rc_result_incs "-I${arg} ${rc_result_incs}") - endforeach() - - set(CMAKE_RC_COMPILE_OBJECT " ${rc_result_defs} ${I18N_DEFS} -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 -I${CMAKE_CURRENT_SOURCE_DIR} ${rc_result_incs} -i -O coff -o " PARENT_SCOPE) endfunction() function(add_delay_importlibs MODULE) diff --git a/reactos/cmake/msvc.cmake b/reactos/cmake/msvc.cmake index d80e9bf8902..6c1dd2207b8 100644 --- a/reactos/cmake/msvc.cmake +++ b/reactos/cmake/msvc.cmake @@ -40,7 +40,7 @@ if(${_MACHINE_ARCH_FLAG} MATCHES X86) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB /RELEASE") endif() -set(CMAKE_RC_COMPILE_OBJECT " ${I18N_DEFS} /I${REACTOS_SOURCE_DIR}/include/psdk /I${REACTOS_BINARY_DIR}/include/psdk /I${REACTOS_SOURCE_DIR}/include /I${REACTOS_SOURCE_DIR}/include/reactos /I${REACTOS_BINARY_DIR}/include/reactos /I${REACTOS_SOURCE_DIR}/include/reactos/wine /I${REACTOS_SOURCE_DIR}/include/crt /I${REACTOS_SOURCE_DIR}/include/crt/mingw32 /fo ") +set(CMAKE_RC_COMPILE_OBJECT " ${I18N_DEFS} /fo ") if(MSVC_IDE) # Asm source files are not supported in VS generators yet. As a result, isn't recognized. @@ -111,18 +111,6 @@ function(set_module_type_toolchain MODULE TYPE) endfunction() function(set_rc_compiler) - get_directory_property(defines COMPILE_DEFINITIONS) - get_directory_property(includes INCLUDE_DIRECTORIES) - - foreach(arg ${defines}) - set(rc_result_defs "${rc_result_defs} /D${arg}") - endforeach() - - foreach(arg ${includes}) - set(rc_result_incs "/I${arg} ${rc_result_incs}") - endforeach() - - set(CMAKE_RC_COMPILE_OBJECT " ${rc_result_defs} ${I18N_DEFS} /I${CMAKE_CURRENT_SOURCE_DIR} ${rc_result_incs} /fo " PARENT_SCOPE) endfunction() #define those for having real libraries diff --git a/reactos/dll/win32/imm32/CMakeLists.txt b/reactos/dll/win32/imm32/CMakeLists.txt index c1aed994a29..d22cbb688bd 100644 --- a/reactos/dll/win32/imm32/CMakeLists.txt +++ b/reactos/dll/win32/imm32/CMakeLists.txt @@ -4,14 +4,8 @@ add_definitions(-D__WINESRC__) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) -if(MSVC) - add_definitions(/FIwine/typeof.h) -endif() - include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) -set_rc_compiler() - spec2def(imm32.dll imm32.spec ADD_IMPORTLIB) list(APPEND SOURCE @@ -22,8 +16,11 @@ list(APPEND SOURCE add_library(imm32 SHARED ${SOURCE}) +if(MSVC) + add_target_compile_flags(imm32 "/FIwine/typeof.h") +endif() + set_module_type(imm32 win32dll) target_link_libraries(imm32 wine) add_importlibs(imm32 advapi32 user32 msvcrt kernel32 ntdll) add_cd_file(TARGET imm32 DESTINATION reactos/system32 FOR all) - diff --git a/reactos/drivers/filters/mountmgr/CMakeLists.txt b/reactos/drivers/filters/mountmgr/CMakeLists.txt index 4a99868931c..72586b59ac9 100644 --- a/reactos/drivers/filters/mountmgr/CMakeLists.txt +++ b/reactos/drivers/filters/mountmgr/CMakeLists.txt @@ -11,8 +11,8 @@ list(APPEND SOURCE add_library(mountmgr SHARED ${SOURCE}) target_link_libraries(mountmgr wdmguid ioevent) -allow_warnings(mountmgr) set_module_type(mountmgr kernelmodedriver) add_importlibs(mountmgr ntoskrnl hal) add_pch(mountmgr mntmgr.h) add_cd_file(TARGET mountmgr DESTINATION reactos/system32/drivers NO_CAB FOR all) + diff --git a/reactos/drivers/storage/class/disk_new/CMakeLists.txt b/reactos/drivers/storage/class/disk_new/CMakeLists.txt index 19225ff9113..02c7dbf5327 100644 --- a/reactos/drivers/storage/class/disk_new/CMakeLists.txt +++ b/reactos/drivers/storage/class/disk_new/CMakeLists.txt @@ -1,13 +1,26 @@ include_directories(..) -add_library(disk_new SHARED data.c disk.c diskwmi.c enum.c geometry.c part.c pnp.c disk.rc) +list(APPEND SOURCE + data.c + disk.c + diskwmi.c + enum.c + geometry.c + part.c + pnp.c) + +add_library(disk_new SHARED + ${SOURCE} + disk.rc) target_link_libraries(disk_new libcntpr wdmguid) if(ARCH MATCHES i386) if(MSVC) add_target_compile_flags(disk_new "/Gz") else() - add_target_compile_flags(disk_new "-mrtd -fno-builtin -Wno-unused-variable -Wno-pointer-sign") + # FIXME: http://www.cmake.org/Bug/view.php?id=12998 + #add_target_compile_flags(disk_new "-mrtd -fno-builtin -Wno-unused-variable -Wno-pointer-sign") + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-mrtd -fno-builtin -Wno-unused-variable -Wno-pointer-sign") endif() endif() diff --git a/reactos/drivers/storage/classpnp/CMakeLists.txt b/reactos/drivers/storage/classpnp/CMakeLists.txt index 839f837c41c..df2a5577c7b 100644 --- a/reactos/drivers/storage/classpnp/CMakeLists.txt +++ b/reactos/drivers/storage/classpnp/CMakeLists.txt @@ -9,14 +9,6 @@ add_definitions( -DCLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE=512 -DCLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS=512) -if(ARCH MATCHES i386) - if(MSVC) - add_definitions(/Gz) - else() - add_definitions(-mrtd -fno-builtin -w) - endif() -endif() - spec2def(classpnp.sys classpnp.spec ADD_IMPORTLIB) list(APPEND SOURCE @@ -34,10 +26,22 @@ list(APPEND SOURCE retry.c utils.c xferpkt.c - class.rc ${CMAKE_CURRENT_BINARY_DIR}/classpnp.def) -add_library(classpnp SHARED ${SOURCE}) +add_library(classpnp SHARED + ${SOURCE} + class.rc) + +if(ARCH MATCHES i386) + if(MSVC) + add_target_compile_flags(classpnp "/Gz") + else() + # FIXME: http://www.cmake.org/Bug/view.php?id=12998 + #add_target_compile_flags(classpnp "-mrtd -fno-builtin -w") + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-mrtd -fno-builtin -w") + endif() +endif() + add_pch(classpnp classp.h) target_link_libraries(classpnp ${PSEH_LIB} libcntpr) set_module_type(classpnp kernelmodedriver) diff --git a/reactos/drivers/storage/ide/uniata/CMakeLists.txt b/reactos/drivers/storage/ide/uniata/CMakeLists.txt index 31fc8f3b7f8..ff106958305 100644 --- a/reactos/drivers/storage/ide/uniata/CMakeLists.txt +++ b/reactos/drivers/storage/ide/uniata/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories( set_cpp() set_rc_compiler() -add_library(uniata SHARED +list(APPEND SOURCE id_ata.cpp id_badblock.cpp id_dma.cpp @@ -16,10 +16,18 @@ add_library(uniata SHARED id_probe.cpp id_queue.cpp id_sata.cpp - idedma.rc ros_glue/ros_glue.cpp) -allow_warnings(uniata) +add_library(uniata SHARED + ${SOURCE} + idedma.rc) + +if(NOT MSVC) + # FIXME: http://www.cmake.org/Bug/view.php?id=12998 + #allow_warnings(uniata) + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error") +endif() + add_pch(uniata stdafx.h) set_module_type(uniata kernelmodedriver) add_importlibs(uniata scsiport ntoskrnl hal) diff --git a/reactos/drivers/video/miniport/vga_new/CMakeLists.txt b/reactos/drivers/video/miniport/vga_new/CMakeLists.txt index 32c4819433c..2998a3d8c5a 100644 --- a/reactos/drivers/video/miniport/vga_new/CMakeLists.txt +++ b/reactos/drivers/video/miniport/vga_new/CMakeLists.txt @@ -4,17 +4,20 @@ list(APPEND SOURCE vgadata.c vga.c vbemodes.c - vbe.c - vga.rc) + vbe.c) -add_library(vga SHARED ${SOURCE}) +add_library(vga SHARED + ${SOURCE} + vga.rc) target_link_libraries(vga libcntpr) if(MSVC) add_target_compile_flags(vga "/Gz") else() - add_target_compile_flags(vga "-mrtd -fno-builtin") + # FIXME: http://www.cmake.org/Bug/view.php?id=12998 + #add_target_compile_flags(vga "-mrtd -fno-builtin") + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-mrtd -fno-builtin") endif() set_module_type(vga kernelmodedriver) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/CMakeLists.txt b/reactos/drivers/wdm/audio/backpln/portcls/CMakeLists.txt index c5f109876df..c5db609d4a8 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/CMakeLists.txt +++ b/reactos/drivers/wdm/audio/backpln/portcls/CMakeLists.txt @@ -6,7 +6,7 @@ add_definitions(-D_WIN32_WINNT=0x600) spec2def(portcls.sys portcls.spec) -add_library(portcls SHARED +list(APPEND SOURCE adapter.cpp api.cpp connection.cpp @@ -48,9 +48,12 @@ add_library(portcls SHARED undoc.cpp unregister.cpp version.cpp - portcls.rc ${CMAKE_CURRENT_BINARY_DIR}/portcls.def) +add_library(portcls SHARED + ${SOURCE} + portcls.rc) + target_link_libraries(portcls libcntpr ${PSEH_LIB}) @@ -58,10 +61,13 @@ target_link_libraries(portcls if(MSVC) add_target_compile_flags(portcls "/GR-") else() - add_target_compile_flags(portcls "-fno-exceptions -fno-rtti") + # FIXME: http://www.cmake.org/Bug/view.php?id=12998 + #add_target_compile_flags(portcls "-fno-exceptions -fno-rtti") + set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-fno-exceptions -fno-rtti") endif() set_module_type(portcls kernelmodedriver ENTRYPOINT 0 ) add_pch(portcls private.hpp) add_importlibs(portcls ntoskrnl ks drmk hal) add_cd_file(TARGET portcls DESTINATION reactos/system32/drivers FOR all) + diff --git a/reactos/include/c++/stlport/stddef.h b/reactos/include/c++/stlport/stddef.h index f959c23af4d..4b22a151106 100644 --- a/reactos/include/c++/stlport/stddef.h +++ b/reactos/include/c++/stlport/stddef.h @@ -13,6 +13,8 @@ * */ +#ifndef RC_INVOKED + #ifndef _STLP_OUTERMOST_HEADER_ID # define _STLP_OUTERMOST_HEADER_ID 0x262 # include @@ -42,3 +44,5 @@ # undef _STLP_DONT_POP_HEADER_ID # endif #endif + +#endif diff --git a/reactos/include/c++/stlport/stl/_cprolog.h b/reactos/include/c++/stlport/stl/_cprolog.h index 1d276562ccc..5fa19cdf97f 100644 --- a/reactos/include/c++/stlport/stl/_cprolog.h +++ b/reactos/include/c++/stlport/stl/_cprolog.h @@ -4,6 +4,8 @@ * allow reentrancy of this header. */ +#ifndef RC_INVOKED + #ifdef std # undef std /* We undef "std" on entry , as STLport headers may include native ones. */ #endif @@ -23,3 +25,5 @@ #if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) # include #endif + +#endif diff --git a/reactos/include/c++/stlport/stl/config/compat.h b/reactos/include/c++/stlport/stl/config/compat.h index 434f314e7a6..e81fb6b7dfc 100644 --- a/reactos/include/c++/stlport/stl/config/compat.h +++ b/reactos/include/c++/stlport/stl/config/compat.h @@ -4,6 +4,8 @@ * This section sets new-style macros based on old-style ones, for compatibility */ +#ifndef RC_INVOKED + #if defined (__STL_DEBUG) && !defined (_STLP_DEBUG) # define _STLP_DEBUG __STL_DEBUG #endif @@ -78,3 +80,5 @@ # error STLport do not support anymore the wrapper mode. If you want to use STLport \ use its iostreams implementation or no iostreams at all. #endif + +#endif /* RC_INVOKED */ diff --git a/reactos/include/c++/stlport/stl/config/features.h b/reactos/include/c++/stlport/stl/config/features.h index b5b4e3a7f6d..aacbf2904d5 100644 --- a/reactos/include/c++/stlport/stl/config/features.h +++ b/reactos/include/c++/stlport/stl/config/features.h @@ -26,6 +26,8 @@ #ifndef _STLP_FEATURES_H #define _STLP_FEATURES_H +#ifndef RC_INVOKED + /* * Purpose of this file: * @@ -1076,4 +1078,6 @@ void _STLP_DECLSPEC _STLP_CALL _STLP_CHECK_RUNTIME_COMPATIBILITY(); #undef _STLP_NO_NEW_STYLE_CASTS #undef __AUTO_CONFIGURED +#endif /* RC_INVOKED */ + #endif /* _STLP_FEATURES_H */