Author: tkreuzer
Date: Mon Feb 14 11:09:48 2011
New Revision: 50689
URL:
http://svn.reactos.org/svn/reactos?rev=50689&view=rev
Log:
[CMAKE]
- 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
Modified:
branches/cmake-bringup/cmake/Platform/Windows-cl.cmake
branches/cmake-bringup/msc.cmake
branches/cmake-bringup/toolchain-msvc.cmake
Modified: branches/cmake-bringup/cmake/Platform/Windows-cl.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/cmake/Platform/Wi…
==============================================================================
--- branches/cmake-bringup/cmake/Platform/Windows-cl.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/cmake/Platform/Windows-cl.cmake [iso-8859-1] Mon Feb 14
11:09:48 2011
@@ -19,44 +19,43 @@
SET(CMAKE_USE_WDK_ENV 1)
ENDIF()
-IF(CMAKE_USE_WDK_ENV)
-
- # Detect output architecture
- IF(NOT ARCH)
- IF($ENV{AMD64} MATCHES 1)
- SET(ARCH amd64)
- ELSE()
- SET(ARCH i386)
- ENDIF()
- ENDIF()
-
- # Add library directories
- STRING(REPLACE * ${ARCH} ATL_LIB_PATH $ENV{ATL_LIB_PATH})
- STRING(REPLACE * ${ARCH} CRT_LIB_PATH $ENV{CRT_LIB_PATH})
- STRING(REPLACE * ${ARCH} DDK_LIB_PATH $ENV{DDK_LIB_PATH})
- STRING(REPLACE * ${ARCH} KMDF_LIB_PATH $ENV{KMDF_LIB_PATH})
- STRING(REPLACE * ${ARCH} MFC_LIB_PATH $ENV{MFC_LIB_PATH})
- STRING(REPLACE * ${ARCH} SDK_LIB_PATH $ENV{SDK_LIB_PATH})
- LINK_DIRECTORIES(${ATL_LIB_PATH}
- ${CRT_LIB_PATH}
- ${DDK_LIB_PATH}
- ${IFSKIT_LIB_PATH}
- ${KMDF_LIB_PATH}
- ${MFC_LIB_PATH}
- ${SDK_LIB_PATH})
-
- # Add environment variables
- IF(NOT CMAKE_CROSSCOMPILING)
- SET(ENV{INCLUDE}
"$ENV{CRT_INC_PATH};$ENV{SDK_INC_PATH};$ENV{SDK_INC_PATH}\\crt\\stl60")
- include_directories($ENV{INCLUDE})
- SET(ENV{LIBPATH} "${CRT_LIB_PATH};${SDK_LIB_PATH}")
-
- SET(ENV{USE_MSVCRT} 1)
- SET(ENV{USE_STL} 1)
- SET(ENV{STL_VER} 60)
-
- ENDIF()
-ENDIF()
+if(CMAKE_USE_WDK_ENV)
+
+ # Detect output architecture
+ if(NOT ARCH)
+ if($ENV{AMD64} MATCHES 1)
+ set(ARCH amd64)
+ set(MSVC_C_ARCHITECTURE_ID 64)
+ else()
+ set(ARCH i386)
+ endif()
+ endif()
+
+ # Add library directories
+ STRING(REPLACE * ${ARCH} ATL_LIB_PATH $ENV{ATL_LIB_PATH})
+ STRING(REPLACE * ${ARCH} CRT_LIB_PATH $ENV{CRT_LIB_PATH})
+ STRING(REPLACE * ${ARCH} DDK_LIB_PATH $ENV{DDK_LIB_PATH})
+ STRING(REPLACE * ${ARCH} KMDF_LIB_PATH $ENV{KMDF_LIB_PATH})
+ STRING(REPLACE * ${ARCH} MFC_LIB_PATH $ENV{MFC_LIB_PATH})
+ STRING(REPLACE * ${ARCH} SDK_LIB_PATH $ENV{SDK_LIB_PATH})
+ LINK_DIRECTORIES(${ATL_LIB_PATH}
+ ${CRT_LIB_PATH}
+ ${DDK_LIB_PATH}
+ ${IFSKIT_LIB_PATH}
+ ${KMDF_LIB_PATH}
+ ${MFC_LIB_PATH}
+ ${SDK_LIB_PATH})
+
+ # Add environment variables
+ if(NOT CMAKE_CROSSCOMPILING)
+ set(ENV{INCLUDE}
"$ENV{CRT_INC_PATH};$ENV{SDK_INC_PATH};$ENV{SDK_INC_PATH}\\crt\\stl60")
+ include_directories($ENV{INCLUDE})
+ set(ENV{LIBPATH} "${CRT_LIB_PATH};${SDK_LIB_PATH}")
+ set(ENV{USE_MSVCRT} 1)
+ set(ENV{USE_STL} 1)
+ set(ENV{STL_VER} 60)
+ endif()
+endif()
############
@@ -193,68 +192,34 @@
SET(MSVC_INCREMENTAL_DEFAULT ON)
ENDIF()
-# default to Debug builds
-if(MSVC_VERSION GREATER 1310)
- # for 2005 make sure the manifest is put in the dll with mt
-# SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll
${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
-# SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll
${CMAKE_CXX_CREATE_SHARED_MODULE}")
- # create a C shared library
-# SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
- # create a C shared module just copy the shared library rule
-# SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
-# SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe
${CMAKE_CXX_LINK_EXECUTABLE}")
-# SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe
${CMAKE_C_LINK_EXECUTABLE}")
-
- set(CMAKE_BUILD_TYPE_INIT Debug)
-
- if(ENV{DDKBUILDENV} OR NOT CMAKE_CROSSCOMPILING)
- set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /ZI /Ob0 /Od")
- set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")
- else()
- set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")
- set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")
- endif()
-
- SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc")
- SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
- SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
- SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
- SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
- SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
- SET (CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
- SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
- 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
")
- SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")
-ELSE(MSVC_VERSION GREATER 1310)
- IF(CMAKE_USING_VC_FREE_TOOLS)
- MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available")
- SET(CMAKE_BUILD_TYPE_INIT Release)
- SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX")
- SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ")
- SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
- SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
- SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
- SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
- SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ")
- SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
- SET (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
- SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
- ELSE(CMAKE_USING_VC_FREE_TOOLS)
- SET(CMAKE_BUILD_TYPE_INIT Debug)
- SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX")
- SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ")
- SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
- SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
- SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1 /D NDEBUG")
- SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
- SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /Zi /Ob0 /Od /GZ")
- SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
- SET (CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
- SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1 /D NDEBUG")
- ENDIF(CMAKE_USING_VC_FREE_TOOLS)
- 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")
-ENDIF(MSVC_VERSION GREATER 1310)
-
+# No support for old versions
+if(MSVC_VERSION LESS 1310)
+message(FATAL_ERROR "Your compiler is too old. Get a newer version!")
+endif()
+
+# for 2005 make sure the manifest is put in the dll with mt
+#SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_COMMAND> -E vs_link_dll
${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+#SET(CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_COMMAND> -E vs_link_dll
${CMAKE_CXX_CREATE_SHARED_MODULE}")
+# create a C shared library
+#SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+# create a C shared module just copy the shared library rule
+#SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}")
+#SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe
${CMAKE_CXX_LINK_EXECUTABLE}")
+#SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe
${CMAKE_C_LINK_EXECUTABLE}")
+
+SET(CMAKE_BUILD_TYPE_INIT Debug)
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")
+SET(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /ZI /Ob0 /Od")
+SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
+SET(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000")
+SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
+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 ")
+SET(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")
SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
# executable linker flags
Modified: branches/cmake-bringup/msc.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/msc.cmake?rev=506…
==============================================================================
--- branches/cmake-bringup/msc.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/msc.cmake [iso-8859-1] Mon Feb 14 11:09:48 2011
@@ -1,6 +1,7 @@
-if(0) # Fixme redefinition warning
-if(OPTIMIZE STREQUAL "1")
+if(${CMAKE_BUILD_TYPE} MATCHES Debug)
+ # no optimitation
+elseif(OPTIMIZE STREQUAL "1")
add_definitions(/O1)
elseif(OPTIMIZE STREQUAL "2")
add_definitions(/O2)
@@ -11,7 +12,6 @@
elseif(OPTIMIZE STREQUAL "5")
add_definitions(/GF /Gy /Ob2 /Os /Ox /GS-)
endif()
-endif()
add_definitions(/X /GR- /GS- /Zl)
add_definitions(-Dinline=__inline -D__STDC__=1)
Modified: branches/cmake-bringup/toolchain-msvc.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/toolchain-msvc.cm…
==============================================================================
--- branches/cmake-bringup/toolchain-msvc.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/toolchain-msvc.cmake [iso-8859-1] Mon Feb 14 11:09:48 2011
@@ -19,8 +19,6 @@
"<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"
"<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta
<OBJECT>.tmp")
-set(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W1 /Zm1000")
-
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")