[CMAKE]
[reactos.git] / toolchain-mingw32.cmake
1
2 if(NOT ARCH)
3 set(ARCH i386)
4 endif()
5
6 # Choose the right MinGW prefix
7 if(ARCH MATCHES i386)
8
9 if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
10 set(MINGW_PREFIX "" CACHE STRING "MinGW Prefix")
11 else()
12 set(MINGW_PREFIX "mingw32-" CACHE STRING "MinGW Prefix")
13 set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crs <TARGET> <LINK_FLAGS> <OBJECTS>")
14 endif(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
15
16 elseif(ARCH MATCHES amd64)
17 set(MINGW_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Prefix")
18 elseif(ARCH MATCHES arm)
19 set(MINGW_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Prefix")
20 endif()
21
22 if(ENABLE_CCACHE)
23 set(CCACHE "ccache" CACHE STRING "ccache")
24 else()
25 set(CCACHE "" CACHE STRING "ccache")
26 endif()
27
28 # the name of the target operating system
29 set(CMAKE_SYSTEM_NAME Windows)
30 set(CMAKE_SYSTEM_PROCESSOR i686)
31
32 # which compilers to use for C and C++
33 set(CMAKE_C_COMPILER ${CCACHE} ${MINGW_PREFIX}gcc)
34 set(CMAKE_CXX_COMPILER ${CCACHE} ${MINGW_PREFIX}g++)
35 set(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres)
36 set(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc)
37 set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -x assembler-with-cpp -o <OBJECT> -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> -D__ASM__ -c <SOURCE>")
38
39 # Use stdcall fixups, and don't link with anything by default unless we say so
40 set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
41
42 #MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES)
43 set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "Standard C++ Libraries")
44
45 if(ARCH MATCHES i386)
46 set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import")
47 #-Wl,-T,${REACTOS_SOURCE_DIR}/global.lds
48 elseif(ARCH MATCHES amd64)
49 set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import")
50 endif()