mirror of
https://github.com/reactos/reactos.git
synced 2025-06-29 08:19:45 +00:00
[CLANG-CL] Initial commit that allows us to compile ReactOS with clang-cl.
This commit is contained in:
parent
861360c65f
commit
09c06a2f45
18 changed files with 91 additions and 50 deletions
|
@ -97,8 +97,11 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||||
if(MSVC_VERSION GREATER 1699)
|
if(MSVC_VERSION GREATER 1699)
|
||||||
add_definitions(/D_ALLOW_KEYWORD_MACROS)
|
add_definitions(/D_ALLOW_KEYWORD_MACROS)
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT USE_CLANG_CL)
|
||||||
|
# FIXME: Inspect
|
||||||
add_definitions(/Dinline=__inline)
|
add_definitions(/Dinline=__inline)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(sdk/include/host)
|
include_directories(sdk/include/host)
|
||||||
|
|
||||||
|
@ -182,7 +185,10 @@ else()
|
||||||
|
|
||||||
# Arch Options
|
# Arch Options
|
||||||
if(ARCH STREQUAL "i386")
|
if(ARCH STREQUAL "i386")
|
||||||
add_definitions(-D_M_IX86 -D_X86_ -D__i386__ -Di386)
|
if(NOT USE_CLANG_CL)
|
||||||
|
add_definitions(-D_M_IX86)
|
||||||
|
endif()
|
||||||
|
add_definitions(-D_X86_ -D__i386__ -Di386)
|
||||||
elseif(ARCH STREQUAL "amd64")
|
elseif(ARCH STREQUAL "amd64")
|
||||||
add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
|
add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
|
||||||
elseif(ARCH STREQUAL "arm")
|
elseif(ARCH STREQUAL "arm")
|
||||||
|
|
|
@ -34,11 +34,6 @@ list(APPEND SOURCE
|
||||||
settings.c
|
settings.c
|
||||||
usetup.h)
|
usetup.h)
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
#FIXME: Investigate Clang "illegal character encoding in string literal" warning
|
|
||||||
set_property(SOURCE mui.c APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-invalid-source-encoding")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(usetup ${SOURCE} usetup.rc)
|
add_executable(usetup ${SOURCE} usetup.rc)
|
||||||
target_link_libraries(usetup zlib inflib ext2lib vfatlib)
|
target_link_libraries(usetup zlib inflib ext2lib vfatlib)
|
||||||
set_module_type(usetup nativecui)
|
set_module_type(usetup nativecui)
|
||||||
|
|
|
@ -198,6 +198,11 @@ add_library(freeldr_common ${FREELDR_BOOTLIB_COMMON_SOURCE} ${FREELDR_ARC_COMMON
|
||||||
add_pch(freeldr_common include/freeldr.h FREELDR_COMMON_SOURCE)
|
add_pch(freeldr_common include/freeldr.h FREELDR_COMMON_SOURCE)
|
||||||
add_dependencies(freeldr_common bugcodes asm xdk)
|
add_dependencies(freeldr_common bugcodes asm xdk)
|
||||||
|
|
||||||
|
if(USE_CLANG_CL)
|
||||||
|
# We need to reduce the binary size
|
||||||
|
set_property(SOURCE ${FREELDR_BOOTLIB_COMMON_SOURCE} ${FREELDR_ARC_COMMON_SOURCE} APPEND_STRING PROPERTY COMPILE_FLAGS " /Os")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ARCH STREQUAL "i386" AND NOT MSVC)
|
if(ARCH STREQUAL "i386" AND NOT MSVC)
|
||||||
list(APPEND FREELDR_BASE_SOURCE arch/i386/multiboot.S)
|
list(APPEND FREELDR_BASE_SOURCE arch/i386/multiboot.S)
|
||||||
target_link_libraries(freeldr_common mini_hal)
|
target_link_libraries(freeldr_common mini_hal)
|
||||||
|
|
|
@ -83,6 +83,7 @@ if not defined ARCH (
|
||||||
)
|
)
|
||||||
|
|
||||||
set NEW_STYLE_BUILD=1
|
set NEW_STYLE_BUILD=1
|
||||||
|
set USE_CLANG_CL=0
|
||||||
|
|
||||||
REM Parse command line parameters
|
REM Parse command line parameters
|
||||||
:repeat
|
:repeat
|
||||||
|
@ -95,8 +96,6 @@ REM Parse command line parameters
|
||||||
set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles"
|
set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles"
|
||||||
) else if /I "%1" == "Makefiles" (
|
) else if /I "%1" == "Makefiles" (
|
||||||
set CMAKE_GENERATOR="MinGW Makefiles"
|
set CMAKE_GENERATOR="MinGW Makefiles"
|
||||||
) else if /I "%1" == "clang" (
|
|
||||||
set MINGW_TOOCHAIN_FILE=toolchain-clang.cmake
|
|
||||||
) else (
|
) else (
|
||||||
goto continue
|
goto continue
|
||||||
)
|
)
|
||||||
|
@ -107,6 +106,8 @@ REM Parse command line parameters
|
||||||
set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles"
|
set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles"
|
||||||
) else if /I "%1" == "Makefiles" (
|
) else if /I "%1" == "Makefiles" (
|
||||||
set CMAKE_GENERATOR="NMake Makefiles"
|
set CMAKE_GENERATOR="NMake Makefiles"
|
||||||
|
) else if /I "%1" == "clang" (
|
||||||
|
set USE_CLANG_CL=1
|
||||||
) else if /I "%1" == "VSSolution" (
|
) else if /I "%1" == "VSSolution" (
|
||||||
set VS_SOLUTION=1
|
set VS_SOLUTION=1
|
||||||
REM explicitly set VS version for project generator
|
REM explicitly set VS version for project generator
|
||||||
|
@ -239,6 +240,8 @@ if "%NEW_STYLE_BUILD%"=="0" (
|
||||||
|
|
||||||
if "%BUILD_ENVIRONMENT%" == "MinGW" (
|
if "%BUILD_ENVIRONMENT%" == "MinGW" (
|
||||||
cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%"
|
cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%"
|
||||||
|
) else if %USE_CLANG_CL% == 1 (
|
||||||
|
cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DUSE_CLANG_CL:BOOL=1 -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%"
|
||||||
) else (
|
) else (
|
||||||
cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%"
|
cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%"
|
||||||
)
|
)
|
||||||
|
|
|
@ -42,7 +42,9 @@ add_subdirectory(faultrep)
|
||||||
add_subdirectory(fltlib)
|
add_subdirectory(fltlib)
|
||||||
add_subdirectory(fmifs)
|
add_subdirectory(fmifs)
|
||||||
add_subdirectory(fontsub)
|
add_subdirectory(fontsub)
|
||||||
add_subdirectory(framedyn)
|
if(NOT USE_CLANG_CL)
|
||||||
|
add_subdirectory(framedyn)
|
||||||
|
endif()
|
||||||
add_subdirectory(fusion)
|
add_subdirectory(fusion)
|
||||||
add_subdirectory(gdiplus)
|
add_subdirectory(gdiplus)
|
||||||
add_subdirectory(getuname)
|
add_subdirectory(getuname)
|
||||||
|
|
|
@ -45,10 +45,7 @@ add_pch(browseui precomp.h SOURCE)
|
||||||
add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
add_target_compile_flags(browseui "-Wno-unused-but-set-variable")
|
add_target_compile_flags(browseui "-Wno-unused-but-set-variable")
|
||||||
endif()
|
|
||||||
|
|
||||||
# Binutils linker bug
|
# Binutils linker bug
|
||||||
if(LTCG)
|
if(LTCG)
|
||||||
add_target_link_flags(browseui "-Wl,--allow-multiple-definition")
|
add_target_link_flags(browseui "-Wl,--allow-multiple-definition")
|
||||||
|
|
|
@ -20,7 +20,5 @@ add_dependencies(shellbars xdk)
|
||||||
target_link_libraries(shellbars atlnew)
|
target_link_libraries(shellbars atlnew)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
add_target_compile_flags(shellbars "-Wno-unused-but-set-variable")
|
add_target_compile_flags(shellbars "-Wno-unused-but-set-variable")
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -33,11 +33,6 @@ else()
|
||||||
list(APPEND SOURCE txthost.c txtsrv.c)
|
list(APPEND SOURCE txthost.c txtsrv.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
#FIXME: http://llvm.org/bugs/show_bug.cgi?id=19027
|
|
||||||
set_property(SOURCE txthost.c txtsrv.c APPEND_STRING PROPERTY COMPILE_FLAGS " -no-integrated-as")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND ADDITIONAL_SOURCE
|
list(APPEND ADDITIONAL_SOURCE
|
||||||
version.rc
|
version.rc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/riched20.def)
|
${CMAKE_CURRENT_BINARY_DIR}/riched20.def)
|
||||||
|
|
|
@ -27,7 +27,7 @@ add_importlibs(winmm advapi32 user32 msvcrt kernel32 ntdll)
|
||||||
add_pch(winmm winemm.h SOURCE)
|
add_pch(winmm winemm.h SOURCE)
|
||||||
add_cd_file(TARGET winmm DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET winmm DESTINATION reactos/system32 FOR all)
|
||||||
|
|
||||||
if((NOT MSVC) AND (NOT CMAKE_C_COMPILER_ID STREQUAL "Clang"))
|
if(NOT MSVC)
|
||||||
add_target_compile_flags(winmm "-Wno-unused-but-set-variable")
|
add_target_compile_flags(winmm "-Wno-unused-but-set-variable")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -88,11 +88,13 @@ list(APPEND SOURCE
|
||||||
|
|
||||||
add_library(ext2fs SHARED ${SOURCE} ext2fs.rc)
|
add_library(ext2fs SHARED ${SOURCE} ext2fs.rc)
|
||||||
|
|
||||||
|
if(USE_CLANG_CL)
|
||||||
|
set_property(SOURCE src/create.c src/fileinfo.c src/memory.c src/read.c APPEND_STRING PROPERTY COMPILE_FLAGS " /fallback")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_target_compile_flags(ext2fs "-Wno-pointer-sign -Wno-unused-function")
|
add_target_compile_flags(ext2fs "-Wno-pointer-sign -Wno-unused-function")
|
||||||
if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
add_target_compile_flags(ext2fs "-Wno-unused-but-set-variable -Wno-unused-variable -Wno-missing-braces")
|
add_target_compile_flags(ext2fs "-Wno-unused-but-set-variable -Wno-unused-variable -Wno-missing-braces")
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
#disable warnings: "unreferenced local variable", "initialized, but not used variable", "benign include"
|
#disable warnings: "unreferenced local variable", "initialized, but not used variable", "benign include"
|
||||||
replace_compile_flags("/we\"4189\"" " ")
|
replace_compile_flags("/we\"4189\"" " ")
|
||||||
|
@ -103,5 +105,10 @@ target_link_libraries(ext2fs memcmp ${PSEH_LIB})
|
||||||
add_definitions(-D__KERNEL__)
|
add_definitions(-D__KERNEL__)
|
||||||
set_module_type(ext2fs kernelmodedriver)
|
set_module_type(ext2fs kernelmodedriver)
|
||||||
add_importlibs(ext2fs ntoskrnl hal)
|
add_importlibs(ext2fs ntoskrnl hal)
|
||||||
add_pch(ext2fs inc/ext2fs.h SOURCE)
|
|
||||||
|
if(NOT USE_CLANG_CL)
|
||||||
|
# The fallback we have above prevents cl and clang-cl from using the same PCH
|
||||||
|
add_pch(ext2fs inc/ext2fs.h SOURCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_cd_file(TARGET ext2fs DESTINATION reactos/system32/drivers NO_CAB FOR all)
|
add_cd_file(TARGET ext2fs DESTINATION reactos/system32/drivers NO_CAB FOR all)
|
||||||
|
|
|
@ -426,12 +426,3 @@ else() # _WINKD_
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
||||||
#FIXME: http://llvm.org/bugs/show_bug.cgi?id=19027
|
|
||||||
set_property(SOURCE
|
|
||||||
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/cpu.c
|
|
||||||
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/kiinit.c
|
|
||||||
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/traphdlr.c
|
|
||||||
APPEND_STRING PROPERTY COMPILE_FLAGS " -no-integrated-as")
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -193,8 +193,13 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
|
if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
|
||||||
|
if(NOT USE_CLANG_CL)
|
||||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
|
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
|
||||||
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
|
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
|
||||||
|
else()
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
|
||||||
|
endif()
|
||||||
else ()
|
else ()
|
||||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
|
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
|
||||||
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
|
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
|
||||||
|
|
|
@ -36,7 +36,7 @@ else()
|
||||||
"Whether to compile for debugging.")
|
"Whether to compile for debugging.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC AND (NOT USE_CLANG_CL))
|
||||||
set(KDBG FALSE CACHE BOOL
|
set(KDBG FALSE CACHE BOOL
|
||||||
"Whether to compile in the integrated kernel debugger.")
|
"Whether to compile in the integrated kernel debugger.")
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
|
|
@ -23,6 +23,11 @@ foreach(_host_tool ${host_tools_list})
|
||||||
add_dependencies(native-${_host_tool} host-tools)
|
add_dependencies(native-${_host_tool} host-tools)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
if(USE_CLANG_CL)
|
||||||
|
# FIXME: Fix host tools build with clang
|
||||||
|
#set(USE_CLANG_CL_ARG "-DCMAKE_C_COMPILER=clang-cl;-DCMAKE_CXX_COMPILER=clang-cl")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
|
||||||
ExternalProject_Add(host-tools
|
ExternalProject_Add(host-tools
|
||||||
|
@ -32,6 +37,6 @@ ExternalProject_Add(host-tools
|
||||||
BUILD_ALWAYS 1
|
BUILD_ALWAYS 1
|
||||||
PREFIX host-tools
|
PREFIX host-tools
|
||||||
EXCLUDE_FROM_ALL 1
|
EXCLUDE_FROM_ALL 1
|
||||||
CMAKE_ARGS "-DNEW_STYLE_BUILD=1;-DARCH:STRING=${ARCH}"
|
CMAKE_ARGS "-DNEW_STYLE_BUILD=1;-DARCH:STRING=${ARCH};${USE_CLANG_CL_ARG}"
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
BUILD_BYPRODUCTS ${tools_binaries})
|
BUILD_BYPRODUCTS ${tools_binaries})
|
||||||
|
|
|
@ -29,7 +29,15 @@ endif()
|
||||||
|
|
||||||
add_definitions(/Dinline=__inline /D__STDC__=1)
|
add_definitions(/Dinline=__inline /D__STDC__=1)
|
||||||
|
|
||||||
add_compile_flags("/X /GR- /EHs-c- /GS- /Zl /W3")
|
if(NOT USE_CLANG_CL)
|
||||||
|
add_compile_flags("/X /Zl")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_compile_flags("/GR- /EHs-c- /GS- /W3")
|
||||||
|
|
||||||
|
if(USE_CLANG_CL)
|
||||||
|
set(CMAKE_CL_SHOWINCLUDES_PREFIX "Note: including file: ")
|
||||||
|
endif()
|
||||||
|
|
||||||
# HACK: for VS 11+ we need to explicitly disable SSE, which is off by
|
# HACK: for VS 11+ we need to explicitly disable SSE, which is off by
|
||||||
# default for older compilers. See CORE-6507
|
# default for older compilers. See CORE-6507
|
||||||
|
@ -88,6 +96,11 @@ endif()
|
||||||
# - C4115: named type definition in parentheses
|
# - C4115: named type definition in parentheses
|
||||||
add_compile_flags("/w14115")
|
add_compile_flags("/w14115")
|
||||||
|
|
||||||
|
if(USE_CLANG_CL)
|
||||||
|
add_compile_flags_language("-nostdinc -Wno-multichar -Wno-char-subscripts -Wno-microsoft-enum-forward-reference -Wno-pragma-pack -Wno-microsoft-anon-tag -Wno-unknown-pragmas" "C")
|
||||||
|
add_compile_flags_language("-nostdinc -Wno-multichar -Wno-char-subscripts -Wno-microsoft-enum-forward-reference -Wno-pragma-pack -Wno-microsoft-anon-tag -Wno-unknown-pragmas" "CXX")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Debugging
|
# Debugging
|
||||||
#if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
#if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
@ -101,7 +114,9 @@ endif()
|
||||||
|
|
||||||
# Hotpatchable images
|
# Hotpatchable images
|
||||||
if(ARCH STREQUAL "i386")
|
if(ARCH STREQUAL "i386")
|
||||||
|
if(NOT USE_CLANG_CL)
|
||||||
add_compile_flags("/hotpatch")
|
add_compile_flags("/hotpatch")
|
||||||
|
endif()
|
||||||
set(_hotpatch_link_flag "/FUNCTIONPADMIN:5")
|
set(_hotpatch_link_flag "/FUNCTIONPADMIN:5")
|
||||||
elseif(ARCH STREQUAL "amd64")
|
elseif(ARCH STREQUAL "amd64")
|
||||||
set(_hotpatch_link_flag "/FUNCTIONPADMIN:6")
|
set(_hotpatch_link_flag "/FUNCTIONPADMIN:6")
|
||||||
|
@ -135,7 +150,8 @@ if(MSVC_IDE AND (CMAKE_VERSION MATCHES "ReactOS"))
|
||||||
add_definitions(/DLANGUAGE_EN_US)
|
add_definitions(/DLANGUAGE_EN_US)
|
||||||
else()
|
else()
|
||||||
# Only VS 10+ resource compiler supports /nologo
|
# Only VS 10+ resource compiler supports /nologo
|
||||||
if(MSVC_VERSION GREATER 1599)
|
# CMAKE_CXX_SIMULATE_VERSION is a similar check for our clang-cl builds
|
||||||
|
if((MSVC_VERSION GREATER 1599) OR (CMAKE_CXX_SIMULATE_VERSION VERSION_GREATER 15.99))
|
||||||
set(rc_nologo_flag "/nologo")
|
set(rc_nologo_flag "/nologo")
|
||||||
else()
|
else()
|
||||||
set(rc_nologo_flag)
|
set(rc_nologo_flag)
|
||||||
|
@ -218,12 +234,18 @@ if(PCH)
|
||||||
set(_pch_path_name_flag "/Fp${_gch}")
|
set(_pch_path_name_flag "/Fp${_gch}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(USE_CLANG_CL)
|
||||||
|
set(_pch_compile_flags "${_cl_lang_flag} /Yc${_pch} /FI${_pch} /Fp${_gch}")
|
||||||
|
else()
|
||||||
|
set(_pch_compile_flags "${_cl_lang_flag} /Yc /Fp${_gch}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Build the precompiled header
|
# Build the precompiled header
|
||||||
# HEADER_FILE_ONLY FALSE: force compiling the header
|
# HEADER_FILE_ONLY FALSE: force compiling the header
|
||||||
set_source_files_properties(${_pch} PROPERTIES
|
set_source_files_properties(${_pch} PROPERTIES
|
||||||
HEADER_FILE_ONLY FALSE
|
HEADER_FILE_ONLY FALSE
|
||||||
LANGUAGE ${_pch_language}
|
LANGUAGE ${_pch_language}
|
||||||
COMPILE_FLAGS "${_cl_lang_flag} /Yc /Fp${_gch}"
|
COMPILE_FLAGS ${_pch_compile_flags}
|
||||||
OBJECT_OUTPUTS ${_gch})
|
OBJECT_OUTPUTS ${_gch})
|
||||||
|
|
||||||
# Prevent a race condition related to writing to the PDB files between the PCH and the excluded list of source files
|
# Prevent a race condition related to writing to the PDB files between the PCH and the excluded list of source files
|
||||||
|
|
|
@ -581,9 +581,10 @@ endif()
|
||||||
set_source_files_properties(${CRT_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "__MINGW_IMPORT=extern;USE_MSVCRT_PREFIX;_MSVCRT_LIB_;_MSVCRT_;_MT;CRTDLL")
|
set_source_files_properties(${CRT_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "__MINGW_IMPORT=extern;USE_MSVCRT_PREFIX;_MSVCRT_LIB_;_MSVCRT_;_MT;CRTDLL")
|
||||||
add_asm_files(crt_asm ${CRT_ASM_SOURCE})
|
add_asm_files(crt_asm ${CRT_ASM_SOURCE})
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if(USE_CLANG_CL)
|
||||||
#FIXME: http://llvm.org/bugs/show_bug.cgi?id=19027
|
# clang-cl is missing pragma function support
|
||||||
set_property(SOURCE except/cpp.c APPEND_STRING PROPERTY COMPILE_FLAGS " -no-integrated-as")
|
# https://bugs.llvm.org/show_bug.cgi?id=35116
|
||||||
|
set_property(SOURCE stdlib/rot.c APPEND_STRING PROPERTY COMPILE_FLAGS " /fallback")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(crt ${CRT_SOURCE} ${crt_asm})
|
add_library(crt ${CRT_SOURCE} ${crt_asm})
|
||||||
|
|
|
@ -107,9 +107,10 @@ function(add_asm16_bin _target _binary_file _base_address)
|
||||||
set(_pp_asm16_compile_command ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
|
set(_pp_asm16_compile_command ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# FIXME: clang-cl can't compile this so use cl here instead of ${CMAKE_C_COMPILER} in the meantime
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${_preprocessed_asm_file} ${_object_file}
|
OUTPUT ${_preprocessed_asm_file} ${_object_file}
|
||||||
COMMAND ${CMAKE_C_COMPILER} /nologo /X /I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm ${_directory_includes} ${_source_file_defines} ${_directory_defines} /D__ASM__ /D_USE_ML /EP /c ${_concatenated_asm_file} > ${_preprocessed_asm_file} && ${_pp_asm16_compile_command}
|
COMMAND cl /nologo /X /I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm ${_directory_includes} ${_source_file_defines} ${_directory_defines} /D__ASM__ /D_USE_ML /EP /c ${_concatenated_asm_file} > ${_preprocessed_asm_file} && ${_pp_asm16_compile_command}
|
||||||
DEPENDS ${_concatenated_asm_file})
|
DEPENDS ${_concatenated_asm_file})
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
|
|
@ -14,13 +14,21 @@ set(CMAKE_SYSTEM_NAME Windows)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR i686)
|
set(CMAKE_SYSTEM_PROCESSOR i686)
|
||||||
|
|
||||||
# which compilers to use for C and C++
|
# which compilers to use for C and C++
|
||||||
set(CMAKE_C_COMPILER cl)
|
if(USE_CLANG_CL)
|
||||||
|
set(CMAKE_C_COMPILER clang-cl)
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_COMPILER cl)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ARCH STREQUAL "arm")
|
if(ARCH STREQUAL "arm")
|
||||||
include(CMakeForceCompiler)
|
include(CMakeForceCompiler)
|
||||||
CMAKE_FORCE_CXX_COMPILER(cl MSVC)
|
CMAKE_FORCE_CXX_COMPILER(cl MSVC)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_COMPILER cl)
|
if(USE_CLANG_CL)
|
||||||
|
set(CMAKE_CXX_COMPILER clang-cl)
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_COMPILER cl)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_MC_COMPILER mc)
|
set(CMAKE_MC_COMPILER mc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue