1c2c66affSColin Finck 2f0b53998SVictor Perevertkin# pass variables necessary for the toolchain (needed for try_compile) 3f0b53998SVictor Perevertkinset(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH USE_CLANG_CL) 4f0b53998SVictor Perevertkin 5c2c66affSColin Finck# the name of the target operating system 6c2c66affSColin Finckset(CMAKE_SYSTEM_NAME Windows) 7c2c66affSColin Finckset(CMAKE_SYSTEM_PROCESSOR i686) 8c2c66affSColin Finck 9cad58396SJérôme Gardou# set the generator platform 10cad58396SJérôme Gardouif (NOT DEFINED CMAKE_GENERATOR_PLATFORM) 11cad58396SJérôme Gardou if(ARCH STREQUAL "amd64") 12cad58396SJérôme Gardou set(CMAKE_GENERATOR_PLATFORM "x64") 13cad58396SJérôme Gardou elseif(ARCH STREQUAL "arm") 14cad58396SJérôme Gardou set(CMAKE_GENERATOR_PLATFORM "ARM") 15cad58396SJérôme Gardou elseif(ARCH STREQUAL "arm64") 16cad58396SJérôme Gardou set(CMAKE_GENERATOR_PLATFORM "ARM64") 17cad58396SJérôme Gardou else() 18cad58396SJérôme Gardou set(CMAKE_GENERATOR_PLATFORM "Win32") 19cad58396SJérôme Gardou endif() 20cad58396SJérôme Gardouendif() 21cad58396SJérôme Gardou 2209c06a2fSAmine Khaldiif(USE_CLANG_CL) 2340c5f7a8SThomas Faber set(CMAKE_C_COMPILER clang-cl) 2440c5f7a8SThomas Faber set(CMAKE_CXX_COMPILER clang-cl) 2540c5f7a8SThomas Faber # Clang now defaults to lld-link which we're not compatible with yet 2640c5f7a8SThomas Faber set(CMAKE_LINKER link) 27*62d1a2c8SVictor Perevertkin # llvm-lib with link.exe can't generate proper delayed imports 28*62d1a2c8SVictor Perevertkin set(CMAKE_AR lib) 29*62d1a2c8SVictor Perevertkin set(CMAKE_C_COMPILER_AR lib) 30*62d1a2c8SVictor Perevertkin set(CMAKE_CXX_COMPILER_AR lib) 31cad58396SJérôme Gardou # Explicitly set target so CMake doesn't get confused 32cad58396SJérôme Gardou if (ARCH STREQUAL "amd64") 33cad58396SJérôme Gardou set(CMAKE_C_COMPILER_TARGET "x86_64-pc-windows-msvc") 34cad58396SJérôme Gardou set(CMAKE_CXX_COMPILER_TARGET "x86_64-pc-windows-msvc") 35cad58396SJérôme Gardou elseif(ARCH STREQUAL "arm") 36cad58396SJérôme Gardou set(CMAKE_C_COMPILER_TARGET "arm-pc-windows-msvc") 37cad58396SJérôme Gardou set(CMAKE_CXX_COMPILER_TARGET "arm-pc-windows-msvc") 38cad58396SJérôme Gardou elseif(ARCH STREQUAL "arm64") 39cad58396SJérôme Gardou set(CMAKE_C_COMPILER_TARGET "arm64-pc-windows-msvc") 40cad58396SJérôme Gardou set(CMAKE_CXX_COMPILER_TARGET "arm64-pc-windows-msvc") 41cad58396SJérôme Gardou else() 42cad58396SJérôme Gardou set(CMAKE_C_COMPILER_TARGET "i686-pc-windows-msvc") 43cad58396SJérôme Gardou set(CMAKE_CXX_COMPILER_TARGET "i686-pc-windows-msvc") 44cad58396SJérôme Gardou endif() 45*62d1a2c8SVictor Perevertkin 46*62d1a2c8SVictor Perevertkin # Avoid wrapping RC compiler with cmcldeps utility for clang-cl. 47*62d1a2c8SVictor Perevertkin # Otherwise it breaks cross-compilation (32bit ReactOS cannot be compiled by 64bit LLVM), 48*62d1a2c8SVictor Perevertkin # target architecture is not passed properly 49*62d1a2c8SVictor Perevertkin set(CMAKE_NINJA_CMCLDEPS_RC OFF) 5009c06a2fSAmine Khaldielse() 51c2c66affSColin Finck set(CMAKE_C_COMPILER cl) 52c2c66affSColin Finck set(CMAKE_CXX_COMPILER cl) 53c2c66affSColin Finckendif() 54c2c66affSColin Finck 55c2c66affSColin Finckset(CMAKE_MC_COMPILER mc) 56c2c66affSColin Finckset(CMAKE_RC_COMPILER rc) 57c2c66affSColin Finckif(ARCH STREQUAL "amd64") 5841130ab5SJérôme Gardou set(CMAKE_ASM_MASM_COMPILER ml64) 59c68739e5SJérôme Gardou set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp") 60c2c66affSColin Finckelseif(ARCH STREQUAL "arm") 6141130ab5SJérôme Gardou set(CMAKE_ASM_MASM_COMPILER armasm) 62fcab7787Swoachkelseif(ARCH STREQUAL "arm64") 6341130ab5SJérôme Gardou set(CMAKE_ASM_MASM_COMPILER armasm64) 64c2c66affSColin Finckelse() 6541130ab5SJérôme Gardou set(CMAKE_ASM_MASM_COMPILER ml) 66c68739e5SJérôme Gardou set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp") 67c2c66affSColin Finckendif() 68c2c66affSColin Finck 69c2c66affSColin Finckset(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "") 70c2c66affSColin Finck 718cd5c4e7SAndrew Cookset(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/overrides-msvc.cmake") 72