[CMAKE]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 14 Feb 2011 11:09:48 +0000 (11:09 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 14 Feb 2011 11:09:48 +0000 (11:09 +0000)
- Drop support for MSVC versions below 1300
- use the same flags for WDK / host as normal
- Disable optimization on Debug builds, its incompatible with /ZI

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

cmake/Platform/Windows-cl.cmake
msc.cmake
toolchain-msvc.cmake

index a14ee48..6d1cbd2 100644 (file)
@@ -19,44 +19,43 @@ IF($ENV{DDKBUILDENV} MATCHES "fre")
   SET(CMAKE_USE_WDK_ENV 1)\r
 ENDIF()\r
 \r
   SET(CMAKE_USE_WDK_ENV 1)\r
 ENDIF()\r
 \r
-IF(CMAKE_USE_WDK_ENV)\r
+if(CMAKE_USE_WDK_ENV)\r
 \r
 \r
-  # Detect output architecture\r
-  IF(NOT ARCH)\r
-    IF($ENV{AMD64} MATCHES 1)\r
-      SET(ARCH amd64)\r
-    ELSE()\r
-      SET(ARCH i386)\r
-    ENDIF()\r
-  ENDIF()\r
-\r
-  # Add library directories\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
-  LINK_DIRECTORIES(${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
-  # Add environment variables\r
-  IF(NOT CMAKE_CROSSCOMPILING)\r
-    SET(ENV{INCLUDE} "$ENV{CRT_INC_PATH};$ENV{SDK_INC_PATH};$ENV{SDK_INC_PATH}\\crt\\stl60")\r
-    include_directories($ENV{INCLUDE})\r
-    SET(ENV{LIBPATH} "${CRT_LIB_PATH};${SDK_LIB_PATH}")\r
+    # Detect output architecture\r
+    if(NOT ARCH)\r
+        if($ENV{AMD64} MATCHES 1)\r
+            set(ARCH amd64)\r
+            set(MSVC_C_ARCHITECTURE_ID 64)\r
+        else()\r
+            set(ARCH i386)\r
+        endif()\r
+    endif()\r
 \r
 \r
-    SET(ENV{USE_MSVCRT} 1)\r
-    SET(ENV{USE_STL} 1)\r
-    SET(ENV{STL_VER} 60)\r
+    # Add library directories\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
+    LINK_DIRECTORIES(${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
 \r
-  ENDIF()\r
-ENDIF()\r
+    # Add environment variables\r
+    if(NOT CMAKE_CROSSCOMPILING)\r
+        set(ENV{INCLUDE} "$ENV{CRT_INC_PATH};$ENV{SDK_INC_PATH};$ENV{SDK_INC_PATH}\\crt\\stl60")\r
+        include_directories($ENV{INCLUDE})\r
+        set(ENV{LIBPATH} "${CRT_LIB_PATH};${SDK_LIB_PATH}")\r
+        set(ENV{USE_MSVCRT} 1)\r
+        set(ENV{USE_STL} 1)\r
+        set(ENV{STL_VER} 60)\r
+    endif()\r
+endif()\r
 \r
 ############\r
 \r
 \r
 ############\r
 \r
@@ -193,68 +192,34 @@ IF("${MSVC_VERSION}" GREATER 1599)
   SET(MSVC_INCREMENTAL_DEFAULT ON)\r
 ENDIF()\r
 \r
   SET(MSVC_INCREMENTAL_DEFAULT ON)\r
 ENDIF()\r
 \r
-# default to Debug builds\r
-if(MSVC_VERSION GREATER 1310)\r
-  # for 2005 make sure the manifest is put in the dll with mt\r
-#  SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")\r
-#  SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}")\r
-  # create a C shared library\r
-#  SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")\r
-  # create a C shared module just copy the shared library rule\r
-#  SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")\r
-#  SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}")\r
-#  SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}")\r
-\r
-    set(CMAKE_BUILD_TYPE_INIT Debug)\r
-\r
-    if(ENV{DDKBUILDENV} OR NOT CMAKE_CROSSCOMPILING)\r
-        set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /ZI /Ob0 /Od")\r
-        set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")\r
-    else()\r
-        set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")\r
-        set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")\r
-    endif()\r
+# No support for old versions\r
+if(MSVC_VERSION LESS 1310)\r
+message(FATAL_ERROR "Your compiler is too old. Get a newer version!")\r
+endif()\r
 \r
 \r
-  SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc")\r
-  SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
-  SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
-  SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")\r
-  SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")\r
-  SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
-  SET (CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
-  SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")\r
-  SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ")\r
-  SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")\r
-ELSE(MSVC_VERSION GREATER 1310)\r
-  IF(CMAKE_USING_VC_FREE_TOOLS)\r
-    MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available")\r
-    SET(CMAKE_BUILD_TYPE_INIT Release)\r
-    SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX")\r
-    SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi  /Ob0 /Od /GZ")\r
-    SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")\r
-    SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")\r
-    SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")\r
-    SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")\r
-    SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi  /Ob0 /Od /GZ")\r
-    SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")\r
-    SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")\r
-    SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")\r
-  ELSE(CMAKE_USING_VC_FREE_TOOLS)\r
-    SET(CMAKE_BUILD_TYPE_INIT Debug)\r
-    SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX")\r
-    SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi  /Ob0 /Od /GZ")\r
-    SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
-    SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
-    SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1 /D NDEBUG")\r
-    SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")\r
-    SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /Zi /Ob0 /Od /GZ")\r
-    SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
-    SET (CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
-    SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1 /D NDEBUG")\r
-  ENDIF(CMAKE_USING_VC_FREE_TOOLS)\r
-  SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")\r
-ENDIF(MSVC_VERSION GREATER 1310)\r
+# for 2005 make sure the manifest is put in the dll with mt\r
+#SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")\r
+#SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}")\r
+# create a C shared library\r
+#SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")\r
+# create a C shared module just copy the shared library rule\r
+#SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")\r
+#SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}")\r
+#SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}")\r
 \r
 \r
+SET(CMAKE_BUILD_TYPE_INIT Debug)\r
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")\r
+SET(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")\r
+SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc")\r
+SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")\r
+SET(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")\r
+SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")\r
+SET(CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")\r
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")\r
+SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ")\r
+SET(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")\r
 SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")\r
 \r
 # executable linker flags\r
 SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")\r
 \r
 # executable linker flags\r
index b0c3750..558fdf7 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -1,6 +1,7 @@
 \r
 \r
-if(0) # Fixme redefinition warning\r
-if(OPTIMIZE STREQUAL "1")\r
+if(${CMAKE_BUILD_TYPE} MATCHES Debug)\r
+    # no optimitation\r
+elseif(OPTIMIZE STREQUAL "1")\r
     add_definitions(/O1)\r
 elseif(OPTIMIZE STREQUAL "2")\r
     add_definitions(/O2)\r
     add_definitions(/O1)\r
 elseif(OPTIMIZE STREQUAL "2")\r
     add_definitions(/O2)\r
@@ -11,7 +12,6 @@ elseif(OPTIMIZE STREQUAL "4")
 elseif(OPTIMIZE STREQUAL "5")\r
     add_definitions(/GF /Gy /Ob2 /Os /Ox /GS-)\r
 endif()\r
 elseif(OPTIMIZE STREQUAL "5")\r
     add_definitions(/GF /Gy /Ob2 /Os /Ox /GS-)\r
 endif()\r
-endif()\r
 \r
 add_definitions(/X /GR- /GS- /Zl)\r
 add_definitions(-Dinline=__inline -D__STDC__=1)\r
 \r
 add_definitions(/X /GR- /GS- /Zl)\r
 add_definitions(-Dinline=__inline -D__STDC__=1)\r
index 6687fba..506fda9 100644 (file)
@@ -19,8 +19,6 @@ set(CMAKE_ASM_COMPILE_OBJECT
     "<CMAKE_C_COMPILER> /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"\r
     "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")\r
 \r
     "<CMAKE_C_COMPILER> /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"\r
     "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")\r
 \r
-set(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W1 /Zm1000")\r
-\r
 set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")\r
 \r
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")\r
 set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")\r
 \r
 if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")\r