From 33a0b314cdac7b4c9dcb8c4cd039b766a143acf8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 14 Oct 2010 11:03:20 +0000 Subject: [PATCH] [CMAKE] - add kernelmodedriver module type - add set_cpp macro, which takes care of all c++ stuff for you - hackfix stlport headers for c++ kernel mode modules. - complain about explorer - solitaire, telnet and uniata now build happily against stlport svn path=/branches/cmake-bringup/; revision=49141 --- base/applications/games/CMakeLists.txt | 2 +- .../games/solitaire/CMakeLists.txt | 5 ++-- base/applications/network/CMakeLists.txt | 2 +- .../network/telnet/CMakeLists.txt | 6 ++--- base/shell/explorer/CMakeLists.txt | 4 +++ drivers/storage/ide/uniata/CMakeLists.txt | 13 +++------- gcc.cmake | 26 ++++++++++++------- lib/3rdparty/stlport/CMakeLists.txt | 6 ----- .../stlport/stlport/stl/config/_windows.h | 2 +- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/base/applications/games/CMakeLists.txt b/base/applications/games/CMakeLists.txt index 0fc56018969..f82ff81eb3c 100644 --- a/base/applications/games/CMakeLists.txt +++ b/base/applications/games/CMakeLists.txt @@ -1,4 +1,4 @@ -#add_subdirectory(solitaire) +add_subdirectory(solitaire) #add_subdirectory(spider) add_subdirectory(winemine) diff --git a/base/applications/games/solitaire/CMakeLists.txt b/base/applications/games/solitaire/CMakeLists.txt index 6912fbd6789..603a8b1ec7d 100644 --- a/base/applications/games/solitaire/CMakeLists.txt +++ b/base/applications/games/solitaire/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_cpp() include_directories(${REACTOS_SOURCE_DIR}/lib/3rdparty/cardlib) @@ -9,8 +10,8 @@ add_executable(sol solitaire.cpp rsrc.rc) -target_link_libraries(sol stlport cardlib) +target_link_libraries(sol cardlib) set_module_type(sol win32gui) -add_importlibs(sol advapi32 comctl32 user32 gdi32 msvcrt) +add_importlibs(sol advapi32 comctl32 user32 gdi32 kernel32 msvcrt) diff --git a/base/applications/network/CMakeLists.txt b/base/applications/network/CMakeLists.txt index 6f02c2e489c..277cd521764 100644 --- a/base/applications/network/CMakeLists.txt +++ b/base/applications/network/CMakeLists.txt @@ -9,6 +9,6 @@ add_subdirectory(netstat) add_subdirectory(nslookup) add_subdirectory(ping) #add_subdirectory(route) -#add_subdirectory(telnet) +add_subdirectory(telnet) add_subdirectory(tracert) #add_subdirectory(whois) diff --git a/base/applications/network/telnet/CMakeLists.txt b/base/applications/network/telnet/CMakeLists.txt index d381a5bb166..3679d34b11a 100644 --- a/base/applications/network/telnet/CMakeLists.txt +++ b/base/applications/network/telnet/CMakeLists.txt @@ -1,5 +1,7 @@ add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +set_cpp() + add_executable(telnet src/ansiprsr.cpp src/keytrans.cpp @@ -22,8 +24,6 @@ add_executable(telnet src/ttelhndl.cpp telnet.rc) -target_link_libraries(telnet stlport) - set_module_type(telnet win32cui) -add_importlibs(telnet ws2_32 user32 msvcrt kernel32) +add_importlibs(telnet ws2_32 user32 kernel32 msvcrt) diff --git a/base/shell/explorer/CMakeLists.txt b/base/shell/explorer/CMakeLists.txt index 9133234fa71..e9156b12780 100644 --- a/base/shell/explorer/CMakeLists.txt +++ b/base/shell/explorer/CMakeLists.txt @@ -3,6 +3,10 @@ add_subdirectory(notifyhook) set_unicode() +#NOTE : explorer doesn't follow standard c++, and so doesn't compile with stlport headers +#I'm not willing to do it if explorer_new is hanging around +set(CMAKE_CXX_COMPILE_OBJECT " -o -c ") + add_definitions(-DWIN32) add_definitions(-D__WINDRES__) diff --git a/drivers/storage/ide/uniata/CMakeLists.txt b/drivers/storage/ide/uniata/CMakeLists.txt index c02f423a7ba..d748701e489 100644 --- a/drivers/storage/ide/uniata/CMakeLists.txt +++ b/drivers/storage/ide/uniata/CMakeLists.txt @@ -1,8 +1,8 @@ -set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o ") - include_directories(inc) +set_cpp() + add_library(uniata SHARED id_ata.cpp id_badblock.cpp @@ -14,13 +14,8 @@ add_library(uniata SHARED idedma.rc ros_glue/ros_glue.cpp) -set_target_properties(uniata PROPERTIES LINK_FLAGS "-Wl,-entry,_DriverEntry@8 -Wl,--image-base,0x00010000 -Wl,--exclude-all-symbols -Wl,--subsystem,native" SUFFIX ".sys") +set_module_type(uniata kernelmodedriver) -target_link_libraries(uniata - -lscsiport - -lntoskrnl - -lhal - -lgcc) +add_importlibs(uniata scsiport ntoskrnl hal) -add_dependencies(uniata psdk bugcodes buildno_header) add_minicd_target(uniata reactos uniata.sys) \ No newline at end of file diff --git a/gcc.cmake b/gcc.cmake index 71e3a3f6a89..f737952503e 100644 --- a/gcc.cmake +++ b/gcc.cmake @@ -18,7 +18,7 @@ set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-bas add_definitions(-pipe -fms-extensions) # stlport includes -set(CMAKE_CXX_COMPILE_OBJECT " -o -c ") +set(CMAKE_CXX_COMPILE_OBJECT " -I${REACTOS_SOURCE_DIR}/lib/3rdparty/stlport/stlport -o -c ") set(CMAKE_C_CREATE_SHARED_LIBRARY " -o ") @@ -36,14 +36,6 @@ add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-e # Optimizations add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls) -#linkage hell... -#add_library(gcc STATIC IMPORTED) -#set_target_properties(gcc PROPERTIES IMPORTED_LOCATION ${REACTOS_SOURCE_DIR}/importlibs/libgcc.a -# IMPORTED_LINK_INTERFACE_LIBRARIES "mingw_common -lkernel32") -#add_library(supc++ STATIC IMPORTED) -#set_target_properties(supc++ PROPERTIES IMPORTED_LOCATION ${REACTOS_SOURCE_DIR}/importlibs/libsupc++.a -# IMPORTED_LINK_INTERFACE_LIBRARIES "gcc -lmsvcrt") - # Macros macro(set_entrypoint MODULE ENTRYPOINT) if(${ENTRYPOINT} STREQUAL "0") @@ -76,7 +68,11 @@ endmacro() macro(set_module_type MODULE TYPE) add_dependencies(${MODULE} psdk buildno_header) - + + if(${IS_CPP}) + target_link_libraries(${MODULE} stlport -lsupc++ -lgcc) + endif() + if(${TYPE} MATCHES nativecui) set_subsystem(${MODULE} native) set_entrypoint(${MODULE} NtProcessStartup@4) @@ -112,6 +108,12 @@ macro(set_module_type MODULE TYPE) set_entrypoint(${MODULE} DllMain@12) set_target_properties(${MODULE} PROPERTIES SUFFIX ".cpl") endif() + if(${TYPE} MATCHES kernelmodedriver) + set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-Wl,--image-base,0x00010000 -Wl,--exclude-all-symbols" SUFFIX ".sys") + set_entrypoint(${MODULE} DriverEntry@8) + set_subsystem(${MODULE} native) + add_dependencies(${MODULE} bugcodes) + endif() endmacro() endif() @@ -121,6 +123,10 @@ macro(set_unicode) set(IS_UNICODE 1) endmacro() +macro(set_cpp) + set(IS_CPP 1) + endmacro() + # Workaround lack of mingw RC support in cmake macro(set_rc_compiler) get_directory_property(defines COMPILE_DEFINITIONS) diff --git a/lib/3rdparty/stlport/CMakeLists.txt b/lib/3rdparty/stlport/CMakeLists.txt index 4add3ffa34c..1627dfcd576 100644 --- a/lib/3rdparty/stlport/CMakeLists.txt +++ b/lib/3rdparty/stlport/CMakeLists.txt @@ -41,9 +41,3 @@ list(APPEND SOURCE src/cxa.c) add_library(stlport ${SOURCE}) - -if(NOT MSVC) - #those are mandatory to get correctly ordered linked libraries. - #target_link_libraries(stlport supc++ msvcrt.dll.a) - #add_importlibs(stlport msvcrt) -endif() diff --git a/lib/3rdparty/stlport/stlport/stl/config/_windows.h b/lib/3rdparty/stlport/stlport/stl/config/_windows.h index 5cb6d040b6d..9e69fd03863 100644 --- a/lib/3rdparty/stlport/stlport/stl/config/_windows.h +++ b/lib/3rdparty/stlport/stlport/stl/config/_windows.h @@ -44,7 +44,7 @@ # endif #endif /* _STLP_BIG_ENDIAN */ -#if !defined (_STLP_WINDOWS_H_INCLUDED) +#if !defined (_STLP_WINDOWS_H_INCLUDED) && !defined(_WDMDDK_) //let's hope it will work long enough... # define _STLP_WINDOWS_H_INCLUDED # if defined (__BUILDING_STLPORT) # include -- 2.17.1