[CMAKE]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 19 Sep 2010 23:03:25 +0000 (23:03 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 19 Sep 2010 23:03:25 +0000 (23:03 +0000)
- Improved MSVC toolchain support, now working with WDK, as well
(Thanks to Amine for solving the problems)
- Add compiler specific macro set_subsystem
- add nativecui module type

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

gcc.cmake
msc.cmake
toolchain-msvc.cmake

index 4c3ec59..267ec93 100644 (file)
--- a/gcc.cmake
+++ b/gcc.cmake
@@ -37,6 +37,10 @@ macro(set_entrypoint MODULE ENTRYPOINT)
   set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-Wl,-entry,_${ENTRYPOINT}")\r
 endmacro()\r
 \r
+macro(set_subsystem MODULE SUBSYSTEM)\r
+  set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-Wl,--subsystem:${SUBSYSTEM}")\r
+endmacro()\r
+\r
 macro(add_importlibs MODULE)\r
   FOREACH(LIB ${ARGN})\r
     target_link_libraries(${MODULE} ${LIB}.a)\r
@@ -45,7 +49,12 @@ endmacro()
 \r
 macro(set_module_type MODULE TYPE)\r
   target_link_libraries(${MODULE} mingw_wmain mingw_common)\r
+  if(${TYPE} MATCHES nativecui)\r
+    set_subsystem(${MODULE} native)\r
+    set_entrypoint(${MODULE} NtProcessStartup@4)\r
+  endif()\r
   if(${TYPE} MATCHES win32gui)\r
+    set_subsystem(${MODULE} windows)\r
     set_entrypoint(${MODULE} wWinMainCRTStartup)\r
   endif()\r
 endmacro()\r
index f89f181..f1941d7 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -18,6 +18,10 @@ macro(set_entrypoint MODULE ENTRYPOINT)
   set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "/ENTRY:${ENTRYPOINT}")\r
 endmacro()\r
 \r
+macro(set_subsystem MODULE SUBSYSTEM)\r
+  set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "/subsystem:${SUBSYSTEM}")\r
+endmacro()\r
+\r
 macro(add_importlibs MODULE)\r
   FOREACH(LIB ${ARGN})\r
     target_link_libraries(${MODULE} ${LIB}.LIB)\r
@@ -25,9 +29,17 @@ macro(add_importlibs MODULE)
 endmacro()\r
 \r
 macro(set_module_type MODULE TYPE)\r
+  if(${TYPE} MATCHES nativecui)\r
+    set_subsystem(${MODULE} native)\r
+    add_importlibs(${MODULE} ntdll)\r
+  endif()\r
   if (${TYPE} MATCHES win32gui)\r
-    set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "/subsystem:windows")\r
+    set_subsystem(${MODULE} windows)\r
   endif ()\r
 endmacro()\r
 \r
 endif()\r
+\r
+set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi  /Ob0 /Od")\r
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od")\r
+\r
index 2a12282..a866247 100644 (file)
@@ -1,7 +1,24 @@
 \r
 if(NOT ARCH)\r
-set(ARCH i386)\r
-endif(NOT ARCH)\r
+  set(ARCH i386)\r
+endif()\r
+\r
+# WDK support\r
+string(REPLACE * ${ARCH} ATL_LIB_PATH $ENV{ATL_LIB_PATH})\r
+string(REPLACE * ${ARCH} CRT_LIB_PATH $ENV{CRT_LIB_PATH})\r
+string(REPLACE * ${ARCH} DDK_LIB_PATH $ENV{DDK_LIB_PATH})\r
+string(REPLACE * ${ARCH} KMDF_LIB_PATH $ENV{KMDF_LIB_PATH})\r
+string(REPLACE * ${ARCH} MFC_LIB_PATH $ENV{MFC_LIB_PATH})\r
+string(REPLACE * ${ARCH} SDK_LIB_PATH $ENV{SDK_LIB_PATH})\r
+\r
+link_directories(\r
+#${ATL_LIB_PATH}\r
+                 ${CRT_LIB_PATH}\r
+                 ${DDK_LIB_PATH}\r
+#                 ${IFSKIT_LIB_PATH}\r
+#                 ${KMDF_LIB_PATH}\r
+#                 ${MFC_LIB_PATH}\r
+                 ${SDK_LIB_PATH})\r
 \r
 # the name of the target operating system\r
 set(CMAKE_SYSTEM_NAME Windows)\r
@@ -16,7 +33,12 @@ SET(CMAKE_ASM_COMPILER ml)
 SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <DEFINES> /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 <OBJECT> <SOURCE>")\r
 \r
 set(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W1 /Zm1000")\r
+set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi  /Ob0 /Od")\r
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od")\r
 \r
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\r
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\r
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\r
+\r
+# Prevent from using run time checking when testing the compiler\r
+set(CMAKE_BUILD_TYPE "RelwithDebInfo" CACHE STRING "Build Type")\r