[NTOS:MM] Annotate some functions with regards to MmPfnLock
[reactos.git] / toolchain-clang.cmake
1
2 if(DEFINED ENV{_ROSBE_ROSSCRIPTDIR})
3 set(CMAKE_SYSROOT $ENV{_ROSBE_ROSSCRIPTDIR}/$ENV{ROS_ARCH})
4 endif()
5
6 # pass variables necessary for the toolchain (needed for try_compile)
7 set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH CLANG_VERSION)
8
9 # The name of the target operating system
10 set(CMAKE_SYSTEM_NAME Windows)
11 # The processor we are targeting
12 if (ARCH STREQUAL "i386")
13 set(CMAKE_SYSTEM_PROCESSOR i686)
14 elseif (ARCH STREQUAL "amd64")
15 set(CMAKE_SYSTEM_PROCESSOR x86_64)
16 elseif(ARCH STREQUAL "arm")
17 set(CMAKE_SYSTEM_PROCESSOR arm)
18 else()
19 message(FATAL_ERROR "Unsupported ARCH: ${ARCH}")
20 endif()
21
22 if (DEFINED CLANG_VERSION)
23 set(CLANG_SUFFIX "-${CLANG_VERSION}")
24 else()
25 set(CLANG_SUFFIX "")
26 endif()
27
28 # Which tools to use
29 set(triplet ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32)
30 if (CMAKE_HOST_WIN32)
31 set(GCC_TOOLCHAIN_PREFIX "")
32 else()
33 set(GCC_TOOLCHAIN_PREFIX "${triplet}-")
34 endif()
35
36 set(CMAKE_C_COMPILER clang${CLANG_SUFFIX})
37 set(CMAKE_C_COMPILER_TARGET ${triplet})
38 set(CMAKE_CXX_COMPILER clang++${CLANG_SUFFIX})
39 set(CMAKE_CXX_COMPILER_TARGET ${triplet})
40 set(CMAKE_ASM_COMPILER ${GCC_TOOLCHAIN_PREFIX}gcc)
41 set(CMAKE_ASM_COMPILER_ID GNU)
42 set(CMAKE_MC_COMPILER ${GCC_TOOLCHAIN_PREFIX}windmc)
43 set(CMAKE_RC_COMPILER ${GCC_TOOLCHAIN_PREFIX}windres)
44 # set(CMAKE_AR ${triplet}-ar)
45 # set(CMAKE_DLLTOOL ${triplet}-dlltool)
46
47 # This allows to have CMake test the compiler without linking
48 set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
49
50 set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
51 set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
52 set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
53
54 set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
55 set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++ Libraries")
56
57 find_program (LD_EXECUTABLE ${GCC_TOOLCHAIN_PREFIX}ld)
58 message(STATUS "Using linker ${LD_EXECUTABLE}")
59
60 set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
61 set(CMAKE_MODULE_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")
62 set(CMAKE_EXE_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import -fuse-ld=${LD_EXECUTABLE}")