[CMAKE]
authorJérôme Gardou <jerome.gardou@reactos.org>
Thu, 14 Oct 2010 11:03:20 +0000 (11:03 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Thu, 14 Oct 2010 11:03:20 +0000 (11:03 +0000)
  - 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
base/applications/games/solitaire/CMakeLists.txt
base/applications/network/CMakeLists.txt
base/applications/network/telnet/CMakeLists.txt
base/shell/explorer/CMakeLists.txt
drivers/storage/ide/uniata/CMakeLists.txt
gcc.cmake
lib/3rdparty/stlport/CMakeLists.txt
lib/3rdparty/stlport/stlport/stl/config/_windows.h

index 0fc5601..f82ff81 100644 (file)
@@ -1,4 +1,4 @@
 
-#add_subdirectory(solitaire)
+add_subdirectory(solitaire)
 #add_subdirectory(spider)
 add_subdirectory(winemine)
index 6912fbd..603a8b1 100644 (file)
@@ -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)
index 6f02c2e..277cd52 100644 (file)
@@ -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)
index d381a5b..3679d34 100644 (file)
@@ -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)
index 9133234..e9156b1 100644 (file)
@@ -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 "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+
 add_definitions(-DWIN32)
 add_definitions(-D__WINDRES__)
 
index c02f423..d748701 100644 (file)
@@ -1,8 +1,8 @@
 
-set(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
-
 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
index 71e3a3f..f737952 100644 (file)
--- 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 "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> -I${REACTOS_SOURCE_DIR}/lib/3rdparty/stlport/stlport <FLAGS> -o <OBJECT> -c <SOURCE>")
 
 set(CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
 
@@ -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)
index 4add3ff..1627dfc 100644 (file)
@@ -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()
index 5cb6d04..9e69fd0 100644 (file)
@@ -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 <stl/config/_native_headers.h>