Author: akhaldi
Date: Sun Sep 19 00:27:24 2010
New Revision: 48809
URL:
http://svn.reactos.org/svn/reactos?rev=48809&view=rev
Log:
[CMAKE]
- Introduce MSVC toolchain support. Just use -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake
for the toolchain.
- Sync setjmp.h from trunk.
- Improve mingw targets (mingw_common, mingw_wmain, oldnames... etc) a bit to make them
compile and link with msvc.
- Dedicated to Timo ;)
Added:
branches/cmake-bringup/toolchain-msvc.cmake
Modified:
branches/cmake-bringup/include/crt/setjmp.h
branches/cmake-bringup/lib/3rdparty/mingw/CMakeLists.txt
Modified: branches/cmake-bringup/include/crt/setjmp.h
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/include/crt/setjm…
==============================================================================
--- branches/cmake-bringup/include/crt/setjmp.h [iso-8859-1] (original)
+++ branches/cmake-bringup/include/crt/setjmp.h [iso-8859-1] Sun Sep 19 00:27:24 2010
@@ -136,29 +136,18 @@
#define _JMP_BUF_DEFINED
#endif
-static inline __attribute__((always_inline)) void * mingw_getsp(void)
-{
- void *value;
-#if defined(__x86_64)
#ifdef _MSC_VER
- __asm {mov value, rsp}
+int __cdecl __MINGW_NOTHROW setjmp(jmp_buf _Buf);
#else
- __asm__ __volatile__("movq %%rsp, %[value]" : [value] "=r"
(value) );
-#endif
-#elif defined(_X86_)
-#ifdef _MSC_VER
- __asm {mov value, esp}
-#else
- __asm__ __volatile__("movql %%esp, %[value]" : [value] "=r"
(value) );
-#endif
-#else
- #error mingw_getsp unimplemented
-#endif
- return value;
-}
-
#ifdef USE_MINGW_SETJMP_TWO_ARGS
#ifndef _INC_SETJMPEX
+#if defined(__x86_64)
+# define mingw_getsp() \
+ ({ void* value; __asm__ __volatile__("movq %%rsp, %[value]" : [value]
"=r" (value)); value; })
+#elif defined(_X86_)
+# define mingw_getsp() \
+ ({ void* value; __asm__ __volatile__("movl %%esp, %[value]" : [value]
"=r" (value)); value; })
+#endif
#define setjmp(BUF) _setjmp((BUF),mingw_getsp())
int __cdecl __MINGW_NOTHROW _setjmp(jmp_buf _Buf,void *_Ctx);
#else
@@ -173,6 +162,7 @@
#endif
int __cdecl __MINGW_NOTHROW setjmp(jmp_buf _Buf);
#endif
+#endif
__declspec(noreturn) __MINGW_NOTHROW void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/*
throw(...)*/;
__declspec(noreturn) __MINGW_NOTHROW void __cdecl longjmp(jmp_buf _Buf,int _Value);
Modified: branches/cmake-bringup/lib/3rdparty/mingw/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/3rdparty/ming…
==============================================================================
--- branches/cmake-bringup/lib/3rdparty/mingw/CMakeLists.txt [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/3rdparty/mingw/CMakeLists.txt [iso-8859-1] Sun Sep 19
00:27:24 2010
@@ -1,7 +1,11 @@
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/mingw-w64)
-add_definitions(-D_CRTBLD -Wno-main)
+add_definitions(-D_CRTBLD)
+
+if(NOT MSVC)
+add_definitions(-Wno-main)
+endif(NOT MSVC)
set(MINGW_COMMON_SOURCE
_newmode.c
@@ -31,11 +35,14 @@
xthdloc.c
xtxtmode.c
ofmt_stub.c
- cxa_pure_virtual.c
-)
+ cxa_pure_virtual.c)
add_library(mingw_common ${MINGW_COMMON_SOURCE})
+
+if(NOT MSVC)
target_link_libraries(mingw_common oldnames -lkernel32 -lntdll)
+endif(NOT MSVC)
+
set_target_properties(mingw_common PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE)
add_dependencies(mingw_common psdk)
@@ -53,8 +60,7 @@
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def
--kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
- COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
-)
+ COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES
GENERATED TRUE)
Added: 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 (added)
+++ branches/cmake-bringup/toolchain-msvc.cmake [iso-8859-1] Sun Sep 19 00:27:24 2010
@@ -1,0 +1,18 @@
+
+if(NOT ARCH)
+set(ARCH i386)
+endif(NOT ARCH)
+
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Windows)
+set(CMAKE_SYSTEM_PROCESSOR i686)
+
+# which compilers to use for C and C++
+set(CMAKE_C_COMPILER cl)
+set(CMAKE_CXX_COMPILER cl)
+
+set(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W1 /Zm1000")
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)