[CMAKE]
authorAmine Khaldi <amine.khaldi@reactos.org>
Thu, 6 Jan 2011 16:57:56 +0000 (16:57 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Thu, 6 Jan 2011 16:57:56 +0000 (16:57 +0000)
- Initial support of the arm toolchain/build.

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

CMakeLists.txt
config-arm.cmake [new file with mode: 0644]
gcc.cmake
lib/sdk/crt/CMakeLists.txt
toolchain-mingw32.cmake

index 44073c1..f46358f 100644 (file)
@@ -11,17 +11,18 @@ if(ARCH MATCHES i386)
     include(config.cmake)
 elseif(ARCH MATCHES amd64)
     include(config-amd64.cmake)
     include(config.cmake)
 elseif(ARCH MATCHES amd64)
     include(config-amd64.cmake)
+elseif(ARCH MATCHES arm)
+    include(config-arm.cmake)
 endif()
 
 if(NOT CMAKE_CROSSCOMPILING)
 
 endif()
 
 if(NOT CMAKE_CROSSCOMPILING)
 
+    add_definitions(-DTARGET_${ARCH})
+
     if(ARCH MATCHES i386)
     if(ARCH MATCHES i386)
-        add_definitions(-DTARGET_i386)
         if(MSVC)
             add_definitions(-Dinline=__inline)
         endif()
         if(MSVC)
             add_definitions(-Dinline=__inline)
         endif()
-    elseif(ARCH MATCHES amd64)
-        add_definitions(-DTARGET_amd64)
     endif()
 
     include_directories(
     endif()
 
     include_directories(
@@ -117,6 +118,9 @@ if(CMAKE_CROSSCOMPILING)
         add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
     elseif(ARCH MATCHES amd64)
         add_definitions(-D_M_AMD64 -D_AMD64_ -D_M_AXP64 -D__x86_64__ -D_WIN64)
         add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
     elseif(ARCH MATCHES amd64)
         add_definitions(-D_M_AMD64 -D_AMD64_ -D_M_AXP64 -D__x86_64__ -D_WIN64)
+    elseif(ARCH MATCHES arm)
+        # _M_ARM is already defined by toolchain
+        add_definitions(-D_ARM_ -D__arm__)
     endif()
 
     # Other
     endif()
 
     # Other
@@ -124,6 +128,8 @@ if(CMAKE_CROSSCOMPILING)
         add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
     elseif(ARCH MATCHES amd64)
         add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
         add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
     elseif(ARCH MATCHES amd64)
         add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
+    elseif(ARCH MATCHES arm)
+        add_definitions(-DUSE_COMPILER_EXCEPTIONS)
     endif()
 
     include_directories(
     endif()
 
     include_directories(
@@ -140,6 +146,10 @@ if(CMAKE_CROSSCOMPILING)
         include/reactos
         include/reactos/libs)
 
         include/reactos
         include/reactos/libs)
 
+    if(ARCH MATCHES arm)
+        include_directories(${REACTOS_SOURCE_DIR}/include/reactos/arm)
+    endif()
+
     if(MSVC)
         include_directories(include/crt/msc)
     else()
     if(MSVC)
         include_directories(include/crt/msc)
     else()
diff --git a/config-arm.cmake b/config-arm.cmake
new file mode 100644 (file)
index 0000000..02ae149
--- /dev/null
@@ -0,0 +1,46 @@
+\r
+set(SARCH "omap3-zoom2" CACHE STRING\r
+"Sub-architecture (board) to build for. Specify one of:\r
+ kurobox versatile omap3-zoom2 omap3-beagle")\r
+\r
+set(OARCH "armv7-a" CACHE STRING\r
+"Generate instructions for this CPU type. Specify one of:\r
+ armv5te armv7-a")\r
+\r
+set (OPTIMIZE "1" CACHE STRING\r
+"What level of optimisation to use.\r
+  0 = off\r
+  1 = Default option, optimize for size (-Os) with some additional options\r
+  2 = -Os\r
+  3 = -O1\r
+  4 = -O2\r
+  5 = -O3")\r
+\r
+set(DBG TRUE CACHE BOOL\r
+"Whether to compile for debugging.")\r
+\r
+set(KDBG FALSE CACHE BOOL\r
+"Whether to compile in the integrated kernel debugger.")\r
+\r
+set(GDB FALSE CACHE BOOL\r
+"Whether to compile for debugging with GDB.\r
+If you don't use GDB, don't    enable this.")\r
+\r
+set(_WINKD_ TRUE CACHE BOOL\r
+"Whether to compile with the KD protocol.")\r
+\r
+set(_ELF_ FALSE CACHE BOOL\r
+"Whether to compile support for ELF files.\r
+Do not enable unless you know what you're doing.")\r
+\r
+set(NSWPAT FALSE CACHE BOOL\r
+"Whether to compile apps/libs with features covered software patents or not.\r
+If you live in a country where software patents are valid/apply, don't\r
+enable this (except they/you purchased a license from the patent owner).\r
+This settings is disabled (0) by default.")\r
+\r
+set(BUILD_MP TRUE CACHE BOOL\r
+"Whether to compile the multi processor versions for ntoskrnl and hal.")\r
+\r
+set(NEWSPRINTF FALSE CACHE BOOL\r
+"Whether to compile the new sprintf.")\r
index 5c2a411..563ef56 100644 (file)
--- a/gcc.cmake
+++ b/gcc.cmake
@@ -26,7 +26,7 @@ add_definitions(-gdwarf-2 -g2 -femit-struct-debug-detailed=none -feliminate-unus
 # Tuning
 if(ARCH MATCHES i386)
     add_definitions(-march=${OARCH} -mtune=${TUNE})
 # Tuning
 if(ARCH MATCHES i386)
     add_definitions(-march=${OARCH} -mtune=${TUNE})
-elseif(ARCH MATCHES amd64)
+else()
     add_definitions(-march=${OARCH})
 endif()
 
     add_definitions(-march=${OARCH})
 endif()
 
index 0d2c984..0417362 100644 (file)
@@ -31,7 +31,6 @@ list(APPEND CRT_SOURCE
     except/cppexcept.c
     except/except.c
     except/matherr.c
     except/cppexcept.c
     except/except.c
     except/matherr.c
-    except/${ARCH}/seh.s
     except/xcptfil.c
     float/chgsign.c
     float/copysign.c
     except/xcptfil.c
     float/chgsign.c
     float/copysign.c
@@ -141,7 +140,6 @@ list(APPEND CRT_SOURCE
     search/bsearch.c
     search/lfind.c
     search/lsearch.c
     search/bsearch.c
     search/lfind.c
     search/lsearch.c
-    setjmp/${ARCH}/setjmp.s
     signal/signal.c
     signal/xcptinfo.c
     stdio/access.c
     signal/signal.c
     signal/xcptinfo.c
     stdio/access.c
@@ -281,6 +279,11 @@ list(APPEND CRT_SOURCE
     wine/heap.c
     wine/undname.c)
 
     wine/heap.c
     wine/undname.c)
 
+if(NOT ARCH MATCHES arm)
+list(APPEND CRT_SOURCE
+    except/${ARCH}/seh.s)
+endif()
+
 if(ARCH MATCHES i386)
 list(APPEND CRT_SOURCE
     except/i386/chkstk_asm.s
 if(ARCH MATCHES i386)
 list(APPEND CRT_SOURCE
     except/i386/chkstk_asm.s
@@ -290,7 +293,8 @@ list(APPEND CRT_SOURCE
     float/i386/cntrlfp.c
     float/i386/fpreset.c
     float/i386/logb.c
     float/i386/cntrlfp.c
     float/i386/fpreset.c
     float/i386/logb.c
-    float/i386/statfp.c)
+    float/i386/statfp.c
+    setjmp/i386/setjmp.s)
 elseif(ARCH MATCHES amd64)
 list(APPEND CRT_SOURCE
     except/amd64/chkstk_asm.s
 elseif(ARCH MATCHES amd64)
 list(APPEND CRT_SOURCE
     except/amd64/chkstk_asm.s
@@ -298,8 +302,9 @@ list(APPEND CRT_SOURCE
     float/i386/cntrlfp.c
     float/i386/fpreset.c
     float/i386/logb.c
     float/i386/cntrlfp.c
     float/i386/fpreset.c
     float/i386/logb.c
-    float/i386/statfp.c)
-endif(ARCH MATCHES i386)
+    float/i386/statfp.c
+    setjmp/amd64/setjmp.s)
+endif()
 
 if(ARCH MATCHES i386)
 list(APPEND CRT_SOURCE
 
 if(ARCH MATCHES i386)
 list(APPEND CRT_SOURCE
@@ -384,7 +389,7 @@ list(APPEND CRT_SOURCE
     string/wcsncpy.c
     string/wcsnlen.c
     string/wcsrchr.c)
     string/wcsncpy.c
     string/wcsnlen.c
     string/wcsrchr.c)
-endif(ARCH MATCHES i386)
+endif()
 
 if(ARCH MATCHES amd64)
 list(APPEND CRT_SOURCE
 
 if(ARCH MATCHES amd64)
 list(APPEND CRT_SOURCE
@@ -408,7 +413,7 @@ list(APPEND CRT_SOURCE
     math/amd64/sqrt.S
     math/amd64/sqrtf.S
     math/amd64/tan.S)
     math/amd64/sqrt.S
     math/amd64/sqrtf.S
     math/amd64/tan.S)
-endif(ARCH MATCHES amd64)
+endif()
 
 add_library(crt ${CMAKE_CURRENT_BINARY_DIR}/crt_precomp.h.gch ${CRT_SOURCE})
 
 
 add_library(crt ${CMAKE_CURRENT_BINARY_DIR}/crt_precomp.h.gch ${CRT_SOURCE})
 
@@ -417,8 +422,6 @@ add_pch(crt ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${CRT_SOURCE})
 add_dependencies(crt psdk buildno_header asm)
 
 list(APPEND LIBCNTPR_SOURCE
 add_dependencies(crt psdk buildno_header asm)
 
 list(APPEND LIBCNTPR_SOURCE
-    except/${ARCH}/chkstk_asm.s
-    except/${ARCH}/seh.s
     math/abs.c
     math/div.c
     math/labs.c
     math/abs.c
     math/div.c
     math/labs.c
@@ -428,7 +431,6 @@ list(APPEND LIBCNTPR_SOURCE
     mem/memicmp.c
     search/bsearch.c
     search/lfind.c
     mem/memicmp.c
     search/bsearch.c
     search/lfind.c
-    setjmp/${ARCH}/setjmp.s
     stdlib/qsort.c
     string/ctype.c
     string/scanf.c
     stdlib/qsort.c
     string/ctype.c
     string/scanf.c
@@ -468,6 +470,13 @@ list(APPEND LIBCNTPR_SOURCE
     wstring/wcsspn.c
     wstring/wcsstr.c)
 
     wstring/wcsspn.c
     wstring/wcsstr.c)
 
+if(NOT ARCH MATCHES arm)
+list(APPEND LIBCNTPR_SOURCE
+    except/${ARCH}/chkstk_asm.s
+    except/${ARCH}/seh.s
+    setjmp/${ARCH}/setjmp.s)
+endif()
+
 if(ARCH MATCHES i386)
 list(APPEND LIBCNTPR_SOURCE
     math/i386/alldiv_asm.s
 if(ARCH MATCHES i386)
 list(APPEND LIBCNTPR_SOURCE
     math/i386/alldiv_asm.s
@@ -512,7 +521,7 @@ list(APPEND LIBCNTPR_SOURCE
     math/amd64/pow.S
     math/amd64/sqrt.S
     math/amd64/tan.S)
     math/amd64/pow.S
     math/amd64/sqrt.S
     math/amd64/tan.S)
-endif(ARCH MATCHES i386)
+endif()
 
 if(ARCH MATCHES i386)
 list(APPEND LIBCNTPR_SOURCE
 
 if(ARCH MATCHES i386)
 list(APPEND LIBCNTPR_SOURCE
@@ -565,7 +574,7 @@ list(APPEND LIBCNTPR_SOURCE
     string/wcsncpy.c
     string/wcsnlen.c
     string/wcsrchr.c)
     string/wcsncpy.c
     string/wcsnlen.c
     string/wcsrchr.c)
-endif(ARCH MATCHES i386)
+endif()
 
 add_library(libcntpr ${LIBCNTPR_SOURCE})
 set_property(TARGET libcntpr PROPERTY COMPILE_DEFINITIONS NO_RTL_INLINES _NTSYSTEM_ _NTDLLBUILD_ _LIBCNT_ __CRT__NO_INLINE)
 
 add_library(libcntpr ${LIBCNTPR_SOURCE})
 set_property(TARGET libcntpr PROPERTY COMPILE_DEFINITIONS NO_RTL_INLINES _NTSYSTEM_ _NTDLLBUILD_ _LIBCNT_ __CRT__NO_INLINE)
index 5e9d0e5..1d20922 100644 (file)
@@ -14,6 +14,8 @@ if(ARCH MATCHES i386)
 
 elseif(ARCH MATCHES amd64)
     set(MINGW_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Prefix")
 
 elseif(ARCH MATCHES amd64)
     set(MINGW_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Prefix")
+elseif(ARCH MATCHES arm)
+    set(MINGW_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Prefix")
 endif()
 
 if(ENABLE_CCACHE)
 endif()
 
 if(ENABLE_CCACHE)
@@ -38,6 +40,8 @@ if(ARCH MATCHES i386)
 set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -m32 --win32 -h -o <OBJECT> <SOURCE>")
 elseif(ARCH MATCHES amd64)
 set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -m64 --win64 -h -o <OBJECT> <SOURCE>")
 set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -m32 --win32 -h -o <OBJECT> <SOURCE>")
 elseif(ARCH MATCHES amd64)
 set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -m64 --win64 -h -o <OBJECT> <SOURCE>")
+elseif(ARCH MATCHES arm)
+set(CMAKE_IDL_COMPILE_OBJECT "<CMAKE_IDL_COMPILER> <FLAGS> <DEFINES> -h -o <OBJECT> <SOURCE>")
 endif()
 
 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> <CMAKE_C_LINK_FLAGS> <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 -O coff -o <OBJECT> ")
 endif()
 
 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -i <SOURCE> <CMAKE_C_LINK_FLAGS> <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 -O coff -o <OBJECT> ")