[CMAKE]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 19 Sep 2010 00:15:45 +0000 (00:15 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 19 Sep 2010 00:15:45 +0000 (00:15 +0000)
- *cough* Separate compiler specific flags.

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

CMakeLists.txt
gcc.cmake [new file with mode: 0644]
msc.cmake [new file with mode: 0644]

index 55bdf5b..b47897f 100644 (file)
@@ -19,6 +19,7 @@ add_definitions(-fshort-wchar)
 
 include_directories(${REACTOS_SOURCE_DIR}/tools/unicode)
 include_directories(include)
+include_directories(include/host)
 include_directories(include/reactos)
 include_directories(include/reactos/wine)
 include_directories(${REACTOS_BINARY_DIR}/include)
@@ -30,10 +31,11 @@ export(TARGETS widl winebuild nci buildno gendib cdmake FILE ${CMAKE_BINARY_DIR}
 
 else()
 
-# Linking
-link_directories("${REACTOS_SOURCE_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/3rdparty/mingw)
-set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
-set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--kill-at -Wl,-T,${REACTOS_SOURCE_DIR}/global.lds")
+if(MSVC)
+include(msc.cmake)
+else()
+include(gcc.cmake)
+endif(MSVC)
 
 # Activate support for assembly source files
 enable_language(ASM)
@@ -69,25 +71,6 @@ add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
 add_definitions(-DUSE_COMPILER_EXCEPTIONS)
 add_definitions(-D_USE_32BIT_TIME_T)
 
-# Compiler Core
-add_definitions(-pipe -fms-extensions)
-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>")
-
-# Debugging (Note: DWARF-4 on 4.5.1 when we ship)
-add_definitions(-gdwarf-2 -g2 -femit-struct-debug-detailed=none -feliminate-unused-debug-types)
-
-# Tuning
-add_definitions(-march=pentium -mtune=i686)
-
-# Warnings
-add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value  -Winvalid-pch)
-
-# Optimizations
-add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls)
-
-# C++ Flags
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
-
 include_directories(include)
 include_directories(include/psdk)
 include_directories(include/dxsdk)
@@ -96,7 +79,11 @@ include_directories(${REACTOS_BINARY_DIR}/include/dxsdk)
 include_directories(${REACTOS_BINARY_DIR}/include/psdk)
 include_directories(${REACTOS_BINARY_DIR}/include/reactos)
 include_directories(include/crt)
+if(MSVC)
+include_directories(include/crt/msc)
+else()
 include_directories(include/crt/mingw32)
+endif(MSVC)
 include_directories(include/ddk)
 include_directories(include/ndk)
 include_directories(include/reactos)
diff --git a/gcc.cmake b/gcc.cmake
new file mode 100644 (file)
index 0000000..d8d06f2
--- /dev/null
+++ b/gcc.cmake
@@ -0,0 +1,25 @@
+
+# Linking
+link_directories("${REACTOS_SOURCE_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/3rdparty/mingw)
+set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--kill-at -Wl,-T,${REACTOS_SOURCE_DIR}/global.lds")
+
+# Compiler Core
+add_definitions(-pipe -fms-extensions)
+
+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>")
+
+# Debugging (Note: DWARF-4 on 4.5.1 when we ship)
+add_definitions(-gdwarf-2 -g2 -femit-struct-debug-detailed=none -feliminate-unused-debug-types)
+
+# Tuning
+add_definitions(-march=pentium -mtune=i686)
+
+# Warnings
+add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value -Winvalid-pch)
+
+# Optimizations
+add_definitions(-Os -fno-strict-aliasing -ftracer -momit-leaf-frame-pointer -mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls)
+
+# C++ Flags
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
\ No newline at end of file
diff --git a/msc.cmake b/msc.cmake
new file mode 100644 (file)
index 0000000..97e567d
--- /dev/null
+++ b/msc.cmake
@@ -0,0 +1,3 @@
+
+add_definitions(/GS- /Zl /Zi)
+add_definitions(-Dinline=__inline -D__STDC__=1)
\ No newline at end of file